Example #1
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("Product Categories", Context));
 }
Example #2
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("VisitorLogs", Context));
 }
Example #3
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("Missing images", context));
 }
Example #4
0
        private CmsMenuViewModel SiteBarAdvancedMenu(ApiCall call)
        {
            var context         = call.Context;
            var advanceheadline = Hardcoded.GetValue("Advance", context);
            var advance         = new CmsMenuViewModel(advanceheadline, advanceheadline);

            var system = new CmsMenuViewModel(SideBarSection.System.ToString(), Hardcoded.GetValue("System", context))
            {
                Icon = "icon icon-settings"
            };
            var development = new CmsMenuViewModel(SideBarSection.Development.ToString(), Hardcoded.GetValue("Development", context))
            {
                Icon = "icon fa fa-code"
            };
            var content = new CmsMenuViewModel(SideBarSection.Contents.ToString(), Hardcoded.GetValue("Contents", context))
            {
                Icon = "icon fa fa-files-o"
            };
            var database = new CmsMenuViewModel(SideBarSection.Database.ToString(), Hardcoded.GetValue("Database", context))
            {
                Icon = "icon fa fa-database"
            };
            var commerce = new CmsMenuViewModel(SideBarSection.Commerce.ToString(), Hardcoded.GetValue("Commerce", context))
            {
                Icon = "icon fa fa-database"
            };

            advance.Items.Add(system);
            advance.Items.Add(development);
            advance.Items.Add(content);
            advance.Items.Add(database);
            // advance.Items.Add(commerce);

            var sitebarmenus = MenuContainer.SideBarMenus;

            foreach (var item in sitebarmenus)
            {
                if (item.Parent == SideBarSection.Root)
                {
                    advance.Items.Add(new CmsMenuViewModel(item, context));
                }
                else if (item.Parent == SideBarSection.System)
                {
                    system.Items.Add(new CmsMenuViewModel(item, context));
                }
                else if (item.Parent == SideBarSection.Development)
                {
                    development.Items.Add(new CmsMenuViewModel(item, context));
                }
                else if (item.Parent == SideBarSection.Contents)
                {
                    content.Items.Add(new CmsMenuViewModel(item, context));
                }
                else if (item.Parent == SideBarSection.Database)
                {
                    database.Items.Add(new CmsMenuViewModel(item, context));
                }
                else if (item.Parent == SideBarSection.Commerce)
                {
                    //  commerce.Items.Add(new CmsMenuViewModel(item, context));
                }
            }

            MenuManager.VerifySortSideBar(advance.Items, call.Context);

            return(advance);
        }
Example #5
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("Code search", Context));
 }
Example #6
0
 public string Group(RenderContext context)
 {
     return(Hardcoded.GetValue("Normal", context));
 }
Example #7
0
        public void Check()
        {
            var sitedb = this.session.context.WebSite.SiteDb();

            this.session.Headline = Hardcoded.GetValue("Checking", session.context) + " " + Hardcoded.GetValue("Html tag", session.context) + "...";

            var allrepos = sitedb.ActiveRepositories();

            foreach (var repo in allrepos)
            {
                if (Lib.Reflection.TypeHelper.HasInterface(repo.ModelType, typeof(IDomObject)))

                {
                    var allitems = repo.All();

                    foreach (var item in allitems)
                    {
                        var domobj = item as IDomObject;
                        if (domobj != null)
                        {
                            var dom = domobj.Dom;

                            CheckEmptyTag(domobj as SiteObject, dom);

                            CheckDepth(domobj as SiteObject, dom);

                            CheckOutdateTag(domobj as SiteObject, dom);

                            CheckWrongNestedTag(domobj as SiteObject, dom);
                        }
                    }
                }
            }
        }
Example #8
0
 public string Group(RenderContext context)
 {
     return(Hardcoded.GetValue("Advanced", context));
 }
Example #9
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("Check html using Document structure", context));
 }
Example #10
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("Table Relation", Context));
 }
Example #11
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("CSS optimization", Context));
 }
Example #12
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("TransferTask", Context));
 }
