コード例 #1
0
ファイル: DefaultController.cs プロジェクト: Chrullbo/iziCMS
 public DefaultController()
 {
     var sub = GetSub();
     _ctx = new Context();
     CreateChristian();
     _site = string.IsNullOrEmpty(sub) ? _ctx.Sites.First() : _ctx.Sites.First(x => x.FolderName == sub);
 }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: Chrullbo/iziCMS
        public AdminController()
        {

            var sub = GetSub();
            _ctx = new Context();
            _site = string.IsNullOrEmpty(sub) ? _ctx.Sites.First() : _ctx.Sites.First(x => x.FolderName == sub);



        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: Chrullbo/iziCMS
        public ActionResult Email(Site site)
        {
            _site.SmtpHost = site.SmtpHost;
            _site.SmtpUser = site.SmtpUser;
            _site.SmtpPassword = site.SmtpPassword;
            _site.SmtpPort = site.SmtpPort;

            _ctx.SaveChanges();
            TempData["message"] = new List<string> { "Siten är uppdaterad" };
            return Redirect("/admin/email");
        }
コード例 #4
0
ファイル: DefaultController.cs プロジェクト: Chrullbo/iziCMS
        private void CreateMatoppet()
        {
            var s = new Site { Name = "Matöppet - Fjärdhundra", FolderName = "matoppet" };
            s.Templates.Add(new Template
            {
                Type = TemplateType.Standard,
                Site = s,
                Sections = new List<Section>
                        {
                            
                            //new Section {Namn = "Left", PageArea = PageAreaType.Left},
                            new Section
                                {
                                    Namn = "Content",
                                    PageArea = PageAreaType.Main,
                                    Editable = true
                                },
                            //new Section {Namn = "Right", PageArea = PageAreaType.Right}
                        }
            });



            s.Pages.Add(new Page
            {
                Name = "Startsida",
                UrlName = "hem",
                Startpage = true,
                VisibleInMenu = false,
                Template = new Template
                {
                    Type = TemplateType.Startpage,
                    Site = s,
                    Sections = new List<Section>
                                {
                                    new Section{Namn = "Content",PageArea = PageAreaType.Main,Editable = true},
                                    //new Section{Namn = "Right",PageArea = PageAreaType.Right}
                                }
                }
            });
            

            s.Users.Add(new User { Active = true, Site = s, Type = RoleType.Administrator, Name = "Christian Kihlstrand", UserName = "******", Password = "******", LastLogin = DateTime.Now });
            _ctx.Sites.Add(s);
            _ctx.SaveChanges();
        }
コード例 #5
0
ファイル: AdminController.cs プロジェクト: Chrullbo/iziCMS
        public ActionResult Index(Site site, int startPageID, FormCollection collection)
        {
            _site.Name = site.Name;
            _site.Pages.Single(x => x.ID == startPageID).Startpage = true;
            _site.LeftMenu = site.LeftMenu;
            _site.EditableSiteFoot = site.EditableSiteFoot;
            _site.MetaDescription = site.MetaDescription;
            _site.SubmitApplicationEmail = site.SubmitApplicationEmail;
            _site.SupportEmail = site.SupportEmail;
            _site.SiteUrl = site.SiteUrl;
            _site.MetaKeywords = site.MetaKeywords;

            if (collection["articletypes"] != null)
            {
                var types = collection["articletypes"].Split(',').Select(Int32.Parse).ToArray();

                _site.ArticleTypes = types.Sum(x => x) + 1 + (site.EditableSiteFoot ? 4 : 0);
            }

            _ctx.SaveChanges();
            TempData["message"] = new List<string> { "Siten är uppdaterad" };
            return Redirect("/admin");
        }
コード例 #6
0
ファイル: DefaultController.cs プロジェクト: Chrullbo/iziCMS
        private void CreateMalarentreprenad()
        {

            _ctx.Templates.Add(new Template
            {
                Type = TemplateType.Standard,
                Sections = new List<Section>
                        {
                            new Section {Namn = "Left", PageArea = PageAreaType.Left},
                            new Section
                                {
                                    Namn = "Content",
                                    PageArea = PageAreaType.Main,
                                    Editable = true
                                },
                            new Section {Namn = "Right", PageArea = PageAreaType.Right}
                        }
            });
            var s = new Site { Name = "Your sitename", FolderName = "malarentreprenad" };

            s.Pages.Add(new Page
                {
                    Name = "Startsida",
                    UrlName = "hem",
                    Startpage = true,
                    VisibleInMenu = false,
                    Template = new Template
                        {
                            Type = TemplateType.Startpage,
                            Sections = new List<Section>
                                {
                                    new Section{Namn = "Content",PageArea = PageAreaType.Main,Editable = true},
                                    new Section{Namn = "Right",PageArea = PageAreaType.Right}
                                }
                        }
                });
            _ctx.Sites.Add(s);

            _ctx.Users.Add(new User { Active = true, Type = RoleType.Administrator, UserName = "******", Password = "******", LastLogin = DateTime.Now });
            _ctx.SaveChanges();

        }
コード例 #7
0
ファイル: DefaultController.cs プロジェクト: Chrullbo/iziCMS
        private void CreateHantverkargatan2()
        {
            var s = new Site { Name = "Hantverkargatan 2 - Din personlihghet - Vår passion", FolderName = "hantverkargatan2" };
            s.Templates.Add(new Template
            {
                Type = TemplateType.Standard,
                Site = s,
                Sections = new List<Section>
                        {
                            new Section {Namn = "Left", PageArea = PageAreaType.Left},
                            new Section
                                {
                                    Namn = "Content",
                                    PageArea = PageAreaType.Main,
                                    Editable = true
                                },
                            new Section {Namn = "Right", PageArea = PageAreaType.Right}
                        }
            });
            _ctx.Templates.Add(new Template
            {
                Type = TemplateType.Blogg,
                Site = s,
                Sections = new List<Section>
                        {
                            new Section {Namn = "Left", PageArea = PageAreaType.Left},
                            new Section
                                {
                                    Namn = "Content",
                                    PageArea = PageAreaType.Main,
                                    Editable = true
                                },
                            new Section {Namn = "Right", PageArea = PageAreaType.Right}
                        }
            });


            s.Pages.Add(new Page
            {
                Name = "Startsida",
                UrlName = "hem",
                Startpage = true,
                VisibleInMenu = false,
                Template = new Template
                {
                    Type = TemplateType.Startpage,
                    Site = s,
                    Sections = new List<Section>
                                {
                                    new Section{Namn = "Content",PageArea = PageAreaType.Main,Editable = true},
                                    new Section{Namn = "Right",PageArea = PageAreaType.Right}
                                }
                }
            });


            s.Users.Add(new User { Active = true, Site = s, Type = RoleType.Administrator, Name = "Christian Kihlstrand", UserName = "******", Password = "******", LastLogin = DateTime.Now });
            _ctx.Sites.Add(s);
            _ctx.SaveChanges();
        }