Пример #1
0
        public async Task <IActionResult> UpdateComponent(ComponentJson comp, string module)
        {
            MiniEditorManager editorMgr = new MiniEditorManager();
            var res = await editorMgr.AddUpdateComponent(comp, GetUsername, module, GetSiteID);

            return(new ObjectResult(res));
        }
Пример #2
0
 public PageHome(ComponentJson owner) : base(owner)
 {
     new Html(this)
     {
         TextHtml = "<h1>Web Application Framework</h1>"
     };
 }
Пример #3
0
        public PageAdminStorage(ComponentJson owner) : base(owner)
        {
            var content = new Div(this)
            {
                CssClass = "content"
            };

            new Html(content)
            {
                TextHtml = "<h1>Storage</h1>"
            };
        }
Пример #4
0
        protected override async Task ProcessAsync()
        {
            AlertError.ComponentRemove();
            if (Button.IsClick)
            {
                var loginUserSession = Grid.RowSelect;

                var loginUserRoleAppList = (await Data.Query <LoginUserRoleApp>().Where(item => item.LoginUserName == loginUserSession.Name && item.LoginUserRoleIsActive == true).QueryExecuteAsync());
                if (!loginUserRoleAppList.Any())
                {
                    // Username does not exist
                    this.AlertError = new Alert(this.ComponentOwner <AppJson>(), "Username or password wrong!", AlertEnum.Error);
                }
                else
                {
                    var    pageMain     = this.ComponentOwner <PageMain>();
                    string password     = loginUserSession.PasswordHash;                      // User entered password
                    string passwordHash = loginUserRoleAppList.First().LoginUserPasswordHash; // In db stored hash
                    string passwordSalt = loginUserRoleAppList.First().LoginUserPasswordSalt; // In db stored salt
                    if (passwordHash != null && !UtilFramework.PasswordIsValid(password, passwordHash, passwordSalt))
                    {
                        // Password wrong
                        this.AlertError = new Alert(this.ComponentOwner <AppJson>(), "Username or password wrong!", AlertEnum.Error);
                    }
                    else
                    {
                        if (!loginUserRoleAppList.First().LoginUserIsActive)
                        {
                            // User not active
                            this.AlertError = new Alert(this.ComponentOwner <AppJson>(), "User not (yet) active.", AlertEnum.Warning);
                        }
                        else
                        {
                            // Login successful
                            pageMain.LoginUserRoleAppList = loginUserRoleAppList;
                            foreach (var item in pageMain.LoginUserRoleAppList)
                            {
                                item.LoginUserPasswordHash = null; // Remoe from session
                                item.LoginUserPasswordSalt = null; // Remove from session
                            }
                            var loginUserId = pageMain.LoginUserRoleAppList.First().LoginUserId;
                            await pageMain.GridNavigate.LoadAsync();

                            this.ComponentOwner <AppJson>().Navigate("/"); // Navigate to home after login
                        }
                    }
                }

                // Render grid ConfigDeveloper (coffee icon) if user is a developer.
                await Grid.LoadAsync();
            }
        }
Пример #5
0
 public PageAdminLoginUser(ComponentJson owner) : base(owner)
 {
     new Html(this)
     {
         TextHtml = "<h1>User</h1>"
     };
     GridLoginUser = new GridAdminLoginUser(this);
     new Html(this)
     {
         TextHtml = "<h2>Role</h1>"
     };
     GridLoginUserRole = new GridAdminLoginUserRole(this);
 }
Пример #6
0
 public PageAdminNavigate(ComponentJson owner) : base(owner)
 {
     new Html(this)
     {
         TextHtml = "<h1>Navigate</h1>"
     };
     GridNavigate = new GridAdminNavigate(this);
     new Html(this)
     {
         TextHtml = "<h2>Role</h1>"
     };
     GridNavigateRole = new GridAdminNavigateRole(this);
 }
Пример #7
0
        public PageContent(ComponentJson owner, Content contentRow) : base(owner)
        {
            // Content
            new Html(this)
            {
                TextHtml = contentRow.TextHtml, IsNoSanatize = true, IsNoSanatizeScript = "if (typeof Prism != 'undefined') { Prism.highlightAll(); }"
            };                                                                                                                                                         // IsNoSanatize because of html id for named anchor.

            // Title, Description
            this.ComponentOwner <AppJson>().Title       = contentRow.TitleLong;
            this.ComponentOwner <AppJson>().Description = contentRow.Description;
            NavigatePath = contentRow.NavigatePath;
        }
Пример #8
0
        public PageLoginSignIn(ComponentJson owner)
            : base(owner)
        {
            new Html(this)
            {
                TextHtml = "<h1>User Sign In</h1>"
            };
            Grid = new GridSignIn(this);

            Button = new Button(this)
            {
                TextHtml = "Login", CssClass = "button is-primary"
            };
        }
Пример #9
0
 public PageLoginSignUp(ComponentJson owner) : base(owner)
 {
     new Html(this)
     {
         TextHtml = "<h1>User Sign Up</h1>"
     };
     new Html(this)
     {
         TextHtml = "<p>After sign up you'll receive an email with confirmation link to click and finish registration.</p><div></div>"
     };
     Grid   = new GridLoginUserSignUp(this);
     Button = new Button(this)
     {
         TextHtml = "Sign Up", CssClass = "button is-primary"
     };
 }