Example #13
0
File: Bar.cs Project: xhute/Kooboo
        protected virtual List <MenuItem> SiteMenu_Advance(ApiCall call)
        {
            User   user    = call.Context.User;
            SiteDb siteDb  = call.Context.WebSite.SiteDb();
            var    context = call.Context;

            var items = new List <MenuItem>();

            var sysmenu = new MenuItem
            {
                Name  = Hardcoded.GetValue("System", context),
                Icon  = "icon icon-settings",
                Items =
                {
                    new MenuItem {
                        Name = Hardcoded.GetValue("Settings", context), Url = AdminUrl("System/Settings", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Settings
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Config", context), Url = AdminUrl("System/CoreSettings", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Settings
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Text", context), Url = AdminUrl("System/KConfig", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Configs
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Domains", context), Url = AdminUrl("System/Domains", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Domains
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Sync", context), Url = AdminUrl("Sync", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Synchronization
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("SiteLogs", context), Url = AdminUrl("System/SiteLogs", siteDb), ActionRights = Sites.Authorization.Actions.Systems.SiteLogs
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("VisitorLogs", context), Url = AdminUrl("System/VisitorLogs", siteDb), ActionRights = Sites.Authorization.Actions.Systems.VisitorLogs
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Disk", context), Url = AdminUrl("System/Disk", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Disk
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Jobs", context), Url = AdminUrl("System/Jobs", siteDb), ActionRights = Sites.Authorization.Actions.Systems.Jobs
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("SiteUser", context), Url = AdminUrl("System/SiteUser", siteDb), ActionRights = Sites.Authorization.Actions.Systems.SiteUser
                    },
                }
            };

            if (call.WebSite != null && call.WebSite.EnableFrontEvents)
            {
                var eventmenus = SiteMenu_Events(call);
                if (eventmenus != null && eventmenus.Items.Count() > 0)
                {
                    sysmenu.Items.Add(eventmenus);
                }
            }

            items.Add(sysmenu);



            items.Add(new MenuItem
            {
                Name  = Hardcoded.GetValue("Development", context),
                Icon  = "icon fa fa-code",
                Items =
                {
                    new MenuItem {
                        Name = Hardcoded.GetValue("Layouts", context), Url = AdminUrl("Development/Layouts", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Layouts
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Views", context), Url = AdminUrl("Development/Views", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Views
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Forms", context), Url = AdminUrl("Development/Forms", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Forms
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Menus", context), Url = AdminUrl("Development/Menus", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Menus
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Scripts", context), Url = AdminUrl("Development/Scripts", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Scripts
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Styles", context), Url = AdminUrl("Development/Styles", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Styles
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Code", context), Url = AdminUrl("Development/Code", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Code
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Urls", context), Url = AdminUrl("Development/URLs", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Urls
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Search", context), Url = AdminUrl("Development/Search", siteDb), ActionRights = Sites.Authorization.Actions.Developments.Search
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("DataSource", context), Url = AdminUrl("Development/DataSources", siteDb), ActionRights = Sites.Authorization.Actions.Developments.DataSource
                    },
                }
            });

            items.Add(new MenuItem
            {
                Name  = Hardcoded.GetValue("Contents", context),
                Icon  = "icon fa fa-files-o",
                Items =
                {
                    new MenuItem
                    {
                        Name  = Hardcoded.GetValue("Contents", context),
                        Url   = AdminUrl("Contents/TextContents", siteDb),
                        Items = SiteMenu_SubContent(user, siteDb), ActionRights = Sites.Authorization.Actions.Contents.Content
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("ContentTypes", context), Url = AdminUrl("Contents/ContentTypes", siteDb), ActionRights = Sites.Authorization.Actions.Contents.ContentTypes
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Labels", context), Url = AdminUrl("Contents/Labels", siteDb), ActionRights = Sites.Authorization.Actions.Contents.Labels
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("HtmlBlocks", context), Url = AdminUrl("Contents/HtmlBlocks", siteDb), ActionRights = Sites.Authorization.Actions.Contents.HtmlBlocks
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Files", context), Url = AdminUrl("Storage/Files", siteDb)
                    },
                }
            });

            //items.Add(new MenuItem
            //{
            //    Name = Hardcoded.GetValue("E-Commerce", context),
            //    Icon = "icon fa fa-shopping-cart",
            //    Items =
            //    {
            //        new MenuItem { Name = Hardcoded.GetValue("Products management", context), Url = AdminUrl("ECommerce/Products", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Product types", context), Url = AdminUrl("ECommerce/Product/Types", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Product categories", context), Url = AdminUrl("ECommerce/Product/Categories", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Customers", context), Url = AdminUrl("ECommerce/Product/Categories1", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Orders", context), Url = AdminUrl("ECommerce/Product/Categories2", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Marketing", context), Url = AdminUrl("ECommerce/Product/Categories3", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Reports", context), Url = AdminUrl("ECommerce/Product/Categories4", siteDb) },
            //        new MenuItem { Name = Hardcoded.GetValue("Settings", context), Url = AdminUrl("ECommerce/Product/Categories5", siteDb) }
            //    }
            //});

            items.Add(new MenuItem
            {
                Name  = Hardcoded.GetValue("Database", context),
                Icon  = "icon fa fa-database",
                Items =
                {
                    new MenuItem {
                        Name = Hardcoded.GetValue("Table", context), Url = AdminUrl("Storage/Database", siteDb)
                    },
                    new MenuItem {
                        Name = Hardcoded.GetValue("Key-Value", context), Url = AdminUrl("Storage/KeyValue", siteDb)
                    }
                }
            });

            if (siteDb.WebSite.EnableMultilingual)
            {
                List <string> othercultures = new List <string>();
                foreach (var item in siteDb.WebSite.Culture.Keys.ToList())
                {
                    if (item.ToLower() != siteDb.WebSite.DefaultCulture.ToLower())
                    {
                        othercultures.Add(item);
                    }
                }

                items.Add(new MenuItem
                {
                    Name         = Hardcoded.GetValue("Multilingual", context),
                    Icon         = "icon glyphicon glyphicon-globe",
                    ActionRights = Sites.Authorization.Actions.Contents.Multilingual,
                    Items        = othercultures.Select(it => new MenuItem
                    {
                        Name  = it,
                        Items = SiteMenu_MultiLanguages(call, it)
                    }).ToList()
                });
            }

            return(items);
        }
Example #14
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("SiteUser", Context));
 }
