Beispiel #1
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Parameter = rendering.Parameters;
            Locations = Parameter["Location"];

            if (!String.IsNullOrEmpty(Locations))
            {
                Sitecore.Data.ID Id = Sitecore.Data.ID.Parse(Locations);
                Item = Sitecore.Context.Database.GetItem(Id);

                AddressLine2 = Parameter["Address Line 2"];
                Phone        = Parameter["Phone"];
                URL          = Parameter["URL"];
                Image        = Parameter["Image"];

                if (Locations != "{3CF19799-D782-4708-B5F3-09EFFC0C30B5}")
                {
                    Name         = FieldRenderer.Render(Item, "Name");
                    Address      = FieldRenderer.Render(Item, "Address");
                    MapURL       = FieldRenderer.Render(Item, "MapURL");
                    LocationID   = FieldRenderer.Render(Item, "LocationID");
                    City         = FieldRenderer.Render(Item, "City");
                    State        = FieldRenderer.Render(Item, "State");
                    Zip          = FieldRenderer.Render(Item, "Zip");
                    DefaultImage = FieldRenderer.Render(Item, "DefaultImage", "bc=lightgray&as=1");
                }
            }
        }
Beispiel #2
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;
            dsIsSet   = Sitecore.Data.ID.IsID(Rendering.DataSource);

            if (dsIsSet)
            {
                facebook    = FieldRenderer.Render(Item, "Facebook");
                twitter     = FieldRenderer.Render(Item, "Twitter");
                youTube     = FieldRenderer.Render(Item, "YouTube");
                linkedIn    = FieldRenderer.Render(Item, "LinkedIn");
                googlePlus  = FieldRenderer.Render(Item, "GooglePlus");
                pInterest   = FieldRenderer.Render(Item, "Pinterest");
                instagram   = FieldRenderer.Render(Item, "Instagram");
                flickr      = FieldRenderer.Render(Item, "Flickr");
                rss         = FieldRenderer.Render(Item, "RSS");
                podcast     = FieldRenderer.Render(Item, "Podcast");
                sharePoint  = FieldRenderer.Render(Item, "SharePoint");
                chSmallIcon = Item.Fields["isSmallIcon"];

                chSmallIconTemplateField = Item.Fields["isSmallIcon"].GetTemplateField();
                chSmallIconTemplateId    = chSmallIconTemplateField.ID.Guid.ToString().ToUpper();

                cssClassName = (chSmallIcon.Checked ? smallIconClass : largeIconClass);
            }
        }
Beispiel #3
0
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            try
            {
                Item item = Item.Database.GetItem(Rendering.DataSource);
                IsDatasourceNull = (item != null ? false : true);

                if (IsDatasourceNull)
                {
                    throw new ArgumentNullException("args.Item");
                }
                else
                {
                    chSlideShowHideArrow      = item.Fields["Hide Arrow"];
                    imageHeight               = item.Fields["Image Height"].ToString();
                    chHideArrowTemplateField  = item.Fields["Hide Arrow"].GetTemplateField();
                    getHideArrowTemplateId    = chHideArrowTemplateField.ID.Guid.ToString().ToUpper();
                    SlideShowHideArrow        = chSlideShowHideArrow.Checked ? "slideshow-no-arrows" : "";
                    chHorizontal              = item.Fields["Horizontal"];
                    chHorizontalTemplateField = item.Fields["Horizontal"].GetTemplateField();
                    getHorizontalTemplateId   = chHorizontalTemplateField.ID.Guid.ToString().ToUpper();
                    HorizontalSlider          = chHorizontal.Checked ? "hz-slider" : "";
                }
            }
            catch
            {
                IsDatasourceNull = true;
            }
        }
