Initial commit

This commit is contained in:
Michael Becker 2024-04-17 22:27:59 -04:00
parent c4ca16846e
commit efbc1c7c5e
252 changed files with 18039 additions and 0 deletions

View File

@ -0,0 +1,16 @@
RewriteEngine On
# Do not remove this line, otherwise mod_rewrite rules will stop working
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^Themes\/(.*)\/Theme\.css$ lessc.php?filename=themes/$1/uwt [PT,L,QSA]
RewriteRule ^themes\/(.*)\/theme\.css$ lessc.php?filename=themes/$1/uwt [PT,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?virtualpath=$1 [PT,L,QSA]
#RewriteRule ^StyleSheets\/(.*)\.css$ lessc.php?filename=$1 [PT,L,QSA]

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,118 @@
<?php
use Phast\System;
require_once("mochacommon.inc.php");
System::$BeforeGetTenantNameHandler = function()
{
$path = System::GetVirtualPath(false);
if ($path[0] === "madi")
{
return $path[2];
}
return $path[0];
};
function requiresLogin($path)
{
if ($path != null)
{
if ($path == "ots/{tenant}/services/{serviceName}/{version}/{command}")
{
return false;
}
}
/*
if (count($path) > 0)
{
if ($path[0] == "ots"
|| $path[0] == "suv"
|| $path[0] == "ccx")
{
echo("no");
return false;
}
}
*/
return true;
}
System::$BeforeLaunchEventHandler = function($path)
{
/**
* @var \Mocha\Oms\MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if (count($path) >= 1)
{
if ($path[0] == "madi")
{
return true;
}
else if ($path[0] == "suv")
{
if (count($path) == 2 && ($path[1] == "suvinfo.html" || $path[1] == "phpinfo.html"))
{
//
return true;
}
else
{
header("HTTP/1.1 404 Not Found");
echo ("Not Found");
return false;
}
}
else if ($path[0] == "scripts")
{
return true;
}
}
if (count($path) == 0)
{
System::Redirect("~/" . System::$Configuration["Application.DefaultTenant"], true);
return false;
}
if (count($path) == 1)
{
if ($path[0] != "invalid-url")
{
System::Redirect("~/" . $path[0] . "/d/home.htmld", true);
return false;
}
else
{
return true;
}
}
if ($path[0] == "madi")
{
$currentTenantName = $path[2];
}
else if ($path[0] == "ots")
{
$currentTenantName = $path[1];
}
else
{
$currentTenantName = $path[0];
}
$currentTenant = $oms->getTenantByName($currentTenantName);
if ($currentTenant == null)
{
System::Redirect("~/invalid-url", true);
return false;
}
else
{
$oms->setTenant($currentTenant);
}
return true;
};
?>

View File

@ -0,0 +1,28 @@
<?php
use Phast\IncludeFile;
use Phast\System;
System::$IncludeFiles[] = new IncludeFile("/lib/mocha/system.inc.php", true);
System::$EnableTenantedHosting = false;
System::$Configuration["Application.Title"] = "Mocha SUV";
System::$Configuration["Application.DefaultTenant"] = "super";
System::$Configuration["Application.ThemeName"] = "avondale";
System::$Configuration["Database.ServerName"] = "localhost";
System::$Configuration["Database.PortNumber"] = 3306;
System::$Configuration["Database.DatabaseName"] = "@@MOCHA_DB_DATABASENAME@@";
System::$Configuration["Database.UserName"] = "@@MOCHA_DB_USERNAME@@";
System::$Configuration["Database.Password"] = "@@MOCHA_DB_PASSWORD@@";
System::$Configuration["LoginPageRedirectURL"] = "~/madi/authgwy/$(CurrentTenantName)/login.htmld";
System::$Configuration["Runtime.DisableAutomaticExtensionParsing"] = true;
System::$Configuration["Paths.MasterPages"] = [ "/ui/masterPages" ];
System::$Configuration["Paths.Pages"] = [ "/ui/pages" ];
require_once ("BeforeLaunchEvent.inc.php");
?>

View File

@ -0,0 +1,182 @@
<?php
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Oms\MySQLDatabaseOms;
use Phast\System;
function mocha_asset_get_physical_path($package, $version, $path)
{
return "/usr/share/mocha/assets/" . $package . "/" . $version . "/" . $path;
}
function mocha_asset_exists($package, $version, $path)
{
return file_exists(mocha_asset_get_physical_path($package, $version, $path));
}
function mocha_get_oms()
{
/*
if (!isset($_SESSION["OMS"]))
{
global $oms;
$oms = new MySQLDatabaseOms(System::GetConfigurationValue("Database.ServerName"), System::GetConfigurationValue("Database.PortNumber"), System::GetConfigurationValue("Database.DatabaseName"), System::GetConfigurationValue("Database.UserName"), System::GetConfigurationValue("Database.Password"));
$oms->setCurrentUser(mocha_get_current_user());
$_SESSION["OMS"] = $oms;
}
return $_SESSION["OMS"];
*/
global $oms;
if ($oms === null)
{
$oms = new MySQLDatabaseOms(System::GetConfigurationValue("Database.ServerName"), System::GetConfigurationValue("Database.PortNumber"), System::GetConfigurationValue("Database.DatabaseName"), System::GetConfigurationValue("Database.UserName"), System::GetConfigurationValue("Database.Password"));
}
$oms->setCurrentUser(mocha_get_current_user());
return $oms;
}
function mocha_get_current_user() : ?InstanceReference
{
/**
* @var MySQLDatabaseOms
*/
global $oms; //! WE CANNOT CALL mocha_get_oms() HERE!
if ($oms === null)
{
return null;
}
$currentTenant = $oms->getTenant();
if ($currentTenant !== null)
{
if (isset($_SESSION["user_token_" . $currentTenant->ID]))
{
// SELECT FROM `Users` WHERE `Token` = $_SESSION["user_token"]
$insts = $oms->getInstancesByAttributes(array
(
KnownAttributeGuids::Token => $_SESSION["user_token_" . $currentTenant->ID]
));
$currentUser = null;
$loginEntry = null;
if (count($insts) == 1)
{
$loginEntry = $insts[0];
if ($loginEntry != null)
{
$users = $oms->getRelatedInstances($loginEntry, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User));
if (count($users) == 1)
{
$currentUser = $users[0];
}
}
if ($currentUser === null)
{
echo("returned null");
die();
}
return $currentUser;
}
}
}
return null;
}
/**
* Initializes the SPOT timer into the specified WebPage.
*
* @return bool true if the spot timer was initialized successfully; false otherwise.
*/
function mocha_init_spot_timer($pg) : bool
{
if ($pg === null)
return false;
$literalSpotTimer = $pg->GetControlByID("literalSpotTimer");
$spotTimerInitializationScript = $pg->GetControlByID("spotTimerInitializationScript");
if ($literalSpotTimer === null || $spotTimerInitializationScript === null)
return false;
$spotTimerContent = "";
$spotTimerScript = "";
mocha_get_spot_timer_script($spotTimerContent, $spotTimerScript);
$literalSpotTimer->Content = $spotTimerContent;
$spotTimerInitializationScript->Content = $spotTimerScript;
return true;
}
function mocha_get_spot_timer_script(&$spotTimerContent, &$spotTimerScript)
{
$spotTimerContent = "";
$spotTimerScript = "";
if (file_exists("/etc/mocha/suvstart"))
{
$suv_start_time = trim(file_get_contents("/etc/mocha/suvstart"));
$suv_start_time_d = new \DateTime($suv_start_time);
$suv_start_time_d->setTimezone(new \DateTimeZone("UTC"));
// this can be adjusted?
$suv_end_time_d = $suv_start_time_d->add(new \DateInterval("PT10H"));
$suv_end_time_d->setTimezone(new \DateTimeZone("UTC"));
$suv_end_time = $suv_end_time_d->format('Y-m-d\TH:i:s\Z');
$suv_current_time_d = new \DateTime();
$interval = $suv_end_time_d->diff($suv_current_time_d);
$spotTimerContent = $interval->h . ":" . $interval->i;
$spotTimerScript = <<<EOT
var spot_end_time = new Date('$suv_end_time');
window.datediff = function(earlierDate, laterDate)
{
var interval = { };
var a = earlierDate, b = laterDate;
console.log(earlierDate);
console.log(laterDate);
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
// Discard the time and time-zone information.
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds());
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds());
console.log(utc2);
console.log(utc1);
var diffMS = (utc2 - utc1);
console.log(diffMS);
var secs = (diffMS / 1000) % 60;
var mins = (diffMS / (1000 * 60)) % 60;
var hrs = (diffMS / (1000 * 60 * 60)) % 24;
interval =
{
"raw": diffMS,
"seconds": Math.floor(secs),
"minutes": Math.floor(mins),
"hours": Math.floor(hrs)
};
return interval;
};
window.spot_timer_tick = function()
{
var spot_cur_time = new Date();
var diff = datediff(spot_cur_time, spot_end_time);
console.log(diff);
document.getElementById('spot_timer').innerHTML = diff.hours + ':' + diff.minutes.toString().padStart(2, '0');
window.setTimeout(spot_timer_tick, 60000);
};
window.addEventListener("load", function()
{
spot_timer_tick();
});
EOT;
}
}
?>

View File

@ -0,0 +1,40 @@
<?php
// =============================================================================
// Phast bootstrapper - loads the application modules and executes Phast
// Copyright (C) 2013-2014 Mike Becker
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// =============================================================================
// Load the Phast content (which also include_once's the system modules and
// other Phast-specific stuff)
require_once("lib/phast/System.inc.php");
require_once("lib/mocha/system.inc.php");
// Bring in the Phast\System and Phast\IncludeFile classes so we can simply refer
// to them (in this file only) as "System" and "IncludeFile", respectively, from
// now on
use Phast\System;
use Phast\IncludeFile;
// We need to set the root path of the Web site. It's usually something like
// /var/www/yourdomain.com.
System::SetApplicationPath(dirname(__FILE__));
// Tell Phast that we are ready to launch the application. This searches the entire
// directory hierarchy for Phast files, loading *.phpx files as Phast XML files and
// *.phpx.php files as PHP code-behind files. We may decide to use the *.ctlx extension
// (and its associated *.ctlx.php) for PHPX controls.
System::Launch();
?>

View File

@ -0,0 +1,36 @@
<?php
require_once ("lib/phast/Compilers/StyleSheet/LESS/Internal/LessStyleSheetCompiler.inc.php");
require_once ("lib/phast/Compilers/StyleSheet/LESS/Internal/Formatters/CompressedFormatter.inc.php");
use Phast\Compilers\StyleSheet\Internal\LessStyleSheetCompiler;
use Phast\Compilers\StyleSheet\Internal\Formatters\CompressedFormatter;
header("Content-Type: text/css");
$filename = $_GET["filename"];
if ((isset($_GET["compile"]) && $_GET["compile"] == "false") || file_exists($filename . ".css"))
{
readfile($filename . ".css");
}
else
{
try
{
#echo ("/* " . $filename . ".less" . " */");
$less = new LessStyleSheetCompiler();
$less->formatter = new CompressedFormatter();
$v = $less->compileFile($filename . ".less");
echo("/* compiled with lessphp v0.4.0 - GPLv3/MIT - http://leafo.net/lessphp */\n");
echo("/* for human-readable source of this file, replace .css with .less in the file name */\n");
echo($v);
}
catch (Exception $e)
{
echo "/* " . $e->getMessage() . " */\n";
}
}
?>

View File

