Exemplo n.º 1
0
        protected internal PageOption CloneOption()
        {
            PageOption newOption = this.CreateOption();

            this.CopyProperties(newOption);
            return(newOption);
        }
Exemplo n.º 2
0
        protected virtual void CopyProperties(PageOption newOption)
        {
            //Copy properties that are in the statebag
            newOption.LinkText = this.LinkText;
            newOption.CssClass = this.CssClass;

            //Copy other local member vars here. (If any)
        }
Exemplo n.º 3
0
        protected override void OnRemoveComplete(int index, object value)
        {
            PageOption option = value as PageOption;

            if (option != null)
            {
                option.OptionChanged += new EventHandler(this.OnOptionChanged);
            }

            this.OnOptionsChanged();
        }
Exemplo n.º 4
0
 public void Removed(PageOption option)
 {
     ((IList)this).Remove(option);
 }
Exemplo n.º 5
0
 public void Insert(int index, PageOption option)
 {
     ((IList)this).Insert(index, option);
 }
Exemplo n.º 6
0
 public int IndexOf(PageOption option)
 {
     return(((IList)this).IndexOf(option));
 }
Exemplo n.º 7
0
 public bool Contains(PageOption option)
 {
     return(((IList)this).Contains(option));
 }
Exemplo n.º 8
0
 public void Add(PageOption option)
 {
     ((IList)this).Add(option);
 }
Exemplo n.º 9
0
        /// <summary>
        /// Process the page options information in the xml and creates
        /// the page options items.
        /// </summary>
        /// <param name="snippetXmlData">The xml fragment which contains pageoptions information.</param>
        private void processPageOptionsData(string snippetXmlData)
        {
            // The snippet CDATA may contain CDATA as part of the data but percussion replaces the CDATA
            // close tag with Replace ']]>' with ']]ENDCDATA' this ']]ENDCDATA' should be replaced with
            // valid CDATA close tag ']]>' before it can be deserialized
            snippetXmlData = snippetXmlData.Replace("]]ENDCDATA", "]]>");

            IPageAssemblyInstruction pgInstruction = PageAssemblyContext.Current.PageAssemblyInstruction;

            // If AlternateContentVersions information is not in the instructions then do not create
            // the PageOptions box.
            string[] acvKeys = pgInstruction.AlternateContentVersionsKeys;

            if (acvKeys != null)
            {
                Module_PageOptionsBox mPBO = ModuleObjectFactory <Module_PageOptionsBox> .GetModuleObject(snippetXmlData);

                if (mPBO != null)
                {
                    // Create the Page Options box control.
                    PageOptionsBox pageOptionsBox = new PageOptionsBox();
                    pageOptionsBox.BoxTitle = mPBO.Title;
                    pageOptionsBox.CssClass = "po-box";

                    foreach (PageOption pgOptionItem in mPBO.PageOptions)
                    {
                        try
                        {
                            // Check if the Pageoptions are recognized in the Alternate Content Version keys
                            string key = pgOptionItem.Key;

                            if (!string.IsNullOrEmpty(key))
                            {
                                key = key.ToLower();
                            }

                            if (acvKeys.Contains <string>(key))
                            {
                                NCI.Web.UI.WebControls.PageOption pgoBase = null;

                                if (String.Compare(pgOptionItem.OptionType, PageOptionType.Link.ToString()) == 0)
                                {
                                    pgoBase = new LinkPageOption();
                                    ((LinkPageOption)pgoBase).OnClick = pgOptionItem.WebAnalyticsFunction;
                                    ((LinkPageOption)pgoBase).Href    = pgInstruction.GetUrl(key).ToString();
                                }
                                else if (String.Compare(pgOptionItem.OptionType, PageOptionType.Email.ToString()) == 0)
                                {
                                    pgoBase = new LinkPageOption();
                                    ((LinkPageOption)pgoBase).Href     = pgInstruction.GetUrl("email").ToString();
                                    ((LinkPageOption)pgoBase).OnClick  = pgOptionItem.WebAnalyticsFunction;
                                    ((LinkPageOption)pgoBase).OnClick += " " + "dynPopWindow('" + ((LinkPageOption)pgoBase).Href.Replace("'", "%27").Replace("(", "%28").Replace(")", "%29") + "', 'emailPopUp', 'height=525,width=492'); return false;";
                                }
                                else if (String.Compare(pgOptionItem.OptionType, PageOptionType.BookMarkShare.ToString()) == 0)
                                {
                                    pgoBase = new AddThisPageOption();
                                    ((AddThisPageOption)pgoBase).Settings.Language = pgInstruction.Language;
                                    //((AddThisPageOption)pgoBase).PageTitle = pgInstruction.GetField("long_description").ToString();  //pgInstruction.GetUrl("BookMarkShareUrl").ToString();
                                    ((AddThisPageOption)pgoBase).PageTitle = pgInstruction.GetField("long_title").ToString();
                                    ((AddThisPageOption)pgoBase).OnClick   = pgOptionItem.WebAnalyticsFunction;
                                }

                                if (pgoBase != null)
                                {
                                    pgoBase.CssClass = pgOptionItem.CssClass;
                                    pgoBase.LinkText = pgOptionItem.LinkText;
                                    pageOptionsBox.PageOptions.Add(pgoBase);
                                }
                            }
                        }
                        catch
                        {
                            //TODO, log exception
                        }
                    }

                    if (pageOptionsBox.PageOptions.Count > 0)
                    {
                        this.Controls.Add(pageOptionsBox);
                    }
                }
            }
        }
Exemplo n.º 10
0
 protected override void CopyProperties(PageOption newOption)
 {
     ((AddThisPageOption)newOption).PageTitle = this.PageTitle;
     ((AddThisPageOption)newOption).Settings.CopyProperties(this.Settings);
     base.CopyProperties(newOption);
 }
Exemplo n.º 11
0
 protected override void CopyProperties(PageOption newOption)
 {
     ((LinkPageOption)newOption).OnClick = this.OnClick;
     ((LinkPageOption)newOption).Href    = this.Href;
     base.CopyProperties(newOption);
 }