Beispiel #4
0
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;

            url = PageItem.Paths.Path.Replace("/sitecore/content", "");

            int    x     = 0;
            string value = articleRootPath.Fields["Articles Per Page"].Value;

            articlesPerPage = Int32.TryParse(value, out x) ? x : 8;

            listType = string.Empty;

            if (IsBlogArticleRoot()) // article root
            {
                catFilter = PageItem.Fields["Category Filter"].Value;
                tagFilter = PageItem.Fields["Tag Filter"].Value;
            }

            var getSearchIndex = Sitecore.ContentSearch.ContentSearchManager.GetIndex(searchIndexName);

            using (var context = getSearchIndex.CreateSearchContext())
            {
                var results = context.GetQueryable <SearchResultItem>();
                foreach (var result in results)
                {
                    Item item = result.GetItem();
                    allArticles.Add(item);
                }
            }
        }
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item      = rendering.Item;

            Subject = FieldRenderer.Render(Item, "Subject");
        }
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Item            = rendering.Item;
            Rendering       = rendering;
            PageItem        = Sitecore.Mvc.Presentation.PageContext.Current.Item;
            isDatasourceSet = Sitecore.Data.ID.IsID(Rendering.DataSource);

            if (isDatasourceSet)
            {
                FeedTitle = FieldRenderer.Render(Item, "Feed Title");
                FeedURL   = FieldRenderer.Render(Item, "Feed URL");
                ItemDescriptionCharacterLimit = FieldRenderer.Render(Item, "Item Description Character Limit");
                NumberOfItems            = FieldRenderer.Render(Item, "Number of Items");
                NumberOfImages           = FieldRenderer.Render(Item, "Number of Images");
                ChDisplayFeedTitle       = Item.Fields["Display Feed Title"];
                ChDisplayTitleFirst      = Item.Fields["Display Title First"];
                ChDisplayFeedDescription = Item.Fields["Display Feed Description"];

                FeedCSSClass                    = FieldRenderer.Render(Item, "Feed CSS Class");
                FeedItemCSSClass                = FieldRenderer.Render(Item, "Feed Item CSS Class");
                FeedTitleCSSClass               = FieldRenderer.Render(Item, "Feed Title CSS Class");
                FeedDescriptionCSSClass         = FieldRenderer.Render(Item, "Feed Description CSS Class");
                FeedItemTitleCSSClass           = FieldRenderer.Render(Item, "Feed Item Title CSS Class");
                FeedItemDescriptionCSSClass     = FieldRenderer.Render(Item, "Feed Item Description CSS Class");
                FeedItemPublicationDateCSSClass = FieldRenderer.Render(Item, "Feed Item Publication Date CSS Class");
                FeedItemImageCSSClass           = FieldRenderer.Render(Item, "Feed Item Image CSS Class");
            }
        }
Beispiel #7
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Item      = rendering.Item;
            Rendering = rendering;
            PageItem  = Sitecore.Mvc.Presentation.PageContext.Current.Item;
            dsIsSet   = false;
            if (!String.IsNullOrEmpty(Rendering.DataSource))
            {
                captionText = FieldRenderer.Render(Item, "Caption Text");
                captionUrl  = FieldRenderer.Render(Item, "Caption Link");
                heading     = FieldRenderer.Render(Item, "Heading");
                textContent = FieldRenderer.Render(Item, "Text Content");
                image       = Helpers.getImgField(Item, "Image");

                try
                {
                    Item ds = Sitecore.Context.Database.GetItem(Rendering.DataSource);
                    if (ds == null)
                    {
                        dataSourceID = "";
                    }
                    else
                    {
                        dataSourceID = ds.ID.Guid.ToString();
                    }
                    dsIsSet = ds != null;
                }
                catch { dataSourceID = ""; }
            }
        }
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            int l = 999;

            int.TryParse(Rendering.Parameters[MobileFieldNames.ListViewRenderingParameters.MaxDisplayItems], out l);
            MaxDisplayItems = l;

            DataSourceQuery = !string.IsNullOrEmpty(Rendering.DataSource) && !Rendering.DataSource.StartsWith("{") ? Rendering.DataSource : null;

            EditingEnabled = (Sitecore.Context.Site.DisplayMode == Sitecore.Sites.DisplayMode.Edit);

            if (string.IsNullOrEmpty(DataSourceQuery) && Rendering.Item != null && Rendering.Item.Children.Count > 0)
            {
                var children     = Rendering.Item.Children.ToArray();
                var displayItems = GetVisibleListChildren(children);
                DisplayItems = displayItems;
            }
            else if (!string.IsNullOrEmpty(DataSourceQuery))
            {
                //var dataSourceResult = DataSourceExtensions.DataSourceSearchResults(Rendering.Item, Rendering.DataSource);
                //DisplayItems = dataSourceResult.Select(r => r.GetItem()).ToArray();
                DisplayItems = new Item[0];
            }
            else
            {
                DisplayItems = new Item[0];
            }
        }