@ -0,0 +1,45 @@
<?php
namespace Mocha\Core;
class InstanceKey
{
public $ClassIndex;
public $InstanceIndex;
public function __construct(int $class_id, int $inst_id)
{
$this->ClassIndex = $class_id;
$this->InstanceIndex = $inst_id;
}
public static function Parse(?string $instanceKeyStr) : ?InstanceKey
{
if ($instanceKeyStr !== null)
{
$split = explode("$", $instanceKeyStr);
if (count($split) == 2)
{
if (is_numeric($split[0]) && is_numeric($split[1]))
{
return new InstanceKey(intval($split[0]), intval($split[1]));
}
}
}
return null;
}
public static function TryParse(?string $instanceKeyStr, ?InstanceKey &$out) : bool
{
$ik = InstanceKey::Parse($instanceKeyStr);
if ($ik !== null)
{
$out = $ik;
return true;
}
return false;
}
public function __toString()
{
return $this->ClassIndex . "$" . $this->InstanceIndex;
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace Mocha\Core;
use Mocha\Oms\Oms;
use Mocha\Oop\Method;
use Mocha\Oop\MethodBinding;
use Phast\UUID;
class InstanceReference
{
//public Oms $OMS;
public int $DatabaseId;
public InstanceKey $InstanceKey;
public UUID $GlobalIdentifier;
public static function toInstanceKeys(array $instanceReferences) : array
{
$keys = [ ];
foreach ($instanceReferences as $instanceReference)
{
$keys[] = $instanceReference->InstanceKey;
}
return $keys;
}
public function __construct(int $databaseId, InstanceKey $instanceKey, UUID|string $globalIdentifier)
{
//$this->OMS = $oms;
$this->DatabaseId = $databaseId;
$this->InstanceKey = $instanceKey;
if (is_string($globalIdentifier))
{
$globalIdentifier = UUID::Parse($globalIdentifier);
}
$this->GlobalIdentifier = $globalIdentifier;
}
/*
public function getRelatedInstances(InstanceReference $relationship)
{
$instances = [];
return $instances;
}
public function getAttributeValue($attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
return $this->OMS->getAttributeValue($this, $attributeInstance, $defaultValue, $effectiveDate);
}
*/
public function asMethod()
{
return new Method($this);
}
public function asMethodBinding($oms)
{
return new MethodBinding($oms, $this);
}
public function __is_equal(InstanceReference $other)
{
return $this->GlobalIdentifier->__is_equal($other->GlobalIdentifier);
}
public function __is_not_equal(InstanceReference $other)
{
return !$this->__is_equal($other);
}
public function __toString()
{
if ($this === null)
{
// can we do this?
return "(null)";
}
return $this->GlobalIdentifier->__toString() . " [" . $this->InstanceKey . "]";
}
}
?>

View File

@ -0,0 +1,31 @@
<?php
namespace Mocha\Core;
class InstanceSet
{
private $_Instances;
public function __construct()
{
$this->_Instances = array();
}
public function add($inst)
{
$this->_Instances[] = $inst;
}
public function contains($inst)
{
foreach ($this->_Instances as $needle)
{
if ($needle === $inst)
return true;
}
/*
if (in_array($inst, $this->_Instances))
trigger_error("needle is equal to inst");
return true;
*/
return false;
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Mocha\Core;
// generated from Mocha.System, v4.0.2023.10r302009
class KnownAttributeGuids
{
// Text
const Name = "9153A637992E4712ADF2B03F0D9EDEA6";
const Verb = "61345a5d33974a9687978863f03a476c";
const Singular = "F1A06573C4474D85B4E754A438C4A960";
const Value = "041DD7FD2D9C412B8B9DD7125C166FE0";
const CSSValue = "C0DD4A42F5034EB380347C428B1B8803";
const RelationshipType = "71106B1219344834B0F6D894637BAEED";
const LabelOverride = "{89b361e0-9f13-4fea-9b1e-6eca573bd6ba}";
const Label = "69cdf8affcf24477b75d71593e7dbb22";
const Order = "{49423f66-8837-430d-8cac-7892ebdcb1fe}";
const MethodType = "{47ae57a9-7723-48a8-80f2-dd410d929e14}";
const ClassName = "c7e8d78ecfac4dacae242ac67a0ba9d3";
const ThemeName = "{8cfc012c-52fd-4a66-8b2f-1b9b5e4af474}";
/**
* A Numeric Attribute specifying the maximum length of an input field.
*/
const MaximumLength = "6d69fee2f2204aadab8901bfa491dae1";
const TargetURL = "970F79A09EFE4E7D92869908C6F06A67";
const UserName = "960FAF025C5940F791A720012A99D9ED";
const PasswordHash = "F377FC294DF14AFB96434191F37A00A9";
const PasswordSalt = "8C5A99BC40ED4FA2B23FF373C1F3F4BE";
const Encoding = "a82f3c46055e4e129c5de40447134389";
const ContentType = "34142FCB172C490AAF03FF8451D00CAF";
const BackgroundColor = "B817BE3BD0AC4A60A98A97F99E96CC89";
const ForegroundColor = "BB4B6E0DD9BA403D9E8193E8F7FB31C8";
const IPAddress = "ADE5A3C3A84E4798BC5BE08F21380208";
const Token = "da7686b638034f1597f67f8f3ae16668";
const DebugDefinitionFileName = "03bf47c7dc9743c8a8c9c6147bee4e1f";
}
?>

View File

@ -0,0 +1,157 @@
<?php
namespace Mocha\Core;
class KnownClassGuids
{
const Clasz = "B9C9B9B7AD8A4CBDAA6BE05784630B6B";
const Attribute = "F9CD7751EF624F7C8A28EBE90B8F46AA";
const Relationship = "9B0A80F9C3254D36997CFB4106204648";
const InstanceDefinition = "ee26f1460b894cfea1afae6ac3533eae";
const Enumeration = "70c3ee174d5443429e7b527cf73c93dd";
// Attribute subclasses
const TextAttribute = "C2F3654260C34B9E9A96CA9B309C43AF";
const BooleanAttribute = "EA830448A4034ED9A3D3048D5D5C3A03";
const NumericAttribute = "9DE86AF1EFD64B719DCC202F247C94CB";
const DateAttribute = "0B7B1812DFB44F25BF6DCEB0E1DF8744";
const RichTextAttribute = "{9e393eb5-0b2d-4c31-bc8c-419f9af8aee6}";
const Element = "919295953dbd4eae8add6120a49797c7";
const ElementContent = "f85d4f5ec69f449899137a8554e233a4";
const BEMProcess = "a4c5ffb4bf3749f39190dc329d035b46";
const Translation = "04A53CC832064A9799C5464DB8CAA6E6";
const TranslationValue = "6D38E757EC1843AD9C35D15BB446C0E1";
const String = "5AECB489DBC2432E86AF6BE349317238";
const StringComponent = "F9E2B67113F54172A568725ACD8BBFAB";
const ExtractSingleInstanceStringComponent = "FCECCE4E8D05485AAE34B1B45E766661";
const InstanceAttributeStringComponent = "623565D55AEE49EDA5A90CFE670507BC";
const Prompt = "EC889225416A4F73B8D12A42B37AF43E";
const TextPrompt = "195DDDD70B744498BF61B0549FE05CF3";
const ChoicePrompt = "5597AEEB922D48AFAE67DF7D951C71DB";
const InstancePrompt = "F3ECBF1EE7324370BE058FA7CC520F50";
const BooleanPrompt = "a7b49c03c9ce4a79a4b2e94fc8cd8b29";
const Method = "D281391380B64DD69AD656D989169734";
const GetInstanceSetBySystemRoutineMethod = "{7bdc53a1-81f0-458d-96f4-5637e6e1cf49}"; # 1$65
const GetAttributeBySystemRoutineMethod = "{9d45eb8c-1fb5-4260-a69c-f99a8f7a70b8}"; # 1$66
// const MethodCall = "084A6D5832C94A5F9D2B86C46F74E522";
const ConditionalEvaluationCase = "ba18abdc11ae46af850aeb30280b0ffa";
const ConditionalSelectAttributeCase = "a1115690c4004e3e9c8f24e2a9477e8f";
const AccessModifier = "ca4fcc1116c84872a71282e589d382ce";
const MethodBinding = "CB36098EB9BF4D2287FA4186EC632C89";
const ReturnAttributeMethodBinding = "30FB6BA62BBB41D2B91A709C00A07790";
const ReturnInstanceSetMethodBinding = "AADC20F97559429BAEF097E059295C76";
const Executable = "6A1F66F78EA643D1B2AF198F63B84710";
const ExecutableReturningAttribute = "50b2db7a36234be4b40d98fab89d3ff5";
const ExecutableReturningInstanceSet = "d5fbc5cb13fb4e68b3ad46b4ab8909f7";
const ExecutableReturningElement = "a15a4f521f1a4ef380a7033d45cc0548";
const ExecutableReturningWorkData = "a0365b76ad1f462e84dad6a1d5b9c88c";
const EvaluateBooleanExpressionMethod = "{e1529108-2f84-4a4c-89b3-a647bc3e41d7}";
const Event = "ca727ecd85364aeb9e75352dbb958767";
const WorkData = "05e8f02388cb416b913e75299e665eb2";
const WorkSet = "c4c171d8994b485bb0ac053d11b963ab";
const Parameter = "1ab99be043f1495ab85eec38ea606713";
const ParameterAssignment = "c7aa0c7c50d844fd9b05a558a38a6954"; // 28
const ElementContentDisplayOption = "bd68052adaa443b98965d38095473170";
const ReportDefinition = "{19D947B6-CE82-4EEE-92EC-A4E01E27F2DB}";
const ReportObject = "ff7d5757d9d948abab045932e7341a90";
const Validation = "3E45AA176E8E41DB9C94E84B4B4176E8";
const ValidationClassification = "8f43d578a671436bafdcc8689a5bd9b6";
const PrimaryObjectReportField = "59EA0C72480048BA84A4DDFE10E5F4D0";
const RelationshipReportField = "FC4E3BB51EA744FFB8282EA54CDD4ABB";
const ReportField = "655A04D9FE354F899AABB8FA34989D03";
const AttributeReportField = "C06E0461A95645999708012C8FE04D94";
const Module = "e009631d6b9d445c95df79f4ef8c8fff";
const Report = "19D947B6CE824EEE92ECA4E01E27F2DB";
const ReportColumn = "BEFE99A1B2EB4365A2C9061C6609037B";
const StandardReport = "FDF4A498DE83417DBA01707372125C8D";
const TaskCategory = "e8d8060fa20c442f838403488b63247f";
const Task = "D4F2564B2D114A5C8AA9AF52D4EACC13";
const UITask = "BFD07772178C4885A6CEC85076C8461C";
const SequenceTask = "{2dfd0c4b-3bc7-4fa3-b369-61441f94e88a}";
const HardcodedTask = "df1fe350767047d991a016dafdfbf98d";
const Tenant = "703F9D65C5844D9FA656D0E3C247FF1F";
const User = "9C6871C19A7F4A3A900E69D1D9E24486";
const UserLogin = "64F4BCDB38D04373BA308AE99AF1A5F7";
const MenuItemCommand = "9D3EDE236DB946649145ABCBD3A0A2C2";
const MenuItemSeparator = "798DECAB511949D7B0ADD4BF45807188";
const MenuItemHeader = "1F1488738A974409A79BC19D5D380CA4";
const MenuItemInstance = "6E3AA9AF96B94208BEA9291A72C68418";
const Style = "A48C843AB24B4BC3BE6FE2D069229B0A";
const StyleRule = "C269A1F3E0144230B78D38EAF6EA8A81";
const StyleClass = "a725f08977634887af37da52358c378c";
const Page = "D962635948E34840A089CD8DA6731690";
const ContainerPageComponent = "6AD6BD1C7D1C4AC99642FEBC61E9D6FF";
const ButtonPageComponent = "F480787DF51E498A897272128D808AEB";
const HeadingPageComponent = "FD86551EE4CE4B8B95CBBEC1E6A0EE2B";
const ImagePageComponent = "798B67FAD4BE42B9B4BD6F8E02C953C0";
const PanelPageComponent = "D349C48996844A5A9843B906A7F803BC";
const ParagraphPageComponent = "ADFF93CE9E854168A7D45239B99BE36D";
const SequentialContainerPageComponent = "A66D9AE23BEC4083A5CB7DE3B03A9CC7";
const SummaryPageComponent = "5EBA7BD6BA0A45B2835CC92489FD7E74";
const TabContainerPageComponent = "E52B02D7895C46429B03EB0232868190";
const DetailPageComponent = "41F9508E6CF04F3D8762FF17CD52C466";
const ElementPageComponent = "122d55659df94656b6afba5df6630d32";
const IntegrationID = "49a5ebdabaaa4edebba5decc250ce1a3";
const IntegrationIDUsage = "86084b9f38604857a41f2f8b6877aff1";
const Dashboard = "896B529C452D42AC98C5170ED4F826C6";
const DashboardContent = "2720ea77cb0940999f74ccdacdd146e8";
const Instance = "263C4882945F4DE9AED8E0D6516D4903";
const InstanceSet = "53aac86ece604509a869417c38c305e0";
const AuditLine = "a4124a7602f6406a9583a197675b493b";
const Theme = "7c2cc4b583234478863b1759d7adf62e";
const CommonBoolean = "5b025da3b7bd45a9b08448c4a922bf72";
const CommonInstanceSet = "3382da214fc545dcbbd1f7ba3ece1a1b";
const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92";
const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b";
const GroupLayout = "{108605af-c20d-42eb-af4f-35b2ff701921}";
const BuildAttributeMethod = "{e5879955-0093-48c8-8042-813168578af2}";
const GetAttributeMethod = "{c3ecf8c9-597f-417b-ad65-fae0401719c6}";
const GetInstancesMethod = "{0a379314-9d0f-432d-ae59-63194ab32dd3}";
const GetReferencedAttributeMethod = "{9205c54e-921a-484c-9be2-3d3deb877474}";
const GetReferencedInstanceSetMethod = "{bcfd0d64-3eba-4a97-9622-f3a960877d24}";
const ConditionalSelectAttributeMethod = "{d534a369-321e-4c32-bd7f-8ff2017f191e}";
const GetSpecifiedInstancesMethod = "{7794c7d0-b15d-4b23-aa40-63bb3d1f53ac}";
const ProcessRelatedUpdatesMethod = "2953e69803c54752a1ebcbbfa8f13905";
const SelectFromInstanceSetMethod = "{130637B4-17A7-4394-8F4D-E83A79114E6C}";
const ConditionalSelectFromInstanceSetMethod = "{ffea8e52-06e5-4e95-8c40-da3ba54ce95f}";
const BinarySwitchLayout = "{248d781d-3d2f-4377-acc4-38112cf2f9d1}";
const RotarySwitchLayout = "{ea52446a-6332-49f7-baa9-4c78bea4faab}";
}
?>

View File

@ -0,0 +1,78 @@
<?php
namespace Mocha\Core;
class KnownInstanceGuids
{
/**
* The GUID of the default tenant instance.
*/
const DefaultTenant = "{F2C9D4A9-9EFB-4263-84DB-66A9DA65AD00}";
const DisplayOption__DisplayAsPageTitle = "{369335cf-4a3d-4349-9300-62bd72dafeb6}";
const DisplayOption__NotEnterable = "831e921b51324b379303da0994a0f828";
const DisplayOption__SubmitNotEnterable = "f480a1d6cc9b4606bce1d6757fa99bad";
const DisplayOption__ShowSubelementsVertically = "8bfd1ae21474413db4dd6cd4993080d1";
const DisplayOption__Singular = "683b3cdb2e69468ebb364bd62716542c";
const DisplayOption__DoNotShow = "cc278872445449fe821aae657bffe062";
const DisplayOption__InitializeForEntry = "59410ca482144b59ba491565d0cf16c7";
const DisplayOption__DoNotShowLabel = "a9fe1e0207854363b4dd8b7ca989d4fd";
const DisplayOption__WideText = "dc0570c5cfd54f879ba751fab4ccf551";
const DisplayOption__Required = "7e508c5405074ae78ea27c9f197051c7";
const DisplayOption__DoNotShowIfEmpty = "055b9a42caf542adbd2e9a4c3527947d";
const DisplayOption__RowsNotEditable = "{c4777ade-827a-466b-a183-24f39e4aa2ab}";
/// <summary>
/// Obscured Text - displays text in a text box element as obscured (system-dependent, e.g. asterisk (*) or dot)
/// </summary>
/// <value>The GUID of the `Obscured Text` EC Display Option.</value>
const DisplayOption__ObscuredText = "e42fb627655942e7a8fe59c9d674eec4";
const Element__LoginPage = "9E272BC303584EB78B3B581964A59634";
const Element__LoginPageSubedit = "2b7d4481b7c24e26a917e3ff7c367a8a";
const Element__HomePage = "3c1f92a509a04b52926946c386b0c905";
const ElementContent__UserNameForLoginPage = "c67f305ebd4d4628816b55fb85ea1b67";
const ElementContent__PasswordForLoginPage = "51b51be344fd48f1971f682aee0a6132";
const Element__ViewElementContent = "e68bb6c429eb4c77908a1b3793c952bc";
const Alignment__Near = "35ea407a45e1462fa923a526d12fbc47";
const Alignment__Center = "{63179b92-9a6a-495b-a823-f45e353be9d8}";
const Alignment__Far = "f19d16c799ff48a3b86a7db8f400d869";
const RelationalOperator__Subset = "{76d42d7c-f7da-4df6-92cc-b362e3a87d7b}";
const RelationalOperator__Empty = "{b416747b-537f-46f9-b855-e71ca361d265}";
const RelationalOperator__CountGreaterThan = "{dbc516aa-0fd9-47a9-bab5-8cede4102af6}";
const RelationalOperator__CountLessThan = "{5101eb0d-bce3-4f1e-b4b1-e75f68a42829}";
const RelationalOperator__CountEqualTo = "{beef419c-4375-41f2-909a-af8dded51d04}";
const RelationalOperator__CountGreaterThanOrEqualTo = "{3579168f-52bc-49f3-be6f-a548ac74f502}";
const RelationalOperator__CountLessThanOrEqualTo = "{bc05d0b7-59ee-42cc-91e9-90a1e0b3ed85}";
const RelationalOperator__Superset = "{67d2da4e-d147-4526-9a94-526f0d79ec9c}";
const RelationalOperator__CountNotEqualTo = "{92ac4ea4-b034-4b09-be67-c39608ae2ecf}";
const RelationalOperator__NotEmpty = "{aeb5a45f-2aff-4b2b-8f6d-f05f50bc8f8c}";
const RelationalOperator__NotInSet = "{7fde8600-680b-4c07-be3b-2660f00b01c2}";
const RelationalOperator__InSet = "{824417e6-61e5-4e74-9e95-514905c01846}";
const RelationalOperator__NotSuperset = "{8e695935-548a-4177-a474-581fc960eddb}";
const RelationalOperator__NotSubset = "{ef7726d6-2feb-426c-bf2c-770014d35f68}";
const RelationalOperator__NotExactMatch = "{f08a632a-1f3e-4979-8ec5-17fefc33b865}";
const RelationalOperator__ExactMatch = "{93611da1-e21e-4021-9ddd-f7575e0c79ec}";
const LogicalOperator__EqualTo = "{733e1fb4-6366-4813-bebb-1e6a7bf504db}";
const LogicalOperator__NotEqualTo = "{c357f835-6b3c-446c-922e-6e867e116fb5}";
const LogicalOperator__GreaterThan = "{f79b96b7-3c57-455f-87ce-1a3372be65b8}";
const LogicalOperator__LessThan = "{8b7b92d4-6297-4f1d-ba11-7cad9d33f517}";
const LogicalOperator__GreaterThanOrEqualTo = "{3a4eb7be-f96b-45ac-b97a-bb8fbfc35923}";
const LogicalOperator__LessThanOrEqualTo = "{528e5637-f995-4a6d-93c3-f5e1e62b4517}";
const WorkSet__RelatedInstance = "{d9634929-0bb4-482a-85cc-9c8f1251556f}";
const WorkSet_ClassForMethod = "{d8eeff45-acbc-4031-8b09-bf9b8085c185}";
const WorkSet__TaskRelatedInstance = "{d3860252-491e-469e-939e-702d56d88063}";
const SystemAttributeRoutine_GetGlobalIdentifier = "{1a7ebec3-dc02-4c9b-a5df-0c72646453c9}";
const SystemAttributeRoutine_GetInstanceText = "{b024abd6-1f2b-495a-9da3-c9ce29fb0c2f}";
}
?>

View File

@ -0,0 +1,13 @@
<?php
namespace Mocha\Core;
class KnownMethodBindingGuids
{
/**
* The GUID of the default tenant instance.
*/
const User__get__User_for_User_Name_parm = "{08265aea-1c51-4fa6-9987-242952386cfe}";
}
?>

View File

@ -0,0 +1,361 @@
<?php
namespace Mocha\Core;
use Phast\UUID;
class KnownRelationshipGuids
{
const Class__has_super__Class = "{100F0308-855D-4EC5-99FA-D8976CA20053}";
const Class__has_sub__Class = "C14BC80D879C4E6F9123E8DFB13F4666";
const Class__has__Method = "2DA282715E464472A6F5910B5DD6F608";
const Method__for__Class = "76D2CE0DAA4D460BB8442BD76EF9902B";
const Class__has__Instance = "7EB41D3C2AE9488483A4E59441BCAEFB";
const Instance__for__Class = "494D5A6D04BE477B8763E3F57D0DD8C8";
const Class__has__Relationship = "3997CAAD3BFA4EA69CFA2AA63E20F08D";
const Relationship__for__Class = "C00BD63F10DA4751B8EA0905436EA098";
const Class__has_title__Translation = "B8BDB90569DD49CDB5570781F7EF2C50";
const Class__has__Attribute = "DECBB61A2C6C4BC890420B5B701E08DE";
const Attribute__for__Class = "FFC8E435B9F844958C854DDA67F7E2A8";
const Class__has_default__Task = "CF396DAA75EA41488468C66A71F2262D";
const Class__has_owner__User = "D1A25625C90F4A73A6F2AFB530687705";
const User__owner_for__Class = "04DD2E6BEA5748408DD5F0AA943C37BB";
const Instance__for__Module = "c60fda3c2c0a422980e8f644e4471d28";
const Module__has__Instance = "c3e5d7e35e114f8da212b175327b2648";
const Class__has__Object_Source = "B62F9B81799B4ABEA4AF29B45347DE54";
const Object_Source__for__Class = "FBB9391DC4A243269F857801F377253C";
const Relationship__has_source__Class = "7FB5D234042E45CBB11DAD72F8D45BD3";
const Relationship__has_destination__Class = "F220F1C204994E87A32EBDBF80C1F8A4";
const Relationship__has_sibling__Relationship = "656110FF450248B8A7F3D07F017AEA3F";
const Translation__has__Translation_Value = "F9B60C00FF1D438FAC746EDFA8DD7324";
const Translation_Value__has__Language = "3655AEC2E2C94DDE8D980C4D3CE1E569";
const String__has__String_Component = "3B6C4C25B7BC42428ED1BA6D01B834BA";
const Extract_Single_Instance_String_Component__has__Relationship = "5E499753F50F4A9EBF53DC013820499C";
const Instance_Attribute_String_Component__has__Attribute = "E15D427769FB4F1992DB8D087F361484";
const String_Component__has_source__Method = "1ef1c965e12048beb682aa040573b5fb";
// const Class__instance_labeled_by__String = "F52FC851D65548A9B526C5FE0D7A29D2";
const Class__instances_labeled_by__Executable_returning_Attribute = "{c22fc17f-0c92-47dc-9a8b-28db0db68985}";
const Class__has_summary__Report_Field = "D11050AD73764AB784DEE8D0336B74D2";
const Class__uses_preview__Executable_returning_Element = "{059dc948-5f1b-4331-94f4-6d79dc324ebf}";
const Executable_returning_Element__preview_used_by__Class = "{07d5e08f-fe38-49fd-8fcb-c862a532ec57}";
const Class__has_related__Task = "4D8670E12AF14E7C9C87C910BD7B319B";
const Report_Object__has__Report_Field = "0af6265642bc40a5b0bcdbba67c347f6";
const Report_Field__for__Report_Object = "b46c8caa3f46465fba117d6f385425a2";
const Task__has_title__Translation = "D97AE03C261F4060A06D985E26FA662C";
const Task__has_instructions__Translation = "A93878989DC0400694F11FB02EB3ECD7";
const Task__has__Prompt = "929B106F7E3E4D30BB84E450A4FED063";
const Task__has__Task_Category = "84048159430d4f6c9361115c8629c517";
const Task__executes__Method_Call = "D8C0D4D4F8C64B92A2C18BF16B16203D";
const Task__has_preview_action_title__Translation = "3f65ce0211dd4829a46bb9ea1b43e56a";
const Prompt__has__Report_Field = "922CCB0561EA441D96E063D58231D202"; // 3de784b9456142f0946fb1e90d80029e
const Report_Field__for__Prompt = "5DED3DB4686445A9A5FF8E5A35AD6E6F"; // b5f59216a1f149798642a4845e59daa8
const Instance_Prompt__has_valid__Class = "D5BD754BF4014FD8A70782684E7E25F0";
const Instance_Prompt_Value__has__Instance = "512B518EA89244ABAC354E9DBCABFF0B";
const Method__executed_by__Method_Binding = "D52500F114214B739987223163BC9C04";
const Method_Binding__executes__Method = "B782A5928AF542288296E3D0B24C70A8";
const Method__has_return_type__Class = "1241c599e55d4dcf9200d0e48c217ef8";
const Method_Binding__has__Parameter_Assignment = "2493810994f1463a9314c49e667cf45b";
const Parameter_Assignment__for__Method_Binding = "19c4a5dbfd2644b8b431e081e6ffff8a";
const Parameter_Assignment__assigns_from__Executable_returning_Work_Data = "{6f3687ed-7d88-4ece-914e-c47c57c1146d}";
const Parameter_Assignment__assigns_to__Work_Data = "{51c37636-35d2-4528-99ca-50cf09fa1427}";
const Parameter__has_data_type__Instance = "ccb5200c5faf4a3a9e8e2edf5c2e0785";
const Instance__data_type_for__Parameter = "ea1e6305b2e44ba591b41ecfbebfa490";
const Instance_Set__has__Instance = "7c9010a269f1402999c872e05c78c41e";
const Parameter_Assignment__assigns_to__Parameter = "a6d30e787bff4fccb109ee96681b0a9e";
const Parameter__assigned_from__Parameter_Assignment = "2085341e5e7e4a7fbb8ddfa58f6030d9";
const Method_Binding__assigned_to__Parameter_Assignment = "cbcb23b710c449eba1cab9da73fe8b83";
const Parameter_Assignment__assigns_from__Method_Binding = "1e055d30a96849d893fe541994fc0c51";
const Validation__has__Validation_Classification = "BCDB6FFDD2F24B63BD7E9C2CCD9547E0";
const Validation__has_true_condition__Executable = "AA2D3B5141534599A9836B4A13ADCBCB";
const Validation__has_false_condition__Executable = "419047F8852B4A4DB161A8BD022FD8EB";
const Validation__has_failure_message__Translation = "E15A97DD2A1D4DC0BD6BA957B63D9802";
const Translation__failure_message_for__Validation = "46a7dfcb884847d59ad3d27fbd8b423f";
const Build_Attribute_Method__returns__Attribute = "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}";
# const Build_Attribute_Method__builds_with__Executable_returning_Attribute = "{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}";
const Build_Attribute_Method__builds_with__Build_Attribute_Method_Component = "{b4fad1b8-711c-4e84-82d0-e9a9e41e8aa7}";
const Build_Attribute_Method_Component__uses__Executable_returning_Attribute = "{9d2acd01-5c6d-4a95-b77e-5261ba109540}";
const Get_Attribute_Method__has__Attribute = "5eca9b3fbe754f6e8495781480774833";
const Get_Referenced_Instance_Set_Method__returns__Work_Set = "{72057f5b-9b49-497d-852f-cd7e5e258d6c}";
const Get_Referenced_Instance_Set_Method__uses_reference__Executable_returning_Instance_Set = "{2978238f-7cb0-4ba3-8c6f-473df782cfef}";
const Get_Referenced_Instance_Set_Method__uses_answer__Executable_returning_Instance_Set = "{6a65819e-c8cb-4575-9af8-ee221364049b}";
const Get_Referenced_Attribute_Method__returns__Attribute = "87f90fe95ec64b098f51b8a4d1544cae";
const Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set = "{c7ecd498-6d05-4e07-b1bc-f7127d0d6666}";
const Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute = "{022ccde3-2b9e-4573-a8fc-e7568f420cd3}";
const Get_Specified_Instances_Method__returns__Work_Set = "{27796f3d-0cbd-42c5-a840-791d3af6c16d}";
const Get_Specified_Instances_Method__uses__Instance = "dea1aa0b2bef4bacb4f90ce8cf7006fc";
const Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute = "{53cf2cb6-f5f2-499f-9f18-26b86bf671c4}";
const Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data = "{45d76d56-01ed-4641-9f68-cfe0c7d0d265}";
const IDR_Evaluate_Boolean_Expression_Method__uses__Boolean_Operator = "{aa9e17a2-e4d9-4598-bcfc-2d729031d11c}";
const Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data = "{0646df91-7e3e-4d59-be71-b978a22ced8e}";
const Prompt_Value__has__Prompt = "7CD62362DDCE4BFC87B9B5499B0BC141";
const User__has_display_name__Translatable_Text_Constant = "6C29856C3B104F5BA291DD3CA4C04A2F";
const User_Login__has__User = "85B40E4B849B4006A9C04E201B25975F";
const User__has_default__Page = "f00cda6feded4e0fb6c59675ed664a75";
const Dashboard__has__Dashboard_Content = "d26acf18afa54ccd8629e1d9dac394ed";
const Dashboard_Content__for__Dashboard = "9f236d2d1f454096a69c42f37abbeebc";
const Dashboard_Content__has__Instance = "1f0c40752b7d42c28488c7db06e91f5a";
const Instance__for__Dashboard_Content = "376951c9252b48438e1dca89c94ddfa6";
const Return_Instance_Set_Method_Binding__has_source__Class = "EE7A30498E09410C84CBC2C0D652CF40";
const Report__has__Report_Column = "7A8F57F1A4F34BAF84A5E893FD79447D";
const Report__has__Report_Data_Source = "1DE7B484F9E3476AA9D37D2A86B55845";
const Report__has__Prompt = "5D112697303F419F886F3F09F0670B07";
const Report_Column__has__Report_Field = "B90269107E914EE1B5F2D7B740614831";
const Report_Column__has__Report_Column_Option = "41FFF5F0B4674986A6FD46FAF4A479E9";
const Report_Data_Source__has_source__Method = "2D5CB496583946A09B9430D4E2227B56";
const Report_Field__has_source__Method = "5db86b7669bf421f96e74c49452db82e";
const Attribute_Report_Field__has_target__Attribute = "3796430126FD41D886611F73684C0E0A";
const Relationship_Report_Field__has_target__Relationship = "134B2790F6DF4F979AB59878C4A715E5";
const Tenant__has__Application = "22936f5126294503a30ba02d61a6c0e0";
const Tenant__has_sidebar__Menu_Item = "D62DFB9F48D54697AAAD1CAD0EA7ECFA";
const Tenant__has__Tenant_Type = "E94B6C9D330748589726F24B7DB21E2D";
const Tenant__has_company_logo_image__File = "3540c81cb2294eacb9b59d4b4c6ad1eb";
const Menu__has__Menu_Section = "a22d949ff8d14dcca3ebd9f910228dfd";
const Menu_Item__has_title__Translatable_Text_Constant = "65E3C87EA2F74A339FA7781EFA801E02";
const Menu_Section__has__Menu_Item = "5b659d7c58f9453c9826dd3205c3c97f";
const Command_Menu_Item__has__Icon = "8859DAEF01F746FA8F3E7B2F28E0A520";
const Instance_Menu_Item__has_target__Instance = "C599C20EF01A4B12A9195DC3B0F545C2";
const Page__has_title__Translation = "7BE6522A4BE84CD38701C8353F7DF630";
const Page__has__Style = "6E6E1A853EA94939B13ECBF645CB8B59";
const Page__has__Page_Component = "24F6C596D77D4754B02300321DEBA924";
const Style__has__Style_Rule = "4CC8A654B2DF4B17A95624939530790E";
const Style_Rule__has__Style_Property = "B69C2708E78D413AB491ABB6F1D2A6E0";
const Style__has_width__Measurement = "4930ca87641a426d9d67cda6d5f22303";
const Style__has_height__Measurement = "978e6de0af7345a0bb56aaf451615b06";
const Measurement__has__Measurement_Unit = "C97200821F40406D80B781C1B690354D";
const Page__has_master__Page = "9bdbfd640915419f83fde8cf8bcc74ae";
const Page__master_for__Page = "7fe8f2a2c94d401083aa9300cc99d71d";
const Page_Component__has__Style = "818CFF507D4243B2B6A792C3C54D450D";
const Style__for__Page_Component = "007563E7727744368C8206D5F156D8E1";
const Button_Page_Component__has_text__Translatable_Text_Constant = "C25230B14D234CFE8B7556C33E8293AF";
const Image_Page_Component__has_source__Method = "481E3FBEB82A4C769DDFD66C6BA8C590";
const Sequential_Container_Page_Component__has__Sequential_Container_Orientation = "DD55F50687184240A89421346656E804";
const Container_Page_Component__has__Page_Component = "CB7B81621C9E4E72BBB8C1C37CA69CD5";
const Panel_Page_Component__has_header__Page_Component = "223B4073F41749CDBCA10E0749144B9D";
const Panel_Page_Component__has_content__Page_Component = "AD8C5FAE24444700896EC5F968C0F85B";
const Panel_Page_Component__has_footer__Page_Component = "56E339BD61894BACAB83999543FB8060";
const Element_Page_Component__has__Element = "fe833426e25d4cde89392a6c9baac20c";
const Element_Page_Component__has__Element_Content_Display_Option = "74e3c13a04fd4f49be7005a32cdcdfe7";
const Element_Content_Display_Option__for__Element_Page_Component = "7d3a7045092549db9b7d24863c9848a6";
const Element__for__Element_Page_Component = "963c5c60397947fab201a26839b9ded9";
const Tenant__has_logo_image__File = "4C399E80ECA24A68BFB426A5E6E97047";
const Tenant__has_background_image__File = "39B0D9634BE049C8BFA2607051CB0101";
const Tenant__has_icon_image__File = "CC4E65BD7AAA40DAAECAC607D7042CE3";
const Tenant__has_login_header__Translatable_Text_Constant = "41D66ACBAFDE4B6F892DE66255F10DEB";
const Tenant__has_login_footer__Translatable_Text_Constant = "A6203B6B5BEB4008AE49DB5E7DDBA45B";
const Tenant__has_application_title__Translation = "7668343767ba46d9a5e72945be635345";
const Tenant__has_mega__Menu = "cdd743cbc74a46719922652c7db9f2d8";
const Tenant_Type__has_title__Translatable_Text_Constant = "79AAE09C5690471C84421B230610456C";
const Prompt__has_title__Translatable_Text_Constant = "081ee211753443c499b524bd9537babc";
const Report__has_title__Translatable_Text_Constant = "DF93EFB08B5E49E78BC0553F9E7602F9";
const Report__has_description__Translatable_Text_Constant = "D5AA18A77ACD4792B0396C620A151BAD";
const Report_Field__has_title__Translatable_Text_Constant = "6780BFC2DBC040AE83EEBFEF979F0054";
const Content_Page_Component__gets_content_from__Method = "0E002E6FAA79457C93B82CCE1AEF5F7E";
const Method__provides_content_for__Content_Page_Component = "5E75000D24214AD49E5FB9FDD9CB4744";
const Securable_Item__secured_by__Method = "15199c4995954288846d13b0ad5dcd4b";
const Get_Relationship_Method__has__Relationship = "321581d660c1454783449d5bda027adc";
const Integration_ID__has__Integration_ID_Usage = "6cd30735df834253aabe360d6e1a3701";
const Integration_ID_Usage__for__Integration_ID = "d8d981ec768640dab89f006c85042444";
const Conditional_Select_from_Instance_Set_Method__has__Conditional_Select_from_Instance_Set_Case = "b6715132b4384073b81d3ecf19584b7d";
const Conditional_Select_from_Instance_Set_Case__for__Conditional_Select_from_Instance_Set_Method = "1c868a068fb7432d839b7a5a02a50eb6";
const Condition_Group__has_true_condition__Executable_returning_Attribute = "d955da3f7ef443748b86167c73434f75";
const Executable_returning_Attribute__true_condition_for__Condition_Group = "1acdefd1e1b445bb99e1bf73dea71da5";
const Condition_Group__has_false_condition__Executable_returning_Attribute = "e46dbc4fae8d4ad8b9e610cedfa68b73";
const Executable_returning_Attribute__false_condition_for__Condition_Group = "633af008bf7f4da194d667a9a80586d6";
const Audit_Line__has__Instance = "c91807ed0d734729990bd90750764fb5";
const Audit_Line__has__User = "7c1e048d3dcb44739f2ee21014a76aa5";
const Method__has__Method_Parameter = "c455dc79ba9b4a7caf8e9ca59dbe511f";
const Method_Parameter__for__Method = "0bcb6e5b58854747843ced4c3d3dc234";
const Method__returns__Attribute = "eb015d320d4f4647b9b8715097f4434b";
const Detail_Page_Component__has_caption__Translation = "4a15fa44fb7b4e268ce2f36652792b48";
const Element__has__Element_Content = "c1d3248102f948c6baf837d93fa8da23";
const Element_Content__for__Element = "2eff7f580edd40b79c0600774257649e";
const Element__has_label__Translation = "7147ea909f454bb9b151025b6e2bd834";
const Element_Content__has__Instance = "315b71ba953d45fc87e54f0a268242a9";
const Instance__for__Element_Content = "c3959f84248d4edea3f2f262917c7b56";
const Element_Content__has__Layout = "1ab7412005ea4acab6d3c7e0133e0c4f";
const Element_Content__has__EC_Dynamic_Display_Option = "{4a41391a-c325-4182-920a-a94ad28c15fa}";
const EC_Dynamic_Display_Option__modifies__Element_Content = "{4d091643-2bfc-4b83-b3e4-8a3b22c665a9}";
const Dynamic_Display_Option__add__Display_Option = "{2ed33b28-f84d-4120-b585-be965cfb691f}";
const Dynamic_Display_Option__remove__Display_Option = "{dc06bf0b-70dd-4f71-854d-0f5685e2124f}";
const Element_Content__built_from__BEM_Process = "{3d7094ff-33e5-4800-9e4e-93dde0d1d331}";
const BEM_Process__uses_loop__Executable_returning_Instance_Set = "{0fb2b538-eacb-418a-b7d8-43a584b85952}";
const Layout__has__Style = "{e684bb26-7e78-4a21-b8b4-5a550f3053d5}";
const Rotary_Switch_Layout__has__Rotary_Switch_Layout_Option = "{ae716c95-1e26-48f4-9013-001d1a1854aa}";
const Element_Content__has__Element_Content_Display_Option = "f070dfa762604488a779fae291903f2d";
const Element_Content__has__Parameter_Assignment = "51214ef0458a44fa8b9df3d9d2309388";
const Parameter__assigned_from__Element_Content = "dcef180ba2ca4d87bb05b946c319b562";
const Element_Content__has__Validation = "265637cd2099416b88fa4f5ed88a87e3";
const Validation__for__Element_Content = "3a4677e89c78414980ad46e5ac3b12f5";
const Instance__has__Instance_Definition = "329c54ee17b84550ae80be5dee9ac53c";
const Task__has_initiating__Element = "78726736f5b74466b11429cbaf6c9329";
const Element__initiates_for__Task = "36964c5d348e4f888a620a795b43bc14";
const Detail_Page_Component__has_row_source__Method_Binding = "54FBD0560BD444F4921C11FB0C77996E";
const Detail_Page_Component__has_column_source__Method_Binding = "ddabeedaaa264d87a4574e7da921a293";
const Work_Set__has_valid__Class = "0808746241a5427184bca9bcd31a2c21";
const Class__valid_for__Work_Set = "73c65dcf781047d498c0898ca1b17a68";
const Conditional_Select_Attribute_Method__returns__Attribute = "{b2b9d9cc-c4dd-491b-853e-e3669ea4e66a}";
const Attribute__returned_by__Conditional_Select_Attribute_Method = "{e3e734ce-953b-49b8-b50d-b1826b519053}";
const Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case = "{49396bd0-b5a9-4384-99f4-2126d80b3b66}";
const Conditional_Select_Attribute_Case__for__Conditional_Select_Attribute_Method = "{38e2816e-ccb4-4e89-86ab-4981f5c2d7ac}";
const Conditional_Select_Attribute_Case__invokes__Executable_returning_Attribute = "{dbd97430-9c55-430d-815c-77fce9887ba7}";
const Executable_returning_Attribute__invoked_by__Conditional_Select_Attribute_Case = "{f4b04072-abe8-452a-b8f8-e0369dde24d4}";
const Style__gets_background_image_File_from__Return_Instance_Set_Method_Binding = "4b4a0a3e426c4f70bc15b6efeb338486";
const Style__has__Style_Class = "2cebd83052aa44ff818db2d6ee273a1f";
const Style_Class__for__Style = "b2fbce51455a42b59fd1c28bb0cbe613";
const Style__implements__Style = "99b1c16af2cb4cc5a3bb82a96335aa39";
const Style__implemented_for__Style = "271ef8161e944f02a8054f9536c28dca";
const Style__has_horizontal__Alignment = "{cc8d60e3-1b42-4ab1-a918-3d109891bb4e}";
const Style__has_vertical__Alignment = "{24c175dd-c34c-4ffc-aef0-440aa032ceeb}";
const Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine = "{f7aaac2c-0bfd-4b31-8c8c-3a76e9522574}";
const Get_Attribute_by_System_Routine_Method__returns__Attribute = "{e19cf181-b5bf-4595-b5c6-b9098a7a41bb}";
const Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine = "{085bd706-eece-4604-ac04-b7af114d1d21}";
const System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method = "{6fb6534c-2a46-4d6d-b9df-fd581f19efed}";
const Get_Instance_Set_by_System_Routine_Method__returns__Instance_Set = "{84a864fe-84de-4901-a51c-1e103dc56aed}";
const System_Account__has__User_Preferences = "{ada4deb2-adfd-409f-b13a-9856fabd5522}";
const User_Preferences__for__System_Account = "{ab2372a5-a4c7-488a-89f6-67e5834f8c83}";
const Button_Layout__executes_task_from__Instance_Set = "04d104faa6c4425ea6cd56d847c63e9d";
const Button_Layout__gets_related_instance_from__Instance_Set = "{462bb1ab-aefa-4455-8d56-eff233e3caa7}";
const Element__processed_by__Process_Related_Updates_Method = "{ed9c836a-04a4-4505-8953-3c567e841c66}";
const Element__processed_by__Control_Transaction_Method = "{0f182291-6784-47b3-a8d3-d2f6ebf3950c}";
const Control_Transaction_Method__uses__Build_Response_Method_Binding = "{d8f2f0cc-54a2-4004-a383-8c1321495531}";
const Build_Response_Method_Binding__used_by__Control_Transaction_Method = "{9b83d1f3-6569-4e98-9d88-765684abfd18}";
const Process_Related_Updates_Method__uses__Executable_for_PUMB = "{50e1f14a-d6e5-4c71-b7ab-1755442728dc}";
const Process_Related_Updates_Method__processes_for__Class = "{436a20fb-f672-4397-aca4-ec0ed6e2280a}";
const Assign_Attribute_Method__uses__Executable_returning_Attribute = "{9313f96e-58af-416f-852e-ef83725057fc}";
const Assign_Attribute_Method__assigns__Attribute = "{74061875-8a27-403b-9456-02e52cfd13b2}";
const Get_Instances_Method__returns__Work_Set = "{7d0f93b1-8c93-464e-a44d-d674f910b589}";
const Get_Instances_Method__selects_instances_of__Class = "{c0b85d90-de8c-44c2-9420-c5e724ccdf2c}";
const Build_UI_Response_Method__uses__Executable_returning_Element = "{6f066ec6-b978-4627-81da-78fee1bed5e5}";
const Executable_returning_Element__used_by__Build_UI_Response_Method = "{0e662556-ca79-43fe-9a50-57ad22df65de}";
const Select_from_Instance_Set_Method__returns__Work_Set = "{e7805b49-0eb3-46ea-bc8a-a5ed676a7726}";
const Work_Set__returned_by__Select_from_Instance_Set_Method = "{df12608a-e157-4a1b-bae2-0224a18f5b94}";
const Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set = "{a907f814-b996-4294-b347-ca16ccaf1f5b}";
const Executable_returning_Instance_Set__used_by__Select_from_Instance_Set_Method = "{a3ec06f9-54e8-4279-a31d-d221f8697a6a}";
const Select_from_Instance_Set_Method__uses__Set_Function = "{abda76ae-a969-40e3-aed2-1a20fcec8b31}";
const Set_Function__used_by__Select_from_Instance_Set_Method = "{753f9f4f-3fe3-470a-890d-d799c24e47af}";
const Select_from_Instance_Set_Method__uses__Selection_Function = "{6498e72e-f321-4be2-acfd-dfd6f916ce54}";
const Selection_Function__used_by__Select_from_Instance_Set_Method = "{e5e6a392-a436-41f7-bc80-cb6603503be1}";
const Select_from_Instance_Set_Method__uses_function__Executable_returning_Attribute = "{30905c53-0d64-4332-9023-12a03e60cd09}";
const Executable_returning_Attribute__function_used_by__Select_from_Instance_Set_Method = "{79adb5ea-0257-445b-9f7c-e5f8508a59a2}";
const Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute = "{c7a5ef47-fce3-4e7c-87b8-f5cab93b1b10}";
const Executable_returning_Attribute__order_used_by__Select_from_Instance_Set_Method = "{48c984ea-f4da-4090-bdd0-fd659b9be13d}";
const Select_from_Instance_Set_Method__uses_subset_index__Executable_returning_Attribute = "{b5ef8d8b-683a-4cb9-9e6c-bc470324f4e3}";
const Executable_returning_Attribute__as_subset_index_for__Select_from_Instance_Set_Method = "{7d03574f-db28-4aff-a96c-8013832b8269}";
const Select_from_Instance_Set_Method__uses_comparator__Executable_returning_Work_Data = "{974c6e8b-b04f-4e3c-8719-298052afa9c7}";
const Executable_returning_Work_Data__comparator_for__Select_from_Instance_Set_Method = "{c877ea85-ee9f-4e22-bae7-4a0d7b9272e1}";
}
?>

View File

@ -0,0 +1,8 @@
<?php
namespace Mocha\Core;
class Oms
{
}
?>

View File

@ -0,0 +1,109 @@
<?php
namespace Mocha\Core;
class OmsContext
{
private $elementParms;
public $workData;
private $temporaryData;
public $CallStack;
public function __construct()
{
$this->elementParms = array();
$this->workData = array();
$this->temporaryData = array();
$this->CallStack = array();
}
public function setElementParm(InstanceReference $elementContent, string $parmId, $value)
{
if (!array_key_exists($elementContent->DatabaseId, $this->elementParms))
{
$this->elementParms[$elementContent->DatabaseId] = array();
}
$this->elementParms[$elementContent->DatabaseId][$parmId] = $value;
}
public function getElementParm(InstanceReference $elementContent, string $parmId, $defaultValue = null)
{
if (array_key_exists($elementContent->DatabaseId, $this->elementParms))
{
if (array_key_exists($parmId, $this->elementParms[$elementContent->DatabaseId]))
{
return $this->elementParms[$elementContent->DatabaseId][$parmId];
}
}
return $defaultValue;
}
public function setWorkData(string|InstanceReference $parmId, $value)
{
/**
* @var \Mocha\Oms\MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$key = $parmId;
if ($key instanceof InstanceReference)
{
$key = $key->GlobalIdentifier->__toString();
if ($value === null)
{
//echo ("[ set wd " . $parmId->InstanceKey->__toString() . " = null ]");
}
else
{
if (is_string($value))
{
//echo ("[ set wd " . $parmId->InstanceKey . " = STR'" . $value . "' ]");
}
else
{
//echo ("[ set wd " . $parmId->InstanceKey . " = IK'" . $value->InstanceKey . "' ]");
}
}
$expectedDataType = "";
$actualDataType = "";
if (!$oms->validateWorkDataType($parmId, $value, $expectedDataType, $actualDataType))
{
//echo("invalid work data (expected: " . $expectedDataType . ", got: " . $actualDataType . ") for attribute " . $parmId->InstanceKey . " @ " . $parmId->GlobalIdentifier);
}
}
$this->workData[$key] = $value;
}
public function getWorkData(string|InstanceReference $parmId, $defaultValue = null)
{
$key = $parmId;
if ($key instanceof InstanceReference)
{
$key = $key->GlobalIdentifier->__toString();
}
if (array_key_exists($key, $this->workData))
{
return $this->workData[$key];
}
return $defaultValue;
}
public function setTemporaryVariable(InstanceReference $key, $value)
{
$key = $key->GlobalIdentifier->__toStringFormat(false, "", "");
$this->temporaryData[$key] = $value;
}
public function getTemporaryVariable(string|InstanceReference $key, $defaultValue = null)
{
$key = $key->GlobalIdentifier->__toStringFormat(false, "", "");
if (array_key_exists($key, $this->temporaryData))
{
return $this->temporaryData[$key];
}
return $defaultValue;
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
namespace Mocha\Core;
class TenantReference
{
public $ID;
public $Name;
public $GlobalIdentifier;
public function __construct($id, $name, $globalIdentifier)
{
$this->ID = $id;
$this->Name = $name;
$this->GlobalIdentifier = $globalIdentifier;
}
}
?>

View File

@ -0,0 +1,10 @@
<?php
namespace Mocha\Oms;
abstract class DatabaseOms extends Oms
{
}
?>

View File

@ -0,0 +1,796 @@
<?php
namespace Mocha\Oms;
use InvalidArgumentException;
use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference;
use Mocha\Core\TenantReference;
use Phast\Utilities\Stopwatch;
use Phast\UUID;
class MySQLDatabaseOms extends DatabaseOms
{
private \PDO $PDO;
private ?InstanceReference $_currentUser = null;
public function setCurrentUser(?InstanceReference $userInstance)
{
$this->_currentUser = $userInstance;
}
public function getCurrentUser() : ?InstanceReference
{
return $this->_currentUser;
}
public function query($query, array $parms)
{
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute($parms);
$values = $stmt->fetchAll();
return $values;
}
public function getInstances() : array
{
$query = "SELECT * FROM mocha_instances WHERE (" . $this->buildTenantIDQuery() . ")";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute();
$values = $stmt->fetchAll();
$insts = array();
foreach ($values as $value)
{
$insts[] = $this->getInstanceFromDatabase($value);
}
return $insts;
}
/**
* Raised when the tenant is changed via setTenant.
*/
public function onTenantChanged(?TenantReference $oldTenant, ?TenantReference $newTenant)
{
$query = "CALL mocha_select_tenant(:tenant_id);";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"tenant_id" => $newTenant->ID
));
if ($result === false)
{
return false;
}
return true;
}
/**
* Gets the tenant with the specified name, or NULl if no tenant with the specified name exists on the server.
*
* @param string $tenantName the name of the desired tenant
*
* @return ?TenantReference
*/
public function getTenantByName(string $tenantName) : ?TenantReference
{
$query = "SELECT * FROM mocha_tenants WHERE tenant_name = :tenant_name;";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"tenant_name" => $tenantName
));
$values = $stmt->fetch();
if ($values !== false)
{
$tenant = new TenantReference($values["id"], $values["tenant_name"], $values["global_identifier"]);
return $tenant;
}
return null;
}
public function getTenantByID(int $id) : ?TenantReference
{
$query = "SELECT * FROM mocha_tenants WHERE id = :tenant_id;";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"tenant_id" => $id
));
$values = $stmt->fetch();
if ($values !== false)
{
$tenant = new TenantReference($values["id"], $values["tenant_name"], $values["global_identifier"]);
return $tenant;
}
return null;
}
public function __construct($hostname, $port, $databasename, $username, $password)
{
parent::__construct();
$this->PDO = new \PDO("mysql:host=" . $hostname . ";port=" . $port . ";dbname=" . $databasename, $username, $password);
}
public function getDbId($instRef)
{
if ($instRef == null)
return 0;
return $instRef->DatabaseId;
}
public function createInstanceOf(InstanceReference $classInstance) : ?InstanceReference
{
$assigned_id = null;
$query = "CALL mocha_create_instance_of(mocha_get_instance_by_key(1, :class_index), :global_identifier, :user_inst_id, :effective_date, @assigned_id);";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"class_index" => $classInstance->InstanceKey->InstanceIndex,
"global_identifier" => null,
"user_inst_id" => null,
"effective_date" => null
));
$values = $stmt->fetch();
$stmt->closeCursor();
$results = current($this->PDO->query("SELECT @assigned_id AS assigned_id")->fetchAll());
if (isset($results["assigned_id"]))
{
return $this->getInstanceByDBID($results["assigned_id"]);
}
return null;
}
public function getUserByUserName(string $username) : ?InstanceReference
{
$query = "SELECT mocha_get_user_by_username(:username);";
$stmt = $this->PDO->prepare($query);
try
{
$result = $stmt->execute(array
(
"username" => $username
));
$values = $stmt->fetch();
}
catch (\PDOException $ex)
{
// this may result in a "String data, right truncated" if we pass in
// text longer than whatever the stored procedure expects; in this case
// we should just treat it as the user doesn't exist and return null
//
// * Note that if any methods actually allow us to create users with names
// * this long, this will prevent them from logging in!
return null;
}
if ($values[0] == null)
return null;
$dbid = $values[0];
$ir = new InstanceReference($dbid, $this->getInstanceKey($dbid), $this->getGlobalIdentifier($dbid));
return $ir;
}
public function getGlobalIdentifier($dbid) : string
{
$query = "SELECT global_identifier FROM mocha_instances WHERE id = :id";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array("id" => $dbid));
$values = $stmt->fetch();
return $values[0];
}
public function getInstanceKey($dbid) : InstanceKey
{
$query = "SELECT class_id, inst_id FROM mocha_instances WHERE id = :id";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array("id" => $dbid));
$values = $stmt->fetch();
return new InstanceKey($values["class_id"], $values["inst_id"]);
}
public function getInstanceByDBID(int $dbid) : ?InstanceReference
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$query = "SELECT * FROM mocha_instances WHERE id = :id";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"id" => $dbid
));
$values = $stmt->fetch();
$ir = new InstanceReference($values["id"], new InstanceKey($values["class_id"], $values["inst_id"]), $values["global_identifier"]);
return $ir;
}
public function getInstanceByKey(InstanceKey $instanceKey) : ?InstanceReference
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$query = "CALL mocha_get_instance_by_key(:class_id, :inst_id)";
// $query = "SELECT * FROM mocha_instances WHERE class_id = :class_id AND inst_id = :inst_id AND class_id IS NOT NULL;";
$stmt = $this->PDO->prepare($query);
$parms = array
(
"class_id" => $instanceKey->ClassIndex,
"inst_id" => $instanceKey->InstanceIndex
);
$result = $stmt->execute($parms);
if ($result === false)
{
trigger_error("unknown database error, query was:", \E_USER_ERROR);
trigger_error($query, \E_USER_NOTICE);
return null;
}
$values = $stmt->fetchAll();
if (count($values) == 0)
{
trigger_error("no records found, query was:", \E_USER_NOTICE);
trigger_error($query, \E_USER_NOTICE);
foreach ($parms as $key => $value)
{
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
}
return null;
}
$dbid = $values[0]["id"];
$class_id = $values[0]["class_id"];
$inst_id = $values[0]["inst_id"];
$global_id = $values[0]["global_identifier"];
$ir = new InstanceReference($dbid, new InstanceKey($class_id, $inst_id), $global_id);
return $ir;
}
private $_instanceCache;
private static bool $useInstanceCache = true; // makes a 0.2ms difference!
/*
render time with stored procedure
24$3 22.388103961945 ms without SP
24$3 10.10122179985 ms with SP
plus the SP actually works, and the straight query INTRODUCES bugs... wtf?
*/
public function getReferencedTenants(TenantReference $tenantReference) : array
{
$retval = [];
$query = "SELECT target_tenant_id FROM mocha_tenant_references WHERE source_tenant_id = :source_tenant_id";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"source_tenant_id" => $tenantReference->ID
));
if ($result === false)
{
$this->logDatabaseError($query);
}
else
{
$values = $stmt->fetchAll();
$count = count($values);
for ($i = 0; $i < $count; $i++)
{
$target_tenant_id = $values[$i][0];
$target_tenant = $this->getTenantByID($target_tenant_id);
if ($target_tenant !== null)
{
$retval[] = $target_tenant;
}
}
}
return $retval;
}
private function logDatabaseError(string $query, ?array $parms = null)
{
trigger_error("unknown database error, query was:", \E_USER_ERROR);
trigger_error($query, \E_USER_NOTICE);
return null;
}
private function buildTenantIDQuery(string $tenantIdParmName = "tenant_id")
{
$tenant_id_qry = $tenantIdParmName . " = " . $this->getTenant()->ID;
$tenant_references = $this->getReferencedTenants($this->getTenant());
foreach ($tenant_references as $tenantref)
{
$tenant_id_qry .= " OR " . $tenantIdParmName . " = " . $tenantref->ID;
}
return $tenant_id_qry;
}
public function initializeInstanceCache()
{
error_log("invalidating instance cache");
$instanceCache = array();
$insts = $this->getInstances();
foreach ($insts as $ir)
{
$instanceCache[$ir->GlobalIdentifier->__toStringFormat(false, "", "")] =
array
(
"dbid" => $ir->DatabaseId,
"cid" => $ir->InstanceKey->ClassIndex,
"iid" => $ir->InstanceKey->InstanceIndex,
"gid" => $ir->GlobalIdentifier->__toStringFormat(false, "", "")
);
}
$_SESSION["instanceCache"] = $instanceCache;
}
public function getInstanceByGlobalIdentifier(UUID|string $globalIdentifier) : ?InstanceReference
{
$sw = new Stopwatch();
$sw->start();
$tenant = $this->getTenant();
if ($tenant === null)
{
debug_print_backtrace();
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
if (is_string($globalIdentifier))
{
$globalIdentifier = UUID::parse($globalIdentifier);
}
if ($_SESSION["instanceCache"] === null)
{
$this->initializeInstanceCache();
}
$instanceCache = $_SESSION["instanceCache"];
// if (!array_key_exists($globalIdentifier->__toStringFormat(false, "", ""), $instanceCache))
// {
// $this->initializeInstanceCache();
// }
if (array_key_exists($globalIdentifier->__toStringFormat(false, "", ""), $instanceCache))
{
$values = $instanceCache[$globalIdentifier->__toStringFormat(false, "", "")];
return new InstanceReference($values["dbid"], new InstanceKey(intval($values["cid"]), intval($values["iid"])), UUID::parse($values["gid"]));
}
# trigger_error("instance cache: key not found " . $globalIdentifier->__toString(), \E_USER_ERROR);
return null;
}
public function getInstanceByGlobalIdentifier__OLD(UUID|string $globalIdentifier) : ?InstanceReference
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
// 13 ms with query executed for each line
if (is_string($globalIdentifier))
{
$globalIdentifier = UUID::parse($globalIdentifier);
}
if ($this->_instanceCache == null || !MySQLDatabaseOms::$useInstanceCache)
{
$this->_instanceCache = array();
}
if (array_key_exists($globalIdentifier->__toString(), $this->_instanceCache))
{
return $this->_instanceCache[$globalIdentifier->__toString()];
}
// echo("calling sql for GetInstanceByGID (" . $globalIdentifier->__toString() . ")");
// $query = "CALL mocha_get_instance_by_global_identifier(mocha_normalize_uuid(:global_identifier))";
echo ("query using SQL");
$query = "SELECT * FROM mocha_instances WHERE (" . $this->buildTenantIDQuery() . ") AND global_identifier = :global_identifier AND class_id IS NOT NULL";
$stmt = $this->PDO->prepare($query);
$parms = array
(
//"global_identifier" => $globalIdentifier->__toString()
"global_identifier" => $globalIdentifier->__toStringFormat(false, "", "")
);
$result = $stmt->execute($parms);
if ($result === false)
{
trigger_error("unknown database error, query was:", \E_USER_ERROR);
trigger_error($query, \E_USER_NOTICE);
return null;
}
$values = $stmt->fetchAll();
if (count($values) == 0)
{
trigger_error("no records found, query was:", \E_USER_NOTICE);
trigger_error($query, \E_USER_NOTICE);
foreach ($parms as $key => $value)
{
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
}
return null;
}
$dbid = $values[0]["id"];
$class_id = $values[0]["class_id"];
$inst_id = $values[0]["inst_id"];
$global_id = $values[0]["global_identifier"];
$ir = new InstanceReference($dbid, new InstanceKey($class_id, $inst_id), $global_id);
$this->_instanceCache[$ir->GlobalIdentifier->__toString()] = $ir;
return $ir;
}
/**
* !UGLY UGLY HACK
* !Remove when we can figure out a solution to the duplicate instance problem
* !(DUPLICATEINSTANCES)
*/
// public $HACK__IncludeDuplicateInstances = false;
protected function getRelatedInstancesInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{
/*
if ($this->_relatedInstancesCache === null)
{
$this->_relatedInstancesCache = array();
}
if (!array_key_exists($sourceInstance->DatabaseId, $this->_relatedInstancesCache))
{
$this->_relatedInstancesCache[$sourceInstance->DatabaseId] = array();
}
if (array_key_exists($relationshipInstance->DatabaseId, $this->_relatedInstancesCache[$sourceInstance->DatabaseId]))
{
return $this->_relatedInstancesCache[$sourceInstance->DatabaseId][$relationshipInstance->DatabaseId];
}
*/
$dt = null;// $this->normalizeSqlDateTime($effectiveDate, true);
/*
$query = "CALL mocha_get_related_instances(:src_inst_id, :rel_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$parms = array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"eff_date" => $dt
);
*/
/*
$query = "SELECT mocha_instances.* FROM mocha_instances INNER JOIN mocha_relationships ON mocha_instances.id = mocha_relationships.destination_inst_id WHERE mocha_relationships.tenant_id = :tenant_id " .
"AND source_inst_id = :src_inst_id AND relationship_inst_id = :rel_inst_id" ; // AND :eff_date IS NULL OR (effective_date >= :eff_date)";
*/
$query = "SELECT destination_inst_id, remove_flag FROM mocha_relationships WHERE (" . $this->buildTenantIDQuery("mocha_relationships.tenant_id") . ") " .
"AND source_inst_id = :src_inst_id AND relationship_inst_id = :rel_inst_id" ; // AND :eff_date IS NULL OR (effective_date >= :eff_date)";
$stmt = $this->PDO->prepare($query);
$parms = array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance) //,
//"eff_date" => $dt
);
$result = $stmt->execute($parms);
// trigger_error($query, \E_USER_NOTICE);
// trigger_error("source inst id: " . $sourceInstance->InstanceKey, \E_USER_NOTICE);
// trigger_error("relationship inst id: " . $relationshipInstance->InstanceKey, \E_USER_NOTICE);
// foreach ($parms as $key => $value)
// {
// trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
// }
if ($result === false)
{
return null;
}
$values = $stmt->fetchAll();
$ret = array();
foreach ($values as $value)
{
/*
$retval = $this->getInstanceFromDatabase($value);
if ($retval !== null)
{
if ($value["remove_flag"] == 1)
{
unset($ret[$retval->GlobalIdentifier->__toString()]);
}
else
{
//echo($retval->GlobalIdentifier->__toString() . "\n");
// $ret[$retval->GlobalIdentifier->__toString()] = $retval;
$ret[$retval->GlobalIdentifier->__toString()] = $retval;
}
}
*/
$ir = $this->getInstanceByDBID($value["destination_inst_id"]);
if ($ir !== null)
{
// !HACK: (DUPLICATEINSTANCES)
// ! We cannot do duplicate instances AND single line removal of instances
// ! because we would not have a way to determine which *index* of instance
// ! was removed!
/*
if ($this->HACK__IncludeDuplicateInstances)
{
$ret[] = $ir;
}
else
{
if ($value["remove_flag"] == 1)
{
unset($ret[$ir->GlobalIdentifier->__toString()]);
}
else
{
//echo($retval->GlobalIdentifier->__toString() . "\n");
// $ret[$retval->GlobalIdentifier->__toString()] = $retval;
$ret[$ir->GlobalIdentifier->__toString()] = $ir;
}
}
*/
if ($value["remove_flag"] == 1)
{
unset($ret[$ir->GlobalIdentifier->__toString()]);
}
else
{
//echo($retval->GlobalIdentifier->__toString() . "\n");
// $ret[$retval->GlobalIdentifier->__toString()] = $retval;
$ret[$ir->GlobalIdentifier->__toString()] = $ir;
}
}
}
/*
if ($this->HACK__IncludeDuplicateInstances)
{
$this->MetadataExceptions["MX_DUPLICATEINSTANCES_HACK"] = new OmsMetadataException("An element on this page uses the (DUPLICATEINSTANCES) hack", [ "Source" => "getRelatedInstancesInternal" ], null, OmsMetadataExceptionSeverity::Warning);
return $ret;
}
*/
//$this->_relatedInstancesCache[$sourceInstance->DatabaseId][$relationshipInstance->DatabaseId] = $ret;
return array_values($ret);
}
protected function getAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
$dt = $this->normalizeSqlDateTime($effectiveDate, true);
// $query = "CALL mocha_get_attribute_value(:src_inst_id, :att_inst_id, :eff_date)";
//echo ("GAV: " . $sourceInstance->InstanceKey . " : " . $attributeInstance->InstanceKey );
$query = "SELECT * FROM mocha_attributes WHERE tenant_id = :tenant_id AND src_inst_id = :src_inst_id AND att_inst_id = :att_inst_id AND att_effective_date <= NOW() ORDER BY att_effective_date DESC";
$stmt = $this->PDO->prepare($query);
$vars = array
(
"tenant_id" => $this->getTenant()->ID,
"src_inst_id" => $this->getDbId($sourceInstance),
"att_inst_id" => $this->getDbId($attributeInstance)//,
//"eff_date" => $dt
);
$result = $stmt->execute($vars);
if ($result === false)
{
return $defaultValue;
}
$values = $stmt->fetchAll();
if (count($values) > 0)
{
$value = $values[0]["att_value"];
return $value;
}
// the attribute was not set on the current tenant,
// so retry the query with our parent tenants
$parentTenants = $this->getReferencedTenants($this->getTenant());
foreach ($parentTenants as $parentTenant)
{
$vars["tenant_id"] = $parentTenant->ID;
$result = $stmt->execute($vars);
if ($result === false)
{
return $defaultValue;
}
$values = $stmt->fetchAll();
if (count($values) > 0)
{
// we have a value!
$value = $values[0]["att_value"];
return $value;
}
}
// attribute has not been defined anywhere
/*
echo ("<!-- NOK - query : " . $query);
print_r($vars);
echo (" -->");
*/
return $defaultValue;
}
public function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$dt = $this->normalizeSqlDateTime($effectiveDate, true);
$query = "CALL mocha_set_attribute_value(:src_inst_id, :attr_inst_id, :attr_value, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"attr_inst_id" => $this->getDbId($attributeInstance),
"attr_value" => $value,
"user_inst_id" => $this->getCurrentUser()->DatabaseId,
"eff_date" => $dt
));
}
private function normalizeSqlDateTime(?\DateTime $parm, bool $useNow = false)
{
return null;
$dt = null;
if ($parm !== null)
{
$dt = $parm->format("Y-m-d");
}
else if ($useNow)
{
$dt = (new \DateTime())->format("Y-m-d");
}
return $dt;
}
protected function removeRelationshipInstanceInternal(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, InstanceReference|string|InstanceKey|array $targetInstances, ?\DateTime $effectiveDate = null)
{
$dt = $this->normalizeSqlDateTime($effectiveDate, true);
if (is_array($targetInstances))
{
foreach ($targetInstances as $targetInstance)
{
$query = "INSERT INTO mocha_relationships (tenant_id, source_inst_id, relationship_inst_id, destination_inst_id, user_inst_id, effective_date, remove_flag) VALUES (:tenant_id, :src_inst_id, :rel_inst_id, :dest_inst_id, :user_inst_id, NOW(), 1)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"tenant_id" => $this->getTenant()->ID,
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstance),
"user_inst_id" => $this->getCurrentUser()->DatabaseId #,
# "eff_date" => $dt
));
}
}
else
{
$query = "INSERT INTO mocha_relationships (tenant_id, source_inst_id, relationship_inst_id, destination_inst_id, user_inst_id, effective_date, remove_flag) VALUES (:tenant_id, :src_inst_id, :rel_inst_id, :dest_inst_id, :user_inst_id, NOW(), 1)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"tenant_id" => $this->getTenant()->ID,
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstances),
"user_inst_id" => $this->getCurrentUser()->DatabaseId #,
# "eff_date" => $dt
));
}
}
protected function assignRelationshipInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, InstanceReference|array $targetInstances, ?\DateTime $effectiveDate = null)
{
$dt = $this->normalizeSqlDateTime($effectiveDate, true);
if (is_array($targetInstances))
{
foreach ($targetInstances as $targetInstance)
{
$query = "CALL mocha_assign_relationship(:src_inst_id, :rel_inst_id, :dest_inst_id, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstance),
"user_inst_id" => $this->getCurrentUser()->DatabaseId,
"eff_date" => $dt
));
}
}
else
{
$query = "CALL mocha_assign_relationship(:src_inst_id, :rel_inst_id, :dest_inst_id, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstances),
"user_inst_id" => $this->getCurrentUser()->DatabaseId,
"eff_date" => $dt
));
}
}
public function getInstancesByAttributes($parms)
{
// FIXME: NOT IMPLEMENTED
//usage:
// getInstanceByAttributes (array ( getInstanceByGlobalIdentifier(NAME_ATTRIBUTE) => "zq-developer" ))
$query = "SELECT mocha_instances.* FROM mocha_instances, mocha_attributes WHERE (" . $this->buildTenantIDQuery("mocha_instances.tenant_id") . ") AND mocha_attributes.tenant_id = mocha_instances.tenant_id AND mocha_instances.id = mocha_attributes.src_inst_id";
if (count($parms) > 0)
{
$query .= " AND ";
$i = 0;
$queryParms = array();
foreach ($parms as $key => $value)
{
$query .= "(att_value = :att_value$i AND att_inst_id = mocha_get_instance_by_global_identifier(:att_inst_id$i))";
$queryParms["att_inst_id$i"] = $key;
$queryParms["att_value$i"] = $value;
$i++;
if ($i < count($parms) - 1)
{
$query .= " AND ";
}
}
}
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute($queryParms);
$values = $stmt->fetchAll();
$insts = array();
if (count($values) > 0)
{
foreach ($values as $value)
{
$inst = $this->getInstanceFromDatabase($value);
$insts[] = $inst;
}
}
return $insts;
}
public function getInstanceFromDatabase($value)
{
if ($value["class_id"] === null)
return null;
$retval = new InstanceReference($value["id"], new InstanceKey($value["class_id"], $value["inst_id"]), $value["global_identifier"]);
return $retval;
}
}
?>

