Esempio n. 1
0
		protected override void AddParsedSubObject (object ob)
		{
			if (ob is HtmlTitle)
				title = (HtmlTitle) ob;
			
			base.AddParsedSubObject (ob);
		}
Esempio n. 2
0
        protected internal override void AddedControl(Control control, int index)
        {
            base.AddedControl(control, index);

            if (control is HtmlTitle)
            {
                if (_title != null)
                {
                    throw new HttpException(SR.GetString(SR.HtmlHead_OnlyOneTitleAllowed));
                }

                _title = (HtmlTitle)control;
            }
            else if (control is HtmlMeta)
            {
                // We will only use the first matching meta tag per, and ignore any others
                HtmlMeta meta = (HtmlMeta)control;
                if (_description == null && string.Equals(meta.Name, "description", StringComparison.OrdinalIgnoreCase))
                {
                    _description = meta;
                }
                else if (_keywords == null && string.Equals(meta.Name, "keywords", StringComparison.OrdinalIgnoreCase))
                {
                    _keywords = meta;
                }
            }
        }
Esempio n. 3
0
        protected internal override void AddedControl(Control control, int index)
        {
            //You can only have one <title> element within the <head> element.
            HtmlTitle t = control as HtmlTitle;

            if (t != null)
            {
                if (title != null)
                {
                    throw new HttpException("You can only have one <title> element within the <head> element.");
                }
                title = t;
            }

#if NET_4_0
            HtmlMeta meta = control as HtmlMeta;
            if (meta != null)
            {
                if (String.Compare("keywords", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    keywordsMeta = meta;
                }
                else if (String.Compare("description", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    descriptionMeta = meta;
                }
            }
#endif
            base.AddedControl(control, index);
        }
Esempio n. 4
0
        void EnsureTitleControl()
        {
            if (title != null)
            {
                return;
            }

            HtmlTitle t = new HtmlTitle();

            t.Text = titleText;
            Controls.Add(t);
        }
 protected internal override void RemovedControl(Control control)
 {
     base.RemovedControl(control);
     if (control is HtmlTitle)
     {
         this._title = null;
     }
     else if (control == this._description)
     {
         this._description = null;
     }
     else if (control == this._keywords)
     {
         this._keywords = null;
     }
 }
 protected internal override void RemovedControl(Control control)
 {
     base.RemovedControl(control);
     if (control is HtmlTitle)
     {
         this._title = null;
     }
     else if (control == this._description)
     {
         this._description = null;
     }
     else if (control == this._keywords)
     {
         this._keywords = null;
     }
 }
Esempio n. 7
0
        protected internal override void RemovedControl(Control control)
        {
            if (title == control)
            {
                title = null;
            }

            if (keywordsMeta == control)
            {
                keywordsMeta = null;
            }
            else if (descriptionMeta == control)
            {
                descriptionMeta = null;
            }
            base.RemovedControl(control);
        }
Esempio n. 8
0
        protected internal override void RemovedControl(Control control)
        {
            base.RemovedControl(control);

            if (control is HtmlTitle)
            {
                _title = null;
            }
            // There can be many meta tags, so we only clear it if its the correct meta
            else if (control == _description)
            {
                _description = null;
            }
            else if (control == _keywords)
            {
                _keywords = null;
            }
        }
Esempio n. 9
0
 protected override void OnPreRender(EventArgs e)
 {
     bool hasTitle = false;
     foreach (Control cntrl in this.Control.Controls)
     {
         if (cntrl is HtmlTitle)
         {
             hasTitle = true;
             break;
         }
     }
     if (!hasTitle)
     {
         HtmlTitle ht = new HtmlTitle();
         ht.Text = Page.Title;
         Control.Controls.Add(ht);
     }
     base.OnPreRender(e);
 }
 protected internal override void AddedControl(Control control, int index)
 {
     base.AddedControl(control, index);
     if (control is HtmlTitle)
     {
         if (this._title != null)
         {
             throw new HttpException(System.Web.SR.GetString("HtmlHead_OnlyOneTitleAllowed"));
         }
         this._title = (HtmlTitle) control;
     }
     else if (control is HtmlMeta)
     {
         HtmlMeta meta = (HtmlMeta) control;
         if ((this._description == null) && string.Equals(meta.Name, "description", StringComparison.OrdinalIgnoreCase))
         {
             this._description = meta;
         }
         else if ((this._keywords == null) && string.Equals(meta.Name, "keywords", StringComparison.OrdinalIgnoreCase))
         {
             this._keywords = meta;
         }
     }
 }
 protected internal override void AddedControl(Control control, int index)
 {
     base.AddedControl(control, index);
     if (control is HtmlTitle)
     {
         if (this._title != null)
         {
             throw new HttpException(System.Web.SR.GetString("HtmlHead_OnlyOneTitleAllowed"));
         }
         this._title = (HtmlTitle)control;
     }
     else if (control is HtmlMeta)
     {
         HtmlMeta meta = (HtmlMeta)control;
         if ((this._description == null) && string.Equals(meta.Name, "description", StringComparison.OrdinalIgnoreCase))
         {
             this._description = meta;
         }
         else if ((this._keywords == null) && string.Equals(meta.Name, "keywords", StringComparison.OrdinalIgnoreCase))
         {
             this._keywords = meta;
         }
     }
 }
Esempio n. 12
0
        protected internal override void AddedControl(Control control, int index) {
            base.AddedControl(control, index);

            if (control is HtmlTitle) {
                if (_title != null) {
                    throw new HttpException(SR.GetString(SR.HtmlHead_OnlyOneTitleAllowed));
                }

                _title = (HtmlTitle)control;
            }
            else if (control is HtmlMeta) {
                // We will only use the first matching meta tag per, and ignore any others
                HtmlMeta meta = (HtmlMeta)control;
                if (_description == null && string.Equals(meta.Name, "description", StringComparison.OrdinalIgnoreCase)) {
                    _description = meta;
                }
                else if (_keywords == null && string.Equals(meta.Name, "keywords", StringComparison.OrdinalIgnoreCase)) {
                    _keywords = meta;
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Writes the HTML Head element.  Adds site stylesheet.
        /// </summary>
        protected virtual void RenderHtmlHead()
        {
            _head = new HtmlHead();

            HtmlTitle title = new HtmlTitle();
            title.Text = _title;
            _head.Controls.Add(title);

            HtmlLink logEmCSS = new HtmlLink();
            logEmCSS.Attributes.Add("rel", "stylesheet");
            logEmCSS.Attributes.Add("type", "text/css");
            logEmCSS.Attributes.Add("href", ExtractBaseLogEmUrl(Context.Request.Url.Segments) + "stylesheet");
            _head.Controls.Add(logEmCSS);

            Page.Controls.Add(_head);

            _head.RenderControl(_writer);
            _writer.WriteLine();
        }
		/// <summary>
		/// 如果请求是提醒对话框的,则处理该请求,显示提醒对话框的内容
		/// </summary>
		private void DoNotifyDialog()
		{
			if (HttpContext.Current.Request.RequestType == "POST")
			{
				string taskID = HttpContext.Current.Request.QueryString["taskID"];
				string taskSource = WebUtility.GetRequestFormString("taskSource", "userTask");

				if (string.IsNullOrEmpty(taskID) == false && GetAutoTransferToCompletedTask())
				{
					UserTask task = new UserTask();
					task.TaskID = taskID;
					UserTaskCollection tasks = new UserTaskCollection();
					tasks.Add(task);
					if (taskSource == "userTask")
						UserTaskAdapter.Instance.DeleteUserTasks(tasks);
					else
						UserTaskAdapter.Instance.DeleteUserAccomplishedTasks(tasks);
				}

				SaveAutoTransferToCompletedTaskFlag();

				//WebUtility.ResponseRefreshParentWindowScriptBlock();
				HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());
				WebUtility.ResponseTimeoutScriptBlock("top.close();", ExtScriptHelper.DefaultResponseTimeout);

				HttpContext.Current.Response.End();
			}
			else
			{
				Page page = new Page();

				HtmlGenericControl html = new HtmlGenericControl("html");
				WebUtility.SetCurrentPage(page);
				page.Controls.Add(html);

				HtmlHead head = new HtmlHead();
				html.Controls.Add(head);

				HtmlTitle title = new HtmlTitle();
				title.Text = Translator.Translate(Define.DefaultCulture, "提醒消息");
				head.Controls.Add(title);

				HtmlGenericControl body = new HtmlGenericControl("body");
				html.Controls.Add(body);

				WebUtility.AttachPageModules(page);

				string temmplate = GetNotifyDialogHtml();
				string pageHtml = InitNotifyDialogPage(temmplate);

				body.Controls.Add(new LiteralControl(pageHtml));

				((IHttpHandler)page).ProcessRequest(HttpContext.Current);

				HttpContext.Current.Response.End();
			}
		}
Esempio n. 15
0
 private HtmlTitle __BuildControl__control5()
 {
     HtmlTitle title = new HtmlTitle();
     LiteralControl control = this.__BuildControl__control6();
     IParserAccessor accessor = title;
     accessor.AddParsedSubObject(control);
     object[] parameters = new object[5];
     parameters[0] = title;
     parameters[2] = 0x107;
     parameters[3] = 0x13;
     parameters[4] = false;
     this.__PageInspector_SetTraceData(parameters);
     return title;
 }
Esempio n. 16
0
		void EnsureTitleControl () {
			if (title != null)
				return;

			HtmlTitle t = new HtmlTitle ();
			t.Text = titleText;
			Controls.Add (t);
		}
Esempio n. 17
0
        private void HandleOpenTag(Stack<Control> container, HtmlChunk chunk, StringBuilder currentLiteralText)
        {
            if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                var title = new HtmlTitle();
                container.Peek().Controls.Add(title);
                container.Push(title);
            }
            else if (chunk.TagName.Equals("head", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();
                var head = new HtmlHead();
                container.Peek().Controls.Add(head);
                container.Push(head);
            }
            else if (chunk.TagName.Equals("asp:ContentPlaceHolder", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                if (chunk.HasAttribute("ID"))
                {
                    var id = chunk.AttributesMap["ID"] as string;
                    var placeHolder = new ContentPlaceHolder() { ID = id };
                    container.Peek().Controls.Add(placeHolder);
                    this.AddContentPlaceHolder(id);
                    this.InstantiateControls(placeHolder);
                }
            }
            else if (chunk.TagName.Equals("form", StringComparison.OrdinalIgnoreCase) && chunk.HasAttribute("runat"))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var form = new HtmlForm();
                if (chunk.HasAttribute("id"))
                    form.ID = chunk.AttributesMap["id"] as string;
                else
                    form.ID = "aspnetForm";

                container.Peek().Controls.Add(form);
                container.Push(form);
            }
            else if (chunk.TagName.Equals(LayoutsHelpers.SectionTag, StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var sectionRenderer = new SectionRenderer();
                if (chunk.HasAttribute("name"))
                {
                    sectionRenderer.Name = chunk.AttributesMap["name"].ToString();
                }

                container.Peek().Controls.Add(sectionRenderer);
            }
            else if (chunk.TagName == "%@")
            {
                //// Ignore
            }
            else
            {
                currentLiteralText.Append(chunk.Html);
            }
        }
Esempio n. 18
0
		protected internal override void AddedControl (Control control, int index)
		{
			//You can only have one <title> element within the <head> element.
			HtmlTitle t = control as HtmlTitle;
			if (t != null) {
				if (title != null)
					throw new HttpException ("You can only have one <title> element within the <head> element.");
				title = t;
			}

#if NET_4_0
			HtmlMeta meta = control as HtmlMeta;
			if (meta != null) {
				if (String.Compare ("keywords", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
					keywordsMeta = meta;
				else if (String.Compare ("description", meta.Name, StringComparison.OrdinalIgnoreCase) == 0)
					descriptionMeta = meta;
			}
#endif
			base.AddedControl (control, index);
		}
Esempio n. 19
0
		protected internal override void RemovedControl (Control control)
		{
			if (title == control)
				title = null;

#if NET_4_0
			if (keywordsMeta == control)
				keywordsMeta = null;
			else if (descriptionMeta == control)
				descriptionMeta = null;
#endif
			base.RemovedControl (control);
		}
Esempio n. 20
0
        protected internal override void RemovedControl(Control control) {
            base.RemovedControl(control);

            if (control is HtmlTitle) {
                _title = null;
            }
            // There can be many meta tags, so we only clear it if its the correct meta
            else if (control == _description) {
                _description = null;
            }
            else if (control == _keywords) {
                _keywords = null;
            }
        }