Beispiel #9
0
        public void RenderView(ViewContext viewContext, Rendering rendering)
        {
            var prevHandler = Context.Handler;

            using (var containerPage = new PageHolderContainerPage(this))
            {
                try
                {
                    Context.Handler = containerPage;

                    if (Sitecore.Context.Page == null)
                    {
                        viewContext.Writer.WriteLine("<!-- Unable to use sitecoreplacholder outside sitecore -->");

                        return;
                    }

                    InitializePageContext(containerPage, viewContext);
                    RenderViewAndRestoreContentType(containerPage, viewContext);
                }
                finally
                {
                    Context.Handler = prevHandler;
                }
            }
        }
Beispiel #10
0
 public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
 {
     Item           = rendering.Item;
     Rendering      = rendering;
     PageItem       = Sitecore.Mvc.Presentation.PageContext.Current.Item;
     dsIsSet        = (!String.IsNullOrEmpty(rendering.DataSource) ? true : false);
     richTextEditor = FieldRenderer.Render(Item, "RichTextContent");
 }
Beispiel #11
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item = rendering.Item;
            PageItem = PageContext.Current.Item;

            Make = new HtmlString(FieldRenderer.Render(Item, "Make"));
            Model = new HtmlString(FieldRenderer.Render(Item, "Model"));
        }
Beispiel #12
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;

            Make  = new HtmlString(FieldRenderer.Render(Item, "Make"));
            Model = new HtmlString(FieldRenderer.Render(Item, "Model"));
        }
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;

            url = Sitecore.Links.LinkManager.GetItemUrl(PageItem);
        }
Beispiel #14
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Item      = rendering.Item;
            PageItem  = Sitecore.Mvc.Presentation.PageContext.Current.Item;
            Rendering = rendering;

            ID         = FieldRenderer.Render(Item, "ID");
            Class      = FieldRenderer.Render(Item, "Class");
            Error      = new HtmlString("<center><br /><h3>Accordion<br />Please set associated content or edit related item</h3><br /></center>");
            FolderItem = Item.Name;
        }
Beispiel #15
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            // Use the Rendering object passed in by Sitecore to set the datasource Item and context PageItem properties
            Rendering = rendering;
            Item = rendering.Item;
            PageItem = PageContext.Current.Item;

            // Set property values using FieldRenderer to ensure that the values are editable in the Page Editor
            Make = new HtmlString(FieldRenderer.Render(Item, "Make"));
            Model = new HtmlString(FieldRenderer.Render(Item, "Model"));
        }
Beispiel #16
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            // Use the Rendering object passed in by Sitecore to set the datasource Item and context PageItem properties
            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;

            // Set property values using FieldRenderer to ensure that the values are editable in the Page Editor
            Make  = new HtmlString(FieldRenderer.Render(Item, "Make"));
            Model = new HtmlString(FieldRenderer.Render(Item, "Model"));
        }
Beispiel #17
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = Sitecore.Mvc.Presentation.PageContext.Current.Item;

            Title          = FieldRenderer.Render(Item, "Title");
            URL            = FieldRenderer.Render(Item, "URL");
            CSS            = FieldRenderer.Render(Item, "CSS");
            LightboxTitle  = FieldRenderer.Render(Item, "LightboxTitle");
            ThumbnailImage = FieldRenderer.Render(Item, "ThumbnailImage", "class=video-image");
        }