View File

@ -0,0 +1,867 @@
<?php
namespace Mocha\Oms;
use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownMethodBindingGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Core\TenantReference;
use Mocha\Oop\MethodImplementation;
use Mocha\Oop\Methods\BuildAttributeMethod;
use Phast\System;
use Phast\UUID;
abstract class Oms
{
public ?array $MethodImplementations;
public function __construct()
{
$this->_tenant = null;
$this->_pclass_cache = null;
$this->MetadataExceptions = array();
$this->MethodImplementations = null;
}
private function registerMethodImplementation(InstanceReference|string|InstanceKey $methodImplementationClass, MethodImplementation $implementation)
{
$methodImplementationClass = $this->normalizeInstanceReference($methodImplementationClass);
$this->MethodImplementations[$methodImplementationClass->GlobalIdentifier->__toString()] = $implementation;
}
private function initializeMethodImplementations()
{
$this->registerMethodImplementation(KnownClassGuids::BuildAttributeMethod, new \Mocha\Oop\MethodImplementations\BuildAttributeMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::ConditionalSelectAttributeMethod, new \Mocha\Oop\MethodImplementations\ConditionalSelectAttributeMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::EvaluateBooleanExpressionMethod, new \Mocha\Oop\MethodImplementations\EvaluateBooleanExpressionMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetAttributeBySystemRoutineMethod, new \Mocha\Oop\MethodImplementations\GetAttributeBySystemRoutineMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetAttributeMethod, new \Mocha\Oop\MethodImplementations\GetAttributeMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetInstanceSetBySystemRoutineMethod, new \Mocha\Oop\MethodImplementations\GetInstanceSetBySystemRoutineMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetInstancesMethod, new \Mocha\Oop\MethodImplementations\GetInstancesMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetReferencedAttributeMethod, new \Mocha\Oop\MethodImplementations\GetReferencedAttributeMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetReferencedInstanceSetMethod, new \Mocha\Oop\MethodImplementations\GetReferencedInstanceSetMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::GetSpecifiedInstancesMethod, new \Mocha\Oop\MethodImplementations\GetSpecifiedInstancesMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::ProcessRelatedUpdatesMethod, new \Mocha\Oop\MethodImplementations\ProcessRelatedUpdatesMethodImplementation());
$this->registerMethodImplementation(KnownClassGuids::SelectFromInstanceSetMethod, new \Mocha\Oop\MethodImplementations\SelectFromInstanceSetMethodImplementation());
}
private function getMethodImplementation(InstanceReference|string|InstanceKey $methodImplementationClass)
{
if ($this->MethodImplementations === null)
{
// initialize method implementations
// we cannot do this in the constructor, since it relies on getInstanceByGlobalIdentifier
// which fails if the current tenant is null, and we need OMS to get the current tenant...
$this->initializeMethodImplementations();
}
$methodImplementationClass = $this->normalizeInstanceReference($methodImplementationClass);
$key = $methodImplementationClass->GlobalIdentifier->__toString();
if (array_key_exists($key, $this->MethodImplementations))
{
return $this->MethodImplementations[$key];
}
return null;
}
/**
* @var array
*/
public $MetadataExceptions;
/**
* Gets ALL instances on this OMS.
*/
public function getInstances() : array
{
return [ ];
}
/**
* Gets the instance with the specified global identifier.
*/
public function getInstanceByGlobalIdentifier(UUID|string $inst) : ?InstanceReference
{
return null;
}
/**
* Indices are 1-based
*/
public function getNthInstanceOf(InstanceReference|string|InstanceKey $sourceInstance, int $index, $defaultValue = null)
{
$insts = $this->getRelatedInstances($sourceInstance, KnownRelationshipGuids::Class__has__Instance);
if (count($insts) > 0)
{
return $insts[$index - 1];
}
return $defaultValue;
}
public function instanceKeysToInstances(array|string|null $instanceKeys)
{
$insts = [ ];
if ($instanceKeys === null)
{
return $insts;
}
if (is_string($instanceKeys))
{
$instanceKeys = explode(",", $instanceKeys);
}
foreach ($instanceKeys as $instanceKey)
{
if (is_string($instanceKey))
{
$instanceKey = InstanceKey::parse($instanceKey);
}
if ($instanceKey !== null)
{
$insts[] = $this->getInstanceByKey($instanceKey);
}
}
return $insts;
}
public function getRelatedInstances(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey|null $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
if ($relationshipInstance === null)
{
//echo ("Relationship Instance is null");
return null;
}
return $this->getRelatedInstancesInternal($sourceInstance, $relationshipInstance, $effectiveDate);
}
protected abstract function getRelatedInstancesInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array;
public function getRelatedInstance(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, \DateTime $effectiveDate = null) : ?InstanceReference
{
$insts = $this->getRelatedInstances($sourceInstance, $relationshipInstance, $effectiveDate);
if ($insts === null)
return null;
if (count($insts) === 0)
return null;
return $insts[0];
}
/**
* Gets the parent class Instance of the specified Instance.
*/
public function getParentClass(InstanceReference $inst) : ?InstanceReference
{
$gid = $inst->GlobalIdentifier->__toString();
$forClass = $this->getRelatedInstance($inst, $this->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Instance__for__Class));
return $forClass;
}
/**
* Gets the instance representing the default tenant.
*/
public function getTenantInstance() : ?InstanceReference
{
return $this->getInstanceByGlobalIdentifier(KnownInstanceGuids::DefaultTenant);
}
/**
* Gets the value of the given attribute on the specified instance.
*/
public function getAttributeValue(InstanceReference|string|InstanceKey|null $sourceInstance, InstanceReference|string|InstanceKey|null $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$attributeInstance = $this->normalizeInstanceReference($attributeInstance);
if ($sourceInstance === null || $attributeInstance === null)
return $defaultValue;
return $this->getAttributeValueInternal($sourceInstance, $attributeInstance, $defaultValue, $effectiveDate);
}
protected abstract function getAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string;
public function setAttributeValue(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$attributeInstance = $this->normalizeInstanceReference($attributeInstance);
$this->setAttributeValueInternal($sourceInstance, $attributeInstance, $value, $effectiveDate);
}
protected abstract function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null);
public function getDefaultTaskUrl(InstanceReference $inst) : ?string
{
$instParent = $this->getParentClass($inst);
if ($instParent === null)
return null;
$instDefaultTask = $this->getRelatedInstance($instParent, KnownRelationshipGuids::Class__has_default__Task);
if ($instDefaultTask != null)
{
// !FIXME: check to see if the task is authorized for the current user
// (e.g. this can be by if `User .has Security Domain` any in `Securable.has Security Domain`)
// e.g. if User has `Administrator` and Task has `Administrator`, return true
if (true) // ($oms->isTaskAuthorizedForUser($instDefaultTask, $oms->getCurrentUser()))
{
return System::ExpandRelativePath("~/d/inst/" . $instParent->InstanceKey . "/" . $inst->InstanceKey . ".htmld");
}
}
return null;
}
private $_instanceTextCache;
public function getInstanceText($inst)
{
if ($inst === null)
return "ERR: inst null";
if ($this->_instanceTextCache === null)
{
$this->_instanceTextCache = array();
}
if (array_key_exists($inst->GlobalIdentifier->__toString(), $this->_instanceTextCache))
{
return $this->_instanceTextCache[$inst->GlobalIdentifier->__toString()];
}
$parentClass = $this->getParentClass($inst);
if ($parentClass === null)
{
$this->MetadataExceptions[] = new OmsMetadataException("Parent class empty", array
(
"For Instance" => $inst
));
return "ERR: no parent class for inst";
}
$instancesLabeledByRAMB = $this->getRelatedInstance($parentClass, KnownRelationshipGuids::Class__instances_labeled_by__Executable_returning_Attribute);
if ($instancesLabeledByRAMB !== null)
{
$context = new OmsContext();
$context->setWorkData($parentClass->GlobalIdentifier->__toString(), $inst);
$textAttr = $this->execute($context, $instancesLabeledByRAMB);
$text = $context->getWorkData($textAttr);
//$this->printWorkData($context->workData);
$this->_instanceTextCache[$inst->GlobalIdentifier->__toString()] = $text;
return $text;
}
else
{
//echo ("no RAMB");
}
return $this->getAttributeValue($inst, $this->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name));
}
public function removeRelationshipInstances(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
$targetInstances = $this->getRelatedInstances($sourceInstance, $relationshipInstance);
$this->removeRelationshipInstance($sourceInstance, $relationshipInstance, $targetInstances);
}
protected abstract function removeRelationshipInstanceInternal(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, InstanceReference|string|InstanceKey|array $targetInstances, ?\DateTime $effectiveDate = null);
public function removeRelationshipInstance(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, InstanceReference|string|InstanceKey|array $targetInstances, ?\DateTime $effectiveDate = null)
{
return $this->removeRelationshipInstanceInternal($sourceInstance, $relationshipInstance, $targetInstances, $effectiveDate);
}
public function assignRelationship(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, InstanceReference|string|InstanceKey|array $targetInstances, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
$targetInstances = $this->normalizeInstanceReference($targetInstances);
return $this->assignRelationshipInternal($sourceInstance, $relationshipInstance, $targetInstances, $effectiveDate);
}
protected abstract function assignRelationshipInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, InstanceReference|array $targetInstances, ?\DateTime $effectiveDate = null);
private $_tenant;
public function getTenant() : ?TenantReference
{
return $this->_tenant;
}
public function setTenant(TenantReference $tenant) : void
{
$oldTenant = $this->_tenant;
$this->_tenant = $tenant;
$this->onTenantChanged($oldTenant, $tenant);
}
public function onTenantChanged(TenantReference $oldTenant, TenantReference $newTenant)
{
}
public function getTenantName() : ?string
{
if ($this->_tenant !== null)
{
return $this->_tenant->Name;
}
return null;
}
/**
* Gets the tenant with the specified name, or NULl if no tenant with the specified name exists on the server.
*
* @param string $tenantName the name of the desired tenant
*
* @return ?TenantReference
*/
public function getTenantByName(string $tenantName) : ?TenantReference
{
return null;
}
public function getInstanceKeysString(array $instanceReferences, string $separator = ":")
{
$val = "";
$ct = count($instanceReferences);
for($i = 0; $i < $ct; $i++)
{
$val .= $instanceReferences[$i]->InstanceKey;
if ($i < $ct - 1)
{
$val .= $separator;
}
}
return $val;
}
public function printInstanceKeys(array $instanceReferences, string $separator = ":")
{
echo ($this->getInstanceKeysString($instanceReferences, $separator));
}
public function instanceSetContains(array /*<InstanceReference>*/ $haystack, InstanceReference $needle)
{
foreach ($haystack as $v)
{
if ($v->DatabaseId == $needle->DatabaseId)
{
return true;
}
}
return false;
}
public function getInstancesOf(InstanceReference|string|InstanceKey|UUID $classInstance) : ?array
{
$classInstance = $this->normalizeInstanceReference($classInstance);
$instances = $this->getRelatedInstances($classInstance, KnownRelationshipGuids::Class__has__Instance);
return $instances;
}
/**
* Given an InstanceReference, GUID (string), or InstanceKey, return the normalized InstanceReference for that representation.
*
* @return InstanceReference|array|null
*/
public function normalizeInstanceReference(InstanceReference|string|InstanceKey|array|null $instanceReferenceOrGuidOrInstanceKey) : InstanceReference|array|null
{
if ($instanceReferenceOrGuidOrInstanceKey === null)
return null;
if (is_array($instanceReferenceOrGuidOrInstanceKey))
{
$arry = array();
foreach ($instanceReferenceOrGuidOrInstanceKey as $instanceRef)
{
$arry[] = $this->normalizeInstanceReference($instanceRef);
}
return $arry;
}
else if (is_string($instanceReferenceOrGuidOrInstanceKey) || $instanceReferenceOrGuidOrInstanceKey instanceof UUID)
{
// assume GUID
return $this->getInstanceByGlobalIdentifier($instanceReferenceOrGuidOrInstanceKey);
}
else if ($instanceReferenceOrGuidOrInstanceKey instanceof InstanceKey)
{
return $this->getInstanceByKey($instanceReferenceOrGuidOrInstanceKey);
}
else if ($instanceReferenceOrGuidOrInstanceKey instanceof InstanceReference)
{
return $instanceReferenceOrGuidOrInstanceKey;
}
echo ("ERR");
return null;
}
public function getTranslationValue($sourceInstance, $relationshipInstance, $defaultValue = null)
{
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
$ctx = new OmsContext();
$m_Translatable__get__Translation_Value_for_Relationship_parm = $this->getInstanceByGlobalIdentifier(KnownMethodGuids::Translatable__get__Translation_Value_for_Relationship_parm);
$ctx->setWorkData(KnownClassGuids::Relationship, $relationshipInstance);
$mb_Translatable__get__Translation_Value_for_Relationship_parm = $this->executeMethodReturningAttribute($m_Translatable__get__Translation_Value_for_Relationship_parm, $ctx);
// Translatable@get Translation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance seTranslation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance settTranslation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance set: Translatable@get Translations for Effective User Language(GRS)*S[rsmb]
// ---- Translatable@get Translations for Language parm(GRS)*S[rsmb]
// ---- Language => User@get Effective Language(SSC)[rsmb]
// ---- ---- if User@get Current Language then User@get Current Language
// ---- ---- if not User@get Current Language then Tenant@get Default Language
// get attribute: Translation@get Value(GA)[ramb]
}
public function getRelatedTasks(InstanceReference $inst)
{
$instParent = $this->getParentClass($inst);
$relatedTasks = [];
$instInstance = $this->getInstanceByGlobalIdentifier(KnownClassGuids::Instance);
$relatedTasks0 = $this->getRelatedInstances($instInstance, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks0 as $task)
{
$relatedTasks[] = $task;
}
$relatedTasks1 = $this->getRelatedInstances($instParent, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks1 as $task)
{
$relatedTasks[] = $task;
}
$superclasses = $this->getRelatedInstances($instParent, KnownRelationshipGuids::Class__has_super__Class);
foreach ($superclasses as $superclass)
{
$relatedTasks2 = $this->getRelatedInstances($superclass, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks2 as $task)
{
$relatedTasks[] = $task;
}
}
return $relatedTasks;
}
public function getNthRelatedInstance(InstanceReference $inst, InstanceReference|string|InstanceKey|array $rel, int $index)
{
$rel = $this->normalizeInstanceReference($rel);
$relInsts = $this->getRelatedInstances($inst, $rel);
return $relInsts[$index];
}
/**
* Checks to ensure the given value is of the appropriate type for the specified work data.
*
* @return bool true if the given value is of the appropriate type; false otherwise.
*/
public function validateWorkDataType(InstanceReference $instWorkData, mixed $value, &$expectedTypeName, &$actualTypeName)
{
$actualTypeName = gettype($value);
if (is_string($value))
{
$expectedTypeName = "Text Attribute";
if ($this->is_a($instWorkData, KnownClassGuids::TextAttribute))
{
return true;
}
}
else if (is_int($value) || is_float($value))
{
$expectedTypeName = "Numeric Attribute";
// int and float should only be assigned to Numeric Attribute
if ($this->is_a($instWorkData, KnownClassGuids::NumericAttribute))
{
return true;
}
}
else if ($value instanceof InstanceReference)
{
// instance references can be assigned to Work Sets and all sorts of other stuff
if ($this->is_a($instWorkData, KnownClassGuids::WorkSet))
{
$expectedTypeName = "Work Set";
// but if our Work Set declares a `Work Set.has valid Class` then we should validate that
$workDataHasValidClasses = $this->getRelatedInstances($instWorkData, KnownRelationshipGuids::Work_Set__has_valid__Class);
if ($workDataHasValidClasses !== null && count($workDataHasValidClasses) > 0)
{
// loop through all valid classes and check them
foreach ($workDataHasValidClasses as $validClass)
{
if ($this->is_a($instWorkData, $validClass))
{
$expectedTypeName = $this->getAttributeValue($validClass, KnownAttributeGuids::Name);
// our work set declares a valid class, and it passes
return true;
}
}
// none of the valid classes pass validation for $instWorkData
$actualTypeName = $this->getAttributeValue($this->getParentClass($instWorkData), KnownAttributeGuids::Name);
$expectedTypeName = $this->getAttributeValue($validClass, KnownAttributeGuids::Name);
return false;
}
// this work set doesn't care whether or not $instWorkData passes validation
return true;
}
// we are not a work set, so we can't validate anything
return true;
}
// none of our validations pass
return false;
}
public function buildAccessKeyForOmsAttachment($fileInstance, $entropy)
{
/*
if (!entropy.ContainsKey(this.GetInstanceKey(inst)))
{
byte[] entropyData = new byte[256];
random.NextBytes(entropyData);
entropy[this.GetInstanceKey(inst)] = entropyData;
}
string entropy_co = Convert.ToBase64String(entropy[this.GetInstanceKey(inst)]);
string guid = inst.GlobalIdentifier.ToString();
long timestamp = DateTime.Now.Ticks;
string originalFileName = this.GetAttributeValue<string>(inst, KnownAttributeGuids.Text.Name);
string ft_co = String.Format("{0}?oms-attachments/{1}?{2}??{3}", entropy_co, guid, timestamp, originalFileName);
string base64 = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(ft_co));
string safeBase64 = MBS.Framework.Conversion.Base64ToUrlSafeBase64(base64);
return safeBase64;
*/
$entropy_co = base64_encode("lalalala");
//$timestamp = (new \DateTime())->
$timestamp = "112340340";
$originalFileName = "lalala.png";
$ft_co = $entropy_co . "?oms-attachments/" . $fileInstance->GlobalIdentifier . "?" . $timestamp . "??" . $originalFileName;
return base64_encode($ft_co);
}
public function getStackTrace(array $arr)
{
$sr = "";
$ct = count($arr);
for ($i = 0; $i < $ct; $i++)
{
if ($arr[$i] !== null)
{
$sr .= $arr[$i]->InstanceKey->__toString();
}
if ($i < $ct - 1)
{
$sr .= ":";
}
}
return $sr;
}
private function createHtmlLinkToInstanceReference($val)
{
return "<a href=\"" . System::ExpandRelativePath("~/d/inst/" . $val->InstanceKey . ".htmld") . "\">" . $val->InstanceKey->__toString() . "</a>";
}
public function getStackTraceWithLinks(array $arr)
{
$sr = "";
$ct = count($arr);
for ($i = 0; $i < $ct; $i++)
{
if ($arr[$i] !== null)
{
$sr .= $this->createHtmlLinkToInstanceReference($arr[$i]);
}
if ($i < $ct - 1)
{
$sr .= ":";
}
}
return $sr;
}
public function getAttachmentUrl(InstanceReference $fileInstance)
{
$entropy = null;
$accessKey = $this->buildAccessKeyForOmsAttachment($fileInstance, $entropy);
return "/" . $this->getTenantName() . "/attachment/" . $fileInstance->InstanceKey . "/" . $accessKey;
}
public function executeReturningAttribute(OmsContext $context, InstanceReference $inst)
{
$value = $this->execute($context, $inst);
if ($value !== null)
{
return $context->getWorkData($value);
}
return null;
}
public function executeAndEvaluateWorkData(OmsContext $context, InstanceReference $inst)
{
$result = $this->execute($context, $inst);
if ($this->is_a($result, KnownClassGuids::WorkSet))
{
return $context->getWorkData($result);
}
return $result;
}
public function execute(OmsContext $context, InstanceReference $inst, $classesLookupWorkData = true, ?array $parms = null)
{
$instParent = $this->getParentClass($inst);
$methodImplementation = $this->getMethodImplementation($instParent);
if ($methodImplementation !== null)
{
$retval = $methodImplementation->execute($this, $context, $inst, $parms); // $this->executeMethod($context, $inst, $parms);
}
else if ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnAttributeMethodBinding))
|| ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnInstanceSetMethodBinding))))
{
$methodBindingExecutesMethod = $this->getRelatedInstance($inst, KnownRelationshipGuids::Method_Binding__executes__Method);
if ($methodBindingExecutesMethod === null)
{
echo ("Method Binding.executes Method[" . KnownRelationshipGuids::Method_Binding__executes__Method . "] not found for " . $inst->InstanceKey);die();
}
$parameterAssignments = $this->getRelatedInstances($inst, KnownRelationshipGuids::Method_Binding__has__Parameter_Assignment);
foreach ($parameterAssignments as $parameterAssignment)
{
$this->applyParameterAssignment($context, $parameterAssignment);
}
if (is_array(value: $parms))
{
foreach ($parms as $gid => $value)
{
$context->setWorkData($gid, $value);
}
}
// echo ("MB stack: " . $methodInstance->InstanceKey . ":" . $methodBindingExecutesMethod->InstanceKey);
$retval = $this->execute($context, $methodBindingExecutesMethod, $parms);
}
else if (
// $this->is_a($inst, UUID::parse(KnownClassGuids::TextAttribute))
//|| $this->is_a($inst, UUID::parse(KnownClassGuids::NumericAttribute))
//|| $this->is_a($inst, UUID::parse(KnownClassGuids::DateAttribute))
// || $this->is_a($inst, UUID::parse(KnownClassGuids::BooleanAttribute))
$this->is_a($inst, UUID::parse(KnownClassGuids::WorkSet))
|| ($this->is_a($inst, UUID::parse(KnownClassGuids::Clasz)) && $classesLookupWorkData)
)
{
//return $context->getWorkData($inst);
$retval = $context->getWorkData($inst);
}
else
{
trigger_error("execute: unsupported class '" . $instParent->GlobalIdentifier . "' [" . $instParent->InstanceKey . "]");
$retval = $inst;
}
return $retval;
}
public function applyParameterAssignment(OmsContext $context, InstanceReference $parameterAssignment)
{
$assignsFromWorkData = $this->getRelatedInstance($parameterAssignment, KnownRelationshipGuids::Parameter_Assignment__assigns_from__Executable_returning_Work_Data);
$assignsToParm = $this->getRelatedInstance($parameterAssignment, KnownRelationshipGuids::Parameter_Assignment__assigns_to__Work_Data);
if ($assignsFromWorkData !== null && $assignsToParm !== null)
{
$workData = $this->execute($context, $assignsFromWorkData);
if ($workData !== null)
{
$workDataValue = $context->getWorkData($workData);
// $context->getWorkData($assignsFromWorkData); //
if (
is_string($workDataValue) ||
$this->is_a($workData, KnownClassGuids::WorkSet)
)
{
// !! HACK !!
$workData = $workDataValue;
}
//echo ("update with " . $assignsToParm->InstanceKey . " = " . $workDataValue);
$context->setWorkData($assignsToParm, $workData);
}
else
{
//echo ("setting null on " . $assignsToParm->InstanceKey);
}
}
}
public function evaluateConditions(OmsContext $context, ?array $trueConditions, ?array $falseConditions)
{
if ($trueConditions !== null)
{
foreach ($trueConditions as $condition)
{
$val = $this->executeReturningAttribute($context, $condition);
if (!$val)
{
return false;
}
}
}
if ($falseConditions !== null)
{
foreach ($falseConditions as $condition)
{
$val = $this->executeReturningAttribute($context, $condition);
if ($val)
{
return false;
}
}
}
return true;
}
public function printWorkData(array $workData)
{
foreach ($workData as $key => $value)
{
echo ($key . " == ");
if ($value instanceof InstanceReference)
{
echo ("[" . $this->createHtmlLinkToInstanceReference($value) . "]");
}
else
{
echo ("'" . $value . "'");
}
echo (" ; ");
}
}
public function CompareInstanceSets_ExactMatch(InstanceReference|array|null $left, InstanceReference|array|null $right)
{
//echo ("CIS: " . $left->InstanceKey . " ?? " . $right->InstanceKey);
if ($left === null && $right === null)
return true;
if ($left === null || $right === null)
return false;
if (is_array($left) && is_array($right))
{
// Both are Instance Sets, so we can make some optimizations
if (count($left) !== count($right))
return false;
$is = array_intersect($left, $right);
return count($is) === count($left);
}
else
{
// Instance Set and Instance cannot be compared, for now
if (is_array($left) || is_array($right))
{
return false;
}
}
// If we get here, $left and $right should both be single instances
if ($left->GlobalIdentifier->__is_equal($right->GlobalIdentifier))
{
return true;
}
return false;
}
private function __is_a_impl(InstanceReference $inst, InstanceReference|string|InstanceKey $what, int $reentrant_counter)
{
$what = $this->normalizeInstanceReference($what);
if ($reentrant_counter > 10)
{
if ($reentrant_counter == 11)
{
echo("recursion detected!\n");
}
echo("__is_a_impl!(" . $inst->InstanceKey . ", " . $what->InstanceKey . ")\n");
if ($reentrant_counter > 30)
{
die();
}
}
$pclass = $this->getParentClass($inst);
if ($pclass === null)
return false;
if ($pclass->__is_equal($what))
{
return true;
}
if (!($pclass->InstanceKey->ClassIndex == 1 && $pclass->InstanceKey->InstanceIndex == 1))
{
$pclassSuperclasses = $this->getRelatedInstances($pclass, KnownRelationshipGuids::Class__has_super__Class);
foreach ($pclassSuperclasses as $pclassSuperclass)
{
if ($what->GlobalIdentifier->__is_equal($pclassSuperclass->GlobalIdentifier))
{
return true;
}
}
}
return false;
}
public function is_a(InstanceReference $inst, InstanceReference|string|InstanceKey $what)
{
return $this->__is_a_impl($inst, $what, 0);
}
public function setSessionAttributeValue(OmsContext $context, InstanceReference $instance, mixed $value)
{
$context->setTemporaryVariable($instance, $value);
}
public function getSessionAttributeValue(OmsContext $context, InstanceReference $instance, mixed $defaultValue = null)
{
return $context->getTemporaryVariable($instance, $defaultValue);
}
}
?>

