コード例 #1
0
ファイル: HtmlWriter.cs プロジェクト: nobled/mono
		protected override void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
		{
			output.WriteLine ("{0:###0} AddAttribute ({1}, {2}, {3}))", NextIndex (), name, value, key);
			if (full_trace)
				WriteTrace (new StackTrace ());

			base.AddAttribute (name, value, key);
		}
コード例 #2
0
ファイル: HtmlWriter.cs プロジェクト: nobled/mono
		public override void AddAttribute (HtmlTextWriterAttribute key, string value, bool fEncode)
		{
			output.WriteLine ("{0:###0} AddAttribute ({1}, {2}, {3}))", NextIndex (), key, value, fEncode);
			if (full_trace)
				WriteTrace (new StackTrace ());

			base.AddAttribute (key, value, fEncode);
		}
コード例 #3
0
ファイル: CleanHtmlTextWriter.cs プロジェクト: nobled/mono
		public PendingAttribute (string name, string value, HtmlTextWriterAttribute a, bool encode, bool know_encode)
		{
			this.name = name;
			this.value = value;
			this.a = a;
			this.encode = encode;
			this.know_encode = know_encode;
		}
 public override void AddAttribute(HtmlTextWriterAttribute key, string value)
 {
     if (((key == HtmlTextWriterAttribute.Src) || (key == HtmlTextWriterAttribute.Href)) || (key == HtmlTextWriterAttribute.Background))
     {
         base.AddAttribute(key.ToString(), value, key);
     }
     else
     {
         base.AddAttribute(key, value);
     }
 }
コード例 #5
0
        public override void AddAttribute(HtmlTextWriterAttribute key, string value)
        {
            if (multiValueAttrs != null && multiValueAttrs.Contains(key))
            {
                if (!attrValues.ContainsKey(key))
                    attrValues.Add(key, new List<string>());

                attrValues[key].Add(value);
            }
            else
            {
                base.AddAttribute(key, value);
            }
        }
コード例 #6
0
        public override void AddAttribute(HtmlTextWriterAttribute key, string value)
        {
            if (_allowedMultiValueAttrs.Contains(key))
            {
                if (!_attrValues.ContainsKey(key))
                    _attrValues.Add(key, new List<string>());

                _attrValues[key].Add(value);
            }
            else
            {
                base.AddAttribute(key, value);
            }
        }
 protected override bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key)
 {
     Hashtable hashtable = (Hashtable) this._recognizedAttributes[base.TagName];
     if ((hashtable == null) || (hashtable[name] == null))
     {
         if (this._globalSuppressedAttributes[name] != null)
         {
             return false;
         }
         Hashtable hashtable2 = (Hashtable) this._suppressedAttributes[base.TagName];
         if ((hashtable2 != null) && (hashtable2[name] != null))
         {
             return false;
         }
     }
     return true;
 }
コード例 #8
0
        /// <devdoc>
        /// Override to filter out unnecessary attributes
        /// </devdoc>
        protected override bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key) {
            Hashtable elementRecognizedAttributes = (Hashtable)_recognizedAttributes[TagName];
            if (elementRecognizedAttributes != null && elementRecognizedAttributes[name] != null) {
                return true;
            }
            
            if (_globalSuppressedAttributes[name] != null) {
                return false;
            }
            
            Hashtable elementSuppressedAttributes = (Hashtable)_suppressedAttributes[TagName];
            if (elementSuppressedAttributes != null && elementSuppressedAttributes[name] != null) {
                return false;
            }

            return true;
        }
コード例 #9
0
 /// <summary>
 /// Applies the value to the specified attribute to the HtmlTextWriter
 /// this instance contains.
 /// </summary>
 /// <param name="key">The attribute to set.</param>
 /// <param name="value">The value to set to the attribute.</param>
 /// <returns>The attribute manager.</returns>
 public HtmlAttributeManager Attr(HtmlTextWriterAttribute key, string value)
 {
     Writer.AddAttribute(key, value);
     return this;
 }
コード例 #10
0
ファイル: CustomButton.cs プロジェクト: devhost/Corelicious
 public override void AddAttribute(HtmlTextWriterAttribute key, String value)
 {
     if (HasRenderedFirstTag) {
         base.AddAttribute(key, value);
     } else if (key == HtmlTextWriterAttribute.Onclick) {
         value +=
             ";(function(e){" +
               "setTimeout(function(){" +
                 "e.disabled=(window.Page_IsValid !== true) ? false : (e.form && e.form.checkValidity && e.form.checkValidity());" +
               "}, 0);" +
             "})(this);";
         base.AddAttribute(key, value);
     } else {
         base.AddAttribute(key, value);
     }
 }
コード例 #11
0
 protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key) {
     return true;
 }
コード例 #12
0
 protected bool IsAttributeDefined(HtmlTextWriterAttribute key) {
     for (int i = 0; i < _attrCount; i++) {
         if (_attrList[i].key == key) {
             return true;
         }
     }
     return false;
 }
コード例 #13
0
        protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value) {
            bool encode = true;

            if (0 <= (int)attrKey && (int)attrKey < _attrNameLookupArray.Length) {
                encode = _attrNameLookupArray[(int)attrKey].encode;
            }

            return EncodeAttributeValue(value, encode);
        }
コード例 #14
0
 protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key) {
     AddAttribute(name, value, key, false, false);
 }