Example #15
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("Check the size of image, should below 1MB", context));
 }
Example #16
0
        public void Check()
        {
            var sitedb = this.session.context.WebSite.SiteDb();

            this.session.Headline = Hardcoded.GetValue("Checking", session.context) + " " + Hardcoded.GetValue("Dom structure", session.context) + "...";

            var allrepos = sitedb.AllRepositories;

            string name = Hardcoded.GetValue("Dom structure error", session.context);

            foreach (var repo in allrepos)
            {
                if (Lib.Reflection.TypeHelper.HasInterface(repo.ModelType, typeof(IDomObject)))

                {
                    var allitems = repo.All();

                    foreach (var item in allitems)
                    {
                        var domobj = item as DomObject;
                        if (domobj != null)
                        {
                            List <string> errors = new List <string>();

                            var dom = Kooboo.Dom.DomParser.CreateDom(domobj.Body, errors);

                            foreach (var err in errors)
                            {
                                string message = err;
                                message += DiagnosisHelper.DisplayUsedBy(session.context, domobj as SiteObject);
                                session.AddMessage(name, message, MessageType.Warning);
                            }
                        }
                    }
                }
            }
        }
Example #17
0
        public List <ExportStoreNameViewModel> ExportStoreNames(ApiCall call)
        {
            List <ExportStoreNameViewModel> names = new List <ExportStoreNameViewModel>();

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Page", DisplayName = Hardcoded.GetValue("Page", call.Context)
            });
            names.Add(new ExportStoreNameViewModel()
            {
                Name = "View", DisplayName = Hardcoded.GetValue("View", call.Context)
            });
            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Layout", DisplayName = Hardcoded.GetValue("Layout", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Image", DisplayName = Hardcoded.GetValue("Image", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Script", DisplayName = Hardcoded.GetValue("Script", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Style", DisplayName = Hardcoded.GetValue("Style", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "TextContent", DisplayName = Hardcoded.GetValue("TextContent", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "ContentType", DisplayName = Hardcoded.GetValue("ContentType", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "ContentFolder", DisplayName = Hardcoded.GetValue("ContentFolder", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "HtmlBlock", DisplayName = Hardcoded.GetValue("HtmlBlock", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Label", DisplayName = Hardcoded.GetValue("Label", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Menu", DisplayName = Hardcoded.GetValue("Menu", call.Context)
            });

            names.Add(new ExportStoreNameViewModel()
            {
                Name = "Storage", DisplayName = Hardcoded.GetValue("Storage", call.Context)
            });

            return(names);
        }
Example #18
0
        private static IResponse ExecuteMethod(ApiCall call, ApiMethod apimethod)
        {
            object response = null;

            if (apimethod.ClassInstance is Api)
            {
                var instance = Activator.CreateInstance(apimethod.DeclareType) as Api;

                try
                {
                    var ok = instance.OnActionExecuting(call);
                    if (ok)
                    {
                        response = Methods.ApiMethodManager.Execute(apimethod, call);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    instance.OnActionExecuted(call);
                }
            }
            else
            {
                response = Methods.ApiMethodManager.Execute(apimethod, call);
            }


            if (apimethod.IsVoid)
            {
                return(new JsonResponse()
                {
                    Success = true, DataChange = true
                });
            }

            if (response != null && response.GetType() == typeof(bool))
            {
                var ok     = (bool)response;
                var result = new JsonResponse()
                {
                    Success = ok
                };
                if (!ok)
                {
                    result.Messages.Add(Hardcoded.GetValue("Api method define a bool return type and return false", call.Context));
                }
                return(result);
            }

            if (response == null)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(Hardcoded.GetValue("method return null for required object type", call.Context) + " :" + apimethod.ReturnType.ToString());
                return(result);
            }

            if (response is IResponse)
            {
                return(response as IResponse);
                //TODO: set the response message to multiple lingual.
            }
            else
            {
                return(new JsonResponse(response)
                {
                    Success = true
                });
            }
        }
Example #19
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("Check html tag for empty, too deep hierarchy, outdated tag and invalid nested tags", context));
 }
Example #20
0
        public static IResponse Execute(ApiCall call, IApiProvider apiProvider)
        {
            ApiMethod apimethod = null;

            var apiobject = apiProvider.Get(call.Command.ObjectType);

            if (apiobject != null)
            {
                apimethod = Methods.ApiMethodManager.Get(apiobject, call.Command.Method);
            }

            if (apimethod == null && apiProvider.GetMethod != null)
            {
                apimethod = apiProvider.GetMethod(call);
            }

            if (apimethod == null)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(Hardcoded.GetValue("Api method Not Found", call.Context));
                return(result);
            }

            // check permission
            if (apiProvider.CheckAccess != null)
            {
                if (!apiProvider.CheckAccess(call.Context, apimethod))
                {
                    var result = new JsonResponse()
                    {
                        Success = false
                    };
                    result.Messages.Add(Hardcoded.GetValue("Unauthorized access", call.Context));
                    return(result);
                }
            }

            if (call.IsFake)
            {
                var fakedata = Lib.Development.FakeData.GetFakeValue(apimethod.ReturnType);
                return(new JsonResponse(fakedata)
                {
                    Success = true
                });
            }
            if (apiobject != null)
            {
                if (!ValidateRequirement(call.Command, call.Context, apiProvider))
                {
                    var result = new JsonResponse()
                    {
                        Success = false
                    };
                    result.Messages.Add(Hardcoded.GetValue("User or website not valid", call.Context));
                    return(result);
                }
            }

            List <string> errors = new List <string>();

            if (!ValideAssignModel(apimethod, call, errors.Add))
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.AddRange(errors);
                return(result);
            }

            if (!ValideParameters(apimethod, call, errors.Add))
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.AddRange(errors);
                return(result);
            }
            try
            {
                return(ExecuteMethod(call, apimethod));
            }
            catch (Exception ex)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(ex.Message);

                Kooboo.Data.Log.Instance.Exception.WriteException(ex);

                return(result);
            }
        }