View File

@ -0,0 +1,183 @@
<?php
namespace Mocha\Oms;
use Mocha\Core\InstanceReference;
use Mocha\Core\TenantReference;
class OmsAttributeValue
{
public ?\DateTime $EffectiveDate;
public mixed $Value;
public function __construct(?\DateTime $effectiveDate, mixed $value)
{
$this->EffectiveDate = $effectiveDate;
$this->Value = $value;
}
}
class OmsRelationshipValue
{
public ?\DateTime $EffectiveDate;
public array $TargetInstances;
public function __construct(?\DateTime $effectiveDate, array $targetInstances)
{
$this->EffectiveDate = $effectiveDate;
$this->TargetInstances = $targetInstances;
}
}
class OmsInstanceReferenceCache
{
private InstanceReference $instanceReference;
private array $attributes;
private array $relationships;
public function __construct(InstanceReference $instanceReference)
{
$this->instanceReference = $instanceReference;
$this->attributes = array();
$this->relationships = array();
}
public function hasAttribute(InstanceReference $attributeInstance)
{
return array_key_exists($attributeInstance->GlobalIdentifier->__toStringFormat(false, "", ""), $this->attributes);
}
public function hasRelationship(InstanceReference $relationshipInstance)
{
return array_key_exists($relationshipInstance->GlobalIdentifier->__toStringFormat(false, "", ""), $this->relationships);
}
public function getRelatedInstances(InstanceReference $relationshipInstance, ?\DateTime $effectiveDate = null)
{
if (!$this->hasRelationship($relationshipInstance))
{
$this->relationships[$relationshipInstance->GlobalIdentifier->__toStringFormat(false, "", "")] = array();
}
$ary = $this->relationships[$relationshipInstance->GlobalIdentifier->__toStringFormat(false, "", "")];
$retval = array();
foreach ($ary as $val)
{
// if less than or eqal to eff date
foreach ($val->TargetInstances as $inst)
{
$retval[] = $inst;
}
}
return $retval;
}
public function assignRelationship(InstanceReference $relationshipInstance, array $targetInstances, ?\DateTime $effectiveDate = null)
{
$key = $relationshipInstance->GlobalIdentifier->__toStringFormat(false, "", "");
if (!$this->hasRelationship($relationshipInstance))
{
$this->relationships[$key] = array();
}
$this->relationships[$key][] = new OmsRelationshipValue($effectiveDate, $targetInstances);
}
public function getAttributeValue(InstanceReference $attributeInstance, ?\DateTime $effectiveDate = null) : mixed
{
if (!$this->hasAttribute($attributeInstance))
{
$this->attributes[$attributeInstance->GlobalIdentifier->__toStringFormat(false, "", "")] = array();
}
$ary = $this->attributes[$attributeInstance->GlobalIdentifier->__toStringFormat(false, "", "")];
$retval = array();
foreach ($ary as $val)
{
// if less than or eqal to eff date
return $val->Value;
}
return null;
}
public function setAttributeValue(InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$key = $attributeInstance->GlobalIdentifier->__toStringFormat(false, "", "");
if (!$this->hasAttribute($attributeInstance))
{
$this->attributes[$key] = array();
}
$this->attributes[$key][] = new OmsAttributeValue($effectiveDate, $value);
}
}
class OmsInstanceCache
{
private array $array;
public function __construct()
{
$this->array = array();
}
public function has(InstanceReference $instance)
{
return array_key_exists($instance->GlobalIdentifier->__toStringFormat(false, "", ""), $this->array);
}
public function get(InstanceReference $instance) : OmsInstanceReferenceCache
{
if (!$this->has($instance))
{
$this->array[$instance->GlobalIdentifier->__toStringFormat(false, "", "")] = new OmsInstanceReferenceCache($instance);
}
return $this->array[$instance->GlobalIdentifier->__toStringFormat(false, "", "")];
}
}
class OmsCache
{
private array $array;
public function __construct()
{
$this->array = array();
}
public function has(TenantReference $tenant) : bool
{
return array_key_exists($tenant->ID, $this->array);
}
public function get(TenantReference $tenant) : OmsInstanceCache
{
if (!$this->has($tenant))
{
$this->array[$tenant->ID] = new OmsInstanceCache();
}
return $this->array[$tenant->ID];
}
public function hasRelationship(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $relationshipInstance)
{
return $this->get($tenant)->get($sourceInstance)->hasRelationship($relationshipInstance);
}
public function getRelatedInstances(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $relationshipInstance, ?\DateTime $effectiveDate = null)
{
return $this->get($tenant)->get($sourceInstance)->getRelatedInstances($relationshipInstance, $effectiveDate);
}
public function assignRelationship(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $relationshipInstance, array $targetInstances)
{
$cache = $this->get($tenant)->get($sourceInstance);
$cache->assignRelationship($relationshipInstance, $targetInstances);
}
public function hasAttributeValue(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $attributeInstance)
{
return $this->get($tenant)->get($sourceInstance)->hasAttribute($attributeInstance);
}
public function getAttributeValue(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $attributeInstance, ?\DateTime $effectiveDate = null)
{
return $this->get($tenant)->get($sourceInstance)->getAttributeValue($attributeInstance, $effectiveDate);
}
public function setAttributeValue(TenantReference $tenant, InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$cache = $this->get($tenant)->get($sourceInstance);
$cache->setAttributeValue($attributeInstance, $value, $effectiveDate);
}
}
?>