Beispiel #18
0
        public static Sitecore.Layouts.RenderingReference GetRenderingReference(Sitecore.Mvc.Presentation.Rendering rendering, Sitecore.Globalization.Language language, Sitecore.Data.Database database)
        {
            Sitecore.Diagnostics.Assert.IsNotNull(rendering, "rendering");
            Sitecore.Diagnostics.Assert.IsNotNull(language, "language");
            Sitecore.Diagnostics.Assert.IsNotNull(database, "database");
            string text = rendering.Properties["RenderingXml"];

            if (!string.IsNullOrEmpty(text))
            {
                return(new Sitecore.Layouts.RenderingReference(XElement.Parse(text).ToXmlNode(), language, database));
            }
            return(null);
        }
 public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
 {
     item             = rendering.Item;
     PageItem         = PageContext.Current.Item;
     Rendering        = rendering;
     isDatasourceNull = string.IsNullOrEmpty(rendering.DataSource);
     if (!isDatasourceNull)
     {
         chX20         = item.Fields["X20 Directory Listing"];
         templateField = item.Fields["X20 Directory Listing"].GetTemplateField();
         getTemplateID = templateField.ID.Guid.ToString().ToUpper();
     }
 }
Beispiel #20
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Item = rendering.Item;

            Title              = Item["Title"];
            StyleClass         = Item["StyleClass"];
            HtmlID             = Item["htmlID"];
            TransitionTime     = Item["TransitionTime"];
            PauseOnHover       = (String.IsNullOrEmpty(Item["PauseOnHover"]) ? "" : "hover");
            FadeTransition     = (String.IsNullOrEmpty(Item["FadeTransition"]) ? "" : "slideshow-fade");
            SlideShowNoArrow   = (String.IsNullOrEmpty(Item["SlideShowNoArrow"]) ? "" : "slideshow-no-arrows");
            SlideShowIndicator = (String.IsNullOrEmpty(Item["SlideShowIndicator"]) ? "" : "slideshow-no-indicators");
            Error              = new HtmlString("<center><br /><h3>Slide Show<br />Please set associated content or edit related item</h3><br /></center>");
        }
Beispiel #21
0
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            int l = 999;

            int.TryParse(Rendering.Parameters[MobileFieldNames.ListViewRenderingParameters.MaxDisplayItems], out l);
            MaxDisplayItems = l;

            DataSourceQuery = !string.IsNullOrEmpty(Rendering.DataSource) && !Rendering.DataSource.StartsWith("{") ? Rendering.DataSource : null;

            EditingEnabled = (Sitecore.Context.Site.DisplayMode == Sitecore.Sites.DisplayMode.Edit);

            InitializeListDisplayItems();
        }
Beispiel #22
0
 public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
 {
     Item      = rendering.Item;
     isSetDs   = rendering.DataSource;
     Rendering = Sitecore.Mvc.Presentation.RenderingContext.Current.Rendering;
     if (!String.IsNullOrEmpty(isSetDs))
     {
         try {
             smallHeadline = FieldRenderer.Render(Item, "Small Headline");
             largeHeadline = FieldRenderer.Render(Item, "Large Headline");
             headline      = FieldRenderer.Render(Item, "Headline");
         }
         catch
         {
             isSetDs = "";
         }
     }
 }
Beispiel #23
0
        public override void Initialize(Rendering rendering)
        {
            base.Initialize(rendering);
            Description = Item.Fields[Constants.Fields.Unit.Description].Value;
            Race = this.Item.Fields[Constants.Fields.Unit.Race].Value;
            Attributes = this.Item.Fields[Constants.Fields.Unit.Attributes].Value;
            Life = this.Item.Fields[Constants.Fields.Unit.Life].Value;
            Shield = this.Item.Fields[Constants.Fields.Unit.Shield].Value;
            Armor = this.Item.Fields[Constants.Fields.Unit.Armor].Value;
            CargoSize = this.Item.Fields[Constants.Fields.Unit.CargoSize].Value;

            Producer = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.Producer));
            Requires = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.Requires));
            CostMineral = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.CostMinirel));
            CostGas = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.CostGas));
            Supply = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.Supply));
            BuildTime = new HtmlString(FieldRenderer.Render(this.Item, Constants.Fields.Unit.BuildTime));
        }
Beispiel #24
0
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            try
            {
                Item item = Item.Database.GetItem(Rendering.DataSource);
                IsDatasourceNull = (item != null ? false : true);

                if (IsDatasourceNull)
                {
                    throw new ArgumentNullException("args.Item");
                }
            }
            catch
            {
                IsDatasourceNull = true;
            }
        }
