GetArticle() private method

private GetArticle ( int itemId ) : Article
itemId int
return Article
コード例 #1
0
        /// <summary>
        /// Updates the <see cref="Item.DisplayTabId"/> and <see cref="ChildDisplayTabId"/> settings of all children of this <see cref="Category"/> (and their children's children, etc.)
        /// </summary>
        /// <param name="revisingUser">The revising user.</param>
        /// <returns>The number of affected <see cref="Item"/>s</returns>
        public int CascadeChildDisplayTab(int revisingUser)
        {
            int count = 0;

            foreach (DataRow itemRow in GetAllChildren(ItemId, Util.RelationshipType.ItemToParentCategory.GetId(), PortalId).Tables[0].Rows)
            {
                Item childItem;
                var  itemId = (int)itemRow["itemId"];
                if (GetItemTypeId(itemId) == ItemType.Article.GetId())
                {
                    childItem = Article.GetArticle(itemId, PortalId, true, true, true);
                }
                else
                {
                    childItem = GetCategory(itemId, true, true);
                }

                childItem.DisplayTabId = ChildDisplayTabId;

                var childCategory = childItem as Category;
                if (childCategory != null)
                {
                    childCategory.ChildDisplayTabId = ChildDisplayTabId;
                }

                Setting displayOnCurrentPageSetting = Setting.ArticleSettingCurrentDisplay;
                displayOnCurrentPageSetting.PropertyValue = false.ToString(CultureInfo.InvariantCulture);
                childItem.VersionSettings.Add(new ItemVersionSetting(displayOnCurrentPageSetting));

                childItem.Save(revisingUser);
                count++;
            }

            return(count);
        }
コード例 #2
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Article a = Article.GetArticle(ItemId, PortalId);

                if (a != null && ((!a.ForceDisplayOnPage() && UserHasRights(TabId)) || UserHasRights(a.DisplayTabId)))
                {
                    lblArticleTitle.Text = pageTitle.Text = a.Name;
                    lblArticleText.Text  = a.ArticleText.Replace("[PAGE]", "");

                    //TODO: configure this page to allow for displaying author, date, etc based on the itemversionsettings

                    //ItemVersionSetting auSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlAuthor", "Visible", PortalId);
                    //if (auSetting != null)
                    //{
                    //    ShowAuthor = Convert.ToBoolean(auSetting.PropertyValue, CultureInfo.InvariantCulture);
                    //}


                    lnkPortalLogo.NavigateUrl = "http://" + PortalSettings.PortalAlias.HTTPAlias;
                    lnkPortalLogo.ImageUrl    = PortalSettings.HomeDirectory + PortalSettings.LogoFile;

                    CssStyle = PortalSettings.ActiveTab.SkinPath + "skin.css";
                }
                else
                {
                    lblArticleTitle.Text = pageTitle.Text = Localization.GetString("Permission", LocalResourceFile);
                }
            }
            catch (Exception exc)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(exc);
            }
        }
コード例 #3
0
 private void Page_Load(object sender, EventArgs e)
 {
     try
     {
         LocalizeControls();
         if (_itemType != null)
         {
             //TODO: we need to figure out PortalID so we can get the folloing items from Cache
             if (_itemType.Equals(ItemType.Category.Name, StringComparison.OrdinalIgnoreCase))
             {
                 //TODO: where can we get portalid from? NEED NEW METHOD - HK
                 Category category = Category.GetCategory(_itemId);
                 DisplayItem(category);
             }
             else if (_itemType.Equals(ItemType.Article.Name, StringComparison.OrdinalIgnoreCase))
             {
                 Article article = Article.GetArticle(_itemId);
                 DisplayItem(article);
             }
             else if (_itemType.Equals("OLDARTICLE", StringComparison.OrdinalIgnoreCase))
             {
                 int     newId   = Article.GetOldArticleId(_itemId);
                 Article article = Article.GetArticle(newId);
                 DisplayItem(article);
             }
         }
     }
     catch (Exception ec)
     {
         DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(ec);
     }
 }
コード例 #4
0
        public static List <Article> GetCategoryArticles(int itemId, int portalId)
        {
            DataTable children = GetAllChildren(ItemType.Article.GetId(), itemId, Util.RelationshipType.ItemToParentCategory.GetId(), Util.RelationshipType.ItemToRelatedCategory.GetId(), portalId).Tables[0];
            var       articles = new List <Article>(children.Rows.Count);

            foreach (DataRow row in children.Rows)
            {
                articles.Add(Article.GetArticle((int)row["ItemId"], portalId));
            }
            return(articles);
        }
コード例 #5
0
        private void DisplayCurrentVersion()
        {
            this.SetItemId(Convert.ToInt32(this.Request.QueryString["itemid"], CultureInfo.InvariantCulture));

            if (this.TypeOfItem == ItemType.Article)
            {
                string  articleControlToLoad = "~" + DesktopModuleFolderName + "ArticleControls/articleDisplay.ascx";
                Article a = Article.GetArticle(this.ItemId, this.PortalId);
                if (a == null)
                {
                    throw new InvalidOperationException("Article not found");
                }

                var ad = (ArticleDisplay)this.LoadControl(articleControlToLoad);
                ad.ModuleConfiguration = this.ModuleConfiguration;
                ad.ID                     = Path.GetFileNameWithoutExtension(articleControlToLoad);
                ad.Overrideable           = true;
                ad.DisplayPrinterFriendly = false;
                ad.DisplayRelatedArticle  = false;
                ad.DisplayRelatedLinks    = false;
                ad.DisplayEmailAFriend    = false;
                ad.SetItemId(a.ItemId);
                this.phItem.Controls.Add(ad);
            }
            else if (this.TypeOfItem == ItemType.Category)
            {
                string   categoryControlToLoad = "~" + DesktopModuleFolderName + "CategoryControls/CategoryDisplay.ascx";
                Category category = Category.GetCategory(this.ItemId, this.PortalId);
                if (category == null)
                {
                    throw new InvalidOperationException("Category not found");
                }

                var cd = (CategoryDisplay)this.LoadControl(categoryControlToLoad);
                cd.ModuleConfiguration = this.ModuleConfiguration;
                cd.ID           = Path.GetFileNameWithoutExtension(categoryControlToLoad);
                cd.Overrideable = true;
                cd.ShowAll      = true;
                cd.SetItemId(category.ItemId);
                this.phItem.Controls.Add(cd);
            }
            else
            {
                throw new InvalidOperationException("Invalid Item Type");
            }
        }