View File

@ -0,0 +1,31 @@
<?php
namespace Mocha\Oms;
use Phast\Enumeration;
class OmsMetadataExceptionSeverity extends Enumeration
{
const None = 0;
const Information = 1;
const Warning = 2;
const Error = 3;
}
class OmsMetadataException
{
public $Message;
public $Parameters;
public $CallStack;
public $Severity;
public function __construct(string $message, array $parameters = null, array $callStack = null, $severity = OmsMetadataExceptionSeverity::Error)
{
$this->Message = $message;
$this->Parameters = $parameters;
$this->CallStack = $callStack;
$this->Severity = $severity;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
namespace Mocha\Oop;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Core\InstanceReference;
class MethodBinding
{
public InstanceReference $MethodBindingInstance;
public function __construct($oms, InstanceReference $methodBindingInst)
{
$this->OMS = $oms;
$this->MethodBindingInstance = $methodBindingInst;
}
public function executeReturningInstanceSet(?array $parms = null) : null|array|InstanceReference
{
$context = new OmsContext();
$method = $this->OMS->getRelatedInstance($this->MethodBindingInstance, $this->MethodBindingInstance->OMS->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Method_Binding__executes__Method))->asMethod();
if (is_array(value: $parms))
{
foreach ($parms as $gid => $value)
{
$context->setWorkData($gid, $value);
}
}
$val = $method->execute($parms);
return $val;
}
}
?>

View File

@ -0,0 +1,21 @@
<?php
namespace Mocha\Oop;
use Mocha\Core\InstanceReference;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
abstract class MethodImplementation
{
public InstanceReference $MethodInstance;
protected abstract function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms);
public function execute(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms) : mixed
{
array_push($context->CallStack, $method);
$retval = $this->executeInternal($oms, $context, $method, $parms);
array_pop($context->CallStack);
return $retval;
}
}
?>

View File

@ -0,0 +1,69 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\QuickSort;
class BuildAttributeMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Build_Attribute_Method__returns__Attribute);
$initialValue = $oms->getAttributeValue($method, KnownAttributeGuids::Value);
$buildsWithAttributes = $oms->getRelatedInstances($method, KnownRelationshipGuids::Build_Attribute_Method__builds_with__Build_Attribute_Method_Component);
$value = $initialValue;
$qs = new QuickSort();
$sortedAttributes = $qs->Sort_By($buildsWithAttributes, function($item)
{
$oms = mocha_get_oms();
$order = $oms->getAttributeValue($item, KnownAttributeGuids::Order);
return $order;
});
foreach ($sortedAttributes as $buildsWithAttribute)
{
$baExecutesMethod = $oms->getRelatedInstance($buildsWithAttribute, KnownRelationshipGuids::Build_Attribute_Method_Component__uses__Executable_returning_Attribute);
$attr = null;
if ($baExecutesMethod !== null)
{
$attr = $oms->execute($context, $baExecutesMethod);
}
else
{
$attr = $oms->execute($context, $buildsWithAttribute);
}
// echo ("value of `" . $attr->InstanceKey . "` is '" . $context->getWorkData($attr) . "'");
if ($attr !== null)
{
$val = $context->getWorkData($attr);
if (is_string($val))
{
$value .= $val;
}
else
{
if ($val !== null)
{
$value .= "E!". $val->InstanceKey;
}
}
}
else
{
echo ("ERR[" . $buildsWithAttribute->InstanceKey . "]");
trigger_error("executeMethod did not return properly - called method: " . $buildsWithAttribute->GlobalIdentifier . " [" . $buildsWithAttribute->InstanceKey . "]");
}
}
$context->setWorkData($returnsAttribute, $value);
// echo ("value of MethodType is '" . $context->getWorkData(KnownAttributeGuids::MethodType) . "'");
return $returnsAttribute;
}
}
?>

View File

@ -0,0 +1,50 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
class ConditionalSelectAttributeMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$retval = null;
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Conditional_Select_Attribute_Method__returns__Attribute);
$cases = $oms->getRelatedInstances($method, KnownRelationshipGuids::Conditional_Select_Attribute_Method__has__Conditional_Select_Attribute_Case);
foreach ($cases as $case)
{
$trueConditions = $oms->getRelatedInstances($case, KnownRelationshipGuids::Condition_Group__has_true_condition__Executable_returning_Attribute);
$falseConditions = $oms->getRelatedInstances($case, KnownRelationshipGuids::Condition_Group__has_false_condition__Executable_returning_Attribute);
if (!$oms->evaluateConditions($context, $trueConditions, $falseConditions))
{
continue;
}
$invokesExecutableReturningAttribute = $oms->getRelatedInstance($case, KnownRelationshipGuids::Conditional_Select_Attribute_Case__invokes__Executable_returning_Attribute);
if ($invokesExecutableReturningAttribute !== null)
{
$att = $oms->execute($context, $invokesExecutableReturningAttribute);
return $att;
}
else
{
$pp = $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value);
$context->setWorkData($pp, "SAC case with NULL attribute");
$retval = $pp;
}
}
if ($retval === null)
{
$pp = $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value);
$context->setWorkData($pp, "SAC returned no case");
$retval = $pp;
}
return $retval;
}
}
?>

View File

@ -0,0 +1,99 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class EvaluateBooleanExpressionMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$value = false;
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute);
$sourceInstanceRef = $oms->getRelatedInstance($method, KnownRelationshipGuids::Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data);
$booleanOperator = $oms->getRelatedInstance($method, KnownRelationshipGuids::IDR_Evaluate_Boolean_Expression_Method__uses__Boolean_Operator);
$targetInstanceRef = $oms->getRelatedInstance($method, KnownRelationshipGuids::Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data);
$sourceInstanceWD = $oms->execute($context, $sourceInstanceRef);
$sourceInstance = $sourceInstanceWD;
if ($oms->is_a($sourceInstanceWD, KnownClassGuids::WorkSet))
{
$sourceInstance = $context->getWorkData($sourceInstanceWD);
}
if ($sourceInstanceWD === null)
{
$oms->MetadataExceptions[] = new OmsMetadataException("Evaluate Boolean Expression `source instance` is null", array
(
"Source Instance Method Binding" => $sourceInstanceRef
));
// echo ("ERR: `source inst` [ from " . $sourceInstanceRef->InstanceKey . " ] null");
return false;
}
if ($targetInstanceRef !== null)
{
$targetInstanceWD = $oms->execute($context, $targetInstanceRef, false);
$targetInstance = $targetInstanceWD;
if ($targetInstanceWD !== null && $oms->is_a($targetInstanceWD, KnownClassGuids::WorkSet))
{
$targetInstance = $context->getWorkData($targetInstanceWD);
}
$mx = array
(
"Method Instance" => $method,
"Source Instance Ref" => $sourceInstanceRef,
"Source Instance WD" => $sourceInstanceWD,
"Source Instance" => $sourceInstance,
"Target Instance Ref" => $targetInstanceRef,
"Target Instance WD" => $targetInstanceWD,
"Target Instance" => $targetInstance,
"Boolean Operator" => $booleanOperator
);
// $oms->MetadataExceptions[] = new OmsMetadataException("EBE called", );
//$this->printWorkData($context->workData);
//echo (" @@@@ ");
//echo ("source " . $sourceInstanceRef->InstanceKey . "(" . $sourceInstance->InstanceKey . ") ... operator " . $booleanOperator->InstanceKey . " ... target " . $targetInstanceRef->InstanceKey . "(" . $targetInstance->InstanceKey . ")");
if ($booleanOperator->GlobalIdentifier == UUID::parse(KnownInstanceGuids::RelationalOperator__ExactMatch))
{
$value = $oms->CompareInstanceSets_ExactMatch($sourceInstance, $targetInstance);
}
else if ($booleanOperator->GlobalIdentifier == UUID::parse(KnownInstanceGuids::LogicalOperator__EqualTo))
{
$source = $context->getWorkData($sourceInstance);
$target = $context->getWorkData($targetInstance);
// echo ("EBE check: " . $source->Instance . " ?? " . $target);
$value = $source === $target;
}
}
else
{
echo ("source " . $sourceInstanceRef->InstanceKey . "(" . $sourceInstance->InstanceKey . ") ... operator " . $booleanOperator->InstanceKey . " ... target NULL!");
}
if ($returnsAttribute !== null)
{
$context->setWorkData($returnsAttribute, $value);
}
else
{
$oms->MetadataExceptions[] = new OmsMetadataException("EBE : returned null attribute", array
(
"Method Instance" => $method
));
}
return $returnsAttribute;
}
}
?>

View File

@ -0,0 +1,48 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetAttributeBySystemRoutineMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$instSystemRoutine = $oms->getRelatedInstance($method, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine));
$returnsWorkData = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Attribute_by_System_Routine_Method__returns__Attribute);
$singular = false; // $oms->getAttributeValue($instSystemRoutine, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Singular));
if ($instSystemRoutine === null)
{
$oms->MetadataExceptions[] = new OmsMetadataException("system routine unspecified for GAS", array
(
"Method" => $method
));
return null;
}
if ($instSystemRoutine->GlobalIdentifier->__is_equal(UUID::parse(KnownInstanceGuids::SystemAttributeRoutine_GetGlobalIdentifier)))
{
// get instance text
$context->setWorkData($returnsWorkData, $context->getWorkData(KnownClassGuids::Instance)->GlobalIdentifier->__toString());
}
else if ($instSystemRoutine->GlobalIdentifier->__is_equal(UUID::parse(KnownInstanceGuids::SystemAttributeRoutine_GetInstanceText)))
{
// get instance text
$instTarget = $context->getWorkData($oms->normalizeInstanceReference(KnownClassGuids::Instance));
$context->setWorkData($returnsWorkData, $oms->getInstanceText($instTarget));
}
return $returnsWorkData;
}
}
?>

View File

@ -0,0 +1,30 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetAttributeMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Attribute_Method__has__Attribute);
$forClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Method__for__Class);
$targetInstance = $context->getWorkData($forClass);
$value = $oms->getAttributeValue($targetInstance, $returnsAttribute);
$context->workData[$returnsAttribute->GlobalIdentifier->__toString()] = $value;
// echo ("[GA @" . $forClass->InstanceKey . ": inst (" . $targetInstance->InstanceKey . ") ; att " . $returnsAttribute->InstanceKey . " : " . $value . "]");
return $returnsAttribute;
}
}
?>

View File

@ -0,0 +1,44 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetInstanceSetBySystemRoutineMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$instSystemRoutine = $oms->getRelatedInstance($method, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine));
$returnsWorkData = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Instance_Set_by_System_Routine_Method__returns__Instance_Set);
$singular = false; $oms->getAttributeValue($instSystemRoutine, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Singular));
if ($instSystemRoutine->GlobalIdentifier->__is_equal(UUID::parse("430f572dd1164b0497b265a9e9230ce5")))
{
// get User for User Name parm
// this System Attribute Routine has a required parm: `User Name [TX]` [4$11]
$userName = $context->getWorkData(KnownAttributeGuids::UserName); // $parms[KnownAttributeGuids::UserName];
$singular = true;
if ($singular)
{
$value = $oms->getUserByUserName($userName);
}
else
{
$value = [ $oms->getUserByUserName($userName) ];
}
$context->setWorkData($returnsWorkData, $value);
}
return $returnsWorkData;
}
}
?>

View File

@ -0,0 +1,27 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetInstancesMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$returnsWorkSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Instances_Method__returns__Work_Set);
$usesInstancesOfClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Instances_Method__selects_instances_of__Class);
$usesInstances = $oms->getInstancesOf($usesInstancesOfClass);
$context->setWorkData($returnsWorkSet, $usesInstances);
return $returnsWorkSet;
}
}
?>

View File

@ -0,0 +1,91 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oms\OmsMetadataExceptionSeverity;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetReferencedAttributeMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$returnsAttribute = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Attribute_Method__returns__Attribute);
$forClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Method__for__Class);
$loopOnInstanceSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Attribute_Method__uses_reference__Executable_returning_Instance_Set);
$answer = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Attribute_Method__uses_answer__Executable_returning_Attribute);
$targetInstance = $context->getWorkData($forClass);
if ($oms->is_a($loopOnInstanceSet, KnownClassGuids::MethodBinding))
{
$loopOnInstanceSetTarget = $oms->execute($context, $loopOnInstanceSet);
if ($loopOnInstanceSetTarget === null)
{
}
$targetInstance = $context->getWorkData($loopOnInstanceSetTarget);
}
$refISRel = $oms->execute($context, $loopOnInstanceSet);
$mx = array
(
"Method Instance" => $method,
"Returns Attribute" => $returnsAttribute,
"Loop on Instance Set" => $loopOnInstanceSet,
"Get Attribute" => $answer,
"For Class" => $forClass,
"Target Instance" => $targetInstance,
"Referenced Instance Relationship" => $refISRel,
);
if ($refISRel !== null)
{
$refIS = $context->getWorkData($refISRel);
if ($refIS !== null)
{
$pc = $oms->getParentClass($refIS);
if ($pc !== null)
{
$context->setWorkData($pc, $refIS);
}
else
{
$oms->MetadataExceptions[] = new OmsMetadataException("missing parent class for instance", array
(
"Instance" => $refIS
));
}
$answerVal = $oms->execute($context, $answer);
$mx["Answer Work Data"] = $answerVal;
$value = $context->getWorkData($answerVal); // $this->getAttributeValue($refIS, $answer);
$mx["Answer Value"] = $value;
$context->setWorkData($returnsAttribute, $value);
//$oms->MetadataExceptions[] = new OmsMetadataException("GRA call", $mx, $context->CallStack, OmsMetadataExceptionSeverity::Information);
}
else
{
$oms->MetadataExceptions[] = new OmsMetadataException("GRA : Loop on Instance Set returned a value, but that value returned null", $mx);
}
}
else
{
$oms->MetadataExceptions[] = new OmsMetadataException("Loop on Instance Set returned null for `Get Referenced Attribute Method.uses reference Executable returning Attribute`", array
(
"Method Instance" => $method,
"Loop on Instance Set" => $loopOnInstanceSet
), $context->CallStack);
}
return $returnsAttribute;
}
}
?>

View File

@ -0,0 +1,104 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oms\OmsMetadataExceptionSeverity;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetReferencedInstanceSetMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$forClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Method__for__Class);
$returnsWorkSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Instance_Set_Method__returns__Work_Set);
$loopOnInstanceSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Instance_Set_Method__uses_reference__Executable_returning_Instance_Set);
$targetInstance = null;
if ($oms->is_a($loopOnInstanceSet, KnownClassGuids::MethodBinding))
{
$loopOnInstanceSetTarget = $oms->execute($context, $loopOnInstanceSet);
if ($loopOnInstanceSetTarget === null)
{
$mx = array
(
"Method Instance" => $method,
"Returns Work Set" => $returnsWorkSet,
"Loop on Instance Set" => $loopOnInstanceSet,
"For Class" => $forClass
);
$oms->MetadataExceptions[] = new OmsMetadataException("loop on instance set was an MB, but returned null", $mx, null, OmsMetadataExceptionSeverity::Information);
}
$targetInstance = $context->getWorkData($loopOnInstanceSetTarget);
}
else
{
$targetInstance = $context->getWorkData($loopOnInstanceSet);
}
$relationship = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Referenced_Instance_Set_Method__uses_answer__Executable_returning_Instance_Set);
$relhack = false;
if (!$oms->is_a($relationship, KnownClassGuids::Relationship))
{
$relationship = $context->getWorkData($relationship);
$relhack = true;
}
$mx = array
(
"Method Instance" => $method,
"Returns Work Set" => $returnsWorkSet,
"Loop on Instance Set" => $loopOnInstanceSet,
"Get Relationship" => $relationship,
"For Class" => $forClass,
"Target Instance" => $targetInstance
);
if ($targetInstance === null)
{
$targetInstance = $loopOnInstanceSet;
}
if ($targetInstance !== null)
{
$singular = $oms->getAttributeValue($returnsWorkSet, KnownAttributeGuids::Singular);
if ($singular != 1)
{
$singular = $oms->getAttributeValue($method, KnownAttributeGuids::Singular);
}
if ($singular == 1)
{
$value = $oms->getRelatedInstance($targetInstance, $relationship);
}
else
{
//$oms->MetadataExceptions[] = new OmsMetadataException("GRS: returning nonsingular work set", $mx, $context->CallStack, OmsMetadataExceptionSeverity::Information);
$value = $oms->getRelatedInstances($targetInstance, $relationship);
}
$mx["Got Value"] = $value;
$context->setWorkData($returnsWorkSet, $value);
if ($relhack)
{
//$oms->MetadataExceptions[] = new OmsMetadataException("GRS with relhack failed", $mx, null, OmsMetadataExceptionSeverity::Information);
}
// $oms->MetadataExceptions[] = new OmsMetadataException("GRS call", $mx, null, OmsMetadataExceptionSeverity::Information);
}
else
{
//echo ("exec GRS for class : " . $forClass->InstanceKey);
$oms->MetadataExceptions[] = new OmsMetadataException("GRS: target instance unspecified", $mx, $context->CallStack);
}
// $oms->MetadataExceptions[] = new OmsMetadataException("GRS", $mx, null, OmsMetadataExceptionSeverity::Information);
return $returnsWorkSet;
}
}
?>

View File

@ -0,0 +1,25 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class GetSpecifiedInstancesMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$returnsWorkSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Specified_Instances_Method__returns__Work_Set);
$usesInstances = $oms->getRelatedInstances($method, KnownRelationshipGuids::Get_Specified_Instances_Method__uses__Instance);
$context->setWorkData($returnsWorkSet, $usesInstances);
return $returnsWorkSet;
}
}
?>

View File

@ -0,0 +1,66 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oop\MethodImplementation;
class ProcessRelatedUpdatesMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$classForPRU = $oms->getRelatedInstance($method, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class);
if ($classForPRU === null)
{
$oms->MetadataExceptions[] = new OmsMetadataException("Class for PRU is empty", [
"Process Related Updates Method" => $method
]);
return;
}
if ($classForPRU !== null)
{
}
//!HACK!
$instForPRU = $oms->getNthInstanceOf($classForPRU, 1);
if ($instForPRU !== null)
{
//echo("current work data for '" . $instForPRU->GlobalIdentifier . "' = '" . $context->getWorkData($instForPRU->GlobalIdentifier->__toString()) . "'");
}
$instExecutablesForPUMB = $oms->getRelatedInstances($method, KnownRelationshipGuids::Process_Related_Updates_Method__uses__Executable_for_PUMB);
foreach ($instExecutablesForPUMB as $instExecutableForPUMB)
{
if ($instExecutableForPUMB !== null)
{
$assignsAttribute = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__assigns__Attribute);
$usesExecutableReturningAttribute = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__uses__Executable_returning_Attribute);
//$context->setWorkData($assignsAttribute->GlobalIdentifier->__toString(), $usesExecutableReturningAttribute);
//echo ("assigning attribute '" . $assignsAttribute->GlobalIdentifier . "' the value from executable '" . $usesExecutableReturningAttribute->GlobalIdentifier . "'");
$value = $context->getWorkData($usesExecutableReturningAttribute->GlobalIdentifier->__toString());
if ($value instanceof InstanceReference)
{
//echo ("the value from work data is ##IS#'" . $value->GlobalIdentifier . "'##");
}
else
{
$oms->setAttributeValue($instForPRU, $assignsAttribute, $value);
}
}
else
{
echo ("executable for PUMB is null");
}
}
}
}
?>

View File

@ -0,0 +1,98 @@
<?php
namespace Mocha\Oop\MethodImplementations;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
use Mocha\Oms\OmsMetadataException;
use Mocha\Oms\OmsMetadataExceptionSeverity;
use Mocha\Oop\MethodImplementation;
use Phast\UUID;
class SelectFromInstanceSetMethodImplementation extends MethodImplementation
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
$forClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Method__for__Class);
$returnsWorkSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__returns__Work_Set);
$loopOnInstanceSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses__Executable_returning_Instance_Set);
$selectionFunction = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses__Selection_Function);
$setFunction = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses__Set_Function);
$functionRAMB = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses_function__Executable_returning_Attribute);
$comparatorWorkData = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses_comparator__Executable_returning_Work_Data);
$orderRAMB = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses_order__Executable_returning_Attribute);
$subsetIndexRAMB = $oms->getRelatedInstance($method, KnownRelationshipGuids::Select_from_Instance_Set_Method__uses_subset_index__Executable_returning_Attribute);
// $targetInstance = $context->getWorkData($forClass);
$mx = array
(
"Method Instance" => $method,
"Returns Work Set" => $returnsWorkSet,
"Loop on Instance Set" => $loopOnInstanceSet,
"Selection Function" => $selectionFunction,
"Set Function" => $setFunction,
"Function RAMB" => $functionRAMB,
"Comparator Work Data" => $comparatorWorkData,
"Order RAMB" => $orderRAMB,
"Subset Index RAMB" => $subsetIndexRAMB,
"For Class" => $forClass
);
$singular = $oms->getAttributeValue($returnsWorkSet, KnownAttributeGuids::Singular);
if ($singular != 1)
{
$singular = $oms->getAttributeValue($method, KnownAttributeGuids::Singular);
}
$valuesWD = $oms->execute($context, $loopOnInstanceSet);
$values = $context->getWorkData($valuesWD);
$retval = array();
foreach ($values as $value)
{
if ($functionRAMB !== null)
{
// execute function to determine if we keep it in the set
// return true if it should be kept, false if it should be discarded
$valuePC = $oms->getParentClass($value);
$context->setWorkData($valuePC, $value);
$ramb = $oms->execute($context, $functionRAMB);
$val = $context->getWorkData($ramb);
if ($val)
{
$retval[] = $value;
}
}
}
if ($singular == 1)
{
if (count($retval) > 0)
{
$value = $retval[0];
}
else
{
$value = null;
}
}
else
{
//$oms->MetadataExceptions[] = new OmsMetadataException("GRS: returning nonsingular work set", $mx, $context->CallStack, OmsMetadataExceptionSeverity::Information);
$value = $retval;
}
$mx["Got Value"] = $oms->getInstanceKeysString($value);
$context->setWorkData($returnsWorkSet, $value);
// $oms->MetadataExceptions[] = new OmsMetadataException("SS called", $mx, $context->CallStack);
//$this->MetadataExceptions[] = new OmsMetadataException("GRS", $mx, null, OmsMetadataExceptionSeverity::Information);
return $returnsWorkSet;
}
}
?>

View File