コード例 #15
0
 protected string GetAttributeName(HtmlTextWriterAttribute attrKey)
 {
     if ((attrKey >= HtmlTextWriterAttribute.Accesskey) && (attrKey < _attrNameLookupArray.Length))
     {
         return _attrNameLookupArray[(int) attrKey].name;
     }
     return string.Empty;
 }
コード例 #16
0
        private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool encode, bool isUrl) {
            string nameLCase = name.ToLower(CultureInfo.InvariantCulture);

            _attrKeyLookupTable.Add(nameLCase, key);

            if ((int)key < _attrNameLookupArray.Length) {
                _attrNameLookupArray[(int)key] = new AttributeInformation(name, encode, isUrl);
            }
        }
コード例 #17
0
 public virtual void AddAttribute(HtmlTextWriterAttribute key,string value, bool fEncode) {
     int attributeIndex = (int) key;
     if (attributeIndex >= 0 &&  attributeIndex < _attrNameLookupArray.Length) {
         AttributeInformation info = _attrNameLookupArray[attributeIndex];
         AddAttribute(info.name,value,key, fEncode, info.isUrl);
     }
 }
コード例 #18
0
ファイル: ChtmlTextWriter.cs プロジェクト: nlhepler/mono
		protected override bool OnAttributeRender (string name, string value, HtmlTextWriterAttribute key)
		{
			// FIXME:
			// I checked every possible HtmlTextWriterAttribute key
			// and always throws ArgumentNullException.
			return (bool) attr_render [null];
		}
コード例 #19
0
 private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode, bool isUrl) {
     if(_attrList == null) {
         _attrList = new RenderAttribute[20];
     }
     else if (_attrCount >= _attrList.Length) {
         RenderAttribute[] newArray = new RenderAttribute[_attrList.Length * 2];
         Array.Copy(_attrList, newArray, _attrList.Length);
         _attrList = newArray;
     }
     RenderAttribute attr;
     attr.name = name;
     attr.value = value;
     attr.key = key;
     attr.encode = encode;
     attr.isUrl = isUrl;
     _attrList[_attrCount] = attr;
     _attrCount++;
 }
コード例 #20
0
	public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode) {}
コード例 #21
0
        protected string GetAttributeName(HtmlTextWriterAttribute attrKey) {
            if ((int)attrKey >= 0 && (int)attrKey < _attrNameLookupArray.Length)
                return _attrNameLookupArray[(int)attrKey].name;

            return string.Empty;
        }
コード例 #22
0
		public bool PublicOnAttributeRender (string name, string value, HtmlTextWriterAttribute attr)
		{
			return OnAttributeRender (name, value, attr);
		}
コード例 #23
0
 protected bool IsAttributeDefined(HtmlTextWriterAttribute key, out string value) {
     value = null;
     for (int i = 0; i < _attrCount; i++) {
         if (_attrList[i].key == key) {
             value = _attrList[i].value;
             return true;
         }
     }
     return false;
 }
コード例 #24
0
		public string PublicGetAttributeName (HtmlTextWriterAttribute attrKey)
		{
			return GetAttributeName (attrKey);
		}
コード例 #25
0
            /// <summary>
            /// ・POSTデータから値を読み込んでコントロールの状態を復元します。
            /// ・また、コントロールの状態が変わったらtrueを返します。
            /// </summary>
            /// <param name="key">Attributeのkey</param>
            /// <param name="value">Attributeのvalue</param>
            public override void AddAttribute(HtmlTextWriterAttribute key, string value)
            {
                // 描画時にname属性にGroupNameを、value属性にUniqueIDを設定
                switch (key)
                {
                    case HtmlTextWriterAttribute.Name:
                        base.AddAttribute(key, this._ctrl.GroupName);
                        break;

                    case HtmlTextWriterAttribute.Value:
                        base.AddAttribute(key, this._ctrl.UniqueID);
                        break;

                    default:
                        base.AddAttribute(key, value);
                        break;
                }
            }
コード例 #26
0
 public static HtmlTextWriter Attribute(this HtmlTextWriter writer, HtmlTextWriterAttribute attribute, string content = "")
 {
     writer.AddAttribute(attribute, content);
     return writer;
 }
コード例 #27
0
ファイル: CustomButton.cs プロジェクト: devhost/Corelicious
 public override void AddAttribute(HtmlTextWriterAttribute key, String value)
 {
     if (HasRenderedFirstTag) {
         base.AddAttribute(key, value);
     } else if (key == HtmlTextWriterAttribute.Type) {
         // Ignore.
     } else if (key == HtmlTextWriterAttribute.Value) {
         // Ignore.
     } else {
         base.AddAttribute(key, value);
     }
 }
コード例 #28
0
 protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key) {
     RegisterAttribute(name, key, false);
 }
コード例 #29
0
		/// <summary>
		/// Initializes a new instance of the HtmlAttribute class.
		/// </summary>
		/// <param name="attribute">The attribute.</param>
		/// <param name="value">The value of the attribute.</param>
		public HtmlAttribute(HtmlTextWriterAttribute attribute, string value)
		{
			this.Name = attribute.ToString().ToLower();
			this.Value = value;
		}
コード例 #30
0
 private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool encode) {
     RegisterAttribute(name, key, encode, false);
 }