コード例 #1
0
        protected void rptStoryCards_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                try
                {
                    Item nodeItm = (Item)e.Item.DataItem;

                    Literal litFeatured    = (Literal)e.Item.FindControl("litFeatured");
                    Literal litComingNext  = (Literal)e.Item.FindControl("litComingNext");
                    Literal litReadStory   = (Literal)e.Item.FindControl("litReadStory");
                    string  featuredText   = string.Empty;
                    string  comingNextText = string.Empty;

                    if (nodeItm.Fields["Featured Story"] != null)
                    {
                        Sitecore.Data.Fields.CheckboxField fldIsFeatured = nodeItm.Fields["Featured Story"];
                        if (fldIsFeatured.Checked == true)
                        {
                            featuredText     = "<h1 class=\"hyhh-story-callout-heading\">Feature Story</h1>";
                            litFeatured.Text = featuredText;
                        }
                    }

                    if (comingNext.ID == nodeItm.ID)
                    {
                        comingNextText       = "<h1 class=\"hyhh-story-callout-heading\">Coming Next</h1>";
                        litComingNext.Text   = comingNextText;
                        litReadStory.Visible = false;

                        //To remove later after coming next is fully implemented
                        //HyperLink storyLink = (HyperLink)e.Item.FindControl("storyLink");
                        //storyLink.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(nodeItm);
                    }
                    else
                    {
                        HyperLink storyLink = (HyperLink)e.Item.FindControl("storyLink");
                        storyLink.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(nodeItm);
                    }
                    //only add a hyperlink to the stories that aren't "Coming Next"



                    Text fldTitle = (Text)e.Item.FindControl("fldTitle");

                    Sitecore.Web.UI.WebControls.Image fldRollupImage = (Sitecore.Web.UI.WebControls.Image)e.Item.FindControl("fldRollupImage");

                    Text fldRollupSummary = (Text)e.Item.FindControl("fldRollupSummary");

                    fldTitle.Item = nodeItm;

                    fldRollupImage.Item   = nodeItm;
                    fldRollupSummary.Item = nodeItm;
                }
                catch (Exception ex)
                {
                    bool exHandled = handleException(ex);
                }
            }
        }
コード例 #2
0
        protected void rptStoryQuote_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                try
                {
                    Item nodeItm = (Item)e.Item.DataItem;
                    //Text fldQuote = (Text)e.Item.FindControl("fldQuote");
                    Text fldCitation = (Text)e.Item.FindControl("fldCitation");

                    //Literal litFeatured = (Literal)e.Item.FindControl("litFeatured");
                    //Literal litComingNext = (Literal)e.Item.FindControl("litComingNext");

                    Literal litQuote    = (Literal)e.Item.FindControl("litQuote");
                    Literal litCitation = (Literal)e.Item.FindControl("litCitation");

                    string quoteText    = string.Empty;
                    string citationText = string.Empty;

                    if (nodeItm.Fields["Quote"] != null)
                    {
                        Sitecore.Data.Fields.CheckboxField fldIsQuote = nodeItm.Fields["Not Quote"];
                        if (fldIsQuote.Checked == true)
                        {
                            //quote text is p text
                            quoteText     = string.Format("<{0}>{1}</{0}>", "p", nodeItm.Fields["Quote"]);
                            litQuote.Text = quoteText;
                        }
                        else
                        {
                            quoteText     = string.Format("<{0}><{1}>{2}</{1}></{0}>", "blockquote", "q", nodeItm.Fields["Quote"]);
                            litQuote.Text = quoteText;
                        }
                    }

                    if (nodeItm.Fields["Citation"].Value == "")
                    {
                        citationText     = string.Format("<{0}>{1}</{0}>", "div", nodeItm.Fields["Citation"]);
                        litCitation.Text = citationText;
                    }
                    else
                    {
                        citationText     = string.Format("<{0}>{1}</{0}>", "cite", nodeItm.Fields["Citation"]);
                        litCitation.Text = citationText;
                    }



                    //fldQuote.Item = nodeItm;
                    //fldCitation.Item = nodeItm;
                }
                catch (Exception ex)
                {
                    bool exHandled = handleException(ex);
                }
            }
        }
コード例 #3
0
        public void PublishItems(string parentID, bool isMediaFolder = false, bool isContentItem = false)
        {
            if (!string.IsNullOrWhiteSpace(parentID))
            {
                var db = Factory.GetDatabase("master");
                var parentItem = db.GetItem(parentID);
                if (parentItem != null)
                {
                    var settingsItem = GetItem("{1ED79DC0-D783-44E5-A0B4-55056215B11A}");
                    if (settingsItem != null && isMediaFolder)
                    {
                        Sitecore.Data.Fields.CheckboxField assignCheckbox = settingsItem.Fields["Publish Media Item on Import"];
                        if (assignCheckbox != null && assignCheckbox.Checked)
                        {
                            //Publish Targets for Media Folder?

                            string publishingTargets = settingsItem["Media Publishing Target DBs"];

                            if (!string.IsNullOrWhiteSpace(publishingTargets))
                            {
                                PublishItemsToTargetDBs(db, parentItem, publishingTargets);
                            }
                        }
                    }
                    else if(settingsItem != null && isContentItem)
                    {
                        Sitecore.Data.Fields.CheckboxField assignCheckbox = settingsItem.Fields["Publish Content Item on Import"];
                        if (assignCheckbox != null && assignCheckbox.Checked)
                        {
                            //Publish Targets for Media Folder?

                            string publishingTargets = settingsItem["Content Item Publishing Target DBs"];

                            if (!string.IsNullOrWhiteSpace(publishingTargets))
                            {
                                PublishItemsToTargetDBs(db, parentItem, publishingTargets);
                            }
                        }
                    }
                }
            }
        }