Пример #10
0
        public PageNotFound(ComponentJson owner) : base(owner)
        {
            var content = new Div(this)
            {
                CssClass = "content"
            };

            new Html(content)
            {
                TextHtml = "<h1>Page not Found</h1>"
            };
            string text = "<article class=\"message is-warning\"><div class=\"message-body\">The requested URL was not found on this server.</div></article>";

            new Html(content)
            {
                TextHtml = text
            };
        }
Пример #11
0
        public PageAdminContent(ComponentJson owner) : base(owner)
        {
            new Html(this)
            {
                TextHtml = "<h1>Content Page</h1>"
            };
            GridContent   = new GridContent(this);
            GridContentMd = new GridContentMd(this);
            ButtonPublish = new Button(this)
            {
                TextHtml = "Update Navigation", CssClass = "button is-primary"
            };
            var content = new Div(this)
            {
                CssClass = "content"
            };

            Html = new Html(content)
            {
                IsNoSanatize = true, IsNoSanatizeScript = "if (typeof Prism != 'undefined') { Prism.highlightAll(); }"
            };                                                                                                                                   // IsNoSanatize because of html id for named anchor.
        }
Пример #12
0
 public PageLoginSignOut(ComponentJson owner) : base(owner)
 {
 }
Пример #13
0
 public BootstrapContainer(ComponentJson owner) : base(owner)
 {
     CssClass = "container";
 }
Пример #14
0
 public BootstrapNavbar(ComponentJson owner)
     : base(owner, nameof(BootstrapNavbar))
 {
 }
Пример #15
0
 public BootstrapRow(ComponentJson owner) : base(owner)
 {
     CssClass = "row";
 }
Пример #16
0
 public GridFeedback(ComponentJson owner)
     : base(owner)
 {
     FeedbackList = new List <Feedback>();
     FeedbackList.Add(new Feedback());
 }
Пример #17
0
 public GridContentMd(ComponentJson owner)
     : base(owner)
 {
 }
Пример #18
0
 public GridLanguage(ComponentJson owner)
     : base(owner)
 {
 }
Пример #19
0
 public PageConfigGrid(ComponentJson owner, string tableNameCSharp, string fieldNameCSharp)
     : base(owner)
 {
     TableNameCSharp = tableNameCSharp;
     FieldNameCSharp = fieldNameCSharp;
 }
Пример #20
0
 public GridConfigGrid(ComponentJson owner) : base(owner)
 {
 }
Пример #21
0
 public MyGrid(ComponentJson owner)
     : base(owner, nameof(MyGrid))
 {
 }
Пример #22
0
 public GridLoginUserSignUp(ComponentJson owner)
     : base(owner)
 {
     LoginUserList.Add(new LoginUser());
 }
Пример #23
0
 public GridAdminLoginUserRole(ComponentJson owner)
     : base(owner)
 {
 }
Пример #24
0
 public GridNavigate(ComponentJson owner)
     : base(owner)
 {
 }
Пример #25
0
        public PageMain(ComponentJson owner)
            : base(owner)
        {
            BulmaNavbar = new BulmaNavbar(this)
            {
                BrandTextHtml = "<b>WorkplaceX</b>.org"
            };

            // Hero
            new Custom01(this);

            // Columns
            var columns = new DivContainer(this)
            {
                CssClass = "columns"
            };
            var column0 = new Div(columns)
            {
                CssClass = "column is-one-fifth has-background-white-ter"
            };
            var column1 = new Div(columns)
            {
                CssClass = "column"
            };
            var column2 = new Div(columns)
            {
                CssClass = "column is-one-fifth"
            };

            // Container
            // var container = new DivContainer(column1) { CssClass = "container" };
            Content = new Div(column1)
            {
                CssClass = "content content-bulma-framework"
            };
            // Content = column1;

            GridNavigate = new GridNavigate(this)
            {
                IsHide = true
            };
            GridLanguage = new GridLanguage(this)
            {
                IsHide = true
            };

            // Footer
            Footer = new Custom02(this);

            BulmaNavbar.GridAdd(GridLanguage, isNavbarEnd: true, isSelectMode: true);
            BulmaNavbar.GridAdd(GridNavigate);

            new BulmaNavbarMenu(column0)
            {
                Grid = GridNavigate
            };

            // Preserve login user
            if (this.ComponentOwner <AppMain>().IsNavigateReload <AppMain>(out var appJsonPrevious))
            {
                LoginUserRoleAppList = appJsonPrevious.PageMain.LoginUserRoleAppList;
            }
        }
Пример #26
0
 public GridAdminNavigateRole(ComponentJson owner)
     : base(owner)
 {
 }
Пример #27
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BulmaNavbar(ComponentJson owner)
     : base(owner, nameof(BulmaNavbar))
 {
 }
Пример #28
0
 public BingMap(ComponentJson owner)
     : base(owner, nameof(BingMap))
 {
 }
Пример #29
0
 public MyComponent(ComponentJson owner)
     : base(owner, nameof(MyComponent))
 {
 }
Пример #30
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public GridStorage(ComponentJson owner)
     : base(owner)
 {
 }