Пример #1
0
        private void LoadFormForSite()
        {
            var cmsSite = SiteFactory.Get(_siteId);

            _siteName       = cmsSite.Name;
            PageHeader.Text = _siteName;

            SetStandardFieldLabels();

            // Standard fields
            SiteName.PropertyValue = new StringProperty(cmsSite.Name);

            // Advanced fields
            ChildSortDirection.SelectedValue = ((int)cmsSite.ChildSortDirection).ToString();
            ChildSortOrder.SelectedValue     = ((int)cmsSite.ChildSortOrder).ToString();

            var propertyDefinitions = CmsSite.PropertyDefinitions;

            AddTabs(propertyDefinitions);

            foreach (var propertyDefinition in propertyDefinitions)
            {
                var propertyName = propertyDefinition.Name;
                var propertyData = cmsSite.Property[propertyName];

                AddControl(propertyName, propertyData, propertyDefinition.PropertyTypeId, propertyDefinition.Header, propertyDefinition.Parameters, propertyDefinition.Required, propertyDefinition.TabGroup);
            }
        }
Пример #2
0
        private object SaveData()
        {
            var cmsSite      = SiteFactory.Get(_siteId);
            var editableSite = cmsSite.MakeEditable();

            SavePropertiesForPage(editableSite);
            _siteName = editableSite.Name;

            return(editableSite);
        }
        private void GetChildren(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            var items = new List <dynamic>();

            var id = context.Request.Form["id"];

            if (id == "#")
            {
                var siteId         = Guid.Empty;
                var site           = SiteFactory.Get(siteId);
                var jQueryTreeItem = new JQueryTreeItem {
                    text = site.Name, children = true, id = siteId.ToString(), parent = "#", icon = "jstree-rooticon"
                };
                items.Add(jQueryTreeItem);
                context.Response.Write(Serialization.JsonSerialization.SerializeJson(items, new JSONParameters {
                    UseExtensions = false, SerializeNullValues = false
                }));
                context.Response.End();
            }

            var pageId = new Guid(id);

            var children = PageFactory.GetChildrenForPage(pageId, PublishState.All);

            foreach (var childId in children.PageIds)
            {
                var page = PageFactory.GetPage(childId);
                var icon = page.Status == PageInstanceStatus.Published ? "" : "jstree-newpage";
                var text = page.Status == PageInstanceStatus.Published ? page.PageName : "<i>" + page.PageName + "</i>";
                items.Add(new JQueryTreeItem {
                    text = text, children = page.HasChildren, id = childId.ToString(), icon = icon, a_attr = new JQueryTreeLink {
                        href = page.PageUrl.ToString()
                    }
                });
            }

            context.Response.Write(Serialization.JsonSerialization.SerializeJson(items, new JSONParameters {
                UseExtensions = false, SerializeNullValues = false
            }));
        }
Пример #4
0
        public PublicSite Get()
        {
            var site = SiteFactory.Get(SiteSettings.RootPage);

            return(new PublicSite(site));
        }