Example #21
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("Check availability of external links", context));
 }
Example #22
0
 public string Name(RenderContext context)
 {
     return(Hardcoded.GetValue("check all internal links to make sure that the resource did exists", context));
 }
Example #23
0
 public string GetDisplayName(RenderContext Context)
 {
     return(Hardcoded.GetValue("Layouts", Context));
 }
Example #24
0
        public static IResponse Execute(ApiCall call, IApiProvider apiProvider)
        {
            var apiobject = apiProvider.Get(call.Command.ObjectType);

            if (apiobject == null)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(Hardcoded.GetValue("Object type Not Found", call.Context));
                return(result);
            }

            var apimethod = Methods.ApiMethodManager.Get(apiobject, call.Command.Method);

            if (apimethod == null)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(Hardcoded.GetValue("Api method Not Found", call.Context));
                return(result);
            }

            if (call.IsFake)
            {
                var fakedata = Lib.Development.FakeData.GetFakeValue(apimethod.ReturnType);
                return(new JsonResponse(fakedata)
                {
                    Success = true
                });
            }

            if (!ValidateRequirement(call.Command, call.Context.WebSite, call.Context.User, apiProvider))
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(Hardcoded.GetValue("User or website not valid", call.Context));
                return(result);
            }
            List <string> errors = new List <string>();

            if (!ValideAssignModel(apimethod, call, errors.Add))
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.AddRange(errors);
                return(result);
            }

            if (!ValideParameters(apimethod, call, errors.Add))
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.AddRange(errors);
                return(result);
            }

            try
            {
                return(ExecuteMethod(call, apimethod));
            }
            catch (Exception ex)
            {
                var result = new JsonResponse()
                {
                    Success = false
                };
                result.Messages.Add(ex.Message);

                Kooboo.Data.Log.ExceptionLog.Write(ex.Message + "\r\n" + ex.StackTrace + "\r\n" + ex.Source);

                return(result);
            }
        }