private void LoadControlType()
        {
            UseCache = false;
            if (ItemVersionId == -1)
            {
                BindItemData(true);
                //trArticleId.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                BindItemData();
                cmdDelete.Visible = IsAdmin;
            }

            var av = (Article)VersionInfoObject;

            //Item Edit
            itemEditControl = (ItemEdit)LoadControl(ItemControlToLoad);
            itemEditControl.ModuleConfiguration = ModuleConfiguration;
            itemEditControl.ID = Path.GetFileNameWithoutExtension(ItemControlToLoad);
            itemEditControl.VersionInfoObject = VersionInfoObject;
            phControls.Controls.Add(itemEditControl);

            //Article Text Editor
            TeArticleText                = (TextEditor)LoadControl("~/controls/TextEditor.ascx");
            TeArticleText.HtmlEncode     = false;
            TeArticleText.TextRenderMode = "Raw";
            //TeArticleText.Width = ArticleEditWidth; //default values for the editor
            TeArticleText.Height     = ArticleEditHeight; //default values for the editor
            TeArticleText.ChooseMode = true;
            phArticleText.Controls.Add(TeArticleText);
            TeArticleText.Text = av.ArticleText;

            //Parent Category Relationship
            parentCategoryRelationship = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            parentCategoryRelationship.ModuleConfiguration = ModuleConfiguration;

            parentCategoryRelationship.LocalResourceFile        = ItemrelationshipResourceFile;
            parentCategoryRelationship.VersionInfoObject        = VersionInfoObject;
            parentCategoryRelationship.ListRelationshipTypeId   = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.CreateRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.AvailableSelectionMode   = ListSelectionMode.Single;
            parentCategoryRelationship.IsRequired = true;
            parentCategoryRelationship.FlatView   = true;
            parentCategoryRelationship.ItemTypeId = ItemType.Category.GetId();
            phParentCategory.Controls.Add(parentCategoryRelationship);

            //Related Category Relationship
            relatedCategoryRelationships = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            relatedCategoryRelationships.ModuleConfiguration      = ModuleConfiguration;
            relatedCategoryRelationships.LocalResourceFile        = ItemrelationshipResourceFile;
            relatedCategoryRelationships.VersionInfoObject        = VersionInfoObject;
            relatedCategoryRelationships.ListRelationshipTypeId   = Util.RelationshipType.ItemToParentCategory.GetId();
            relatedCategoryRelationships.CreateRelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId();
            relatedCategoryRelationships.AvailableSelectionMode   = ListSelectionMode.Multiple;
            relatedCategoryRelationships.IsRequired = false;
            relatedCategoryRelationships.FlatView   = true;
            relatedCategoryRelationships.ItemTypeId = ItemType.Category.GetId();
            phRelatedCategories.Controls.Add(relatedCategoryRelationships);


            //load approval status
            itemApprovalStatus = (ItemApproval)LoadControl(ApprovalControlToLoad);
            itemApprovalStatus.ModuleConfiguration = ModuleConfiguration;
            itemApprovalStatus.ID = Path.GetFileNameWithoutExtension(ApprovalControlToLoad);
            itemApprovalStatus.VersionInfoObject = VersionInfoObject;
            phApproval.Controls.Add(itemApprovalStatus);


            if (AllowTags)
            {
                var tagList = new StringBuilder(255);
                foreach (ItemTag it in VersionInfoObject.Tags)
                {
                    tagList.Append(Tag.GetTag(it.TagId, PortalId).Name);
                    tagList.Append(";");
                }

                tagEntryControl = (TagEntry)LoadControl(TagControlToLoad);
                tagEntryControl.ModuleConfiguration = ModuleConfiguration;
                tagEntryControl.ID = Path.GetFileNameWithoutExtension(TagControlToLoad);


                tagEntryControl.TagList = tagList.ToString();
                phTagEntry.Controls.Add(tagEntryControl);
            }
            else
            {
            }
        }