@ -0,0 +1,139 @@
<?php
namespace Mocha\Search;
use Mocha\Core\KnownClassGuids;
class SearchHelper
{
/**
* @var \Mocha\Oms\MySQLDatabaseOms
*/
private $_OMS;
public function __construct($oms)
{
$this->_OMS = $oms;
$this->ValidClasses = [ ];
$this->LastQuery = "";
}
public $ValidClasses;
public $LastQuery;
public function search(string $q)
{
if ($q == "")
return $this->searchSlow($q);
return $this->searchIndexed($q);
}
public function searchIndexed(string $q)
{
$oms = $this->_OMS;
// $query = "SELECT DISTINCT src_inst_id FROM mocha_attributes WHERE att_value LIKE :att_value AND att_effective_date <= NOW() ORDER BY att_effective_date LIMIT 10";
$query = <<<EOF
SELECT DISTINCT mocha_instances.id, mocha_instances.class_id, mocha_instances.inst_id
FROM mocha_instances, mocha_attributes
WHERE mocha_instances.id = mocha_attributes.src_inst_id
AND mocha_attributes.att_value LIKE :att_value
EOF;
$count = count($this->ValidClasses);
if ($count > 0)
{
$query .= " AND (";
for ($i = 0; $i < $count; $i++)
{
if ($this->ValidClasses[$i]->InstanceKey->InstanceIndex == 17)
{
$query .= " 1=1 ";
continue;
}
$query .= "mocha_instances.class_id = " . $this->ValidClasses[$i]->InstanceKey->InstanceIndex;
if ($i < $count - 1)
{
$query .= " OR ";
}
}
$query .= ")";
}
$this->LastQuery = $query;
$values = $oms->query($query, array
(
"att_value" => "%" . $q . "%"
));
$results = array();
foreach ($values as $value)
{
$inst = $oms->getInstanceByDBID($value["id"]);
/*
foreach ($this->ValidClasses as $pclass)
{
if (!$oms->is_a($inst, $pclass))
continue;
}
*/
$title = $oms->getInstanceText($inst);
$searchResult = new SearchResult($inst, $title);
$results[] = $searchResult;
}
return $results;
}
public function flattenValidClasses(array $validClasses)
{
$oms = $this->_OMS;
$flattened = [ ];
return $flattened;
}
public function searchSlow(string $query)
{
$oms = $this->_OMS;
$insts = [];
$validClasses = $this->ValidClasses;
if (count($validClasses) === 0)
{
$validClasses = array
(
$oms->getInstanceByGlobalIdentifier(KnownClassGuids::Clasz),
$oms->getInstanceByGlobalIdentifier(KnownClassGuids::Task)
);
}
foreach ($validClasses as $validClass)
{
$insts2 = $oms->getInstancesOf($validClass);
foreach ($insts2 as $inst2)
{
$insts[] = $inst2;
}
}
$insts = array_unique($insts, SORT_REGULAR);
$count = count($insts);
$results = array();
foreach ($insts as $inst)
{
$title = $oms->getInstanceText($inst);
if (!str_contains(strtolower($title), strtolower($query)))
{
continue;
}
$searchResult = new SearchResult($inst, $title);
$results[] = $searchResult;
}
return $results;
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
namespace Mocha\Search;
class SearchResult
{
public $Title;
public $Instance;
public function __construct($instance, $title)
{
$this->Instance = $instance;
$this->Title = $title;
}
}
?>

View File

@ -0,0 +1,44 @@
<?php
require("core/InstanceKey.inc.php");
require("core/InstanceReference.inc.php");
require("core/InstanceSet.inc.php");
require("core/TenantReference.inc.php");
require("core/KnownClassGuids.inc.php");
require("core/KnownInstanceGuids.inc.php");
require("core/KnownAttributeGuids.inc.php");
require("core/KnownRelationshipGuids.inc.php");
require("core/KnownMethodBindingGuids.inc.php");
require("core/OmsContext.inc.php");
require("oms/OmsMetadataException.inc.php");
require("oms/Oms.inc.php");
require("oms/DatabaseOms.inc.php");
require("oms/MySQLDatabaseOms.inc.php");
require("oop/MethodImplementation.inc.php");
require("oop/MethodBinding.inc.php");
$filenames = glob(DIRNAME(__FILE__) . "/oop/methodImplementations/*.inc.php");
foreach ($filenames as $filename)
{
require ($filename);
}
require("search/SearchHelper.inc.php");
require("search/SearchResult.inc.php");
require("ui/DisplayOption.inc.php");
require("ui/ElementContent.inc.php");
require("ui/ValidationResult.inc.php");
require("ui/controls/InstanceBrowser.inc.php");
require("ui/renderers/html/Editor.inc.php");
require("ui/renderers/html/HTMLRenderer.inc.php");
require("ui/tasks/Task.inc.php");
require("ui/tasks/HardcodedTask.inc.php");
?>

View File

@ -0,0 +1,8 @@
<?php
namespace Mocha\UI;
class DisplayOption
{
}
?>

View File

@ -0,0 +1,32 @@
<?php
namespace Mocha\UI;
use Mocha\Core\InstanceSet;
class ElementContent
{
private $_Text;
private $_DisplayOptions;
public function __construct($text, $displayOptions)
{
$this->_Text = $text;
$this->_DisplayOptions = new InstanceSet();
for ($i = 0; $i < count($displayOptions); $i++)
{
$this->_DisplayOptions->add($displayOptions[$i]);
}
}
public function getText()
{
return $this->_Text;
}
public function getDisplayOptions()
{
return $this->_DisplayOptions;
}
}
?>

View File

@ -0,0 +1,20 @@
<?php
namespace Mocha\UI;
use Mocha\Core\InstanceReference;
class ValidationResult
{
public $ValidationInstance;
public $Title;
public $Message;
public function __construct(?InstanceReference $validationInstance, ?string $title, ?string $message)
{
$this->ValidationInstance = $validationInstance;
$this->Title = $title;
$this->Message = $message;
}
}
?>

View File

@ -0,0 +1,321 @@
<?php
namespace Mocha\UI\Controls;
use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Oms\MySQLDatabaseOms;
use Phast\HTMLControl;
use Phast\HTMLControls\Input;
use Phast\HTMLControls\InputType;
use Phast\System;
use Phast\WebControl;
use Phast\WebControlAttribute;
use Phast\WebControls\AdditionalDetailWidget;
use Phast\WebControls\HiddenField;
use Phast\WebControls\Menu;
use Phast\WebControls\MenuItemCommand;
use Phast\WebControls\TextBox;
use Phast\WebControls\WebActionListCommand;
class InstanceBrowser extends WebControl
{
public $Name;
public $Text;
public ?string $AutoCompleteUrl;
public bool $DisplayInline;
public bool $Editable;
public bool $MultiSelect;
public bool $DisplayAsCount;
public bool $DisableLink;
public array $SelectedInstances;
public array $ValidClasses;
public string $Title;
public $TargetUrl;
public function __construct(array $instanceReferences = null)
{
parent::__construct();
$this->AutoCompleteUrl = null;
$this->Name = null;
$this->Text = null;
$this->TagName = "div";
$this->ClassList[] = "mcx-instancebrowser";
$this->DisplayInline = false;
$this->Editable = false;
$this->MultiSelect = false;
$this->DisplayAsCount = false;
$this->DisableLink = false;
$this->ValidClasses = array();
$this->Title = "";
if ($instanceReferences === null)
{
$instanceReferences = array();
}
$this->SelectedInstances = $instanceReferences;
}
protected function OnInitialize()
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if ($this->Editable)
{
$this->ClassList[] = "mcx-editable";
}
if ($this->MultiSelect) $this->ClassList[] = "mcx-multiselect";
if (count($this->SelectedInstances) == 0)
{
$this->ClassList[] = "mcx-empty";
}
if ($this->DisplayAsCount)
{
$this->ClassList[] = "mcx-display-as-count";
}
if ($this->DisplayInline)
{
$this->ClassList[] = "mcx-inline";
}
$selectedInstanceIds = implode(",", InstanceReference::toInstanceKeys($this->SelectedInstances));
$this->Attributes[] = new WebControlAttribute("data-instance-ids", $selectedInstanceIds);
$this->Attributes[] = new WebControlAttribute("data-valid-class-ids", implode(",", InstanceReference::toInstanceKeys($this->ValidClasses)));
if ($this->AutoCompleteUrl !== null)
{
$this->Attributes[] = new WebControlAttribute("data-autocomplete-url", $this->AutoCompleteUrl);
}
/*
System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox();
txt.AutoCompleteType = System.Web.UI.WebControls.AutoCompleteType.Disabled;
txt.ID = String.Format("{0}_TextBox", this.ID);
if (Text != null)
txt.Text = Text;
this.Controls.Add(txt);
*/
$mobileExpansionTitleLabel = new WebControl();
$mobileExpansionTitleLabel->TagName = "div";
$mobileExpansionTitleLabel->ClassList[] = "uwt-title";
if ($this->Title !== null)
{
$mobileExpansionTitleLabel->Content = $this->Title;
}
$this->Controls[] = $mobileExpansionTitleLabel;
$hidden = new HiddenField();
if ($this->Name !== null)
{
$hidden->Name = $this->Name;
}
$hidden->Value = $selectedInstanceIds;
$this->Controls[] = $hidden;
/*
Oms oms = Page.GetOMS();
System.Web.UI.HtmlControls.HtmlGenericControl ul = new System.Web.UI.HtmlControls.HtmlGenericControl("ul");
if (DisplayAsCount)
{
System.Web.UI.HtmlControls.HtmlGenericControl li = new System.Web.UI.HtmlControls.HtmlGenericControl("li");
System.Web.UI.HtmlControls.HtmlAnchor a = new System.Web.UI.HtmlControls.HtmlAnchor();
a.AddCssClass("mcx-count-link");
a.InnerText = InstanceReferences.Count.ToString();
li.Controls.Add(a);
ul.Controls.Add(li);
}
else
{
for (int i = 0; i < InstanceReferences.Count; i++)
{
Instance inst = oms.GetInstance(InstanceReferences[i]);
System.Web.UI.HtmlControls.HtmlGenericControl li = new System.Web.UI.HtmlControls.HtmlGenericControl("li");
MBS.Web.Controls.ActionPreviewButton apb = new MBS.Web.Controls.ActionPreviewButton();
apb.PreviewContent.Controls.Add(new System.Web.UI.HtmlControls.HtmlGenericControl("h1") { InnerHtml = oms.GetInstanceText(inst) });
apb.Attributes["data-preview-url"] = String.Format("~/api/preview/{0}", InstanceReferences[i]);
apb.Attributes["data-instance-id"] = InstanceReferences[i].ToString();
string tenantName = Page.GetCurrentTenantName();
apb.TargetUrl = String.Format("~/{0}/d/inst/{1}.htmld", tenantName, InstanceReferences[i]);
if (Text != null)
{
apb.Text = Text;
}
else if (oms != null)
{
if (inst != null)
{
apb.Text = oms.GetInstanceText(inst);
if (String.IsNullOrEmpty(apb.Text))
{
apb.Text = oms.GetTTC(inst);
}
}
else
{
apb.Text = String.Format("(NULL INSTANCE: {0})", InstanceReferences[i]);
}
}
else
{
apb.Text = InstanceReferences[i].ToString();
}
li.Controls.Add(apb);
ul.Controls.Add(li);
}
}
*/
$txt = new Input();
$txt->Type = InputType::Text;
$this->Controls[] = $txt;
$ul = new WebControl();
$ul->TagName = "ul";
$ul->ClassList[] = "mcx-selected-items";
foreach ($this->SelectedInstances as $inst)
{
$li = new WebControl();
$li->TagName = "li";
$instParent = $oms->getParentClass($inst);
$parentClassName = $oms->getInstanceText($instParent);
$adw = new AdditionalDetailWidget("");
$adw->RelatedActionButtonUrl = "~/d/inst/" . $inst->InstanceKey . "/rel-tasks.htmld";
if (mocha_asset_exists("uic-assets", "1.1.5", "zq/icons/1$" . $inst->InstanceKey->ClassIndex . ".png")
|| mocha_asset_exists("uic-assets", "1.1.5", "zq/icons/1$" . $inst->InstanceKey->ClassIndex . ".svg"))
{
$adw->ImageUrl = "~~/madi/asset/uic-assets/1.1.5/zq/icons/1$" . $inst->InstanceKey->ClassIndex;
}
$adw->Attributes[] = new WebControlAttribute("data-instance-id", $inst->InstanceKey);
$adw->ClassList[] = "mcx-moniker";
$adw->ClassTitle = $parentClassName;
$defaultTaskUrl = $oms->getDefaultTaskUrl($inst);
if ($defaultTaskUrl !== null)
{
$adw->TargetURL = $defaultTaskUrl;
$adw->ShowURL = true;
}
else
{
$adw->ShowURL = false;
}
if ($this->Text !== null)
{
$adw->Text = $this->Text;
}
else
{
$adw->Text = $oms->getInstanceText($inst);
}
/*
$this->MenuItems = array(
new MenuItemCommand("Element Tests Testing Class 1", null, null, null, array(
new MenuItemCommand("Delete")
)),
new MenuItemCommand("Debugging", null, null, null, array(
new MenuItemCommand("Show in Code Editor")
)),
new MenuItemCommand("Favorite", null, null, null, array(
new MenuItemCommand("Add to Favorites"),
new MenuItemCommand("Manage Favorites")
)),
new MenuItemCommand("Integration IDs", null, null, null, array(
new MenuItemCommand("View IDs"),
new MenuItemCommand("Edit External IDs"),
new MenuItemCommand("Edit Reference ID"),
new MenuItemCommand("Maintain Reference IDs")
)),
new MenuItemCommand("Method Binding", null, null, null, array(
new MenuItemCommand("View"),
new MenuItemCommand("Edit")
))
);
*/
$li->Controls[] = $adw;
$aClose = new WebControl();
$aClose->TagName = "a";
$aClose->ClassList[] = "uwt-delete-button";
$li->Controls[] = $aClose;
$ul->Controls[] = $li;
}
$this->Controls[] = $ul;
$div = new WebControl();
$div->TagName = "div";
$div->ClassList[] = "uwt-popup";
$div->ClassList[] = "mcx-search-results";
$ul = new Menu();
$ul->MultiSelect = true;
$li = new MenuItemCommand();
$li->Title = "Test 1";
$adw = new AdditionalDetailWidget("");
$adw->ShowText = false;
$li->Controls[] = $adw;
$li->Selected = true;
$ul->Items[] = $li;
$li = new MenuItemCommand();
$li->Title = "Test 2";
$ul->Items[] = $li;
$li = new MenuItemCommand();
$li->Title = "Test 3";
$ul->Items[] = $li;
$div->Controls[] = $ul;
$spinner = new WebControl();
$spinner->TagName = "div";
$spinner->ClassList[] = "uwt-spinner";
$div->Controls[] = $spinner;
$placeholder = new WebControl();
$placeholder->TagName = "div";
$placeholder->ClassList[] = "uwt-placeholder";
$placeholder->Content = "type to search the list"; // Too many results. Please type to search.
$div->Controls[] = $placeholder;
$this->Controls[] = $div;
/*
$span = new WebControl();
$span->TagName = "span";
$span->ClassList[] = "mcx-empty-text";
$span->Content = "(empty)";
$this->Controls[] = $span;
*/
parent::OnInitialize();
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Mocha\UI\Renderers\HTML;
use Mocha\Core\InstanceReference;
class Editor
{
public InstanceReference $ForClass;
public $ViewFunction;
public $EditFunction;
public function __construct(InstanceReference $forClass, callable $viewFunction, callable $editFunction)
{
$this->ForClass = $forClass;
$this->ViewFunction = $viewFunction;
$this->EditFunction = $editFunction;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
<?php
$oms = mocha_get_oms();
$tenantName = $oms->getTenantName();
$cdn_url = "static.alcehosting.net";
$tenant_environment_text = "Implementation - " . $tenantName;
function expandUrl($path = "")
{
$ret = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"];
if ($path != "")
{
$ret .= "/" . $path;;
}
return $ret;
}
?>
// Add properties to mocha
window.mocha = window.mocha || {};
mocha.tenant = '<?php echo($tenantName); ?>';
mocha.clientOrigin = '<?php echo(expandUrl()); ?>';
mocha.language = 'en_US';
mocha.clientVersion = '0';
mocha.systemConfidenceLevel = 'PROD';
mocha.oauthAuthorizationPending = false;
mocha.proxyLoginEnabled = false;
mocha.maintenancePageUrl = '<?php echo(expandUrl()); ?>/madi/drs/outage?t=<?php echo($tenantName); ?>';
mocha.deviceTrustDetailsUrl = '';
mocha.pendingAuthDetailsUrl = '';
mocha.webAuthnDetailsUrl = '';
mocha.enableBluePrimaryButtons = 'false';
// Construct init params for GWT app
mocha.initParams = {
authGatewayPath: '/madi/authgwy',
baseDir: '/madi/asset/ui-html/',
systemConfidenceLevel: 'PROD',
cdn: {
endpoint: '<?php echo($cdn_url); ?>',
enabled: true,
allowed: true
},
proxyEnabled: false,
currentVersion: '20.0.04.045',
serviceType: 'authgwy',
loginAuthURL: '/<?php echo($tenantName); ?>/login-auth.xml',
environment: '<?php echo($tenant_environment_text); ?>',
environmentType: 'IMPL'
};

View File

@ -0,0 +1,38 @@
<?php
namespace Mocha\UI\Tasks;
use Mocha\Core\InstanceReference;
class HardcodedTask extends Task
{
public InstanceReference $TaskInstance;
public InstanceReference $RelatedInstance;
public function __construct(InstanceReference $instTask, InstanceReference $instRelatedInstance)
{
$this->TaskInstance = $instTask;
$this->RelatedInstance = $instRelatedInstance;
}
protected function OnProcessUpdates()
{
}
protected function OnRender()
{
}
public function Render()
{
return $this->OnRender();
}
public function ProcessUpdates()
{
$this->OnProcessUpdates();
}
}
?>

View File

@ -0,0 +1,9 @@
<?php
namespace Mocha\UI\Tasks;
abstract class Task
{
}
?>

View File

@ -0,0 +1 @@
/home/beckermj/Documents/Projects/phast/app/lib/phast

View File

@ -0,0 +1,5 @@
function KnownInstanceKeys()
{
}
KnownInstanceKeys.DisplayOption__NotEnterable = "924$2";

View File

@ -0,0 +1,116 @@
function McxElementListView(parentElement)
{
this.ParentElement = parentElement;
this.CaptionElement = this.ParentElement.children[0];
this.HeaderElement = this.ParentElement.children[1];
this.HeaderRowElement = this.HeaderElement.children[0];
this.HeaderAddRowButton = this.HeaderRowElement.children[0].children[0];
this.HeaderAddRowButton.NativeObject = this;
this.HeaderAddRowButton.addEventListener("click", function(e)
{
var lv = this.NativeObject;
lv.addRowBefore(0);
e.preventDefault();
e.stopPropagation();
return false;
});
this.BodyElement = this.ParentElement.children[2];
this.buildRow = function()
{
var lvInstId = this.ParentElement.getAttribute("data-ecid");
var tr = document.createElement("tr");
tr.appendChild(this.createAddRemoveColumn());
var xhr = new XMLHttpRequest();
var url = System.ExpandRelativePath("~/" + System.TenantName + "/flowController.htmld");
xhr.open("POST", url);
var h = {
"_flowExecutionKey": "e0s1",
"ecid": lvInstId,
"sessionSecureToken": "7733ad40-edf6-4dc9-aa90-85bcf93cc8f0",
"clientRequestID" : "9af7ce5bc51348a6981539a98b267072"
};
xhr.send(JSON.stringify(h));
for (var i = 1; i < this.HeaderRowElement.children.length; i++)
{
var colInstId = this.HeaderRowElement.children[i].getAttribute("data-ecid");
var fqecid = lvInstId + ":*:" + colInstId;
var td = document.createElement("td");
var input = document.createElement("input");
input.id = "ec_" + fqecid;
input.name = "ec_" + fqecid;
input.setAttribute("data-ecid", "ec_" + fqecid);
input.type = "text";
td.appendChild(input);
tr.appendChild(td);
}
return tr;
};
this.addRowBefore = function(beforeIndex)
{
var tr = this.buildRow();
this.BodyElement.insertBefore(tr, this.BodyElement.children[beforeIndex]);
};
this.addRowAfter = function(afterElement)
{
var tr = this.buildRow();
this.BodyElement.insertAfter(tr, afterElement);
};
this.removeRow = function(row)
{
row.remove();
};
this.removeRowAt = function(index)
{
this.BodyElement.children[index].remove();
};
this.createAddRemoveColumn = function()
{
var td = document.createElement("td");
td.className = "uwt-listview-row-buttons";
var aAdd = document.createElement("a");
aAdd.className = "uwt-listview-row-add";
aAdd.href = "#";
aAdd.NativeObject = this;
aAdd.addEventListener("click", function()
{
this.NativeObject.addRowAfter(this.parentElement);
});
td.appendChild(aAdd);
var aRemove = document.createElement("a");
aRemove.className = "uwt-listview-row-remove";
aRemove.href = "#";
aRemove.NativeObject = this;
aRemove.addEventListener("click", function()
{
this.NativeObject.removeRow(this.parentElement.parentElement);
});
td.appendChild(aRemove);
return td;
};
}
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-element");
for (var i = 0; i < items.length; i++)
{
if (items[i].tagName === "TABLE" && System.ClassList.Contains(items[i], "uwt-listview"))
{
items[i].McxElementListView = new McxElementListView(items[i]);
}
}
});

View File

@ -0,0 +1,223 @@
function McxElementContent(parentElement)
{
this.ParentElement = parentElement;
this.LabelTd = this.ParentElement.children[0];
if (this.LabelTd)
{
if (this.LabelTd.tagName === "td")
{
this.LabelElement = this.LabelTd.children[0];
}
else
{
this.LabelElement = this.LabelTd;
}
}
this.updateElementContentsWithFlowController = function(value, changes)
{
for (var i = 0; i < changes.length; i++)
{
var ecid = changes[i].ecid;
var ec = document.getElementById("ec_" + ecid);
if (ec)
{
if (changes[i].addsDisplayOptions)
{
for (var j = 0; j < changes[i].addsDisplayOptions.length; j++)
{
if (changes[i].addsDisplayOptions[j].iid == "924$2")
{
if (value)
{
ec.setAttribute("disabled", "disabled");
}
else
{
ec.removeAttribute("disabled");
}
}
}
}
if (changes[i].removesDisplayOptions)
{
for (var j = 0; j < changes[i].removesDisplayOptions.length; j++)
{
if (changes[i].removesDisplayOptions[j].iid == KnownInstanceKeys.DisplayOption__NotEnterable)
{
if (value)
{
ec.removeAttribute("disabled");
}
else
{
ec.setAttribute("disabled", "disabled");
}
}
}
}
}
}
};
this.ValueContainer = this.ParentElement.children[1];
if (this.ValueContainer.children.length > 0)
{
if (this.ValueContainer.children[0].tagName === "INPUT")
{
this.ValueContainer.children[0].addEventListener("blur", function()
{
console.log(" DO validation Here!");
});
}
else if (this.ValueContainer.children[0].tagName === "DIV" && System.ClassList.Contains(this.ValueContainer.children[0], "mcx-instancebrowser"))
{
this.ValueContainer.children[0].children[2].addEventListener("blur", function(e)
{
var ib = this.parentElement.NativeObject;
console.log("IB selected items: " + ib.getSelectedItems().length);
});
}
else if (this.ValueContainer.children[0].tagName === "DIV" && System.ClassList.Contains(this.ValueContainer.children[0], "uwt-checkbox"))
{
var inputElement = this.ValueContainer.children[1];
inputElement.McxNativeObject = this;
inputElement.addEventListener("change", function()
{
var value = this.NativeObject.GetChecked();
var ecid = this.McxNativeObject.ParentElement.getAttribute("data-fqecid");
var xhr = new XMLHttpRequest();
var url = System.ExpandRelativePath("~/" + System.TenantName + "/flowController.htmld");
xhr.NativeObject = this.McxNativeObject;
xhr.NativeObject.ValueElement = this.NativeObject.ParentElement;
xhr.inputElement = this;
xhr.onreadystatechange = function()
{
if (this.readyState === 4)
{
console.log(xhr);
if (this.status === 200)
{
json = JSON.parse(xhr.responseText);
this.NativeObject.updateElementContentsWithFlowController(json.value, json.changes);
}
else
{
this.NativeObject.ValueElement.NativeObject.__inhibit_update = true;
this.NativeObject.ValueElement.NativeObject.ToggleChecked();
this.NativeObject.ValueElement.NativeObject.__inhibit_update = false;
if (this.status === 403 || this.status === 401)
{
Alert.show("Please log in to continue", "Not Logged In", "uwt-color-danger", 5000, "NotLoggedIn");
}
}
}
};
xhr.open("POST", url);
var h = {
"_flowExecutionKey": "e0s1",
"ecid": ecid,
"sessionSecureToken": "7733ad40-edf6-4dc9-aa90-85bcf93cc8f0",
"clientRequestID" : "9af7ce5bc51348a6981539a98b267072",
"value": value
};
xhr.send(JSON.stringify(h));
return true;
});
}
}
this.InstanceID = this.ParentElement.getAttribute("data-instance-id");
this.ECID = this.ParentElement.getAttribute("data-ecid");
if (this.LabelElement)
{
this.LabelElement.NativeObject = this;
this.LabelElement.addEventListener("contextmenu", function(e)
{
var cm = new ContextMenu();
var ecid = this.NativeObject.ECID;
var iid = this.NativeObject.InstanceID;
cm.Items = [
{
"JJJJ": this.NativeObject,
"ClassName": "MenuItemCommand",
"Title": "Show Field Properties",
"Visible": true,
"Execute": function()
{
var popup = Popup.create(this.JJJJ.LabelTd);
var listview = ListView.create(popup.ParentElement, {
"columns": [
{
"id": "ecid",
"title": "ECID"
},
{
"id": "iid",
"title": "Instance ID"
}
],
"items": [
{
"columns": [
{
"id": "ecid",
"value": ecid
},
{
"id": "iid",
"value": iid
}
]
}
]
});
popup.ParentElement.appendChild(listview.ParentElement);
popup.Show();
}
},
{
"ClassName": "MenuItemCommand",
"Title": "Show Field EC",
"Visible": true,
"Execute": function()
{
window.open(System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/1$56/" + ecid + ".htmld"));
}
}
];
cm.Show(e.clientX, e.clientY, this);
e.preventDefault();
e.stopPropagation();
return false;
});
}
}
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-elementcontent");
for (var i = 0; i < items.length; i++)
{
// console.log("found mcx-elementcontent");
// console.log(items[i]);
items[i].McxNativeObject = new McxElementContent(items[i]);
}
/*
var items = document.getElementsByClassName("mcx-element");
for (var i = 0; i < items.length; i++)
{
items[i].McxNativeObject = new McxElementContent(items[i]);
}
*/
});

View File

@ -0,0 +1,419 @@
function McxInstanceBrowser(parentElement)
{
this.ParentElement = parentElement;
this.HiddenElement = this.ParentElement.children[1];
this.TextBoxElement = this.ParentElement.children[2];
this.ListElement = this.ParentElement.children[3];
this.SearchResultsElement = this.ParentElement.children[4];
this.SearchResultsMenuElement = this.SearchResultsElement.children[0];
this.SearchResultsSpinnerElement = this.SearchResultsElement.children[1];
this.SearchResultsPlaceholderElement = this.SearchResultsElement.children[2];
this.__timeout = null;
this.TextBoxElement.NativeObject = this;
this.TextBoxElement.addEventListener("focus", function(e)
{
this.NativeObject.search(this.NativeObject.TextBoxElement.value);
this.NativeObject.setEditing(true);
});
this.ParentElement.addEventListener("blur", function(e)
{
console.log(e.relatedTarget);
this.NativeObject.setEditing(false);
});
this.setEditing = function(value)
{
if (value)
{
System.ClassList.Add(this.ParentElement, "mcx-editing");
}
else
{
System.ClassList.Remove(this.ParentElement, "mcx-editing");
}
};
this.SearchResultsElement.NativeObject = this;
this.SearchResultsElement.addEventListener("mousemove", function(e)
{
var searchResultsElements = this.NativeObject.SearchResultsMenuElement.children;
for (var i = 0; i < searchResultsElements.length; i++)
{
System.ClassList.Remove(searchResultsElements[i], "uwt-highlight");
}
System.ClassList.Add(e.target, "uwt-highlight");
});
this.SearchResultsElement.addEventListener("keydown", function(e)
{
if (e.keyCode == KeyboardKeys.Tab)
{
// we are tabbing out of the search results, forward
this.NativeObject.setEditing(false);
}
});
this.buildSearchResult = function(searchResult)
{
var li = document.createElement("li");
/*
var a = document.createElement("a");
a.href = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + searchResult.iid + ".htmld");
a.setAttribute("data-instance-id", searchResult.iid);
a.innerText = searchResult.title;
li.appendChild(a);
*/
var a = McxMoniker.create(searchResult.instanceId, searchResult.text, searchResult.viewTask);
li.appendChild(a);
a = document.createElement("a");
a.className = "uwt-delete-button";
a.NativeObject = this;
a.Index = this.ListElement.children.length;
a.addEventListener("click", function()
{
this.NativeObject.removeAt(this.Index);
});
li.appendChild(a);
return li;
};
this.getSelectedInstanceKeysString = function()
{
var str = "";
for (var i = 0; i < this.ListElement.children.length; i++)
{
var iid = this.ListElement.children[i].children[0].getAttribute("data-instance-id");
str += iid;
if (i < this.ListElement.children.length - 1)
{
str += ",";
}
}
return str;
};
this.setPlaceholderText = function(value)
{
this.SearchResultsPlaceholderElement.innerText = value;
};
this.clearSearchResults = function()
{
while(this.SearchResultsMenuElement.children.length > 0)
{
this.SearchResultsMenuElement.children[0].remove();
}
};
this.clearSelectedItems = function()
{
while (this.ListElement.children.length > 0)
{
this.ListElement.children[0].remove();
}
};
this.getSelectedItems = function()
{
var items = [];
var strbps = this.HiddenElement.value;
if (strbps === "")
return items;
var strbpa = strbps.split(",");
for (var i = 0; i < strbpa.length; i++)
{
items.push(InstanceKey.parse(strbpa[i]));
}
return items;
};
this.activateSearchResult = function(searchResult)
{
// `this` refers to the McxInstanceBrowser
if (!System.ClassList.Contains(this.ParentElement, "mcx-multiselect"))
{
this.clearSelectedItems();
}
this.ListElement.appendChild(this.buildSearchResult(searchResult));
this.TextBoxElement.value = "";
this.HiddenElement.value = this.getSelectedInstanceKeysString();
this.ParentElement.setAttribute("data-instance-ids", this.getSelectedInstanceKeysString());
return true;
};
this.search = function(query)
{
if (typeof(query) === 'undefined')
{
query = this.TextBoxElement.value;
}
System.ClassList.Add(this.SearchResultsElement, "uwt-loading");
this.clearSearchResults();
this.setPlaceholderText("type to search the list");
if (query === "")
{
System.ClassList.Add(this.SearchResultsElement, "mcx-placeholder-visible");
}
else
{
System.ClassList.Remove(this.SearchResultsElement, "mcx-placeholder-visible");
}
var xhr = new XMLHttpRequest();
xhr.NativeObject = this;
var url = System.ExpandRelativePath("~/" + System.TenantName + "/prompt/c0/" + this.ParentElement.getAttribute("data-ecid") + ".htmld");
xhr.open("POST", url);
var h = {
"_flowExecutionKey": "e0s1",
"_eventId_prompt": this.ParentElement.getAttribute("data-ecid"),
"sessionSecureToken": "7733ad40-edf6-4dc9-aa90-85bcf93cc8f0",
"clientRequestID" : "9af7ce5bc51348a6981539a98b267072",
"q" : query
};
xhr.onreadystatechange = function()
{
if (this.readyState === 4)
{
if (this.status == 200)
{
var json = JSON.parse(this.responseText);
this.NativeObject.clearSearchResults();
System.ClassList.Remove(this.NativeObject.SearchResultsElement, "mcx-placeholder-visible");
for (var i = 0; i < json.items.length; i++)
{
var li = document.createElement("li");
li.className = "uwt-menu-item uwt-menu-item-command uwt-visible";
li.searchResult = json.items[i];
li.NativeObject = this.NativeObject;
li.addEventListener("click", function()
{
if (this.NativeObject.activateSearchResult(this.searchResult))
{
this.NativeObject.setEditing(false);
}
});
var moniker = McxMoniker.create(json.items[i].instanceId, json.items[i].text);
/*
var span = document.createElement("span");
span.className = "uwt-title uwt-description-empty";
span.innerText = json.items[i].title;
li.appendChild(span);
*/
li.appendChild(moniker);
this.NativeObject.SearchResultsMenuElement.appendChild(li);
}
System.ClassList.Remove(this.NativeObject.SearchResultsElement, "uwt-loading");
}
else
{
if (json.responseCode === 403)
{
Alert.show("Please log in to continue", "Not Authorized", "uwt-color-danger");
}
else
{
System.ClassList.Add(this.NativeObject.SearchResultsElement, "mcx-placeholder-visible");
this.NativeObject.setPlaceholderText("Too many results. Please refine your search.");
}
System.ClassList.Remove(this.NativeObject.SearchResultsElement, "uwt-loading");
}
}
};
xhr.send(JSON.stringify(h));
};
this.TextBoxElement.addEventListener("keydown", function(e)
{
if (e.keyCode == 13)
{
if (this.NativeObject.SearchResultsMenuElement.children.length === 1)
{
if (this.NativeObject.activateSearchResult(this.NativeObject.SearchResultsMenuElement.children[0].searchResult))
{
this.NativeObject.setEditing(false);
}
}
else
{
if (this.NativeObject.__timeout !== null)
{
window.clearTimeout(this.NativeObject.__timeout);
}
this.NativeObject.search();
window.setTimeout(function(thiss)
{
if (thiss.NativeObject.SearchResultsMenuElement.children.length === 1)
{
if (thiss.NativeObject.activateSearchResult(thiss.NativeObject.SearchResultsMenuElement.children[0].searchResult))
{
thiss.NativeObject.setEditing(false);
}
}
}, 100, this);
}
e.preventDefault();
e.stopPropagation();
return false;
}
if (e.keyCode == 37)
{
return;
}
else if (e.keyCode == 38)
{
return;
}
else if (e.keyCode == 39)
{
return;
}
else if (e.keyCode == 40)
{
return;
}
else if (e.keyCode == 16 || e.keyCode == 17 || e.keyCode == 18)
{
return;
}
console.log(e.keyCode);
System.ClassList.Add(this.NativeObject.SearchResultsElement, "uwt-loading");
if (this.NativeObject.__timeout !== null)
{
window.clearTimeout(this.NativeObject.__timeout);
}
this.NativeObject.__timeout = window.setTimeout(function(thiss)
{
thiss.search(thiss.TextBoxElement.value);
}, 1000, this.NativeObject);
if (e.keyCode == KeyboardKeys.Tab && e.shiftKey)
{
// we are tabbing out of the input element, backward
this.NativeObject.setEditing(false);
return true;
}
if (e.keyCode == KeyboardKeys.Enter)
{
e.preventDefault();
e.stopPropagation();
return false;
}
else if (e.keyCode == KeyboardKeys.Escape)
{
System.ClassList.Remove(this.NativeObject.ParentElement, "mcx-editing");
}
else if (e.keyCode == KeyboardKeys.ArrowUp)
{
var searchResultsElements = this.NativeObject.SearchResultsMenuElement.children;
if (searchResultsElements.length > 0)
{
var i = searchResultsElements.length - 1;
var currentIndex = -1;
while (i >= 0)
{
if (System.ClassList.Contains(searchResultsElements[i], "uwt-highlight"))
{
currentIndex = i;
}
System.ClassList.Remove(searchResultsElements[i], "uwt-highlight");
i--;
}
if (currentIndex > 0)
{
System.ClassList.Add(searchResultsElements[currentIndex - 1], "uwt-highlight");
}
else
{
System.ClassList.Add(searchResultsElements[searchResultsElements.length - 1], "uwt-highlight");
}
}
}
else if (e.keyCode == KeyboardKeys.ArrowDown)
{
var searchResultsElements = this.NativeObject.SearchResultsMenuElement.children;
if (searchResultsElements.length > 0)
{
var i = 0;
var currentIndex = -1;
while (i < searchResultsElements.length)
{
if (System.ClassList.Contains(searchResultsElements[i], "uwt-highlight"))
{
currentIndex = i;
}
System.ClassList.Remove(searchResultsElements[i], "uwt-highlight");
i++;
}
if (currentIndex < searchResultsElements.length - 1)
{
System.ClassList.Add(searchResultsElements[currentIndex + 1], "uwt-highlight");
}
else
{
System.ClassList.Add(searchResultsElements[0], "uwt-highlight");
}
}
}
});
this.removeAt = function(index)
{
console.log(this.HiddenElement);
var strbps = this.HiddenElement.value;
var strbpa = strbps.split(",");
var strbpn = [ ];
for (var i = 0; i < strbpa.length; i++)
{
if (i !== index)
{
strbpn.push(strbpa[i]);
}
}
this.ListElement.children[index].remove();
this.HiddenElement.value = strbpn.join(",");
};
for (var i = 0; i < this.ListElement.children.length; i++)
{
var delete_btn = this.ListElement.children[i].children[1];
delete_btn.NativeObject = this;
delete_btn.addEventListener("click", function()
{
var index = Array.prototype.indexOf.call(this.NativeObject.ListElement.children, this.parentElement);
this.NativeObject.removeAt(index);
});
}
}
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-instancebrowser");
for (var i = 0; i < items.length; i++)
{
items[i].NativeObject = new McxInstanceBrowser(items[i]);
}
});
window.addEventListener("click", function(e)
{
var ibs = document.getElementsByClassName("mcx-instancebrowser");
for (var i = 0; i < ibs.length; i++)
{
if (!System.CheckIfSenderIsInside(e.target, ibs[i]))
{
ibs[i].NativeObject.setEditing(false);
}
}
});

