예제 #1
0
        protected internal AddThisButtonLanguageItem CloneAddThisButtonLanguageItem()
        {
            AddThisButtonLanguageItem newAddThisItem = this.CreateAddThisLanguageItem();

            this.CopyProperties(newAddThisItem);
            return(newAddThisItem);
        }
        protected override void OnRemoveComplete(int index, object value)
        {
            AddThisButtonLanguageItem buttonItem = value as AddThisButtonLanguageItem;

            if (buttonItem != null)
            {
                buttonItem.LanguageItemChanged += new EventHandler(this.LanguageCollectionChanged);
            }

            this.OnLanguageCollectionChanged();
        }
예제 #3
0
 protected void CopyProperties(AddThisButtonLanguageItem newAddThisItems)
 {
     ((AddThisButtonLanguageItem)newAddThisItems).ButtonsCollection = this.ButtonsCollection;
     ((AddThisButtonLanguageItem)newAddThisItems).Language          = this.Language;
 }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            #region Var AddThis_Share
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            writer.RenderBeginTag(HtmlTextWriterTag.Script);
            writer.Write("var addthis_share = {\n");
            bool multipleConfigItems = false;
            //title
            if (!string.IsNullOrEmpty(PageAssemblyContext.Current.PageAssemblyInstruction.GetField("add_this_title")))
            {
                if (multipleConfigItems)
                {
                    writer.Write(",\n");
                }
                writer.Write("title: \"" + PageAssemblyContext.Current.PageAssemblyInstruction.GetField("add_this_title") + "\"");
                multipleConfigItems = true;
            }
            //description
            if (!string.IsNullOrEmpty(PageAssemblyContext.Current.PageAssemblyInstruction.GetField("add_this_description")))
            {
                if (multipleConfigItems)
                {
                    writer.Write(",\n");
                }
                writer.Write("description: \"" + PageAssemblyContext.Current.PageAssemblyInstruction.GetField("add_this_description") + "\"");
                multipleConfigItems = true;
            }
            //url

            /**if (!PageAssemblyContext.Current.PageAssemblyInstruction.GetUrl("add_this_url").Equals(""))
             * {
             *  if (multipleConfigItems)
             *  {
             *      writer.Write(",\n");
             *  }
             *  writer.Write("url: \"" + PageAssemblyContext.Current.PageAssemblyInstruction.GetUrl("add_this_url") + "\"");
             *  multipleConfigItems = true;
             * }*/
            writer.Write("}");
            writer.RenderEndTag();
            #endregion

            #region Var AddThis_Config
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            writer.RenderBeginTag(HtmlTextWriterTag.Script);
            writer.Write("var addthis_config = {\n");
            multipleConfigItems = false;
            String language = PageAssemblyContext.Current.PageAssemblyInstruction.GetField("Language");
            if (!language.Equals(""))
            {
                AddThisButtonLanguageItem langItem = _itemsCollection[language];
                if (langItem != null)
                {
                    //Custom Button Definitions
                    AddThisButtonCollection buttonCollection = langItem.ButtonsCollection;
                    if (buttonCollection != null)
                    {
                        bool hasCustomButtons = false;
                        foreach (AddThisButtonItem currButton in buttonCollection)
                        {
                            if (currButton.GetType().Name.Equals("CustomAddThisButtonItem"))
                            {
                                if (!hasCustomButtons)
                                {
                                    writer.Write("services_custom: {");
                                    hasCustomButtons = true;
                                }

                                bool hasMoreThenOneProperty = false;
                                //Name
                                if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Name))
                                {
                                    writer.Write("name: \"" + ((CustomAddThisButtonItem)currButton).Name + "\"");
                                    hasMoreThenOneProperty = true;
                                }
                                //Url
                                if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Url))
                                {
                                    if (hasMoreThenOneProperty)
                                    {
                                        writer.Write(",\n");
                                    }
                                    hasMoreThenOneProperty = true;
                                    writer.Write("url: \"" + ((CustomAddThisButtonItem)currButton).Url + "\"");
                                }
                                //Icon
                                if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Icon))
                                {
                                    if (hasMoreThenOneProperty)
                                    {
                                        writer.Write(",\n");
                                    }
                                    hasMoreThenOneProperty = true;
                                    writer.Write("icon: \"" + ((CustomAddThisButtonItem)currButton).Icon + "\"");
                                }
                            }
                        }
                        if (hasCustomButtons)
                        {
                            writer.Write("}");
                            multipleConfigItems = true;
                        }
                    }
                    //Account Field
                    if (!langItem.Account.Equals(""))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("username: \"" + langItem.Account + "\"");
                        multipleConfigItems = true;
                    }
                    //Language Field
                    if (!string.IsNullOrEmpty(langItem.Language))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("ui_language: \"" + langItem.Language + "\"");
                        multipleConfigItems = true;
                    }
                    //Compact Field
                    if (!string.IsNullOrEmpty(langItem.Compact))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("services_compact: \"" + langItem.Compact + "\"");
                        multipleConfigItems = true;
                    }
                    //Expanded Field
                    if (!string.IsNullOrEmpty(langItem.Expanded))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("services_expanded: \"" + langItem.Expanded + "\"");
                        multipleConfigItems = true;
                    }
                    //508 compliance
                    if (multipleConfigItems)
                    {
                        writer.Write(",\n");
                    }
                    writer.Write("ui_508_compliant: true");
                }
                writer.Write("}");
                writer.RenderEndTag();
            }
            #endregion

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "addthis_toolbox addthis_container addthis_default_style addthis_32x32_style");
            base.RenderBeginTag(writer);
        }
 public void Removed(AddThisButtonLanguageItem languageItem)
 {
     ((IList)this).Remove(languageItem);
 }
 public void Insert(int index, AddThisButtonLanguageItem languageItem)
 {
     ((IList)this).Insert(index, languageItem);
 }
 public int IndexOf(AddThisButtonLanguageItem languageItem)
 {
     return(((IList)this).IndexOf(languageItem));
 }
 public bool Contains(AddThisButtonLanguageItem languageItem)
 {
     return(((IList)this).Contains(languageItem));
 }
 public void Add(AddThisButtonLanguageItem languageItem)
 {
     ((IList)this).Add(languageItem);
 }