massive update
This commit is contained in:
parent
2336d1441e
commit
4d11d9f155
@ -17,6 +17,7 @@ public abstract class AuthenticatedBaseWebPage : BaseWebPage
|
||||
string tenantName = e.Context.Request.GetExtraData<string>("TenantName");
|
||||
if (!e.Context.Session.ContainsKey(tenantName + ".UserToken"))
|
||||
{
|
||||
// !FIXME! this should always query the OMS for the appropriate login redirect (e.g. SAML)
|
||||
e.Context.Response.Redirect("~/" + e.Context.Request.PathVariables["tenant"] + "/d/login.htmld");
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
@ -10,7 +10,31 @@ namespace Mocha.ServerApplication.HardcodedPages;
|
||||
|
||||
public abstract class BaseWebPage : WebPage
|
||||
{
|
||||
protected override IEnumerable<Control> GetHeaderControls()
|
||||
protected override void OnInit(RenderEventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
MochaWebApplication app = ((MochaWebApplication)e.Context.Application);
|
||||
Oms oms = app.Oms;
|
||||
|
||||
{
|
||||
InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First();
|
||||
|
||||
InstanceHandle r_Tenant__has__Application = oms.GetInstance(KnownRelationshipGuids.Tenant__has__Application);
|
||||
InstanceHandle i_Application = oms.GetRelatedInstance(i_Tenant, r_Tenant__has__Application);
|
||||
|
||||
if (i_Application != InstanceHandle.Empty)
|
||||
{
|
||||
|
||||
InstanceHandle r_Application__has_title__Translation = oms.GetInstance(KnownRelationshipGuids.Application__has_title__Translation);
|
||||
string applicationTitle = oms.GetTranslationValue(i_Application, r_Application__has_title__Translation, "Mocha Application");
|
||||
Title = applicationTitle;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override IEnumerable<Control> GetHeaderControls()
|
||||
{
|
||||
List<Control> ctls = new List<Control>();
|
||||
ctls.Add(new HtmlLink("stylesheet", "text/css", "/madi/asset/ui-html/2024.27.5/css/mochaApp.css?plate=BMT216A&sha256-XjJJ2%2BcFxZXtxY579nwOKBNYdP1KUySxNDbxR4QGxvQ%3D"));
|
||||
|
||||
@ -15,11 +15,8 @@ public class HomeWebPage : AuthenticatedBaseWebPage
|
||||
{
|
||||
base.OnInit(e);
|
||||
|
||||
string tenantName = e.Context.Request.GetExtraData<string>("TenantName");
|
||||
if (!e.Context.Session.ContainsKey(tenantName + ".UserToken"))
|
||||
{
|
||||
e.Context.Response.Redirect("~/" + e.Context.Request.PathVariables["tenant"] + "/d/login.htmld");
|
||||
}
|
||||
if (e.Cancel)
|
||||
return;
|
||||
|
||||
Console.WriteLine("req app path: " + e.Context.Request.Path);
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using MBS.Core;
|
||||
using MBS.Web;
|
||||
using MBS.Web.UI;
|
||||
using MBS.Web.UI.HtmlControls;
|
||||
using MBS.Web.UI.WebControls;
|
||||
using Mocha.Core;
|
||||
|
||||
@ -9,6 +10,15 @@ namespace Mocha.ServerApplication.HardcodedPages;
|
||||
|
||||
public class LoginWebPage : BaseWebPage
|
||||
{
|
||||
public bool ProxyLogin { get; }
|
||||
public LoginWebPage()
|
||||
{
|
||||
}
|
||||
public LoginWebPage(bool proxyLogin)
|
||||
{
|
||||
ProxyLogin = proxyLogin;
|
||||
}
|
||||
|
||||
protected override void InitializeInternal()
|
||||
{
|
||||
base.InitializeInternal();
|
||||
@ -100,12 +110,27 @@ text-align: center;
|
||||
new FormView.FormViewItem("User _name", new TextBox() { Name = "username" }),
|
||||
new FormView.FormViewItem("_Password", new TextBox(TextBoxType.Password) { Name = "password" } )
|
||||
}));
|
||||
if (ProxyLogin)
|
||||
{
|
||||
((FormView)panel.ContentControls[2]).Items.Add(new FormView.FormViewItem("Proxy _User", new TextBox() { Name = "proxy_username" }));
|
||||
}
|
||||
panel.ContentControls.Add(new Heading(3, loginFooterText));
|
||||
|
||||
litPasswordWarning = new Literal("<p style=\"color: #ff0000;\">The user name or password is incorrect.</p>");
|
||||
litPasswordWarning.Visible = _showPasswordWarning;
|
||||
panel.ContentControls.Add(litPasswordWarning);
|
||||
|
||||
if (!ProxyLogin)
|
||||
{
|
||||
// screw this
|
||||
/*
|
||||
panel.FooterControls.Add(new HtmlAnchor("proxy-login.htmld", null, "Proxy Login", null, null, new KeyValuePair<string, string>[]
|
||||
{
|
||||
new KeyValuePair<string, string>("margin-right", "8px")
|
||||
}));
|
||||
*/
|
||||
}
|
||||
|
||||
panel.FooterControls.Add(new Button("_Log In") { ThemeColorPreset = ThemeColorPreset.Primary, UseSubmitBehavior = true });
|
||||
Controls.Add(panel);
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
using System.Xml;
|
||||
using MBS.Core;
|
||||
using MBS.Core.Drawing;
|
||||
using MBS.Web;
|
||||
using MBS.Web.UI.HtmlControls;
|
||||
using MBS.Web.UI.WebControls;
|
||||
using Mocha.Core;
|
||||
|
||||
@ -7,29 +10,150 @@ namespace Mocha.ServerApplication.HardcodedPages;
|
||||
|
||||
public class TenantedRoutingPage : BaseWebPage
|
||||
{
|
||||
public InstanceHandle Route { get; }
|
||||
public InstanceHandle ProcessedByCT { get; }
|
||||
public TenantedRoutingPage(InstanceHandle processedByCT)
|
||||
public TenantedRoutingPage(InstanceHandle route, InstanceHandle processedByCT)
|
||||
{
|
||||
this.Route = route;
|
||||
this.ProcessedByCT = processedByCT;
|
||||
}
|
||||
|
||||
protected override void CreateChildControls()
|
||||
protected override void OnInit(RenderEventArgs e)
|
||||
{
|
||||
base.CreateChildControls();
|
||||
base.OnInit(e);
|
||||
|
||||
Oms oms = ((MochaWebApplication)Application.Instance).Oms;
|
||||
|
||||
InstanceHandle r_Route__secured_to__Domain = oms.GetInstance(KnownRelationshipGuids.Route__secured_to__Domain);
|
||||
IEnumerable<InstanceHandle> i_Domains = oms.GetRelatedInstances(this.Route, r_Route__secured_to__Domain);
|
||||
if (i_Domains.Count() > 0)
|
||||
{
|
||||
InstanceHandle i_Domain_Anyone = oms.GetInstance(KnownInstanceGuids.SecurityDomains.Anyone);
|
||||
if (!i_Domains.Contains(i_Domain_Anyone))
|
||||
{
|
||||
// we have domains, and they are not Anyone
|
||||
// so we need to check that our current user is logged in and has the appropriate domain
|
||||
string tenantName = e.Context.Request.GetExtraData<string>("TenantName");
|
||||
if (!e.Context.Session.ContainsKey(tenantName + ".UserToken"))
|
||||
{
|
||||
e.Context.Response.Redirect("~/" + e.Context.Request.PathVariables["tenant"] + "/d/login.htmld");
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First();
|
||||
|
||||
InstanceHandle r_Tenant__has__Application = oms.GetInstance(KnownRelationshipGuids.Tenant__has__Application);
|
||||
InstanceHandle i_Application = oms.GetRelatedInstance(i_Tenant, r_Tenant__has__Application);
|
||||
|
||||
if (i_Application != InstanceHandle.Empty)
|
||||
{
|
||||
|
||||
InstanceHandle r_Application__has_title__Translation = oms.GetInstance(KnownRelationshipGuids.Application__has_title__Translation);
|
||||
string applicationTitle = oms.GetTranslationValue(i_Application, r_Application__has_title__Translation, "Mocha Application");
|
||||
Title = applicationTitle;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> GetStyleClasses()
|
||||
{
|
||||
return base.GetStyleClasses().Union([ "uwt-header-visible" ]);
|
||||
}
|
||||
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
base.CreateChildControls();
|
||||
|
||||
Oms oms = ((MochaWebApplication)Application.Instance).Oms;
|
||||
InstanceHandle usesBuildResponseMethodBinding = oms.GetRelatedInstance(ProcessedByCT, oms.GetInstance(KnownRelationshipGuids.Control_Transaction_Method__uses__Build_Response_Method_Binding));
|
||||
|
||||
InstanceHandle r_Tenant__has_mega__Menu = oms.GetInstance(KnownRelationshipGuids.Tenant__has_mega__Menu);
|
||||
|
||||
InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First();
|
||||
|
||||
InstanceHandle hasMegaMenu = oms.GetRelatedInstance(i_Tenant, r_Tenant__has_mega__Menu);
|
||||
|
||||
OmsContext context = oms.CreateContext();
|
||||
PageRenderer renderer = new PageRenderer(context);
|
||||
|
||||
HtmlGenericControl navTop = new HtmlGenericControl("div");
|
||||
navTop.ClassList.Add("uwt-page-header");
|
||||
|
||||
HtmlGenericControl itm = new HtmlGenericControl("div");
|
||||
itm.ClassList.Add("uwt-header-item");
|
||||
itm.ClassList.Add("uwt-applicationmenu");
|
||||
|
||||
Button btn = new Button();
|
||||
btn.DropDown = new Container()
|
||||
{
|
||||
Controls = [
|
||||
new Container("div", [ "uwt-layout-box uwt-orientation-vertical" ])
|
||||
{
|
||||
Controls = [
|
||||
new Container("div", [ "uwt-layout-item" ])
|
||||
{
|
||||
Controls = [ new Image("data:image/png;base64,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") ]
|
||||
},
|
||||
new Container("div", [ "uwt-layout-item" ])
|
||||
{
|
||||
Controls = [ new Label("User Nam") ]
|
||||
}
|
||||
]
|
||||
},
|
||||
new Menu([
|
||||
new CommandMenuItem("Settings"),
|
||||
new CommandMenuItem("Log Out", "~/d/logout.htmld")
|
||||
])
|
||||
]
|
||||
};
|
||||
itm.Controls.Add(btn);
|
||||
|
||||
navTop.Controls.Add(itm);
|
||||
|
||||
Controls.Add(navTop);
|
||||
|
||||
HtmlGenericControl divContent = new HtmlGenericControl("div");
|
||||
divContent.ClassList.Add("uwt-page-content");
|
||||
|
||||
InstanceHandle element = oms.Execute(context, usesBuildResponseMethodBinding);
|
||||
|
||||
// writer.WriteRaw(String.Format("<h1>Processed by CT: {0}</h1>", oms.GetInstanceText(ProcessedByCT)));
|
||||
// writer.WriteRaw(String.Format("<h1>Responds with Element: {0}</h1>", oms.GetInstanceText(element)));
|
||||
|
||||
Container ct = renderer.RenderElement(element);
|
||||
Controls.Add(ct);
|
||||
}
|
||||
divContent.Controls.Add(ct);
|
||||
|
||||
Controls.Add(divContent);
|
||||
|
||||
DockableContainer ctRightSidebar = new DockableContainer
|
||||
{
|
||||
Position = CardinalDirection.Right,
|
||||
Width = new Measurement(300, MeasurementUnit.Pixel)
|
||||
};
|
||||
ctRightSidebar.StyleProperties["background-color"] = "#ffffff";
|
||||
ctRightSidebar.StyleProperties["border-left"] = "1px solid #ccc";
|
||||
|
||||
ctRightSidebar.Controls.Add(new Heading(1, "Edit Page"));
|
||||
ctRightSidebar.Controls.Add(new FormView(new FormView.FormViewItem[]
|
||||
{
|
||||
new FormView.FormViewItem("Test Property", new TextBox())
|
||||
}));
|
||||
|
||||
Container ctButtonContainer = new Container();
|
||||
ctButtonContainer.StyleProperties["margin-top"] = "32px";
|
||||
ctButtonContainer.ClassList.Add("uwt-layout uwt-layout-box uwt-orientation-vertical uwt-spacing-eighth");
|
||||
|
||||
ctButtonContainer.Controls.Add(new Button("Clone Page"));
|
||||
ctButtonContainer.Controls.Add(new Button("Exit Edit Mode"));
|
||||
|
||||
ctRightSidebar.Controls.Add(ctButtonContainer);
|
||||
|
||||
Controls.Add(ctRightSidebar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -85,62 +85,154 @@ public abstract class MochaWebApplication : WebApplication
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
if (e.Context.Request.Path == "/favicon.ico")
|
||||
{
|
||||
string tenantName = "super";
|
||||
if (parts[1] != "madi")
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
tenantName = parts[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts[2] == "authgwy")
|
||||
string tenantName = "super";
|
||||
if (parts[1] != "madi")
|
||||
{
|
||||
tenantName = parts[3];
|
||||
tenantName = parts[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts[2] == "authgwy")
|
||||
{
|
||||
tenantName = parts[3];
|
||||
}
|
||||
}
|
||||
|
||||
e.Context.SetExtraData("TenantName", tenantName);
|
||||
|
||||
TenantHandle tenant = app.Oms.GetTenantByName(tenantName);
|
||||
if (tenant == TenantHandle.Empty)
|
||||
{
|
||||
UpdateRoutes(null, e.Server);
|
||||
|
||||
StreamWriter sw = new StreamWriter(e.Context.Response.Stream);
|
||||
sw.WriteLine("<h1>Not Found</h1>");
|
||||
sw.WriteLine("<p>The requested URL was not found on this server.</p>");
|
||||
sw.WriteLine("<p>Please contact your Mocha applications administrator for further assistance.</p>");
|
||||
sw.Flush();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateRoutes(tenantName, e.Server);
|
||||
|
||||
e.Context.Request.SetExtraData("TenantName", tenantName);
|
||||
|
||||
app.Oms.SelectTenant(tenant);
|
||||
}
|
||||
}
|
||||
|
||||
e.Context.Request.SetExtraData("TenantName", tenantName);
|
||||
|
||||
TenantHandle tenant = app.Oms.GetTenantByName(tenantName);
|
||||
if (tenant == TenantHandle.Empty)
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(e.Context.Response.Stream);
|
||||
sw.WriteLine("<h1>Not Found</h1>");
|
||||
sw.WriteLine("<p>The requested URL was not found on this server.</p>");
|
||||
sw.WriteLine("<p>Please contact your Mocha applications administrator for further assistance.</p>");
|
||||
sw.Flush();
|
||||
Oms.SelectTenant(Oms.GetTenantByName(parts[1]));
|
||||
InstanceHandle c_Tenant = Oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = Oms.GetInstancesOf(c_Tenant).First();
|
||||
|
||||
InstanceHandle r_Tenant__has_initiating__Route = Oms.GetInstance(KnownRelationshipGuids.Tenant__has_initiating__Route);
|
||||
|
||||
InstanceHandle i_Route = Oms.GetRelatedInstance(i_Tenant, r_Tenant__has_initiating__Route);
|
||||
if (i_Route != InstanceHandle.Empty)
|
||||
{
|
||||
string targetUrl = Oms.GetAttributeValue<string>(i_Route, Oms.GetInstance(KnownAttributeGuids.Text.TargetURL));
|
||||
e.Context.Response.Redirect(targetUrl.Replace("{tenant}", parts[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Context.Response.Redirect("~/" + parts[1] + "/d/home.htmld");
|
||||
}
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
app.Oms.SelectTenant(tenant);
|
||||
}
|
||||
}
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
Oms.SelectTenant(Oms.GetTenantByName(parts[1]));
|
||||
InstanceHandle c_Tenant = Oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = Oms.GetInstancesOf(c_Tenant).First();
|
||||
|
||||
InstanceHandle r_Tenant__has_initiating__Route = Oms.GetInstance(KnownRelationshipGuids.Tenant__has_initiating__Route);
|
||||
|
||||
InstanceHandle i_Route = Oms.GetRelatedInstance(i_Tenant, r_Tenant__has_initiating__Route);
|
||||
if (i_Route != InstanceHandle.Empty)
|
||||
{
|
||||
string targetUrl = Oms.GetAttributeValue<string>(i_Route, Oms.GetInstance(KnownAttributeGuids.Text.TargetURL));
|
||||
e.Context.Response.Redirect(targetUrl.Replace("{tenant}", parts[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Context.Response.Redirect("~/" + parts[1] + "/d/home.htmld");
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnServerCreated(WebServerCreatedEventArgs e)
|
||||
private void UpdateRoutes(string tenantName, WebServer server)
|
||||
{
|
||||
TenantHandle tenant = TenantHandle.Empty;
|
||||
if (tenantName != null)
|
||||
{
|
||||
tenant = Oms.GetTenantByName(tenantName);
|
||||
}
|
||||
|
||||
server.Routes.Clear();
|
||||
server.Routes.Add(new WebRoute("/favicon.ico", new WebHandler(delegate (WebContext ctx)
|
||||
{
|
||||
ctx.Response.ResponseCode = 200;
|
||||
ctx.Response.ResponseText = "OK";
|
||||
|
||||
string dataUri = /* data:image/png;base64, */ "iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAABoAAAAaAGj5no8AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABSVJREFUSImNlltsVVUQhv9Za+1bT0ugUDxU0UQkIYABIyEkkogPKgKiiMVQEQ0ookkTCwYhEetRTDARxaokEG9cFAQVUUQwMdoXoyICClg1xEgEmh6KxfacfVtrjQ+l9Vg56Dyu+ef7Z7L3XrOJmXHRIKLVs53xjqNGuMKpFY4ACXFKGHt88abOQ/gPAJXLP3MrXQqpHvF9p85VzhWOo+A4ElJKCEEgEAD8Zhk7TJy8sOC1/Kn/ZZDLkaD9aFSOetr33MDznDbX83Z5Un2jPNXlSgmSVEWgiQDfbi1fYrQJU20eP15zcm1TE9uyBi9NI++swBYpxZ2B750OAm+58jq3LlrP6Y7cWPcYjupSwIEHJzj5mkJ9au3qNNXZRKfb88ab39D8S/wvg1yOBPZjG4C6wPNaqnx/1kNvdf5ROtl1NOZGJd3JStjNk1cc+rk3ty83ttoa+34cp9dHcfLOT4NO1Pc28rfBrbQEjDVKyS8GJGZqwx7u66I09j8/cbhw3BYImhuQOjr64c+7AeCTl0Z6lHf2RnE6pRjHS+rXnngBAETfA2WsAtBW4ZrZ5eAA4FVW1mYC/8sBQXCN8sTo3vNbGn6JSYrZrqvaXKlWvd5weW2fgWY8CiAA4bHG7Xy2HPzH9dePzLju4orAG5ipDH4IKr2O0vzNTUfOKkcuV46s8MkuBQCRu4EUgHkATg+rxdZy8MOvTB4jlLfU81WSCYK1VRVOx/C79hzvrxuc9d+WQrQJoe7ZMYekEBmMAzAEwEeL1nN6IfjXL066hIkeUEKck0K9TwG3Vs14t/VC2msXfZsKgQ8FoaZ7UO04wYRRvZxy3Z9Lw26QOMjQG6HS1upb3vu9nBYA2NJXDMDCjBLMqOk5RXu5gpsePVwY/1DLRqQc44zMXwzeg7J5ZgbY1qhyos3zsxmvxp9YGQSrMhV+1g88BL4H64WIt0yDFALMHGmt9115774lpbVaGxhjYIwhRYQ8M0Di/CTnI/H5aaVtR6r1VXGSDhVSQBCBmaG1gRAEZlpnjB7WvzmjbY3WBtZwXhFwhAEwYxKAN/oMtO6SsbvdEVoJIZ4kIjAD2lgoqXsMwEOtMQf7G0SpnpRqjTSOj4mVu/E9CO0AZm6YQE7fmAnWJDpaE6apieIEYZwgDCMUwwiFYohCMTpVKMQjCt3px6XwDQ9OcJIkmZkkuv3sqOJhAWYG4w0A2dPDMLdX2LCl489Oxt1JlFRGUaLDMEYxjFEsRigWIxQKYVshDNtuWPnd4VIDByfr4zjNRnH6ZlMTWwEAkGgGEILxbG4qVfeKl72W71r4avvyKEruC8M46ek+QqEYcXcxRiEKF5TCN9172eAwCldHcdwdWtsMlFx2T82gpQw8B+CLaoupDXs4XnWbXOc66tNl78YfvLywptYjWyfJyZKkAxT7uzODNHUX0tWazWcDO8/sbXOr9iWpnpIkunHFzmTtPwxARLnpeAdAHRgtMLiDFGYxcLfrOq6jZJdSskOQSpREJYiGWvBgWP5Bw27g1DQlqZmSar3t8Q9tfe8q/fs7YGbMoXkogkC4EwpHAKxAATet2J3o3DQa4FVgCOCDrXPOV13FzCDozg6n3mjeqq3NWmu3VFvcX7qn/72Tieip6VjCQA5ABkAewE4AB4jxKwQqAQw8/1rPBJAF0EWElU/sRnP/n4CySz83jS4DoRGE+ei5DC8UpwFsgkRz0y7+f0u/f+yYQ7K1iPGWcTUIbk8RQgIOjcrgWN12Nher/wvVoI5LIvFkKAAAAABJRU5ErkJggg==";
|
||||
byte[] data = Convert.FromBase64String(dataUri);
|
||||
|
||||
ctx.Response.ContentType = "image/png";
|
||||
ctx.Response.Headers["Content-Length"] = data.Length.ToString();
|
||||
|
||||
ctx.Response.Stream.Write(data, 0, data.Length);
|
||||
})));
|
||||
|
||||
// ? this feels hacky... somehow it gets deselected
|
||||
// ? (probably due to Firefox fetching /robots.txt ...)
|
||||
Oms.SelectTenant(tenant);
|
||||
|
||||
IEnumerable<InstanceHandle> routes = [];
|
||||
if (tenant != TenantHandle.Empty)
|
||||
{
|
||||
InstanceHandle c_Route = Oms.GetInstance(KnownInstanceGuids.Classes.Route);
|
||||
routes = Oms.GetInstancesOf(c_Route);
|
||||
}
|
||||
|
||||
if (routes.Count() > 0)
|
||||
{
|
||||
Console.WriteLine("cup: using tenanted WebRoutes");
|
||||
foreach (InstanceHandle route in routes)
|
||||
{
|
||||
string targetUrl = Oms.GetAttributeValue<string>(route, Oms.GetInstance(KnownAttributeGuids.Text.TargetURL));
|
||||
InstanceHandle processedByCT = Oms.GetRelatedInstance(route, Oms.GetInstance(KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method));
|
||||
server.Routes.Add(new WebRoute(targetUrl, new TenantedRoutingPage(route, processedByCT)));
|
||||
}
|
||||
|
||||
// FIXME: hack
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld")));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/logout.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/logout.htmld")));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage()));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/proxy-login.htmld", new LoginWebPage(true)));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/signup.htmld", new LoginWebPage()));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/logout.htmld", new WebHandler(delegate (WebContext ctx)
|
||||
{
|
||||
ctx.Session.Clear();
|
||||
ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"]);
|
||||
})));
|
||||
server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler()));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler()));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("cup: no tenanted WebRoutes found; using hardcoded ones for now");
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/home.htmld", new HomeWebPage()));
|
||||
// server.Routes.Add(new WebRoute("/{tenant}/d/welcome.htmld", new WelcomePage()));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/signup.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/signup.htmld")));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld")));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/d/logout.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/logout.htmld")));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage()));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/proxy-login.htmld", new LoginWebPage(true)));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/signup.htmld", new LoginWebPage()));
|
||||
server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/logout.htmld", new WebHandler(delegate (WebContext ctx)
|
||||
{
|
||||
ctx.Session.Clear();
|
||||
ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"]);
|
||||
})));
|
||||
server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler()));
|
||||
server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler()));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnServerCreated(WebServerCreatedEventArgs e)
|
||||
{
|
||||
base.OnServerCreated(e);
|
||||
|
||||
@ -150,49 +242,7 @@ public abstract class MochaWebApplication : WebApplication
|
||||
// e.Server.Routes.Add(new WebRoute("/{tenant}", new RedirectWebHandler("~/{tenant}/d/home.htmld")));
|
||||
|
||||
// FIXME: these routes should be loaded from the tenant; requires Mocha.Web.mcl
|
||||
InstanceHandle c_Route = Oms.GetInstance(KnownInstanceGuids.Classes.Route);
|
||||
IEnumerable<InstanceHandle> routes = Oms.GetInstancesOf(c_Route);
|
||||
if (routes.Count() > 0)
|
||||
{
|
||||
Console.WriteLine("cup: using tenanted WebRoutes");
|
||||
foreach (InstanceHandle route in routes)
|
||||
{
|
||||
string targetUrl = Oms.GetAttributeValue<string>(route, Oms.GetInstance(KnownAttributeGuids.Text.TargetURL));
|
||||
InstanceHandle processedByCT = Oms.GetRelatedInstance(route, Oms.GetInstance(KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method));
|
||||
e.Server.Routes.Add(new WebRoute(targetUrl, new TenantedRoutingPage(processedByCT)));
|
||||
}
|
||||
|
||||
// FIXME: hack
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld")));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/logout.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/logout.htmld")));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage()));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/signup.htmld", new LoginWebPage()));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/logout.htmld", new WebHandler(delegate (WebContext ctx)
|
||||
{
|
||||
ctx.Session.Clear();
|
||||
ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"]);
|
||||
})));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler()));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler()));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("cup: no tenanted WebRoutes found; using hardcoded ones for now");
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/home.htmld", new HomeWebPage()));
|
||||
// e.Server.Routes.Add(new WebRoute("/{tenant}/d/welcome.htmld", new WelcomePage()));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/signup.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/signup.htmld")));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/login.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/login.htmld")));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/d/logout.htmld", new RedirectWebHandler("~/madi/authgwy/{tenant}/logout.htmld")));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/login.htmld", new LoginWebPage()));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/signup.htmld", new LoginWebPage()));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/authgwy/{tenant}/logout.htmld", new WebHandler(delegate (WebContext ctx)
|
||||
{
|
||||
ctx.Session.Clear();
|
||||
ctx.Response.Redirect("~/" + ctx.Request.PathVariables["tenant"]);
|
||||
})));
|
||||
e.Server.Routes.Add(new WebRoute("/madi/asset/{name}/{version}/{path}", new AssetWebHandler()));
|
||||
e.Server.Routes.Add(new WebRoute("/{tenant}/attachment/{iid}/{accesskey}", new AttachmentWebHandler()));
|
||||
}
|
||||
Console.WriteLine("Mocha User Interface Service started - http://localhost:{0}", DefaultPort);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using MBS.Web;
|
||||
using MBS.Web.UI.HtmlControls;
|
||||
using MBS.Web.UI.WebControls;
|
||||
using Mocha.Core;
|
||||
|
||||
@ -13,24 +14,64 @@ public class PageRenderer
|
||||
Context = context;
|
||||
}
|
||||
|
||||
private InstanceHandle do_NotEnterable, do_WideText;
|
||||
|
||||
public bool Initialized { get; private set; } = false;
|
||||
public void Initialize()
|
||||
{
|
||||
if (Initialized)
|
||||
return;
|
||||
|
||||
do_NotEnterable = Context.Oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.NotEnterable);
|
||||
do_WideText = Context.Oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.WideText);
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public Container RenderElement(InstanceHandle element)
|
||||
{
|
||||
Initialize();
|
||||
|
||||
Oms oms = Context.Oms;
|
||||
|
||||
Container ct = new Container();
|
||||
HtmlGenericControl table = new HtmlGenericControl("table");
|
||||
table.ClassList.Add("uwt-formview");
|
||||
|
||||
InstanceHandle r_Element__has__Element_Content = oms.GetInstance(KnownRelationshipGuids.Element__has__Element_Content);
|
||||
InstanceHandle r_Element_Content__has__Element_Content_Display_Option = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Element_Content_Display_Option);
|
||||
|
||||
IEnumerable<InstanceHandle> elementContents = oms.GetRelatedInstances(element, r_Element__has__Element_Content);
|
||||
foreach (InstanceHandle elementContent in elementContents)
|
||||
{
|
||||
Control ctl = RenderElementContent(elementContent);
|
||||
ct.Controls.Add(ctl);
|
||||
IEnumerable<InstanceHandle> displayOptions = oms.GetRelatedInstances(elementContent, r_Element_Content__has__Element_Content_Display_Option);
|
||||
HtmlGenericControl tr = new HtmlGenericControl("tr");
|
||||
tr.ClassList.Add("uwt-formview-item");
|
||||
|
||||
HtmlGenericControl tdContent = new HtmlGenericControl("td");
|
||||
tdContent.ClassList.Add("uwt-formview-item-content");
|
||||
|
||||
if (!displayOptions.Contains(do_WideText))
|
||||
{
|
||||
HtmlGenericControl tdLabel = new HtmlGenericControl("td");
|
||||
tdLabel.ClassList.Add("uwt-formview-item-label");
|
||||
tdLabel.Controls.Add(new Label("Control Label"));
|
||||
tr.Controls.Add(tdLabel);
|
||||
}
|
||||
else
|
||||
{
|
||||
tdContent.Attributes["colspan"] = "2";
|
||||
}
|
||||
|
||||
Control ctl = RenderElementContent(elementContent, displayOptions);
|
||||
tdContent.Controls.Add(ctl);
|
||||
tr.Controls.Add(tdContent);
|
||||
|
||||
table.Controls.Add(tr);
|
||||
}
|
||||
return ct;
|
||||
return table;
|
||||
}
|
||||
|
||||
private Control RenderElementContent(InstanceHandle elementContent)
|
||||
private Control RenderElementContent(InstanceHandle elementContent, IEnumerable<InstanceHandle> displayOptions)
|
||||
{
|
||||
Oms oms = Context.Oms;
|
||||
|
||||
@ -39,21 +80,37 @@ public class PageRenderer
|
||||
InstanceHandle c_NumericAttribute = oms.GetInstance(KnownInstanceGuids.Classes.NumericAttribute);
|
||||
InstanceHandle c_DateAttribute = oms.GetInstance(KnownInstanceGuids.Classes.DateAttribute);
|
||||
|
||||
InstanceHandle r_Element_Content__has__Element_Content_Display_Option = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Element_Content_Display_Option);
|
||||
InstanceHandle r_Element_Content__has__Instance = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Instance);
|
||||
|
||||
IEnumerable<InstanceHandle> displayOptions = oms.GetRelatedInstances(elementContent, r_Element_Content__has__Element_Content_Display_Option);
|
||||
InstanceHandle ecInstance = oms.GetRelatedInstance(elementContent, r_Element_Content__has__Instance);
|
||||
|
||||
Control? ctl = null;
|
||||
if (oms.IsInstanceOf(ecInstance, c_TextAttribute))
|
||||
{
|
||||
InstanceHandle a_Value = oms.GetInstance(KnownAttributeGuids.Text.Value);
|
||||
|
||||
TextBox ctl = new TextBox();
|
||||
ctl.Value = oms.GetAttributeValue<string>(ecInstance, a_Value);
|
||||
return ctl;
|
||||
InstanceHandle r_Derived_Element_Content__update_with__Executable_returning_Work_Data = oms.GetInstance(KnownRelationshipGuids.Derived_Element_Content__update_with__Executable_returning_Work_Data);
|
||||
InstanceHandle updateWithERWD = oms.GetRelatedInstance(elementContent, r_Derived_Element_Content__update_with__Executable_returning_Work_Data);
|
||||
if (updateWithERWD != InstanceHandle.Empty)
|
||||
{
|
||||
InstanceHandle workdata = oms.Execute(Context, updateWithERWD);
|
||||
string value = Context.GetWorkData<string>(workdata);
|
||||
if (displayOptions.Contains(do_NotEnterable))
|
||||
{
|
||||
Literal lbl = new Literal(value);
|
||||
ctl = lbl;
|
||||
}
|
||||
else
|
||||
{
|
||||
TextBox txt = new TextBox();
|
||||
txt.Value = value;
|
||||
ctl = txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Label(String.Format("No implementaton for EC instance type {0}", oms.GetGlobalIdentifier(oms.GetParentClass(ecInstance))));
|
||||
if (ctl == null)
|
||||
{
|
||||
ctl = new Label(String.Format("No implementaton for EC instance type {0}", oms.GetGlobalIdentifier(oms.GetParentClass(ecInstance))));
|
||||
}
|
||||
return ctl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,13 +58,27 @@ public class Program : MochaWebApplication
|
||||
|
||||
TenantHandle t_super = oms.GetTenantByName("super");
|
||||
{
|
||||
// FIXME! : selecting tenant doesn't seem to be working, routes get overwritten / not created
|
||||
oms.SelectTenant(t_super);
|
||||
|
||||
InstanceHandle c_Application = oms.GetInstance(KnownInstanceGuids.Classes.Application);
|
||||
InstanceHandle i_Application = oms.CreateInstanceOf(c_Application, new Guid("{773f6c6e-6cef-4a04-b333-ac097c0ab705}"));
|
||||
|
||||
InstanceHandle c_Alerynn_Test_Class = oms.CreateClass("Alerynn Test Class", new Guid("{bb1b32ff-55fe-4de7-a0c4-2e0a9d8de63b}"));
|
||||
InstanceHandle i_Alerynn_Test_Class = oms.CreateInstanceOf(c_Alerynn_Test_Class, new Guid("{d82182d5-451c-453f-9635-af07305b10ee}"));
|
||||
|
||||
InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First();
|
||||
InstanceHandle r_Tenant__has__Application = oms.GetInstance(KnownRelationshipGuids.Tenant__has__Application);
|
||||
oms.AssignRelationship(i_Tenant, r_Tenant__has__Application, c_Application);
|
||||
|
||||
InstanceHandle i_English = oms.GetInstance(KnownInstanceGuids.Languages.English);
|
||||
InstanceHandle r_Tenant__has_login_header__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation);
|
||||
InstanceHandle r_Tenant__has_login_footer__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_footer__Translation);
|
||||
|
||||
InstanceHandle r_Application__has_title__Translation = oms.GetInstance(KnownRelationshipGuids.Application__has_title__Translation);
|
||||
oms.SetTranslationValue(i_Application, r_Application__has_title__Translation, i_English, "Mocha super");
|
||||
|
||||
oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_header__Translation, i_English, "Welcome to your New Tenant");
|
||||
oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_footer__Translation, i_English, "Please enter your user name and password to continue.");
|
||||
|
||||
@ -73,6 +87,68 @@ public class Program : MochaWebApplication
|
||||
|
||||
InstanceHandle i_User1 = oms.CreateInstanceOf(c_User);
|
||||
oms.SetAttributeValue(i_User1, a_UserName, "superuser");
|
||||
|
||||
InstanceHandle a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||
InstanceHandle a_Value = oms.GetInstance(KnownAttributeGuids.Text.Value);
|
||||
|
||||
OmsMethodBuilder mb = new OmsMethodBuilder(oms);
|
||||
BuildAttributeMethod ba = mb.CreateBuildAttributeMethod(c_Alerynn_Test_Class, "get", "Welcome Message", AccessModifier.Public, true, a_Value, "This is the Super User tenant");
|
||||
ReturnAttributeMethodBinding ba_ramb = ba.CreateMethodBinding(oms);
|
||||
|
||||
|
||||
// create the Welcome Page for Alerynn: Infinite Universe
|
||||
InstanceHandle c_TextAttribute = oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute);
|
||||
InstanceHandle c_Element = oms.GetInstance(KnownInstanceGuids.Classes.Element);
|
||||
InstanceHandle c_DerivedElementContent = oms.GetInstance(KnownInstanceGuids.Classes.DerivedElementContent);
|
||||
|
||||
InstanceHandle a_AlerynnWelcome1 = oms.CreateInstanceOf(c_TextAttribute);
|
||||
// oms.SetAttributeValue(a_AlerynnWelcome1, a_Value, "Welcome to Alerynn: Infinite Universe!");
|
||||
|
||||
InstanceHandle r_Element__has__Element_Content = oms.GetInstance(KnownRelationshipGuids.Element__has__Element_Content);
|
||||
InstanceHandle r_Element_Content__has__Instance = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Instance);
|
||||
InstanceHandle r_Derived_Element_Content__has__Derived_EC_Display_Option = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Element_Content_Display_Option);
|
||||
|
||||
InstanceHandle el_AlerynnWelcome1 = oms.CreateInstanceOf(c_Element);
|
||||
oms.SetAttributeValue(el_AlerynnWelcome1, a_Name, "alerynn welcome page");
|
||||
|
||||
InstanceHandle do_WideText = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.WideText);
|
||||
InstanceHandle do_NotEnterable = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.NotEnterable);
|
||||
InstanceHandle do_Required = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.Required);
|
||||
|
||||
InstanceHandle ec_AlerynnWelcome1 = oms.CreateInstanceOf(c_DerivedElementContent);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, r_Element_Content__has__Instance, a_AlerynnWelcome1);
|
||||
oms.AssignRelationship(el_AlerynnWelcome1, r_Element__has__Element_Content, ec_AlerynnWelcome1);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, oms.GetInstance(KnownRelationshipGuids.Derived_Element_Content__update_with__Executable_returning_Work_Data), ba_ramb.Handle);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, r_Derived_Element_Content__has__Derived_EC_Display_Option, new InstanceHandle[]
|
||||
{
|
||||
do_WideText,
|
||||
do_NotEnterable,
|
||||
// do_Required
|
||||
});
|
||||
|
||||
BuildUIResponseMethod buir = mb.CreateBuildUIResponseMethod(c_Tenant, String.Empty, "Welcome Page", AccessModifier.Public, true, el_AlerynnWelcome1);
|
||||
BuildResponseMethodBinding brmb = buir.CreateMethodBinding(oms);
|
||||
|
||||
ControlTransactionMethod ct = mb.CreateControlTransactionMethod(c_Tenant, String.Empty, "Welcome Page", AccessModifier.Public, true, InstanceHandle.Empty, brmb);
|
||||
|
||||
InstanceHandle r_Route__processed_by__Control_Transaction_Method = oms.GetInstance(KnownRelationshipGuids.Route__processed_by__Control_Transaction_Method);
|
||||
|
||||
InstanceHandle a_TargetURL = oms.GetInstance(KnownAttributeGuids.Text.TargetURL);
|
||||
InstanceHandle c_Route = oms.GetInstance(KnownInstanceGuids.Classes.Route);
|
||||
|
||||
InstanceHandle route = oms.CreateInstanceOf(c_Route);
|
||||
|
||||
oms.SetAttributeValue(route, a_TargetURL, "/{tenant}/d/home.htmld");
|
||||
|
||||
InstanceHandle i_Domain_Anyone = oms.GetInstance(KnownInstanceGuids.SecurityDomains.Anyone);
|
||||
InstanceHandle i_Domain_AuthenticatedUsers = oms.GetInstance(KnownInstanceGuids.SecurityDomains.AuthenticatedUsers);
|
||||
InstanceHandle r_Route__secured_to__Domain = oms.GetInstance(KnownRelationshipGuids.Route__secured_to__Domain);
|
||||
oms.AssignRelationship(route, r_Route__secured_to__Domain, [i_Domain_AuthenticatedUsers]);
|
||||
|
||||
oms.AssignRelationship(route, r_Route__processed_by__Control_Transaction_Method, ct.Handle);
|
||||
|
||||
InstanceHandle r_Tenant__has_initiating__Route = oms.GetInstance(KnownRelationshipGuids.Tenant__has_initiating__Route);
|
||||
oms.AssignRelationship(i_Tenant, r_Tenant__has_initiating__Route, route);
|
||||
}
|
||||
|
||||
TenantHandle t_wdoms = oms.CreateTenant("wdoms");
|
||||
@ -97,16 +173,34 @@ public class Program : MochaWebApplication
|
||||
TenantHandle t_alerynn1 = oms.CreateTenant("alerynn");
|
||||
{
|
||||
oms.SelectTenant(t_alerynn1);
|
||||
|
||||
InstanceHandle c_Application = oms.GetInstance(KnownInstanceGuids.Classes.Application);
|
||||
InstanceHandle i_Application = oms.CreateInstanceOf(c_Application, new Guid("{32582607-1198-4e11-a283-b7f56e26f164}"));
|
||||
|
||||
InstanceHandle c_Alerynn_Test_Class = oms.CreateClass("Alerynn Test Class", new Guid("{bb1b32ff-55fe-4de7-a0c4-2e0a9d8de63b}"));
|
||||
InstanceHandle i_Alerynn_Test_Class = oms.CreateInstanceOf(c_Alerynn_Test_Class, new Guid("{d82182d5-451c-453f-9635-af07305b10ee}"));
|
||||
|
||||
InstanceHandle c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
InstanceHandle i_Tenant = oms.GetInstancesOf(c_Tenant).First();
|
||||
InstanceHandle i_English = oms.GetInstance(KnownInstanceGuids.Languages.English);
|
||||
InstanceHandle r_Tenant__has_login_header__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation);
|
||||
InstanceHandle r_Tenant__has_login_footer__Translation = oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_footer__Translation);
|
||||
|
||||
InstanceHandle r_Application__has_title__Translation = oms.GetInstance(KnownRelationshipGuids.Application__has_title__Translation);
|
||||
InstanceHandle r_Tenant__has__Application = oms.GetInstance(KnownRelationshipGuids.Tenant__has__Application);
|
||||
oms.SetTranslationValue(i_Application, r_Application__has_title__Translation, i_English, "Alerynn: Infinite Universe");
|
||||
oms.AssignRelationship(i_Tenant, r_Tenant__has__Application, i_Application);
|
||||
|
||||
oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_header__Translation, i_English, "Alerynn: Infinite Universe");
|
||||
oms.SetTranslationValue(i_Tenant, r_Tenant__has_login_footer__Translation, i_English, "Welcome to the Nest!");
|
||||
|
||||
InstanceHandle a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||
InstanceHandle a_Value = oms.GetInstance(KnownAttributeGuids.Text.Value);
|
||||
|
||||
OmsMethodBuilder mb = new OmsMethodBuilder(oms);
|
||||
BuildAttributeMethod ba = mb.CreateBuildAttributeMethod(c_Alerynn_Test_Class, "get", "Welcome Message", AccessModifier.Public, true, a_Value, "Welcome to Alerynn: Infinite Universe!");
|
||||
ReturnAttributeMethodBinding ba_ramb = ba.CreateMethodBinding(oms);
|
||||
|
||||
|
||||
InstanceHandle c_User = oms.GetInstance(KnownInstanceGuids.Classes.User);
|
||||
InstanceHandle a_UserName = oms.GetInstance(KnownAttributeGuids.Text.UserName);
|
||||
@ -119,21 +213,32 @@ public class Program : MochaWebApplication
|
||||
// create the Welcome Page for Alerynn: Infinite Universe
|
||||
InstanceHandle c_TextAttribute = oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute);
|
||||
InstanceHandle c_Element = oms.GetInstance(KnownInstanceGuids.Classes.Element);
|
||||
InstanceHandle c_ElementContent = oms.GetInstance(KnownInstanceGuids.Classes.ElementContent);
|
||||
InstanceHandle c_DerivedElementContent = oms.GetInstance(KnownInstanceGuids.Classes.DerivedElementContent);
|
||||
|
||||
InstanceHandle a_AlerynnWelcome1 = oms.CreateInstanceOf(c_TextAttribute);
|
||||
// oms.SetAttributeValue(a_AlerynnWelcome1, a_Value, "Welcome to Alerynn: Infinite Universe!");
|
||||
|
||||
InstanceHandle r_Element__has__Element_Content = oms.GetInstance(KnownRelationshipGuids.Element__has__Element_Content);
|
||||
InstanceHandle r_Element_Content__has__Instance = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Instance);
|
||||
InstanceHandle r_Derived_Element_Content__has__Derived_EC_Display_Option = oms.GetInstance(KnownRelationshipGuids.Element_Content__has__Element_Content_Display_Option);
|
||||
|
||||
InstanceHandle el_AlerynnWelcome1 = oms.CreateInstanceOf(c_Element);
|
||||
oms.SetAttributeValue(el_AlerynnWelcome1, a_Name, "alerynn welcome page");
|
||||
|
||||
InstanceHandle ec_AlerynnWelcome1 = oms.CreateInstanceOf(c_ElementContent);
|
||||
InstanceHandle do_WideText = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.WideText);
|
||||
InstanceHandle do_NotEnterable = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.NotEnterable);
|
||||
InstanceHandle do_Required = oms.GetInstance(KnownInstanceGuids.ElementContentDisplayOptions.Required);
|
||||
|
||||
InstanceHandle ec_AlerynnWelcome1 = oms.CreateInstanceOf(c_DerivedElementContent);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, r_Element_Content__has__Instance, a_AlerynnWelcome1);
|
||||
oms.AssignRelationship(el_AlerynnWelcome1, r_Element__has__Element_Content, ec_AlerynnWelcome1);
|
||||
|
||||
OmsMethodBuilder mb = new OmsMethodBuilder(oms);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, oms.GetInstance(KnownRelationshipGuids.Derived_Element_Content__update_with__Executable_returning_Work_Data), ba_ramb.Handle);
|
||||
oms.AssignRelationship(ec_AlerynnWelcome1, r_Derived_Element_Content__has__Derived_EC_Display_Option, new InstanceHandle[]
|
||||
{
|
||||
do_WideText,
|
||||
do_NotEnterable,
|
||||
// do_Required
|
||||
});
|
||||
|
||||
BuildUIResponseMethod buir = mb.CreateBuildUIResponseMethod(c_Tenant, String.Empty, "Welcome Page", AccessModifier.Public, true, el_AlerynnWelcome1);
|
||||
BuildResponseMethodBinding brmb = buir.CreateMethodBinding(oms);
|
||||
@ -149,6 +254,11 @@ public class Program : MochaWebApplication
|
||||
|
||||
oms.SetAttributeValue(route, a_TargetURL, "/{tenant}/d/welcome.htmld");
|
||||
|
||||
InstanceHandle i_Domain_Anyone = oms.GetInstance(KnownInstanceGuids.SecurityDomains.Anyone);
|
||||
InstanceHandle i_Domain_AuthenticatedUsers = oms.GetInstance(KnownInstanceGuids.SecurityDomains.AuthenticatedUsers);
|
||||
InstanceHandle r_Route__secured_to__Domain = oms.GetInstance(KnownRelationshipGuids.Route__secured_to__Domain);
|
||||
oms.AssignRelationship(route, r_Route__secured_to__Domain, [i_Domain_Anyone]);
|
||||
|
||||
oms.AssignRelationship(route, r_Route__processed_by__Control_Transaction_Method, ct.Handle);
|
||||
|
||||
InstanceHandle r_Tenant__has_initiating__Route = oms.GetInstance(KnownRelationshipGuids.Tenant__has_initiating__Route);
|
||||
|
||||
1
mocha-dotnet/src/app/Mocha.ServerApplication/assets
Symbolic link
1
mocha-dotnet/src/app/Mocha.ServerApplication/assets
Symbolic link
@ -0,0 +1 @@
|
||||
/home/beckermj/Documents/Projects/mochapowered/mocha-dotnet/mocha-dotnet/src/app/Mocha.ServerApplication/bin/Debug/net8.0/assets
|
||||
@ -2,7 +2,7 @@ function Button(parentElement)
|
||||
{
|
||||
this.ParentElement = parentElement;
|
||||
|
||||
if (this.ParentElement.tagName == "A")
|
||||
if (this.ParentElement.tagName.toLowerCase() == "a")
|
||||
{
|
||||
console.log(parentElement);
|
||||
this.ParentElement.addEventListener("click", function(e)
|
||||
@ -17,6 +17,24 @@ function Button(parentElement)
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (this.ParentElement.tagName.toLowerCase() == "div")
|
||||
{
|
||||
this.DropDownButtonElement = this.ParentElement.children[1];
|
||||
this.DropDownContentElement = this.ParentElement.children[2];
|
||||
this.DropDownButtonElement.NativeObject = this;
|
||||
|
||||
this.DropDownButtonElement.addEventListener("click", function (e)
|
||||
{
|
||||
System.ClassList.Toggle(this.NativeObject.DropDownContentElement, "uwt-visible");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("unknown parent element tag: '" + this.ParentElement.tagName + "'");
|
||||
}
|
||||
return;
|
||||
|
||||
this.ButtonElement = this.ParentElement.children[0];
|
||||
|
||||
81
mocha-dotnet/src/assets/ui-html/css/common/uwt-dockable.less
Normal file
81
mocha-dotnet/src/assets/ui-html/css/common/uwt-dockable.less
Normal file
@ -0,0 +1,81 @@
|
||||
.uwt-dockable
|
||||
{
|
||||
position: fixed;
|
||||
z-index: 5;
|
||||
|
||||
&> div.uwt-gripper
|
||||
{
|
||||
position: absolute;
|
||||
padding: 2px;
|
||||
background-color: #ccc;
|
||||
&:hover
|
||||
{
|
||||
background-color: #aaa;
|
||||
}
|
||||
&:active
|
||||
{
|
||||
background-color: #333;
|
||||
}
|
||||
}
|
||||
&.uwt-dock-left
|
||||
{
|
||||
left: 0px;
|
||||
right: auto;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
&> div.uwt-gripper
|
||||
{
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
}
|
||||
&.uwt-dock-top
|
||||
{
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
bottom: auto;
|
||||
&> div.uwt-gripper
|
||||
{
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
}
|
||||
&.uwt-dock-right
|
||||
{
|
||||
left: auto;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
&> div.uwt-gripper
|
||||
{
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
}
|
||||
&.uwt-dock-bottom
|
||||
{
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
top: auto;
|
||||
bottom: 0px;
|
||||
&> div.uwt-gripper
|
||||
{
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
left: 0px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
}
|
||||
|
||||
&> div.uwt-header, &> div.uwt-content
|
||||
{
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
@ -4,15 +4,48 @@ div.uwt-layout.uwt-layout-box
|
||||
&.uwt-orientation-horizontal
|
||||
{
|
||||
flex-direction: row;
|
||||
&.uwt-spacing-eighth > *
|
||||
{
|
||||
margin-right: 4.5px;
|
||||
}
|
||||
&.uwt-spacing-quarter > *
|
||||
{
|
||||
margin-right: 9px;
|
||||
}
|
||||
&.uwt-spacing-half > *
|
||||
{
|
||||
margin-right: 18px;
|
||||
}
|
||||
&.uwt-spacing-whole > *
|
||||
{
|
||||
margin-right: 36px;
|
||||
}
|
||||
}
|
||||
&.uwt-orientation-vertical
|
||||
{
|
||||
flex-direction: column;
|
||||
&.uwt-spacing-eighth > *
|
||||
{
|
||||
margin-bottom: 4.5px;
|
||||
}
|
||||
&.uwt-spacing-quarter > *
|
||||
{
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
&.uwt-spacing-half > *
|
||||
{
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
&.uwt-spacing-whole > *
|
||||
{
|
||||
margin-bottom: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
&> div.uwt-layout-item
|
||||
&> *
|
||||
{
|
||||
flex-grow: 1;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
justify-content: center;
|
||||
|
||||
23
mocha-dotnet/src/assets/ui-html/css/suv.css
Normal file
23
mocha-dotnet/src/assets/ui-html/css/suv.css
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
*
|
||||
* This file is part of Mocha.NET.
|
||||
*
|
||||
* Mocha.NET 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.
|
||||
*
|
||||
* Mocha.NET 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 Mocha.NET. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
body
|
||||
{
|
||||
background-image: linear-gradient(90deg, #804b00, #da9e45);
|
||||
}
|
||||
BIN
mocha-dotnet/src/assets/ui-html/images/mocha-24x24.png
Normal file
BIN
mocha-dotnet/src/assets/ui-html/images/mocha-24x24.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
16
mocha-dotnet/src/assets/ui-html/images/mocha.svg
Normal file
16
mocha-dotnet/src/assets/ui-html/images/mocha.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 13 KiB |
@ -57,6 +57,7 @@ namespace Mocha.Core
|
||||
public static Guid RenderAsText { get; } = new Guid("{15dd9e49-ab6d-44f0-9039-27af81736406}");
|
||||
public static Guid UseAnyCondition { get; } = new Guid("{31a8a2c2-1f55-4dfe-b177-427a2219ef8c}");
|
||||
public static Guid ValidateOnlyOnSubmit { get; } = new Guid("{400fcd8e-823b-4f4a-aa38-b444f763259b}");
|
||||
public static Guid UserIsLoggedIn { get; } = new Guid("{8e93d9f3-a897-4c97-935c-b3427f90633b}");
|
||||
}
|
||||
public static class Numeric
|
||||
{
|
||||
|
||||
@ -40,6 +40,7 @@ namespace Mocha.Core
|
||||
|
||||
public static Guid Element { get; } = new Guid("{91929595-3dbd-4eae-8add-6120a49797c7}");
|
||||
public static Guid ElementContent { get; } = new Guid("{f85d4f5e-c69f-4498-9913-7a8554e233a4}");
|
||||
public static Guid DerivedElementContent { get; } = new Guid("{6c0b11ff-fea0-4376-a58a-e993fddd2f39}");
|
||||
|
||||
public static Guid OMS { get; } = new Guid("{1ddf9a56-ebb8-4992-ab68-1820acf6bfc8}");
|
||||
|
||||
@ -125,10 +126,13 @@ namespace Mocha.Core
|
||||
public static Guid User { get; } = new Guid("{9C6871C1-9A7F-4A3A-900E-69D1D9E24486}");
|
||||
public static Guid UserLogin { get; } = new Guid("{64F4BCDB-38D0-4373-BA30-8AE99AF1A5F7}");
|
||||
|
||||
public static Guid Menu { get; } = new Guid("{c952ef83-af18-4512-9dd9-0f00a19d399c}");
|
||||
public static Guid MenuItem { get; } = new Guid("{f606f612-2d12-4600-bee1-a071d1019ffe}");
|
||||
public static Guid MenuItemCommand { get; } = new Guid("{9D3EDE23-6DB9-4664-9145-ABCBD3A0A2C2}");
|
||||
public static Guid MenuItemSeparator { get; } = new Guid("{798DECAB-5119-49D7-B0AD-D4BF45807188}");
|
||||
public static Guid MenuItemHeader { get; } = new Guid("{1F148873-8A97-4409-A79B-C19D5D380CA4}");
|
||||
public static Guid MenuItemInstance { get; } = new Guid("{6E3AA9AF-96B9-4208-BEA9-291A72C68418}");
|
||||
public static Guid MenuItemGroup { get; } = new Guid("{d7765a47-0740-41aa-b207-b2b826802ae7}");
|
||||
|
||||
public static Guid Style { get; } = new Guid("{A48C843A-B24B-4BC3-BE6F-E2D069229B0A}");
|
||||
public static Guid StyleRule { get; } = new Guid("{C269A1F3-E014-4230-B78D-38EAF6EA8A81}");
|
||||
@ -157,6 +161,7 @@ namespace Mocha.Core
|
||||
|
||||
public static Guid AuditLine { get; } = new Guid("{a4124a76-02f6-406a-9583-a197675b493b}");
|
||||
|
||||
public static Guid Application { get; } = new Guid("{06b6e9bc-812d-49fa-aab2-33654069f815}");
|
||||
public static Guid Theme { get; } = new Guid("{7c2cc4b5-8323-4478-863b-1759d7adf62e}");
|
||||
|
||||
public static Guid CommonText { get; } = new Guid("{a48a5fb2-f80c-47f9-bc47-7adef34d061b}");
|
||||
@ -175,6 +180,8 @@ namespace Mocha.Core
|
||||
|
||||
public static Guid Route { get; } = new Guid("{6c589422-3f1e-4402-afc7-27b6956aa588}");
|
||||
public static Guid RouteTable { get; } = new Guid("{76e5ce90-5f64-4355-a0ee-f659cf615a63}");
|
||||
|
||||
public static Guid Domain { get; } = new Guid("{49bbe159-0901-4788-b683-fd8f6d41b222}");
|
||||
}
|
||||
public static class Methods
|
||||
{
|
||||
@ -186,6 +193,7 @@ namespace Mocha.Core
|
||||
{
|
||||
public static Guid Tenant__get__Current_Tenant { get; } = new Guid("{22ec44d5-bede-48bb-96ca-03481611422c}");
|
||||
public static Guid Instance__get__This_Instance { get; } = new Guid("{d78fe3ca-3c15-41a0-bccf-0a701b4712a4}");
|
||||
public static Guid User__get__Current_User { get; } = new Guid("{e019824e-4174-4756-9d3b-e03dbc8e80cd}");
|
||||
}
|
||||
public static class GetRelationship
|
||||
{
|
||||
@ -274,6 +282,7 @@ namespace Mocha.Core
|
||||
{
|
||||
public static Guid GetRuntimeVersion { get; } = new Guid("{dc4e6c8d-936d-457f-90e9-af47e229b80c}");
|
||||
// public static Guid SystemInstanceSetRoutine { get; } = new Guid("{d17a6d27-da03-4b5d-9256-f67f978f403d}");
|
||||
public static Guid GetCurrentUser { get; } = new Guid("{9ee8edda-aa1b-4766-8c31-1331be5ffb41}");
|
||||
}
|
||||
public static class PromptValueClasses
|
||||
{
|
||||
|
||||
@ -78,6 +78,9 @@ namespace Mocha.Core
|
||||
public static Guid Translation_Value__has__Language { get; } = new Guid("{3655AEC2-E2C9-4DDE-8D98-0C4D3CE1E569}");
|
||||
public static Guid Language__for__Translation_Value { get; } = new Guid("{bf885bb1-da84-447c-95dc-143ce9deac65}");
|
||||
|
||||
public static Guid Application__has_title__Translation { get; } = new Guid("{17e7437a-95bb-472f-a068-c433b715c3e4}");
|
||||
public static Guid Translation__title_for__Application { get; } = new Guid("{79aca30e-ddf9-4d3b-8be7-80b4aaf82c1f}");
|
||||
|
||||
public static Guid String__has__String_Component { get; } = new Guid("{3B6C4C25-B7BC-4242-8ED1-BA6D01B834BA}");
|
||||
public static Guid Extract_Single_Instance_String_Component__has__Relationship { get; } = new Guid("{5E499753-F50F-4A9E-BF53-DC013820499C}");
|
||||
public static Guid Instance_Attribute_String_Component__has__Attribute { get; } = new Guid("{E15D4277-69FB-4F19-92DB-8D087F361484}");
|
||||
@ -146,6 +149,12 @@ namespace Mocha.Core
|
||||
public static Guid Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine { get; } = new Guid("{f7aaac2c-0bfd-4b31-8c8c-3a76e9522574}");
|
||||
public static Guid System_Attribute_Routine__used_by__Get_Attribute_by_System_Routine_Method { get; } = new Guid("{57b3a574-9f0c-4723-a32f-bde523d7e773}");
|
||||
|
||||
public static Guid Get_Instance_Set_by_System_Routine_Method__returns__Work_Set { get; } = new Guid("{595f738c-1c44-401b-ac5f-4fc596d658e3}");
|
||||
public static Guid Work_Set__returned_by__Get_Instance_Set_by_System_Routine_Method { get; } = new Guid("{a9a7ba49-46b2-4cf0-9e9b-86e1841a75f7}");
|
||||
public static Guid Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine { get; } = new Guid("{085bd706-eece-4604-ac04-b7af114d1d21}");
|
||||
public static Guid System_Instance_Set_Routine__used_by__Get_Instance_Set_by_System_Routine_Method { get; } = new Guid("{6fb6534c-2a46-4d6d-b9df-fd581f19efed}");
|
||||
|
||||
|
||||
public static Guid Get_Referenced_Instance_Set_Method__loop_on__Instance_Set { get; } = new Guid("{2978238f-7cb0-4ba3-8c6f-473df782cfef}");
|
||||
public static Guid Get_Referenced_Instance_Set_Method__has_relationship__Method { get; } = new Guid("{6a65819e-c8cb-4575-9af8-ee221364049b}");
|
||||
|
||||
@ -198,14 +207,17 @@ namespace Mocha.Core
|
||||
|
||||
|
||||
public static Guid Tenant__has__Application { get; } = new Guid("{22936f51-2629-4503-a30b-a02d61a6c0e0}");
|
||||
public static Guid Application__for__Tenant { get; } = new Guid("{c4ac2f1f-56c8-496f-9f93-3a0a2bb9a54c}");
|
||||
|
||||
public static Guid Tenant__has_sidebar__Menu_Item { get; } = new Guid("{D62DFB9F-48D5-4697-AAAD-1CAD0EA7ECFA}");
|
||||
public static Guid Tenant__has__Tenant_Type { get; } = new Guid("{E94B6C9D-3307-4858-9726-F24B7DB21E2D}");
|
||||
|
||||
public static Guid Tenant__has_company_logo_image__File { get; } = new Guid("{3540c81c-b229-4eac-b9b5-9d4b4c6ad1eb}");
|
||||
|
||||
public static Guid Menu__has__Menu_Section { get; } = new Guid("{a22d949f-f8d1-4dcc-a3eb-d9f910228dfd}");
|
||||
public static Guid Menu_Item__has_title__Translatable_Text_Constant { get; } = new Guid("{65E3C87E-A2F7-4A33-9FA7-781EFA801E02}");
|
||||
public static Guid Menu_Section__has__Menu_Item { get; } = new Guid("{5b659d7c-58f9-453c-9826-dd3205c3c97f}");
|
||||
|
||||
public static Guid Menu__has__Menu_Item { get; } = new Guid("{5b659d7c-58f9-453c-9826-dd3205c3c97f}");
|
||||
public static Guid Menu_Item__for__Menu { get; } = new Guid("{a22d949f-f8d1-4dcc-a3eb-d9f910228dfd}");
|
||||
|
||||
public static Guid Command_Menu_Item__has__Icon { get; } = new Guid("{8859DAEF-01F7-46FA-8F3E-7B2F28E0A520}");
|
||||
|
||||
@ -246,7 +258,9 @@ namespace Mocha.Core
|
||||
public static Guid Tenant__has_login_header__Translation { get; } = new Guid("{41D66ACB-AFDE-4B6F-892D-E66255F10DEB}");
|
||||
public static Guid Tenant__has_login_footer__Translation { get; } = new Guid("{A6203B6B-5BEB-4008-AE49-DB5E7DDBA45B}");
|
||||
public static Guid Tenant__has_application_title__Translation { get; } = new Guid("{76683437-67ba-46d9-a5e7-2945be635345}");
|
||||
|
||||
public static Guid Tenant__has_mega__Menu { get; } = new Guid("{cdd743cb-c74a-4671-9922-652c7db9f2d8}");
|
||||
public static Guid Menu__mega_for__Tenant { get; } = new Guid("{788db047-ed7f-4e0c-a8b0-68478d486da7}");
|
||||
|
||||
public static Guid Tenant_Type__has_title__Translatable_Text_Constant { get; } = new Guid("{79AAE09C-5690-471C-8442-1B230610456C}");
|
||||
|
||||
@ -305,6 +319,9 @@ namespace Mocha.Core
|
||||
public static Guid Element_Content__has__Validation { get; } = new Guid("{265637cd-2099-416b-88fa-4f5ed88a87e3}");
|
||||
public static Guid Validation__for__Element_Content { get; } = new Guid("{3a4677e8-9c78-4149-80ad-46e5ac3b12f5}");
|
||||
|
||||
public static Guid Derived_Element_Content__update_with__Executable_returning_Work_Data { get; } = new Guid("{4151911a-485c-4488-8e19-1560f489d411}");
|
||||
public static Guid Executable_returning_Work_Data__used_by__Derived_Element_Content { get; } = new Guid("{75fdacf8-163c-45ac-86eb-80677ff738ad}");
|
||||
|
||||
public static Guid Instance__has__Instance_Definition { get; } = new Guid("{329c54ee-17b8-4550-ae80-be5dee9ac53c}");
|
||||
|
||||
public static Guid Task__has_initiating__Element { get; } = new Guid("{78726736-f5b7-4466-b114-29cbaf6c9329}");
|
||||
@ -382,5 +399,8 @@ namespace Mocha.Core
|
||||
|
||||
public static Guid Tenant__has_initiating__Route { get; } = new Guid("{41dc15a8-c748-4d90-ae4e-104e45d15f2b}");
|
||||
public static Guid Route__initiates_for__Tenant { get; } = new Guid("{6682949b-f8d7-49a8-b7c3-a66a304a7fdb}");
|
||||
|
||||
public static Guid Route__secured_to__Domain { get; } = new Guid("{2d085cbe-103b-49ea-b6fe-738357e75912}");
|
||||
public static Guid Domain__secures__Route { get; } = new Guid("{95725379-7b45-4e0c-a04e-b06eead84c60}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,9 +166,13 @@ public class MiniOms : MemoryOms
|
||||
CreateClass("Work Data", KnownInstanceGuids.Classes.WorkData);
|
||||
c_OMS = CreateClass("OMS", KnownInstanceGuids.Classes.OMS);
|
||||
|
||||
InstanceHandle c_Application = CreateClass("Application", KnownInstanceGuids.Classes.Application);
|
||||
|
||||
InstanceHandle c_Tenant = CreateClass("Tenant", KnownInstanceGuids.Classes.Tenant);
|
||||
CreateInstanceOf(c_Tenant);
|
||||
|
||||
CreateRelationship(c_Tenant, "has", c_Application, KnownRelationshipGuids.Tenant__has__Application, true, "for", KnownRelationshipGuids.Application__for__Tenant);
|
||||
|
||||
c_CommonText = CreateClass("Common Text", KnownInstanceGuids.Classes.CommonText);
|
||||
c_CommonBoolean = CreateClass("Common Boolean", KnownInstanceGuids.Classes.CommonBoolean);
|
||||
c_CommonNumeric = CreateClass("Common Numeric", KnownInstanceGuids.Classes.CommonNumeric);
|
||||
|
||||
@ -19,6 +19,8 @@ namespace Mocha.Core.OmsImplementations.Mini;
|
||||
|
||||
public abstract class MiniOmsModule
|
||||
{
|
||||
// public virtual int Priority { get; } = 0;
|
||||
|
||||
protected InstanceHandle c_Class, c_Attribute, c_Relationship, c_TextAttribute, c_BooleanAttribute, c_NumericAttribute, c_DateAttribute, c_WorkSet, c_Instance;
|
||||
|
||||
protected abstract void BuildInternal(Oms oms);
|
||||
|
||||
@ -35,7 +35,7 @@ public class MethodsModule : MiniOmsModule
|
||||
private InstanceHandle c_ReturnAttributeMethodBinding, c_ReturnInstanceSetMethodBinding, c_ReturnElementMethodBinding;
|
||||
private InstanceHandle c_CommonText, c_CommonBoolean, c_CommonNumeric, c_CommonDate, c_CommonInstanceSet;
|
||||
private InstanceHandle c_ConditionGroup;
|
||||
private InstanceHandle c_BuildAttributeMethod, c_GetAttributeMethod, c_GetSpecifiedInstancesMethod, c_GetAttributeBySystemRoutineMethod, c_AssignAttributeMethod, c_GetRelationshipMethod, c_GetReferencedAttributeMethod, c_SelectFromInstanceSetMethod, c_ConditionalSelectFromInstanceSetCase, c_ConditionalSelectFromInstanceSetMethod, c_ConditionalSelectAttributeMethod, c_ConditionalSelectAttributeCase, c_EvaluateBooleanExpressionMethod;
|
||||
private InstanceHandle c_BuildAttributeMethod, c_GetAttributeMethod, c_GetSpecifiedInstancesMethod, c_GetAttributeBySystemRoutineMethod, c_GetInstanceSetBySystemRoutineMethod, c_AssignAttributeMethod, c_GetRelationshipMethod, c_GetReferencedAttributeMethod, c_SelectFromInstanceSetMethod, c_ConditionalSelectFromInstanceSetCase, c_ConditionalSelectFromInstanceSetMethod, c_ConditionalSelectAttributeMethod, c_ConditionalSelectAttributeCase, c_EvaluateBooleanExpressionMethod;
|
||||
private InstanceHandle c_ExecutableReturningAttribute, c_ExecutableReturningInstanceSet, c_ExecutableReturningWorkData;
|
||||
private InstanceHandle c_AccessModifier, i_AccessModifier_Private, i_AccessModifier_Protected, i_AccessModifier_Public, i_AccessModifier_RootA2;
|
||||
private InstanceHandle c_SystemRoutine, c_SystemAttributeRoutine, c_SystemInstanceSetRoutine;
|
||||
@ -150,6 +150,11 @@ public class MethodsModule : MiniOmsModule
|
||||
oms.CreateRelationship(c_GetAttributeBySystemRoutineMethod, "uses", c_Instance, KnownRelationshipGuids.Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine, false, "used by", KnownRelationshipGuids.System_Attribute_Routine__used_by__Get_Attribute_by_System_Routine_Method);
|
||||
oms.AddSuperClass(c_GetAttributeBySystemRoutineMethod, c_Method);
|
||||
|
||||
c_GetInstanceSetBySystemRoutineMethod = oms.CreateClass("GSS - Get Instance Set by System Routine Method", KnownInstanceGuids.MethodClasses.GetInstanceSetBySystemRoutineMethod);
|
||||
oms.CreateRelationship(c_GetInstanceSetBySystemRoutineMethod, "returns", c_WorkSet, KnownRelationshipGuids.Get_Instance_Set_by_System_Routine_Method__returns__Work_Set, true, "returned by", KnownRelationshipGuids.Work_Set__returned_by__Get_Instance_Set_by_System_Routine_Method);
|
||||
oms.CreateRelationship(c_GetInstanceSetBySystemRoutineMethod, "uses", c_SystemInstanceSetRoutine, KnownRelationshipGuids.Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine, true, "used by", KnownRelationshipGuids.System_Instance_Set_Routine__used_by__Get_Instance_Set_by_System_Routine_Method);
|
||||
oms.AddSuperClass(c_GetInstanceSetBySystemRoutineMethod, c_Method);
|
||||
|
||||
c_AssignAttributeMethod = oms.CreateClass("AA - Assign Attribute Method", KnownInstanceGuids.MethodClasses.AssignAttributeMethod);
|
||||
oms.CreateRelationship(c_AssignAttributeMethod, "uses", c_Attribute, KnownRelationshipGuids.Assign_Attribute_Method__uses__Executable_returning_Attribute, true, "used by", KnownRelationshipGuids.Executable_returning_Attribute__used_by__Assign_Attribute_Method);
|
||||
oms.CreateRelationship(c_AssignAttributeMethod, "assigns", c_Attribute, KnownRelationshipGuids.Assign_Attribute_Method__assigns__Attribute, false, "assigned by", KnownRelationshipGuids.Attribute__assigned_by__Assign_Attribute_Method);
|
||||
|
||||
@ -15,37 +15,60 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mocha.NET. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using Mocha.Core.Oop;
|
||||
using Mocha.Core.Oop.Methods;
|
||||
|
||||
namespace Mocha.Core.OmsImplementations.Mini.Modules;
|
||||
|
||||
public class SecurityModule : MiniOmsModule
|
||||
{
|
||||
private InstanceHandle c_User, c_UserLogin, c_Role;
|
||||
private InstanceHandle r_User__has__Role;
|
||||
private InstanceHandle a_Token, a_Name, a_UserName, a_PasswordHash, a_PasswordSalt;
|
||||
private InstanceHandle c_User, c_UserLogin, c_Role, c_Domain;
|
||||
private InstanceHandle r_User__has__Role;
|
||||
private InstanceHandle a_Token, a_Name, a_UserName, a_PasswordHash, a_PasswordSalt, a_UserIsLoggedIn;
|
||||
private MethodReturningInstanceSet m_User__get__Current_User;
|
||||
|
||||
protected override void BuildInternal(Oms oms)
|
||||
{
|
||||
c_User = oms.CreateClass("User", KnownInstanceGuids.Classes.User);
|
||||
c_UserLogin = oms.CreateClass("User Login", KnownInstanceGuids.Classes.UserLogin);
|
||||
a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||
protected override void BuildInternal(Oms oms)
|
||||
{
|
||||
c_User = oms.CreateClass("User", KnownInstanceGuids.Classes.User);
|
||||
c_UserLogin = oms.CreateClass("User Login", KnownInstanceGuids.Classes.UserLogin);
|
||||
a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||
|
||||
a_Token = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Token);
|
||||
oms.SetAttributeValue(a_Token, a_Name, "Name");
|
||||
oms.AddAttribute(c_UserLogin, a_Token);
|
||||
a_Token = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.Token);
|
||||
oms.SetAttributeValue(a_Token, a_Name, "Name");
|
||||
oms.AddAttribute(c_UserLogin, a_Token);
|
||||
|
||||
a_UserName = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.UserName);
|
||||
oms.SetAttributeValue(a_UserName, a_Name, "User Name");
|
||||
oms.AddAttribute(c_User, a_UserName);
|
||||
a_UserName = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.UserName);
|
||||
oms.SetAttributeValue(a_UserName, a_Name, "User Name");
|
||||
oms.AddAttribute(c_User, a_UserName);
|
||||
|
||||
a_PasswordHash = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.PasswordHash);
|
||||
oms.SetAttributeValue(a_PasswordHash, a_Name, "Password Hash");
|
||||
oms.AddAttribute(c_User, a_PasswordHash);
|
||||
a_PasswordHash = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.PasswordHash);
|
||||
oms.SetAttributeValue(a_PasswordHash, a_Name, "Password Hash");
|
||||
oms.AddAttribute(c_User, a_PasswordHash);
|
||||
|
||||
a_PasswordSalt = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.PasswordSalt);
|
||||
oms.SetAttributeValue(a_PasswordSalt, a_Name, "Password Salt");
|
||||
oms.AddAttribute(c_User, a_PasswordSalt);
|
||||
a_PasswordSalt = oms.CreateInstanceOf(c_TextAttribute, KnownAttributeGuids.Text.PasswordSalt);
|
||||
oms.SetAttributeValue(a_PasswordSalt, a_Name, "Password Salt");
|
||||
oms.AddAttribute(c_User, a_PasswordSalt);
|
||||
|
||||
// c_Role = oms.CreateClass("Role", KnownInstanceGuids.Classes.Role);
|
||||
}
|
||||
a_UserIsLoggedIn = oms.CreateInstanceOf(c_BooleanAttribute, KnownAttributeGuids.Boolean.UserIsLoggedIn);
|
||||
|
||||
// c_Role = oms.CreateClass("Role", KnownInstanceGuids.Classes.Role);
|
||||
OmsMethodBuilder mb = new OmsMethodBuilder(oms);
|
||||
OmsSystemRoutineBuilder sr = new OmsSystemRoutineBuilder(oms);
|
||||
|
||||
WorkSet ws_CurrentUser = oms.CreateWorkSet("Current User");
|
||||
m_User__get__Current_User = mb.CreateGetInstanceSetBySystemRoutineMethod(c_User, "get", "Current User", AccessModifier.Public, true, ws_CurrentUser, sr.CreateSystemInstanceSetRoutine(KnownInstanceGuids.SystemInstanceSetRoutines.GetCurrentUser, delegate (Oms oms, OmsContext context)
|
||||
{
|
||||
List<InstanceHandle> list = new List<InstanceHandle>();
|
||||
return list;
|
||||
}));
|
||||
MethodBinding mb_User__get__Current_User = m_User__get__Current_User.CreateMethodBinding(oms);
|
||||
|
||||
EvaluateBooleanExpressionMethod m_User__is__Logged_In = mb.CreateEvaluateBooleanExpressionMethod(c_User, "is", "Logged In", AccessModifier.Public, true, a_UserIsLoggedIn, m_User__get__Current_User, RelationalOperator.IsNotEmpty);
|
||||
MethodBinding mb_User__is__Logged_In = m_User__is__Logged_In.CreateMethodBinding(oms);
|
||||
|
||||
c_Domain = oms.CreateClass("Domain", KnownInstanceGuids.Classes.Domain);
|
||||
oms.CreateInstanceOf(c_Domain, KnownInstanceGuids.SecurityDomains.Anyone);
|
||||
oms.CreateInstanceOf(c_Domain, KnownInstanceGuids.SecurityDomains.AuthenticatedUsers);
|
||||
}
|
||||
|
||||
}
|
||||
@ -51,5 +51,8 @@ public class TranslationModule : MiniOmsModule
|
||||
c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
r_Tenant__has_login_header__Translation = oms.CreateRelationship(c_Tenant, "has login header", c_Translation, KnownRelationshipGuids.Tenant__has_login_header__Translation, true);
|
||||
r_Tenant__has_login_footer__Translation = oms.CreateRelationship(c_Tenant, "has login footer", c_Translation, KnownRelationshipGuids.Tenant__has_login_footer__Translation, true);
|
||||
|
||||
InstanceHandle c_Application = oms.CreateClass("Application", KnownInstanceGuids.Classes.Application);
|
||||
oms.CreateRelationship(c_Application, "has title", c_Translation, KnownRelationshipGuids.Application__has_title__Translation, true, "title for", KnownRelationshipGuids.Translation__title_for__Application);
|
||||
}
|
||||
}
|
||||
@ -7,16 +7,18 @@ namespace Mocha.Core.OmsImplementations.Mini.Modules;
|
||||
|
||||
public class UserInterfaceModule : MiniOmsModule
|
||||
{
|
||||
private InstanceHandle c_Element, c_ElementContent;
|
||||
private InstanceHandle c_Element, c_ElementContent, c_DerivedElementContent;
|
||||
private InstanceHandle r_User__has__Role;
|
||||
private InstanceHandle a_Name;
|
||||
private InstanceHandle c_ExecutableReturningElement;
|
||||
private InstanceHandle c_ExecutableReturningWorkData, c_ExecutableReturningElement;
|
||||
private InstanceHandle c_ElementContentDisplayOption;
|
||||
private InstanceHandle c_Method, c_MethodBinding, c_BuildUIResponseMethod, c_ControlTransactionMethod;
|
||||
private InstanceHandle c_Tenant, c_Method, c_MethodBinding, c_BuildUIResponseMethod, c_ControlTransactionMethod;
|
||||
private InstanceHandle c_BuildResponseMethodBinding;
|
||||
|
||||
protected override void BuildInternal(Oms oms)
|
||||
{
|
||||
c_Tenant = oms.GetInstance(KnownInstanceGuids.Classes.Tenant);
|
||||
|
||||
a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||
c_Method = oms.GetInstance(KnownInstanceGuids.Classes.Method);
|
||||
c_MethodBinding = oms.GetInstance(KnownInstanceGuids.Classes.MethodBinding);
|
||||
@ -26,9 +28,29 @@ public class UserInterfaceModule : MiniOmsModule
|
||||
|
||||
c_ElementContent = oms.CreateClass("Element Content", KnownInstanceGuids.Classes.ElementContent);
|
||||
|
||||
c_ElementContentDisplayOption = oms.CreateClass("Element Content Display Option");
|
||||
|
||||
InstanceHandle i_DisplayOption_DisplayAsPageTitle = oms.CreateInstanceOf(c_ElementContentDisplayOption, KnownInstanceGuids.ElementContentDisplayOptions.DisplayAsPageTitle);
|
||||
oms.SetAttributeValue(i_DisplayOption_DisplayAsPageTitle, a_Name, "Display as Page Title");
|
||||
|
||||
InstanceHandle i_NotEnterable = oms.CreateInstanceOf(c_ElementContentDisplayOption, KnownInstanceGuids.ElementContentDisplayOptions.NotEnterable);
|
||||
oms.SetAttributeValue(i_NotEnterable, a_Name, "Not Enterable");
|
||||
|
||||
InstanceHandle i_Required = oms.CreateInstanceOf(c_ElementContentDisplayOption, KnownInstanceGuids.ElementContentDisplayOptions.Required);
|
||||
oms.SetAttributeValue(i_Required, a_Name, "Required");
|
||||
|
||||
InstanceHandle i_WideText = oms.CreateInstanceOf(c_ElementContentDisplayOption, KnownInstanceGuids.ElementContentDisplayOptions.WideText);
|
||||
oms.SetAttributeValue(i_WideText, a_Name, "Wide Text");
|
||||
|
||||
c_DerivedElementContent = oms.CreateClass("Derived Element Content", KnownInstanceGuids.Classes.DerivedElementContent);
|
||||
oms.AddSuperClass(c_DerivedElementContent, c_ElementContent);
|
||||
|
||||
c_ExecutableReturningWorkData = oms.GetInstance(KnownInstanceGuids.Classes.ExecutableReturningWorkData);
|
||||
|
||||
oms.CreateRelationship(c_Element, "has", c_ElementContent, KnownRelationshipGuids.Element__has__Element_Content, false, "for", KnownRelationshipGuids.Element_Content__for__Element);
|
||||
oms.CreateRelationship(c_ElementContent, "has", c_Instance, KnownRelationshipGuids.Element_Content__has__Instance, true, "has", KnownRelationshipGuids.Instance__for__Element_Content);
|
||||
oms.CreateRelationship(c_ElementContent, "has", c_ElementContentDisplayOption, KnownRelationshipGuids.Element_Content__has__Element_Content_Display_Option, false, "for", KnownRelationshipGuids.Element_Content_Display_Option__for__Element_Content);
|
||||
oms.CreateRelationship(c_DerivedElementContent, "update with", c_ExecutableReturningWorkData, KnownRelationshipGuids.Derived_Element_Content__update_with__Executable_returning_Work_Data, false, "used by", KnownRelationshipGuids.Executable_returning_Work_Data__used_by__Derived_Element_Content);
|
||||
|
||||
c_ExecutableReturningElement = oms.CreateClass("Executable returning Element", KnownInstanceGuids.Classes.ExecutableReturningElement);
|
||||
|
||||
@ -56,5 +78,27 @@ public class UserInterfaceModule : MiniOmsModule
|
||||
|
||||
ConditionalSelectAttributeCase i_CT_Case = new ConditionalSelectAttributeCase(new IExecutableReturningAttribute[] { Method__is__CT.CreateMethodBinding(oms) }, null, false, Method__get__CT_Method_Suffix.CreateMethodBinding(oms));
|
||||
mb.AddConditionalSelectAttributeCase(new ConditionalSelectAttributeMethod(Method_Binding__get__Method_Binding_Abbreviation), i_CT_Case);
|
||||
|
||||
InstanceHandle c_Menu = oms.CreateClass("Menu", KnownInstanceGuids.Classes.Menu);
|
||||
InstanceHandle c_MenuItem = oms.CreateClass("Menu Item", KnownInstanceGuids.Classes.MenuItem);
|
||||
|
||||
InstanceHandle c_MenuItemCommand = oms.CreateClass("Menu Item Command", KnownInstanceGuids.Classes.MenuItemCommand);
|
||||
oms.AddSuperClass(c_MenuItemCommand, c_MenuItem);
|
||||
|
||||
InstanceHandle c_MenuItemGroup = oms.CreateClass("Menu Item Group", KnownInstanceGuids.Classes.MenuItemGroup);
|
||||
oms.AddSuperClass(c_MenuItemGroup, c_MenuItem);
|
||||
|
||||
InstanceHandle c_MenuItemHeader = oms.CreateClass("Menu Item Header", KnownInstanceGuids.Classes.MenuItemHeader);
|
||||
oms.AddSuperClass(c_MenuItemHeader, c_MenuItem);
|
||||
|
||||
InstanceHandle c_MenuItemInstance = oms.CreateClass("Menu Item Instance", KnownInstanceGuids.Classes.MenuItemInstance);
|
||||
oms.AddSuperClass(c_MenuItemInstance, c_MenuItem);
|
||||
|
||||
InstanceHandle c_MenuItemSeparator = oms.CreateClass("Menu Item Separator", KnownInstanceGuids.Classes.MenuItemSeparator);
|
||||
oms.AddSuperClass(c_MenuItemSeparator, c_MenuItem);
|
||||
|
||||
oms.CreateRelationship(c_Menu, "has", c_MenuItem, KnownRelationshipGuids.Menu__has__Menu_Item, false, "for", KnownRelationshipGuids.Menu_Item__for__Menu);
|
||||
|
||||
oms.CreateRelationship(c_Tenant, "has mega", c_Menu, KnownRelationshipGuids.Tenant__has_mega__Menu, true, "mega for", KnownRelationshipGuids.Menu__mega_for__Tenant);
|
||||
}
|
||||
}
|
||||
@ -29,5 +29,8 @@ public class WebModule : MiniOmsModule
|
||||
// Route.processed by CT - Control Transaction Method
|
||||
// CT - Control Transaction Method.uses Build Response Method Binding
|
||||
// Build Response Method Binding.executes Method -- Build UI Response Method
|
||||
|
||||
InstanceHandle c_Domain = oms.GetInstance(KnownInstanceGuids.Classes.Domain);
|
||||
oms.CreateRelationship(c_Route, "secured to", c_Domain, KnownRelationshipGuids.Route__secured_to__Domain, false, "secures", KnownRelationshipGuids.Domain__secures__Route);
|
||||
}
|
||||
}
|
||||
@ -129,6 +129,18 @@ public class OmsMethodBuilder
|
||||
return new GetAttributeBySystemRoutineMethod(method);
|
||||
}
|
||||
|
||||
public GetInstanceSetBySystemRoutineMethod CreateGetInstanceSetBySystemRoutineMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, WorkSet returnsWorkSet, SystemInstanceSetRoutine usesSystemInstanceSetRoutine)
|
||||
{
|
||||
return CreateGetInstanceSetBySystemRoutineMethod(forClassInstance, verb, name, accessModifier, isStatic, Guid.NewGuid(), returnsWorkSet, usesSystemInstanceSetRoutine);
|
||||
}
|
||||
public GetInstanceSetBySystemRoutineMethod CreateGetInstanceSetBySystemRoutineMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, Guid globalIdentifier, WorkSet returnsWorkSet, SystemInstanceSetRoutine usesSystemInstanceSetRoutine)
|
||||
{
|
||||
InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.GetAttributeBySystemRoutineMethod), forClassInstance, verb, name, accessModifier, isStatic, globalIdentifier);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Instance_Set_by_System_Routine_Method__returns__Work_Set), returnsWorkSet.Handle);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine), usesSystemInstanceSetRoutine.Handle);
|
||||
return new GetInstanceSetBySystemRoutineMethod(method);
|
||||
}
|
||||
|
||||
public AssignAttributeMethod CreateAssignAttributeMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, ReturnAttributeMethodBinding assignsFromExecutableReturningAttribute, InstanceHandle assignsToAttribute)
|
||||
{
|
||||
return CreateAssignAttributeMethod(forClassInstance, verb, name, accessModifier, isStatic, assignsFromExecutableReturningAttribute.Handle, assignsToAttribute);
|
||||
@ -287,18 +299,21 @@ public class OmsMethodBuilder
|
||||
return ih;
|
||||
}
|
||||
|
||||
public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, IInstanceWrapper sourceWorkData, BooleanOperator booleanOperator, IInstanceWrapper compareToWorkData)
|
||||
public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, IInstanceWrapper sourceWorkData, BooleanOperator booleanOperator, IInstanceWrapper compareToWorkData = null)
|
||||
{
|
||||
return CreateEvaluateBooleanExpressionMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsAttribute, sourceWorkData.Handle, booleanOperator, compareToWorkData.Handle);
|
||||
return CreateEvaluateBooleanExpressionMethod(forClassInstance, verb, name, accessModifier, isStatic, returnsAttribute, sourceWorkData.Handle, booleanOperator, compareToWorkData?.Handle);
|
||||
}
|
||||
|
||||
public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, InstanceHandle sourceWorkData, BooleanOperator booleanOperator, InstanceHandle compareToWorkData)
|
||||
public EvaluateBooleanExpressionMethod CreateEvaluateBooleanExpressionMethod(InstanceHandle forClassInstance, string verb, string name, AccessModifier accessModifier, bool isStatic, InstanceHandle returnsAttribute, InstanceHandle sourceWorkData, BooleanOperator booleanOperator, InstanceHandle? compareToWorkData)
|
||||
{
|
||||
InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.EvaluateBooleanExpressionMethod), forClassInstance, verb, name, accessModifier, isStatic);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__returns__Boolean_Attribute), returnsAttribute);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_source__Executable_returning_Work_Data), sourceWorkData);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__uses__Boolean_Operator), booleanOperator.Handle);
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data), compareToWorkData);
|
||||
if (compareToWorkData.HasValue)
|
||||
{
|
||||
Oms.AssignRelationship(method, Oms.GetInstance(KnownRelationshipGuids.Evaluate_Boolean_Expression_Method__has_target__Executable_returning_Work_Data), compareToWorkData.Value);
|
||||
}
|
||||
return new EvaluateBooleanExpressionMethod(method);
|
||||
}
|
||||
|
||||
@ -322,7 +337,10 @@ public class OmsMethodBuilder
|
||||
InstanceHandle method = CreateMethodBase(Oms.GetInstance(KnownInstanceGuids.MethodClasses.BuildUIResponseMethod), forClassInstance, verb, name, accessModifier, isStatic);
|
||||
InstanceHandle r_Control_Transaction_Method__processes__Element = Oms.GetInstance(KnownRelationshipGuids.Control_Transaction_Method__processes__Element);
|
||||
InstanceHandle r_Control_Transaction_Method__uses__Build_Response_Method_Binding = Oms.GetInstance(KnownRelationshipGuids.Control_Transaction_Method__uses__Build_Response_Method_Binding);
|
||||
Oms.AssignRelationship(method, r_Control_Transaction_Method__processes__Element, processesElement);
|
||||
if (processesElement != InstanceHandle.Empty)
|
||||
{
|
||||
Oms.AssignRelationship(method, r_Control_Transaction_Method__processes__Element, processesElement);
|
||||
}
|
||||
Oms.AssignRelationship(method, r_Control_Transaction_Method__uses__Build_Response_Method_Binding, usesBuildResponseMethodBinding.Handle);
|
||||
return new ControlTransactionMethod(method);
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2024 Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// This file is part of Mocha.NET.
|
||||
//
|
||||
// Mocha.NET 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.
|
||||
//
|
||||
// Mocha.NET 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 Mocha.NET. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
namespace Mocha.Core.Oop.Methods;
|
||||
|
||||
public class GetInstanceSetBySystemRoutineMethod : MethodReturningInstanceSet
|
||||
{
|
||||
public override Guid ClassId => KnownInstanceGuids.MethodClasses.GetInstanceSetBySystemRoutineMethod;
|
||||
internal GetInstanceSetBySystemRoutineMethod(InstanceHandle handle) : base(handle) { }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user