Beispiel #25
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            try
            {
                Rendering = rendering;
                Item      = rendering.Item;
                PageItem  = Sitecore.Mvc.Presentation.PageContext.Current.Item;

                LeftHeaderIcon   = Item["Left Header Icon"];
                LeftHeaderTitle  = FieldRenderer.Render(Item, "Left Header Title");
                LeftBoxContent   = FieldRenderer.Render(Item, "Left Box Content");
                RightHeaderIcon  = Item["Right Header Icon"];
                RightHeaderTitle = FieldRenderer.Render(Item, "Right Header Title");
                RightBoxContent  = FieldRenderer.Render(Item, "Right Box Content");
            }
            catch (Exception ex)
            {
                Error += ex.Message + "<br/>" + ex.StackTrace + "<br/>";
            }
        }
        protected virtual Renderer GetRenderer(Rendering rendering, GetRendererArgs args)
        {
            if (rendering.RenderingItem == null
                || rendering.RenderingItem.InnerItem == null) return null;

            var settings = new RenderingSettings();
            settings.DataSource = rendering.DataSource;
            settings.Parameters = rendering["Parameters"];
            settings.Placeholder = rendering.Placeholder;
            settings.Caching = RenderingCaching.Parse(rendering.RenderingItem.InnerItem);
            settings.Conditions = rendering.RenderingItem.Conditions;
            settings.MultiVariateTest = rendering.RenderingItem.MultiVariateTest;

            var ctrl = rendering.RenderingItem.GetControl(settings);
            if (ctrl != null)
            {
                return new ControlRenderer(ctrl, ""+rendering.UniqueId);
            }

            return null;
        }
Beispiel #27
0
 public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
 {
     base.Initialize(rendering);
     try
     {
         //Set model specific objects
         Rendering = rendering;
         dsSet     = !String.IsNullOrEmpty(rendering.DataSource);
         if (dsSet)
         {
             DataSourceFolder = Sitecore.Context.Database.GetItem(rendering.DataSource);
             if (DataSourceFolder == null)
             {
                 dsSet = false;
             }
         }
     }
     catch (Exception ex)
     {
         HealthIS.Apps.Util.LogError(ex.Message, ex, this);
     }
 }
Beispiel #28
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            item          = rendering.Item;
            PageItem      = PageContext.Current.Item;
            Rendering     = rendering;
            datasourceSet = rendering.DataSource;

            name     = FieldRenderer.Render(item, "Name");
            address1 = FieldRenderer.Render(item, "Address1");
            address2 = FieldRenderer.Render(item, "Address2");
            address3 = FieldRenderer.Render(item, "Address3");
            address4 = FieldRenderer.Render(item, "Address4");
            address5 = FieldRenderer.Render(item, "Address5");
            phone    = FieldRenderer.Render(item, "Phone");
            email    = FieldRenderer.Render(item, "Email");

            if (!String.IsNullOrEmpty(datasourceSet))
            {
                datasourcePath  = rendering.Item.Paths.Path.ToString();
                currentPagePath = PageItem.Paths.Path.ToString();
                dsEditable      = Helpers.IsDatasourceEditable(item, currentPagePath);
            }
        }
Beispiel #29
0
        public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            Rendering = rendering;
            Item      = rendering.Item;
            PageItem  = PageContext.Current.Item;

            // NavBarHorizontal Template
            H_NavBarClass  = Item["Nav Bar Class"];
            H_LabelH1Class = Item["Label H1 Class"];
            H_LabelIClass  = Item["Label i Class"];
            H_NavBarLabel  = Item["Nav Bar Label"];
            H_UlClass      = Item["ul Class"];
            LiList         = new List <HtmlString>();
            HsTag          = new HtmlString("");
            ListCount      = 0;
            Error          = new HtmlString("<center><br /><h2>Horizontal Navigation<br />Please set associated content or edit related item</h2><br /></center>");
            isEmpty        = false;
            NewTab         = "";

            if (String.IsNullOrEmpty(Rendering.DataSource) || !Item.HasChildren)
            {
                isEmpty = true;
            }
        }
 public void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
 {
     LoadMenuItems();
 }
Beispiel #31
0
 public void Initialize(Rendering rendering)
 {
     _rendering = rendering;
 }
Beispiel #32
0
 public PropellerViewModel(Rendering rendering) : base(rendering.Item)
 {
     Initialize(rendering);
 }