View File

@ -0,0 +1,22 @@
function InstanceKey()
{
this.ClassIndex = 0;
this.InstanceIndex = 0;
this.toString = function()
{
return this.ClassIndex + "$" + this.InstanceIndex;
};
}
InstanceKey.parse = function(value)
{
var split = value.split("$");
var classIndex = parseInt(split[0]);
var instanceIndex = parseInt(split[1]);
var ik = new InstanceKey();
ik.ClassIndex = classIndex;
ik.InstanceIndex = instanceIndex;
return ik;
};

View File

@ -0,0 +1,15 @@
var mochaMessages = {
"MXRES.CONTEXTMENUITEM.ViewPrintableVersion": "View Printable Version",
"MXRES.CONTEXTMENUITEM.ExportToSpreadsheet": "Export to Spreadsheet",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyInstanceID": "Copy Instance ID ({0})",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyText": "Copy Text",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyTextAndInstanceID": "Copy Text and Instance ID",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyURL": "Copy URL",
"MXRES.MONIKER.CONTEXTMENUITEM.EditInNewWindow": "Edit in New Window",
"MXRES.MONIKER.CONTEXTMENUITEM.EditInstance": "Edit Instance",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceID": "Search Instance ID ({0})",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceIDInMaster": "Search Instance ID ({0}) in Master",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceIDInNewWindow": "Search Instance ID ({0}) in New Window",
"MXRES.MONIKER.CONTEXTMENUITEM.SeeInNewWindow": "See in New Tab",
"MXRES.MONIKER.CONTEXTMENUITEM.SeeRelatedInstances": "See Related Instances"
};

View File

@ -0,0 +1,412 @@
function McxMoniker(parentElement)
{
this.ParentElement = parentElement;
if (this.ParentElement.children[0].tagName == "IMG")
{
this.IconElement = this.ParentElement.children[0];
this.LabelElement = this.ParentElement.children[1];
this.ButtonElement = this.ParentElement.children[2];
this.PopupElement = this.ParentElement.children[3];
}
else
{
this.IconElement = null;
this.LabelElement = this.ParentElement.children[0];
this.ButtonElement = this.ParentElement.children[1];
this.PopupElement = this.ParentElement.children[2];
}
this.ParentElement.addEventListener("contextmenu", function(e)
{
var cm = new ContextMenu();
cm.Data = this.McxNativeObject;
var ecid = this.NativeObject.ECID;
var iid = this.McxNativeObject.ParentElement.getAttribute("data-instance-id");
cm.Items = [
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.SeeInNewWindow"],
"Visible": function()
{
return this.Menu.Data.LabelElement.tagName == "A";
},
"Execute": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
window.open(relativeUrl);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": function()
{
return this.Menu.Data.LabelElement.tagName == "A";
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyURL"],
"Visible": true,
"Execute": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
Clipboard.setText(url);
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyText"],
"Visible": true,
"Execute": function()
{
Clipboard.setText(this.Menu.Data.LabelElement.innerText);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": String.format(mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyInstanceID"], iid),
"Visible": true,
"Execute": function()
{
Clipboard.setText(iid);
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyTextAndInstanceID"],
"Visible": true,
"Execute": function()
{
Clipboard.setText(this.Menu.Data.LabelElement.innerText);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.EditInstance"],
"Visible": true,
"TargetURL": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
return url;
}
},
{
"ClassName": "MenuItemCommand",
"Title": String.format(mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceID"], iid),
"Visible": true,
"TargetURL": function()
{
return System.ExpandRelativePath("~/" + System.TenantName + "/d/search.htmld?q=" + iid + "&branch=true");
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.CONTEXTMENUITEM.ViewPrintableVersion"],
"Visible": true,
"Execute": function()
{
Window.ShowDialog("The method or operation is not implemented", "Not Implemented");
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.CONTEXTMENUITEM.ExportToSpreadsheet"],
"Visible": true,
"Execute": function()
{
Window.ShowDialog("The method or operation is not implemented", "Not Implemented");
}
}
];
cm.Show(e.clientX, e.clientY, document.body);
e.preventDefault();
e.stopPropagation();
return false;
});
this.ActionsMenuElement = this.PopupElement.children[0].children[1];
this.ClassTitleElement = this.PopupElement.children[1].children[0].children[0].children[0];
this.InstanceTitleElement = this.PopupElement.children[1].children[0].children[0].children[1];
this.PreviewContentElement = this.PopupElement.children[1].children[1];
this.InstanceID = this.ParentElement.getAttribute("data-instance-id");
this.setInstanceTitle = function(value)
{
this.InstanceTitleElement.innerText = value;
};
this.setClassTitle = function(value)
{
this.ClassTitleElement.innerText = value;
};
this.BuildMenuItem = function(title, url)
{
};
this.ButtonElement.McxNativeObject = this;
this.OnOpening = function()
{
System.ClassList.Add(this.PopupElement, "uwt-loading");
var url = System.ExpandRelativePath("~/" + System.TenantName + "/inst/" + this.InstanceID + "/rel-tasks.htmld");
var xhr = new XMLHttpRequest();
xhr.timeout = 5000;
xhr.open("GET", url);
xhr.thiss = this;
xhr.onreadystatechange = function(e)
{
var xhr = e.target;
if (xhr.readyState == 4)
{
if (xhr.status == 200)
{
var json = JSON.parse(xhr.responseText);
console.log(json);
if (json.result == "failure" && json.responseCode == 403)
{
Alert.show(json.message, json.title, "uwt-color-danger");
return;
}
if (json.instance)
{
if (json.instance.label)
{
// xhr.thiss.setClassTitle("Return Attribute Method Binding");
xhr.thiss.setClassTitle(json.instance.label);
}
if (json.instance.title)
{
// xhr.thiss.setInstanceTitle("Common Text@get Concatenated Date and Time Format (BA)*P*S(public)[ramb]");
xhr.thiss.setInstanceTitle(json.instance.title);
}
}
if (json.taskGroups)
{
System.ClassList.Remove(xhr.thiss.ActionsMenuElement.parentElement, "uwt-empty");
xhr.thiss.ActionsMenuElement.innerHTML = "";
for (var i = 0; i < json.taskGroups.length; i++)
{
var tgprimary = json.taskGroups[i].taskGroups[0];
if (tgprimary.taskGroups.length === 0)
continue;
var label = tgprimary.label;
var li = document.createElement("li");
li.className = "uwt-menu-item-command uwt-menu-item-popup uwt-visible";
var a = document.createElement("a");
a.href = "#";
var span = document.createElement("span");
span.className = "uwt-title";
span.innerText = label;
a.appendChild(span);
li.appendChild(a);
var ulMenuChild = document.createElement("ul");
ulMenuChild.className = "uwt-menu uwt-popup";
for (var j = 0; j < tgprimary.taskGroups.length; j++)
{
var tgsecondary = tgprimary.taskGroups[j].tasks[0];
var li2 = document.createElement("li");
li2.className = "uwt-menu-item-command uwt-visible";
var a2 = document.createElement("a");
a2.href = tgsecondary.uri;
var span2 = document.createElement("span");
span2.className = "uwt-title";
span2.innerText = tgsecondary.label;
a2.appendChild(span2);
li2.appendChild(a2);
ulMenuChild.appendChild(li2);
}
li.appendChild(ulMenuChild);
xhr.thiss.ActionsMenuElement.appendChild(li);
}
}
if (json.messages)
{
for (var i = 0; i < json.messages.length; i++)
{
Alert.show(json.messages[i].content, json.messages[i].title, "uwt-color-danger");
}
}
if (json.preview)
{
xhr.thiss.PreviewContentElement.innerHTML = json.preview;
}
System.ClassList.Remove(xhr.thiss.PopupElement, "uwt-loading");
xhr.thiss.ParentElement.NativeObject.UpdatePopupLocation();
}
else if (xhr.status == 403)
{
}
else if (xhr.status == 0)
{
Alert.show("Please check your connection and try again", "Connection lost", "uwt-color-danger", 5000);
}
}
};
xhr.send(null);
};
}
McxMoniker.create = function(instanceKey, title, viewTask)
{
var div = document.createElement("div");
div.setAttribute("data-instance-id", instanceKey);
div.className = "mcx-moniker uwt-actionpreviewbutton apb-show-text apb-style-ellipsis";
var img = document.createElement("img");
img.className = "apb-icon";
img.addEventListener("error", function()
{
this.style.display="none";
});
img.src = "/madi/asset/uic-assets/1.1.5/zq/icons/1$" + instanceKey.split("$")[0];
img.setAttribute("alt", "");
div.appendChild(img);
var a = document.createElement("a");
if (viewTask != null)
{
a.className = "apb-text";
a.href = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + instanceKey + ".htmld");
}
else
{
a.className = "apb-text apb-empty";
}
if (title == "")
{
a.innerHTML = "&nbsp;";
}
else
{
a.innerText = title;
}
div.appendChild(a);
a = document.createElement("a");
a.className = "apb-button";
a.href = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + instanceKey + "/rel-tasks.htmld");
a.innerHTML = "&nbsp;";
div.appendChild(a);
var apbPreview = document.createElement("div");
apbPreview.className = "apb-preview uwt-popup";
var apbActions = document.createElement("div");
apbActions.className = "apb-actions uwt-empty";
var h2 = document.createElement("h2");
h2.innerText = "Available Actions";
apbActions.appendChild(h2);
var ul = document.createElement("ul");
ul.className = "uwt-menu";
apbActions.appendChild(ul);
apbPreview.appendChild(apbActions);
var apbPreviewContent = document.createElement("div");
apbPreviewContent.className = "apb-preview-content";
var apbHeader = document.createElement("div");
apbHeader.className = "apb-header";
var h2 = document.createElement("h2");
var spanClassTitle = document.createElement("span");
spanClassTitle.className = "apb-class-title";
spanClassTitle.innerText = "Relationship";
h2.appendChild(spanClassTitle);
var img = document.createElement("img");
img.className = "apb-icon";
img.src = "/madi/asset/uic-assets/1.1.5/zq/icons/1$" + instanceKey.split("$")[0];
img.setAttribute("alt", "");
h2.appendChild(img);
var text = document.createElement("a");
text.className = "apb-text apb-empty";
text.href= "";
text.innerText = title;
h2.appendChild(text);
apbHeader.appendChild(h2);
apbPreviewContent.appendChild(apbHeader);
apbPreview.appendChild(apbPreviewContent);
var apbSpinner = document.createElement("div");
apbSpinner.className = "uwt-spinner";
apbPreview.appendChild(apbSpinner);
div.appendChild(apbPreview);
//</div><div class="apb-preview-content"><div class="apb-header"><h2><span class="apb-class-title">Work Set</span><img class="apb-icon" src="/madi/asset/uic-assets/1.1.5/zq/icons/1$15.png"><a class="apb-text" href="/super/d/inst/1$15/15$12.htmld">Conditional Select Attribute Case [Nonsingular]</a></h2></div><div class="apb-content"></div></div><div class="uwt-spinner">&nbsp;</div></div></div>"
div.NativeObject = new AdditionalDetailWidget(div);
div.McxNativeObject = new McxMoniker(div);
div.NativeObject.OnOpening = function()
{
this.Parent.McxNativeObject.OnOpening();
};
return div;
};
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-moniker");
for (var i = 0; i < items.length; i++)
{
items[i].McxNativeObject = new McxMoniker(items[i]);
items[i].NativeObject.OnOpening = function()
{
this.Parent.McxNativeObject.OnOpening();
};
}
});

View File

@ -0,0 +1,110 @@
function McxTypeaheadSearch(parentElement)
{
this.ParentElement = parentElement;
this.FormElement = this.ParentElement.children[0];
this.TextBoxElement = this.FormElement.children[0];
this.PopupElement = this.ParentElement.children[1];
this.MenuElement = this.PopupElement.children[0];
this.clearSearchResults = function()
{
while (this.MenuElement.children.length > 0)
{
this.MenuElement.children[0].remove();
}
};
this.activateSearchResult = function(searchResult)
{
window.location.href = searchResult.uri;
};
this.search = function(query)
{
System.ClassList.Add(this.PopupElement, "uwt-visible");
System.ClassList.Add(this.PopupElement, "uwt-loading");
var xhr = new XMLHttpRequest();
var searchUrl = System.ExpandRelativePath("~/" + System.TenantName + "/search.htmld?q=" + encodeURIComponent(query));
// var searchUrl = System.ExpandRelativePath("~/madi/pex/fs/" + System.TenantName + "typeahead?q=" + encodeURIComponent(query) + "&contextualsearch=true&autocomplete=true&clientRequestId=");
/*
if (this.ParentElement.hasAttribute("data-valid-class-ids"))
{
searchUrl += "&validClassIds=" + this.ParentElement.getAttribute("data-valid-class-ids");
}
*/
xhr.open("GET", searchUrl, true);
xhr.NativeObject = this;
xhr.onreadystatechange = function()
{
if (this.readyState === 4)
{
var resultsText = this.responseText;
var json = JSON.parse(resultsText);
System.ClassList.Remove(this.NativeObject.PopupElement, "uwt-loading");
if (json.result === "success")
{
this.NativeObject.clearSearchResults();
for (var i = 0; i < json.items.length; i++)
{
var li = document.createElement("li");
li.className = "uwt-menu-item uwt-menu-item-command uwt-visible";
li.searchResult = json.items[i];
li.NativeObject = this.NativeObject;
li.addEventListener("click", function()
{
if (this.NativeObject.activateSearchResult(this.searchResult))
{
this.NativeObject.setEditing(false);
}
});
var span = document.createElement("span");
span.className = "uwt-title";
span.innerText = json.items[i].label;
li.appendChild(span);
span = document.createElement("span");
span.className = "uwt-description";
span.innerText = json.items[i].summaryDescription;
li.appendChild(span);
this.NativeObject.MenuElement.appendChild(li);
}
System.ClassList.Remove(this.NativeObject.PopupElement, "uwt-loading");
}
else
{
if (json.responseCode === 403)
{
Alert.show("Please log in to continue", "Not Authorized", "uwt-color-danger");
}
System.ClassList.Remove(this.NativeObject.PopupElement, "uwt-loading");
}
}
};
xhr.send(null);
};
this.__timeout = null;
this.TextBoxElement.NativeObject = this;
this.TextBoxElement.addEventListener("keyup", function(e)
{
if (this.NativeObject.__timeout !== null)
{
window.clearTimeout(this.NativeObject.__timeout);
}
this.NativeObject.__timeout = window.setTimeout(function(thiss)
{
thiss.search(thiss.TextBoxElement.value);
}, 500, this.NativeObject);
});
}
window.addEventListener("load", function()
{
var primarySearch = document.getElementsByClassName("uwt-searchbar");
primarySearch[0].NativeObject = new McxTypeaheadSearch(primarySearch[0]);
});

View File

@ -0,0 +1,55 @@
<?php
if (file_exists(dirname(__FILE__) . "/phast/JSMin.inc.php"))
{
include_once(dirname(__FILE__) . "/phast/JSMin.inc.php");
}
$last_modified_time = filemtime(__FILE__);
$etag = md5_file(__FILE__);
// always send headers
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag");
// exit if not modified
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
@trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)
{
header("HTTP/1.1 304 Not Modified");
exit;
}
header ("Content-Type: text/javascript");
$bundles = array();
$files = glob("*.js");
foreach ($files as $file)
{
$bundles[] = $file;
}
$input = "";
foreach ($bundles as $bundle)
{
$input .= "/* BEGIN '" . $bundle . "' */\r\n";
$input .= file_get_contents($bundle) . "\r\n";
$input .= "/* END '" . $bundle . "' */\r\n\r\n";
}
if (isset($_GET["minify"]) && $_GET["minify"] == "false")
{
echo($input);
}
else
{
if (class_exists("\\JSMin\\JSMin"))
{
$output = \JSMin\JSMin::minify($input);
}
else
{
$output = "/* could not find class '\\JSMin\\JSMin'; minify is unavailable */\r\n";
$output .= $input;
}
echo($output);
}
?>

View File

@ -0,0 +1 @@
/home/beckermj/Documents/Projects/phast/lib/phast/client/scripts

View File

@ -0,0 +1,7 @@
@media (max-width: 1000px)
{
div.uwt-formview > div.uwt-formview-item
{
padding: 0px 8px;
}
}

View File

@ -0,0 +1,11 @@
@media (max-width: 1000px)
{
h1
{
font-size: 20pt;
}
h2
{
font-size: 16pt;
}
}

View File

@ -0,0 +1,37 @@
@media (max-width: 800px)
{
body
{
&> div.uwt-header, &> form > div.uwt-header
{
&> div.uwt-header-item
{
&.uwt-searchbar
{
&:not(:focus-within)
{
&::before
{
color: #4e5155;
font-size: 16pt;
top: 6px;
}
&:hover
{
cursor: pointer;
&::before
{
color: #fff;
}
}
}
input:not(:focus)
{
width: 32px;
background: transparent;
}
}
}
}
}
}

View File

@ -0,0 +1,3 @@
@import "uwt-htmlheading.less";
@import "uwt-formview.less";
@import "uwt-searchbar.less";

View File

@ -0,0 +1,129 @@
div.uwt-actionpreviewbutton
{
&.apb-selected > a.apb-button
{
background-color: #129283 !important;
color: #fff !important;
}
&> a.apb-button
{
&:hover
{
background-color: @ThemeColor;
color: #fff !important;
}
border: solid 1px @ThemeColor;
background-color: #fff;
color: @ThemeColor !important;
}
}
div.apb-preview
{
background: #fff;
border: solid 1px #ccc;
&> a.uwt-button.uwt-button-close
{
right: 0px;
top: 0px;
border: solid 1px;
border-top: none;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
color: #666;
background-color: #fff;
border-color: #ccc;
&:hover
{
background-color: @ThemeColor;
color: #fff;
}
}
&> div.apb-actions
{
background: #eeeeee; // #ccaaff - we could use this for Sydne;
border-right: solid 1px #ccc;
&> h2
{
margin: 16px;
border-bottom: solid 1px #ccc;
}
&> ul.uwt-menu
{
&> li
{
&> a
{
/*
&> span.uwt-title
{
font-size: 12pt;
font-weight: 300;
}
*/
}
&.uwt-menu-item-popup
{
&::after
{
content: "\f105";
position: absolute;
right: 8px;
top: 7px;
font-family: FontAwesome;
font-size: 16px; /* in case it gets changed by parent */
color: #707478;
}
&> ul.uwt-menu
{
background-color: #fff;
border: solid 1px #ccc;
box-shadow: 2px 2px 4px #ccc;
}
}
}
}
}
&> div.uwt-gripper
{
border-bottom: solid 1px #cccccc;
border-right: solid 1px #ccc;
border-left: solid 1px #ccc;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
&:hover
{
background-color: @ThemeColor;
&::after
{
color: #fff;
}
}
&::after
{
content: ". . . . . .";
display: block;
text-align: center;
margin-top: -9px;
font-size: 14pt;
font-weight: bold;
color: #ccc;
}
}
&.uwt-dragging
{
&> div.uwt-gripper
{
background-color: darken(@ThemeColor, 5%);
&::after
{
color: #fff;
}
}
}
}

View File