Пример #2
0
        private void LoadControlType()
        {
            this.UseCache = false;
            if (this.ItemVersionId == -1)
            {
                this.BindItemData(true);
            }
            else
            {
                this.BindItemData();
            }

            // Item Edit
            this.itemEditControl = (ItemEdit)this.LoadControl(ItemControlToLoad);
            this.itemEditControl.ModuleConfiguration = this.ModuleConfiguration;
            this.itemEditControl.ID = Path.GetFileNameWithoutExtension(ItemControlToLoad);
            this.itemEditControl.VersionInfoObject = this.VersionInfoObject;
            this.phItemEdit.Controls.Add(this.itemEditControl);

            if (SecurityFilter.IsSecurityEnabled(this.PortalId))
            {
                this.trCategoryPermissions.Visible = true;

                this.categoryPermissions                     = (CategoryPermissions)this.LoadControl("../CategoryControls/CategoryPermissions.ascx");
                this.categoryPermissions.CategoryId          = this.VersionInfoObject.ItemId;
                this.categoryPermissions.ModuleConfiguration = this.ModuleConfiguration;
                this.phCategoryPermissions.Controls.Add(this.categoryPermissions);
            }

            // Parent Category
            this.parentCategoryRelationships = (ItemRelationships)this.LoadControl("../controls/ItemRelationships.ascx");
            this.parentCategoryRelationships.ExcludeCircularRelationships = true;
            this.parentCategoryRelationships.ModuleConfiguration          = this.ModuleConfiguration;
            this.parentCategoryRelationships.LocalResourceFile            = this.ItemRelationshipResourceFile;
            this.parentCategoryRelationships.VersionInfoObject            = this.VersionInfoObject;
            this.parentCategoryRelationships.ListRelationshipTypeId       = RelationshipType.ItemToParentCategory.GetId();
            this.parentCategoryRelationships.CreateRelationshipTypeId     = RelationshipType.ItemToParentCategory.GetId();
            this.parentCategoryRelationships.AvailableSelectionMode       = ListSelectionMode.Single;
            this.parentCategoryRelationships.FlatView   = true;
            this.parentCategoryRelationships.ItemTypeId = ItemType.Category.GetId();
            this.phParentCategory.Controls.Add(this.parentCategoryRelationships);

            // Related Categories
            // this.irRelated = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            // this.irRelated.ModuleConfiguration = ModuleConfiguration;
            // this.irRelated.LocalResourceFile = ItemRelationshipResourceFile;
            // this.irRelated.VersionInfoObject = VersionInfoObject;
            // this.irRelated.ListRelationshipTypeId = RelationshipType.ItemToRelatedCategory.GetId();
            // this.irRelated.CreateRelationshipTypeId = RelationshipType.ItemToRelatedCategory.GetId();
            // this.irRelated.AvailableSelectionMode = ListSelectionMode.Multiple;
            // this.irRelated.FlatView = true;
            // this.irRelated.ItemTypeId = ItemType.Category.GetId();
            // this.phParentCategory.Controls.Add(this.irRelated);

            // Featured Articles
            this.featuredArticlesRelationships = (ItemRelationships)this.LoadControl("../controls/ItemRelationships.ascx");
            this.featuredArticlesRelationships.ModuleConfiguration      = this.ModuleConfiguration;
            this.featuredArticlesRelationships.VersionInfoObject        = this.VersionInfoObject;
            this.featuredArticlesRelationships.LocalResourceFile        = this.ItemRelationshipResourceFile;
            this.featuredArticlesRelationships.ListRelationshipTypeId   = RelationshipType.ItemToParentCategory.GetId();
            this.featuredArticlesRelationships.CreateRelationshipTypeId = RelationshipType.ItemToFeaturedItem.GetId();
            this.featuredArticlesRelationships.AvailableSelectionMode   = ListSelectionMode.Multiple;
            this.featuredArticlesRelationships.FlatView        = true;
            this.featuredArticlesRelationships.EnableDates     = true;
            this.featuredArticlesRelationships.AllowSearch     = true;
            this.featuredArticlesRelationships.EnableSortOrder = true;
            this.featuredArticlesRelationships.ItemTypeId      = ItemType.Article.GetId();
            this.phFeaturedArticles.Controls.Add(this.featuredArticlesRelationships);

            // load approval status
            this.itemApprovalStatus = (ItemApproval)this.LoadControl(ApprovalControlToLoad);
            this.itemApprovalStatus.ModuleConfiguration = this.ModuleConfiguration;
            this.itemApprovalStatus.ID = Path.GetFileNameWithoutExtension(ApprovalControlToLoad);
            this.itemApprovalStatus.VersionInfoObject = this.VersionInfoObject;
            this.phApproval.Controls.Add(this.itemApprovalStatus);
        }
        private void LoadControlType()
        {
            UseCache = false;
            if (ItemVersionId == -1)
            {
                BindItemData(true);
                //trArticleId.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                BindItemData();
                cmdDelete.Visible = IsAdmin;
            }

            var av = (Article)VersionInfoObject;

            //Item Edit
            itemEditControl = (ItemEdit)LoadControl(ItemControlToLoad);
            itemEditControl.ModuleConfiguration = ModuleConfiguration;
            itemEditControl.ID = Path.GetFileNameWithoutExtension(ItemControlToLoad);
            itemEditControl.VersionInfoObject = VersionInfoObject;
            phControls.Controls.Add(itemEditControl);

            //Article Text Editor
            TeArticleText = (TextEditor)LoadControl("~/controls/TextEditor.ascx");
            TeArticleText.HtmlEncode = false;
            TeArticleText.TextRenderMode = "Raw";
            //TeArticleText.Width = ArticleEditWidth; //default values for the editor
            TeArticleText.Height = ArticleEditHeight; //default values for the editor
            TeArticleText.ChooseMode = true;
            phArticleText.Controls.Add(TeArticleText);
            TeArticleText.Text = av.ArticleText;

            //Parent Category Relationship
            parentCategoryRelationship = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            parentCategoryRelationship.ModuleConfiguration = ModuleConfiguration;

            parentCategoryRelationship.LocalResourceFile = ItemrelationshipResourceFile;
            parentCategoryRelationship.VersionInfoObject = VersionInfoObject;
            parentCategoryRelationship.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.CreateRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationship.AvailableSelectionMode = ListSelectionMode.Single;
            parentCategoryRelationship.IsRequired = true;
            parentCategoryRelationship.FlatView = true;
            parentCategoryRelationship.ItemTypeId = ItemType.Category.GetId();
            phParentCategory.Controls.Add(parentCategoryRelationship);

            //Related Category Relationship
            relatedCategoryRelationships = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            relatedCategoryRelationships.ModuleConfiguration = ModuleConfiguration;
            relatedCategoryRelationships.LocalResourceFile = ItemrelationshipResourceFile;
            relatedCategoryRelationships.VersionInfoObject = VersionInfoObject;
            relatedCategoryRelationships.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            relatedCategoryRelationships.CreateRelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId();
            relatedCategoryRelationships.AvailableSelectionMode = ListSelectionMode.Multiple;
            relatedCategoryRelationships.IsRequired = false;
            relatedCategoryRelationships.FlatView = true;
            relatedCategoryRelationships.ItemTypeId = ItemType.Category.GetId();
            phRelatedCategories.Controls.Add(relatedCategoryRelationships);

            //load approval status
            itemApprovalStatus = (ItemApproval)LoadControl(ApprovalControlToLoad);
            itemApprovalStatus.ModuleConfiguration = ModuleConfiguration;
            itemApprovalStatus.ID = Path.GetFileNameWithoutExtension(ApprovalControlToLoad);
            itemApprovalStatus.VersionInfoObject = VersionInfoObject;
            phApproval.Controls.Add(itemApprovalStatus);

            if (AllowTags)
            {
                var tagList = new StringBuilder(255);
                foreach (ItemTag it in VersionInfoObject.Tags)
                {
                    tagList.Append(Tag.GetTag(it.TagId, PortalId).Name);
                    tagList.Append(";");
                }

                tagEntryControl = (TagEntry)LoadControl(TagControlToLoad);
                tagEntryControl.ModuleConfiguration = ModuleConfiguration;
                tagEntryControl.ID = Path.GetFileNameWithoutExtension(TagControlToLoad);

                tagEntryControl.TagList = tagList.ToString();
                phTagEntry.Controls.Add(tagEntryControl);

            }
            else
            {
            }
        }
        private void LoadControlType()
        {
            UseCache = false;
            if (ItemVersionId == -1)
            {
                BindItemData(true);
            }
            else
            {
                BindItemData();
            }

            //Item Edit
            itemEditControl = (ItemEdit)LoadControl(ItemControlToLoad);
            itemEditControl.ModuleConfiguration = ModuleConfiguration;
            itemEditControl.ID = Path.GetFileNameWithoutExtension(ItemControlToLoad);
            itemEditControl.VersionInfoObject = VersionInfoObject;
            phItemEdit.Controls.Add(itemEditControl);

            if (SecurityFilter.IsSecurityEnabled(PortalId))
            {
                trCategoryPermissions.Visible = true;

                categoryPermissions = (CategoryPermissions)LoadControl("../CategoryControls/CategoryPermissions.ascx");
                categoryPermissions.CategoryId = VersionInfoObject.ItemId;
                categoryPermissions.ModuleConfiguration = ModuleConfiguration;
                phCategoryPermissions.Controls.Add(categoryPermissions);
            }

            //Parent Category
            parentCategoryRelationships = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            parentCategoryRelationships.ExcludeCircularRelationships = true;
            parentCategoryRelationships.ModuleConfiguration = ModuleConfiguration;
            parentCategoryRelationships.LocalResourceFile = ItemRelationshipResourceFile;
            parentCategoryRelationships.VersionInfoObject = VersionInfoObject;
            parentCategoryRelationships.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationships.CreateRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            parentCategoryRelationships.AvailableSelectionMode = ListSelectionMode.Single;
            parentCategoryRelationships.FlatView = true;
            parentCategoryRelationships.ItemTypeId = ItemType.Category.GetId();
            phParentCategory.Controls.Add(parentCategoryRelationships);

            //Related Categories
            //this.irRelated = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            //this.irRelated.ModuleConfiguration = ModuleConfiguration;
            //this.irRelated.LocalResourceFile = ItemRelationshipResourceFile;
            //this.irRelated.VersionInfoObject = VersionInfoObject;
            //this.irRelated.ListRelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId();
            //this.irRelated.CreateRelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId();
            //this.irRelated.AvailableSelectionMode = ListSelectionMode.Multiple;
            //this.irRelated.FlatView = true;
            //this.irRelated.ItemTypeId = ItemType.Category.GetId();
            //this.phParentCategory.Controls.Add(this.irRelated);

            //Featured Articles
            featuredArticlesRelationships = (ItemRelationships)LoadControl("../controls/ItemRelationships.ascx");
            featuredArticlesRelationships.ModuleConfiguration = ModuleConfiguration;
            featuredArticlesRelationships.VersionInfoObject = VersionInfoObject;
            featuredArticlesRelationships.LocalResourceFile = ItemRelationshipResourceFile;
            featuredArticlesRelationships.ListRelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId();
            featuredArticlesRelationships.CreateRelationshipTypeId = Util.RelationshipType.ItemToFeaturedItem.GetId();
            featuredArticlesRelationships.AvailableSelectionMode = ListSelectionMode.Multiple;
            featuredArticlesRelationships.FlatView = true;
            featuredArticlesRelationships.EnableDates = true;
            featuredArticlesRelationships.AllowSearch = true;
            featuredArticlesRelationships.EnableSortOrder = true;
            featuredArticlesRelationships.ItemTypeId = ItemType.Article.GetId();
            phFeaturedArticles.Controls.Add(featuredArticlesRelationships);

            //load approval status
            itemApprovalStatus = (ItemApproval)LoadControl(ApprovalControlToLoad);
            itemApprovalStatus.ModuleConfiguration = ModuleConfiguration;
            itemApprovalStatus.ID = Path.GetFileNameWithoutExtension(ApprovalControlToLoad);
            itemApprovalStatus.VersionInfoObject = VersionInfoObject;
            phApproval.Controls.Add(itemApprovalStatus);
        }