@ -0,0 +1,128 @@
div.uwt-alert
{
padding: .9375rem;
box-shadow: 4px 4px 10px rgba(0,0,0,0.3);
&:not(.uwt-visible)
{
opacity: 0;
visibility: hidden;
}
&> div.uwt-title
{
font-weight: 300;
font-size: 24px;
margin-bottom: 16px;
}
.AlertColor(@color)
{
border: solid 1px shade(@color, 40%);
background-color: tint(@color, 75%);
color: shade(@color, 20%);
&> div.uwt-badge
{
background-color: tint(@color, 50%);
color: shade(@color, 50%);
}
}
.AlertColor2(@textColor, @backgroundColor, @borderColor)
{
border: solid 1px @borderColor;
background-color: @backgroundColor;
color: @textColor;
}
&.uwt-color-primary
{
// .AlertColor(@ThemeColorPrimary);
//.AlertColor2(#ffffff, #1c75c7, #0c55a7);
}
&.uwt-color-info
{
// .AlertColor(@ThemeColorPrimary);
//.AlertColor2(#ffffff, #49b6d6, #3789a1);
}
&.uwt-collapsible
{
padding: 8px;
}
&> div.uwt-icon
{
padding: 12px;
&::before
{
font-family: "Font Awesome 6 Pro";
font-size: 32pt;
font-weight: 100;
}
}
&:not(.uwt-collapsed)
{
&> div.uwt-icon::before
{
content: "\f0a8";
}
}
&.uwt-color-danger
{
//.AlertColor2(#4d1b1a, #ffcecd, #ffcecd);
&.uwt-collapsed
{
&> div.uwt-icon::before
{
content: "\f321";
}
}
}
&.uwt-color-warning
{
//.AlertColor2(#4d1b1a, #ffcecd, #ffcecd);
&.uwt-collapsed
{
&> div.uwt-icon::before
{
content: "\f071";
}
}
}
&.uwt-color-info
{
&.uwt-collapsed
{
&> div.uwt-icon::before
{
content: "\f05a";
}
}
}
&:not(.uwt-disabled)
{
&.uwt-color-success
{
.AlertColor2(#ffffff, #00acac, #008181);
}
&.uwt-color-danger
{
.AlertColor(@ThemeColorDanger);
}
&.uwt-color-warning
{
.AlertColor(@ThemeColorWarning);
}
&.uwt-color-info
{
.AlertColor(@ThemeColorInfo);
}
}
&.uwt-disabled
{
color: #999;
background: #ccc;
border-color: #999;
}
}

View File

@ -0,0 +1,21 @@
div.uwt-header > div.uwt-header-item.uwt-applicationmenu > div.uwt-button > button
{
background-color: transparent;
border: none; /* solid 1px @ThemeColor; */
border-radius: 0px;
// color: @ThemeColor;
color: #4E5155;
&.uwt-selected
{
background-color: @ThemeColor;
color: #FFFFFF;
}
&:hover
{
/* background-color: @ThemeColor; */
color: #FFFFFF;
/* box-shadow: 0px 0px 4px @ThemeColor; */
}
}

View File

@ -0,0 +1,70 @@
.uwt-badge
{
padding: 3px 6px 4px;
font-size: 75%;
font-weight: 600;
background-color: #e4e7ea;
color: #fff;
text-align: center;
border-radius: 3px;
&.uwt-color-danger
{
background-color: #ff5b57;
}
&.uwt-color-warning
{
background-color: #f59c1a;
}
&.uwt-color-yellow
{
color: #2d353c;
background-color: #ffd900;
}
&.uwt-color-lime
{
background-color: #90ca4b;
}
&.uwt-color-green
{
background-color: #32a932;
}
&.uwt-color-success
{
background-color: #00acac;
}
&.uwt-color-primary
{
background-color: #348fe2;
}
&.uwt-color-info
{
background-color: #49b6d6;
}
&.uwt-color-purple
{
background-color: #727cb6;
}
&.uwt-color-indigo
{
background-color: #8753de;
}
&.uwt-color-black
{
background-color: #2d353c;
}
&.uwt-color-pink
{
background-color: #fb5597;
}
&.uwt-color-secondary
{
background-color: #6c757d;
}
&.uwt-color-gray
{
background-color: #f2f3f4;
}
}

View File

@ -0,0 +1,47 @@
div.uwt-binaryswitch
{
border: solid 1px var(--uwt-color-gray-400);
&:not([disabled])
{
&:hover
{
border-color: var(--uwt-color-accent);
}
&> div.uwt-binaryswitch-switches
{
&> div.uwt-switch
{
&:hover
{
border-color: var(--uwt-color-gray-600);
&> div.uwt-switch-indicator
{
background-color: var(--uwt-color-gray-600);
}
}
}
}
}
&> div.uwt-binaryswitch-switches
{
&> div.uwt-switch
{
transition: all 0.3s;
border: solid 1px var(--uwt-color-gray-400);
&> div.uwt-switch-indicator
{
background-color: var(--uwt-color-gray-200);
}
&.uwt-selected
{
border-color: var(--uwt-color-accent);
&> div.uwt-switch-indicator
{
background-color: var(--uwt-color-accent);
}
}
}
}
}

View File

@ -0,0 +1,47 @@
blockquote
{
border-left: solid 5px rgba(0, 0, 0, 0.08);
font-size: 17.5px;
margin: 0px 0px 20px;
padding: 20px;
&> p
{
margin: 0px 0px 10px;
}
&> small
{
color: rgba(0, 0, 0, 0.5);
display: block;
font-size: 80%;
line-height: 1.42857;
&::before
{
content: "— ";
}
}
&.Success
{
background-color: #B0EBCA;
border-color: #4A8564;
color: #3C763D;
}
&.Information
{
background-color: #BEE2EF;
border-color: #587C89;
color: #31708F;
}
&.Warning
{
background-color: #FFF2E3;
border-color: #9D9080;
color: #8A6D3B;
}
&.Danger
{
background-color: #FBD1D1;
border-color: #986E6E;
color: #A94442;
}
}

View File

@ -0,0 +1,22 @@
@ThemeColor: #009A9A; /* #00ACAC; */
@ThemeColorPrimary: #348FE2;
@ThemeColorSuccess: @ThemeColor;
@ThemeColorPrimary: #348FE2;
// @ThemeColorSuccess: #00ACAC;
@ThemeColorDanger: #FF5B57;
@ThemeColorInfo: #2BBCE0;
@ThemeColorWarning: #F59C1A;
@ThemeColorRed: @ThemeColorDanger;
@ThemeColorBlue: @ThemeColorPrimary;
@ThemeColorPurple: #727CB6;
@ThemeColorOrange: #F59C1A;
@ThemeColorBlack: #242A30; /* #2D353C; */
@HeaderHeight: 64px;
@SidebarWidth: 220px;
@PageBackgroundColor: #D9E0E7;

View File

@ -0,0 +1,126 @@
//(~'@{ButtonSelector}')
a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a
{
.ButtonColor(@backcolor, @forecolor)
{
background-color: @backcolor;
border-color: @backcolor;
color: @forecolor;
&:hover
{
background-color: darken(@backcolor, 10%);
color: @forecolor;
}
&:active
{
background-color: darken(@backcolor, 25%);
color: @forecolor;
}
&[disabled]
{
background-color: lighten(@backcolor, 20%);
border-color: lighten(@backcolor, 20%);
pointer-events: none;
}
}
&.Large
{
font-size: 18px;
line-height: 1.33;
padding: 10px 16px;
}
cursor: pointer;
border: solid 1px transparent;
border-bottom: solid 2px transparent;
border-radius: 3px;
line-height: 1.42857;
font-size: 14px;
font-weight: 600;
padding: 6px 12px;
text-align: center;
text-decoration: none;
vertical-align: middle;
white-space: nowrap;
transition: all 0.3s;
.ButtonColor(#f1f3f4, #2d353c);
&:hover
{
text-decoration: none;
}
&:focus
{
border-bottom-color: #2d353c;
}
&+ input[type=submit], &+ input[type=reset], &+ input[type=button], &+ a.uwt-button, &+ button
{
margin-left: 5px;
}
&.uwt-color-gray
{
.ButtonColor(#b6c2c9, #fff);
}
&.uwt-color-purple
{
.ButtonColor(#727cb6, #fff);
}
&.uwt-color-indigo
{
.ButtonColor(#8753de, #fff);
}
&.uwt-color-primary
{
.ButtonColor(#348fe2, #fff);
}
&.uwt-color-info
{
.ButtonColor(#49b6d6, #fff);
}
&.uwt-color-yellow
{
.ButtonColor(#ffd900, #2d353c);
}
&.uwt-color-warning
{
.ButtonColor(#f59c1a, #fff);
}
&.uwt-color-pink
{
.ButtonColor(#fb5597, #fff);
}
&.uwt-color-danger
{
.ButtonColor(#ff5b57, #fff);
}
&.uwt-color-success
{
.ButtonColor(#00acac, #fff);
}
&.uwt-color-green
{
.ButtonColor(#32a932, #fff);
}
&.uwt-color-lime
{
.ButtonColor(#90ca4b, #fff);
}
&.uwt-color-inverse
{
.ButtonColor(#2d353c, #fff);
}
&.uwt-color-none
{
.ButtonColor(transparent, inherit);
}
}

View File

@ -0,0 +1,20 @@
div.uwt-checkbox
{
background-color: #FFFFFF;
border: solid 1px var(--uwt-color-gray-400);
&:hover, &.Hover, &.uwt-checked, &.uwt-indeterminate
{
border-color: @ThemeColor;
}
&.uwt-checked, &.uwt-indeterminate
{
background-color: @ThemeColor;
color: #FFFFFF;
}
&:active
{
background-color: shade(@ThemeColor, 25%);
}
}

View File

@ -0,0 +1,45 @@
:root
{
--uwt-color-default: #e9ecef;
--uwt-color-primary: #348fe2;
--uwt-color-secondary: #6c757d;
--uwt-color-success: #00acac;
--uwt-color-info: #49b6d6;
--uwt-color-warning: #f59c1a;
--uwt-color-danger: #ff5b57;
--uwt-color-light: #f2f3f4;
--uwt-color-dark: #2d353c;
--uwt-color-inverse: #2d353c;
--uwt-color-blue: #348fe2;
--uwt-color-indigo: #8753de;
--uwt-color-purple: #727cb6;
--uwt-color-pink: #fb5597;
--uwt-color-red: #ff5b57;
--uwt-color-orange: #f59c1a;
--uwt-color-yellow: #ffd900;
--uwt-color-green: #32a932;
--uwt-color-teal: #00acac;
--uwt-color-lime: #90ca4b;
--uwt-color-cyan: #49b6d6;
--uwt-color-white: #FFFFFF;
--uwt-color-gray: #6c757d;
--uwt-color-gray-dark: #2d353c;
--uwt-color-muted: #adb5bd;
--uwt-color-black: #000000;
--uwt-color-silver: #b6c2c9;
--uwt-color-gray-100: #f8f9fa;
--uwt-color-gray-200: #e9ecef;
--uwt-color-gray-300: #dee2e6;
--uwt-color-gray-400: #ced4da;
--uwt-color-gray-500: #adb5bd;
--uwt-color-gray-600: #6c757d;
--uwt-color-gray-700: #495057;
--uwt-color-gray-800: #2d353c;
--uwt-color-gray-900: #20252a;
--uwt-color-accent: #00acac;
--uwt-control-text: var(--uwt-color-gray-900);
--uwt-dropdown-menu-highlight-background: #eff1f3;
--uwt-dropdown-menu-highlight-foreground: var(--uwt-control-text);
}

View File

@ -0,0 +1,10 @@
div.Countdown
{
&> div.Segment
{
background-color: rgba(0, 0, 0, 0.5);
border: solid 1px @ThemeColor;
border-radius: 4px;
color: #FFFFFF;
}
}

View File

@ -0,0 +1,9 @@
body > div.uwt-footer, body > form > div.uwt-footer
{
background-color: #242A30;
color: #707478;
box-shadow: 0px 100px 80px -80px rgba(0, 0, 0, 0.7) inset;
/* padding: 60px 16px; */
}

View File

@ -0,0 +1,16 @@
div.FormView
{
&> div.Field
{
&> label
{
color: @ThemeColorBlack;
text-align: right;
}
}
&> div.Field
{
/* fake margin-bottom for elements displayed as table-row */
border-bottom: solid 16px transparent;
}
}

View File

@ -0,0 +1,212 @@
@UnfocusedSearchBarWidth: 220px;
@FocusedSearchBarWidth: 400px;
body
{
&> div.uwt-header, &> form > div.uwt-header
{
background-color: #fff;
&> div.uwt-header-item
{
position: relative;
input[type=text]
{
background-color: #f2f3f4;
border-color: #f2f3f4;
color: #2d353c;
&::placeholder
{
color: rgba(255,255,255,.5);
}
}
&.uwt-searchbar
{
&::before
{
content: "\f002";
display: inline-block;
font-family: "FontAwesome";
font-size: 0.75rem;
font-weight: 900;
position: absolute;
margin-left: -16px;
left: 28px;
top: 10px;
pointer-events: none;
}
input
{
border-radius: 30px;
border: 1px solid #d5dbe0;
width: @UnfocusedSearchBarWidth;
transition: width 0.2s;
padding-left: 32px;
&:focus
{
border-color: #f2f3f4;
width: @FocusedSearchBarWidth;
/* Remove the focus indicator on mouse-focus for browsers
that do support :focus-visible */
outline: none;
}
}
div.uwt-textbox-popup
{
&> div.uwt-dropdown-content > ul.uwt-menu > li > a
{
&> span
{
display: block;
padding-top: 4px;
padding-bottom: 4px;
}
&> span.uwt-title
{
font-weight: bold;
}
&> span.uwt-subtitle, &> span.uwt-content
{
font-size: small;
}
}
background-color: #fff;
}
}
}
margin-bottom: 20px;
height: @HeaderHeight;
&> div.uwt-logo
{
color: #FFFFFF;
font-size: 24px;
padding: (@HeaderHeight / 4);
width: 128px;
a
{
text-decoration: none;
color: inherit;
}
span.Primary
{
color: @ThemeColor;
}
}
&> ul.uwt-menu
{
position: absolute;
right: 24px;
&> li
{
&> a
{
text-transform: uppercase;
font-size: 12px;
font-weight: 600;
line-height: 20px;
padding: 26px 16px;
}
&.uwt-selected
{
&> a
{
background-color: #00ACAC;
color: #ffffff;
}
&::after
{
border-bottom: 16px solid @PageBackgroundColor;
border-left: 16px solid rgba(0, 0, 0, 0);
border-radius: 0;
border-right: 16px solid rgba(0, 0, 0, 0);
content: "";
display: block;
height: 0px;
margin-left: auto;
margin-right: auto;
position: relative;
top: -16px;
width: 0px;
}
}
}
}
}
}
body.uwt-header-inverse
{
&> div.uwt-header, &> form > div.uwt-header
{
background-color: #1a2229;
&> div.uwt-header-item
{
&::before
{
color: #fff;
}
&.uwt-searchbar
{
input
{
border-color: transparent;
}
div.uwt-popup
{
background-color: #1a2229;
color: #fff;
&> ul.uwt-menu
{
width: @FocusedSearchBarWidth;
&> li.uwt-menu-item
{
&> span.uwt-title, &> span.uwt-description
{
display: block;
}
&> span.uwt-description
{
color: var(--uwt-color-gray-500);
}
&:hover, &.uwt-highlight
{
background-color: rgba(255,255,255,0.2);
color: #fff;
}
}
}
}
}
input
{
background-color: rgba(255,255,255,.25);
color: #fff;
&::placeholder
{
color: rgba(255,255,255,.5);
}
}
}
}
}

View File

@ -0,0 +1,9 @@
h1, h2, h3, h4, h5, h6
{
// color: #242A30; // not sure why this is here, it should just inherit from the body right?
font-weight: 300;
}
h1
{
font-size: 36px;
}

View File

@ -0,0 +1,10 @@
a
{
color: @ThemeColor;
text-decoration: none;
&:hover
{
color: darken(@ThemeColor, 15%);
text-decoration: underline;
}
}

View File

@ -0,0 +1,185 @@
@TableBorderColor: #E2E7EB;
@TableGridLineColor: #F5F5F5;
@TableRowHoverBackgroundColor: @TableGridLineColor;
@TableRowHoverForegroundColor: #000000;
@TableRowSelectedBackgroundColor: #fff7cc; // darken(@ThemeColor, 5%); /* #E2E7E9; */
@TableRowSelectedForegroundColor: #665700; // #FFFFFF;
@TableRowSelectedHoverBackgroundColor: lighten(@TableRowSelectedBackgroundColor, 5%);
@TableRowSelectedHoverForegroundColor: @TableRowSelectedForegroundColor;
div.uwt-listview > .uwt-content
{
background-color: #FFFFFF;
border-collapse: collapse;
border: solid 1px #ced4da;
}
.uwt-listview
{
&:not(.uwt-gridlines)
{
&> thead, &> .uwt-content > .uwt-listview-column-headers
{
border-bottom: solid 2px;
border-bottom-color: @TableGridLineColor;
}
}
&> thead, &> .uwt-content > .uwt-listview-column-headers
{
//border-bottom: solid 2px;
//border-bottom-color: @TableGridLineColor;
&> tr
{
&> th
{
border-bottom: solid 2px @TableBorderColor;
color: #242A30;
font-weight: 600;
a
{
color: inherit;
display: block;
text-align: left;
&:hover
{
text-decoration: none;
}
}
&[colspan]
{
font-weight: normal;
background-color: tint(@ThemeColor, 75%);
a
{
text-align: center;
}
}
}
}
}
&> tbody, &> .uwt-content > .uwt-listview-items
{
&> tr:nth-of-type(2n+1), &> div:nth-of-type(2n+1)
{
background-color: #e9ecef; // #f2f4f5;
}
&> tr
{
border: solid 1px transparent;
&.uwt-selected
{
border-color: @ThemeColor;
&> td
{
background-color: fade(@ThemeColor, 25%);
}
}
}
&> div.uwt-listview-item
{
border-bottom: 1px solid rgb(206, 212, 218);
&.uwt-selected
{
// border-color: @ThemeColor;
&> td
{
background-color: fade(@ThemeColor, 25%);
}
}
}
}
&> thead, &> tbody, &> .uwt-listview-section, &> .uwt-listview-contents
{
&> tr
{
&> th, &> td
{
border: solid 1px #cccccc;
}
&:hover > td
{
background-color: tint(@ThemeColor, 85%);
}
}
&> div
{
&:hover
{
// background-color: rgba(233,236,239,0.5);
background-color: tint(@ThemeColor, 85%);
}
}
}
&> .uwt-content > .uwt-listview-column-headers > .uwt-listview-column-header > a,
&> .uwt-content > .uwt-listview-items > .uwt-listview-item > .uwt-listview-item-column
{
padding: 10px 15px;
}
&> .uwt-content > .uwt-listview-items > .uwt-listview-item
{
&.uwt-selected
{
background-color: @TableRowSelectedBackgroundColor;
color: @TableRowSelectedForegroundColor;
}
}
&.HasBorder
{
border-color: @TableBorderColor;
}
&.uwt-gridlines
{
&> .uwt-content, &> .uwt-content > .uwt-listview-column-headers
{
border: 1px solid rgba(0,0,0,0.2);
}
&> .uwt-content > .uwt-listview-column-headers > .uwt-listview-column-header
{
border: 1px solid @TableGridLineColor;
/*
&:not(:first-child)
{
border-left: 1px solid rgba(0,0,0,0.1);
}
&:not(:last-child)
{
border-right: 1px solid rgba(0,0,0,0.1);
}
*/
font-weight: bold;
}
&> .uwt-content > .uwt-listview-items > .uwt-listview-item > .uwt-listview-item-column
{
border: 1px solid rgba(0,0,0,0.05);
}
&> .uwt-content > .uwt-listview-items > .uwt-listview-item
{
border-bottom: none;
}
}
&.uwt-hottracking
{
&> .uwt-content > .uwt-listview-items
{
&> div.uwt-listview-item:hover
{
/*
background-color: @TableRowHoverBackgroundColor;
color: @TableRowHoverForegroundColor;
*/
// background-color: tint(@ThemeColor, 75%);
background-color: rgba(233,236,239,0.5);
&.uwt-selected
{
background-color: @TableRowSelectedHoverBackgroundColor;
color: @TableRowSelectedHoverForegroundColor;
}
}
}
}
}

View File

@ -0,0 +1,5 @@
body.MainPage h1
{
font-size: 64px;
font-weight: 600;
}

View File

@ -0,0 +1,15 @@
div.uwt-menu-large
{
background-color: #ffffff;
}
body.uwt-header-inverse
{
&> form > div.uwt-header, &> div.uwt-header
{
div.uwt-menu-large
{
background-color: #1a2229;
color: #A8ACB1;
}
}
}

View File

@ -0,0 +1,109 @@
ul.uwt-menu
{
padding: 0.5rem 0rem;
margin: 0px;
&.Popup
{
background: #FFFFFF;
border: solid 1px @ThemeColor;
border-top: none;
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
&> li:not(.uwt-section)
{
&> a
{
/*
font-size: 12px;
font-weight: 600;
*/
font-size: 12pt;
font-weight: 300;
padding: 0.309375rem 0.9375rem;
&:not(:hover) > span.uwt-description
{
color: #aaaaaa;
}
}
&:not(.uwt-disabled) > a
{
&:hover
{
text-decoration: none;
}
}
&.uwt-disabled > a
{
color: #666;
pointer-events: none;
cursor: not;
}
&.Header
{
color: #6D7983;
font-size: 11px;
line-height: 20px;
margin: 0;
padding: 10px 20px;
}
&.HasChildren > a
{
&::after
{
content: "";
font-family: "FontAwesome";
position: absolute;
padding: 8px;
}
}
}
&.uwt-orientation-vertical
{
&> li
{
display: block;
&.HasChildren
{
&> a
{
&::after
{
right: 0px;
top: 0px;
}
}
}
}
}
&.uwt-orientation-horizontal
{
display: inline-block;
&> li
{
display: inline-block;
&> a
{
color: #8F8E8E;
display: block;
text-decoration: none;
transition: color linear 0.3s, background-color linear 0.3s;
&:hover
{
background: none;
color: @ThemeColor;
}
}
}
}
}

View File

@ -0,0 +1,12 @@
div.uwt-page-header, div.uwt-page > div.uwt-header,
div.uwt-page-footer, div.uwt-page > div.uwt-footer
{
border-top: 1px solid #d5dbe0;
background: #ffffff;
padding: 16px;
}
body:not(.uwt-hide-header) > div.uwt-page, body:not(.uwt-hide-header) > form > div.uwt-page
{
margin-top: 64px;
}

View File

@ -0,0 +1,61 @@
div.Panel
{
background-color: #FFFFFF;
border-radius: 3px;
&> div.Header, &> div.Content, &> div.Footer
{
padding: 10px 15px;
}
&> div.Header
{
background-color: #DDDDDD;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
color: #333333;
font-size: 12px;
font-weight: 500;
line-height: 20px;
}
&> div.Footer
{
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
&.Danger > div.Header
{
background-color: #CC4946;
}
&.Info > div.Header
{
background-color: #3A92AB;
}
&.Inverse > div.Header
{
background-color: #242A30;
}
&.Primary > div.Header
{
background-color: #2A72B5;
}
&.Success > div.Header
{
background-color: #008A8A;
}
&.Warning > div.Header
{
background-color: #C47D15;
}
&.Danger, &.Info, &.Inverse, &.Primary, &.Success, &.Warning
{
&> div.Header
{
color: #FFFFFF;
}
}
}

View File

@ -0,0 +1,5 @@
.uwt-popup
{
background-color: #ffffff;
box-shadow: 4px 4px 10px rgba(0,0,0,0.5);
}

View File

@ -0,0 +1,10 @@
div.ck-editor
{
&:hover
{
&> div.ck-content
{
border-color: var(--uwt-color-accent);
}
}
}

View File

@ -0,0 +1,7 @@
div.uwt-rotaryswitch
{
&> div.uwt-rotaryswitch-indicator
{
background-color: var(--uwt-color-accent);
}
}

View File

@ -0,0 +1,115 @@
body > div.uwt-sidebar, body > form > div.uwt-sidebar
{
background: #2D353C;
div.UserInfo
{
background-color: #1A2229;
padding: 20px;
&> div.Icon
{
display: table-cell;
width: 56px;
}
&> div.Text
{
display: table-cell;
font-size: 14px;
&> span.UserName, span.StatusText
{
display: block;
}
&> span.UserName
{
color: #FFFFFF;
}
&> span.StatusText
{
color: #889097;
font-size: 85%;
}
}
}
ul.uwt-menu > li
{
&.uwt-section > a
{
color: #707478;
font-size: 85%;
letter-spacing: 2px;
text-transform: uppercase;
padding-top: 16px;
padding-bottom: 16px;
}
&> a
{
display: block;
line-height: 20px;
text-decoration: none;
&> i.fa
{
float: left;
font-size: 14px;
line-height: 20px;
margin-right: 16px;
text-align: center;
width: 14px;
}
}
&> ul.uwt-menu
{
background-color: #1A2229;
height: 0px;
transition: height linear 0.3s;
overflow: hidden;
padding: 0px;
&> li
{
&> a
{
color: #889097;
font-weight: 300;
padding: 5px 20px;
&:hover
{
color: #FFFFFF;
text-decoration: none;
}
}
}
}
&.uwt-opened > ul.uwt-menu
{
height: auto;
padding: 10px 0px 10px 30px;
}
}
/* first child styles only */
&> ul.uwt-menu > li
{
&.uwt-opened > a, > a:hover
{
background-color: #232A2F;
text-decoration: none;
}
&> a
{
padding: 8px 20px;
color: #A8ACB1;
}
&.uwt-selected > a
{
background-color: @ThemeColor;
color: #FFFFFF
}
}
&> ul.uwt-menu > li.uwt-section > a
{
background-color: transparent;
}
}

View File

@ -0,0 +1,27 @@
div.uwt-slider
{
&.uwt-color-primary > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #348fe2;
}
&.uwt-color-danger > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #ff5b57;
}
&.uwt-color-teal > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #00acac;
}
&.uwt-color-purple > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #727cb6;
}
&.uwt-color-orange > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #f59c1a;
}
&.uwt-color-black > div.uwt-slider-bar > div.uwt-slider-selection
{
background-color: #2d353c;
}
}

View File

@ -0,0 +1,11 @@
div.uwt-spinner
{
border-color: #24b498 #ffffff #ffffff;
border-image: none;
border-radius: 100%;
border-right: solid 2px #ffffff;
border-style: solid;
border-width: 2px;
height: 40px;
width: 40px;
}

View File

@ -0,0 +1,37 @@
div.uwt-tabcontainer
{
&> ul.uwt-tabcontainer-tabs
{
background-color: #C1CCD1;
&> li
{
&> a
{
color: #6E7179;
// font-size: 12px;
padding: 10px 16px;
&:hover
{
background-color: #FAFAFA;
color: #333333;
}
}
&.uwt-selected > a
{
background-color: #FFFFFF;
color: #242A30;
}
}
}
&> div.uwt-tabcontainer-tabpages
{
background-color: #FFFFFF;
&> div.uwt-tabpage
{
padding: 16px;
}
}
}

View File

@ -0,0 +1,42 @@
.TextBoxBase()
{
border: solid 1px var(--uwt-color-gray-400);
border-radius: 3px;
box-shadow: none;
font: inherit;
font-size: 12px;
&:not([disabled])
{
&:hover, &:focus
{
border-color: @ThemeColor;
}
}
&:focus
{
box-shadow: 0px 0px 4px #00ACAC;
}
&::placeholder
{
color: #6c757d;
opacity: 1;
}
.UwtColors();
}
input[type=text], input[type=password], input[type=number], input[type=search], textarea
{
.TextBoxBase();
line-height: 1.42857;
padding: 6px 12px;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
}
div.uwt-richtextbox
{
border: 1px solid var(--uwt-color-gray-400);
height: 100px;
background-color: var(--uwt-color-gray-200);
}

View File

@ -0,0 +1,24 @@
div.uwt-tile
{
&> div.uwt-footer
{
&> a
{
display: block;
background-color: rgba(0,0,0,.4);
margin: none;
&:hover
{
background-color: rgba(0,0,0,.6);
}
}
}
&.uwt-color-alizarin, &.uwt-color-danger, &.uwt-color-red
{
background-color: #ff5b57;
color: #fff;
}
}

View File

@ -0,0 +1,107 @@
@ToggleSwitchAnimationLength: 150ms; /* 250ms; */
@ToggleSwitchSize: 50px;
@ToggleSwitchThumbSize: 30px;
.ToggleSwitchColors(@color)
{
&.Checked
{
background-color: @color;
border-color: @color;
box-shadow: 0 0 0 16px @color inset;
}
}
div.ToggleSwitch
{
position: relative;
width: @ToggleSwitchSize;
&[disabled]
{
opacity: 0.5;
}
.ToggleSwitchColors(@ThemeColor);
&.Primary
{
.ToggleSwitchColors(@ThemeColorPrimary);
}
&.Success
{
.ToggleSwitchColors(@ThemeColorSuccess);
}
&.Danger
{
.ToggleSwitchColors(@ThemeColorDanger);
}
&.Info
{
.ToggleSwitchColors(@ThemeColorInfo);
}
&.Warning
{
.ToggleSwitchColors(@ThemeColorWarning);
}
&.Red
{
.ToggleSwitchColors(@ThemeColorRed);
}
&.Blue
{
.ToggleSwitchColors(@ThemeColorBlue);
}
&.Purple
{
.ToggleSwitchColors(@ThemeColorPurple);
}
&.Orange
{
.ToggleSwitchColors(@ThemeColorOrange);
}
&.Black
{
.ToggleSwitchColors(@ThemeColorBlack);
}
&.Checked
{
&> div.ToggleSwitchInner > div.ToggleThumb
{
margin-left: (@ToggleSwitchSize - @ToggleSwitchThumbSize);
}
}
&:not(.Checked)
{
background-color: #FFFFFF;
border-color: #DFDFDF;
box-shadow: 0 0 0 0 #DFDFDF inset;
&> div.ToggleSwitchInner > div.ToggleThumb
{
margin-left: 0px;
}
}
&> div.ToggleSwitchInner > div.ToggleThumb
{
transition: margin-left @ToggleSwitchAnimationLength ease-in 0s;
}
transition: border 0.5s ease 0s, box-shadow 0.5s ease 0s, background-color 1.5s ease 0s;
border-radius: 20px;
cursor: pointer;
height: 30px;
div.ToggleOn, div.ToggleOff
{
display: none;
}
div.ToggleThumb
{
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 100%;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
height: @ToggleSwitchThumbSize;
width: @ToggleSwitchThumbSize;
}
}

View File

@ -0,0 +1,29 @@
div.uwt-toolbar
{
&> a
{
margin: 0px !important;
&.uwt-button
{
border: 1px solid transparent;
color: var(--uwt-color-gray-600);
&:hover
{
background-color: tint(@ThemeColor, 75%);
border: 1px solid @ThemeColor;
color: var(--uwt-color-black);
}
&.uwt-selected
{
background-color: tint(@ThemeColor, 50%);
border: 1px solid @ThemeColor;
color: var(--uwt-color-black);
&:hover
{
background-color: tint(@ThemeColor, 30%);
border: 1px solid @ThemeColor;
}
}
}
}
}

View File

@ -0,0 +1,130 @@
@ThumbSize: 30px;
@TrackSize: 8px;
@ThumbOffset: ((@ThumbSize - @TrackSize) / 2);
div.uwt-trackbar
{
margin-bottom: 10px;
padding: 16px 30px;
&> div.uwt-trackbar-track
{
background-color: #A9ACB1;
border-radius: 16px;
&> div.uwt-trackbar-track-quantity
{
background-color: #017AFD;
border-radius: 15px;
}
&> div.uwt-trackbar-track-thumb
{
background-color: #FFFFFF;
border-radius: 100%;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
cursor: move;
height: @ThumbSize;
width: @ThumbSize;
}
}
&.uwt-orientation-horizontal
{
&> div.uwt-trackbar-track
{
height: @TrackSize;
&> div.uwt-trackbar-track-uantity
{
/* transition: width linear 0.1s; */
}
&> div.uwt-trackbar-track-thumb
{
top: -@ThumbOffset;
/* transition: left linear 0.1s; */
}
}
}
&.uwt-orientation-vertical
{
&> div.uwt-trackbar-track
{
width: @TrackSize;
&> div.uwt-trackbar-track-quantity
{
/* transition: height linear 0.1s; */
}
&> div.uwt-trackbar-track-thumb
{
left: -@ThumbOffset;
/* transition: top linear 0.1s; */
}
}
}
&> div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColor;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColor;
}
}
&.uwt-color-red > div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColorRed;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColorRed;
}
}
&.uwt-color-blue > div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColorBlue;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColorBlue;
}
}
&.uwt-color-purple > div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColorPurple;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColorPurple;
}
}
&.uwt-color-orange > div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColorOrange;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColorOrange;
}
}
&.uwt-color-black > div.uwt-trackbar-track
{
&> div.uwt-trackbar-track-quantity
{
background-color: @ThemeColorBlack;
}
&> div.uwt-trackbar-track-thumb
{
color: @ThemeColorBlack;
}
}
}

View File

@ -0,0 +1,35 @@
div.uwt-window
{
background-color: #FFFFFF;
&> div.uwt-header, &> div.uwt-content, &> div.uwt-footer
{
padding: 16px;
}
&> div.uwt-header
{
border-bottom: solid 1px #E2E7EB;
color: #242A30;
font-size: 18px;
font-weight: 500;
}
&> div.uwt-footer
{
border-top: solid 1px #E2E7EB;
}
&> div.uwt-content
{
&> div.uwt-loading
{
background-color: rgba(255, 255, 255, 0.8);
}
}
transition: visibility linear 0.3s, opacity linear 0.3s, transform linear 0.3s;
transform-origin: center center;
transform: scale(0.0) scaleX(-2.0);
&.uwt-visible
{
transform: scale(1.0) scaleX(1.0);
}
}

Some files were not shown because too many files have changed in this diff Show More