You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(204) |
Dec
(147) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(52) |
Feb
(33) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Argiris K. <be...@us...> - 2005-11-11 06:17:58
|
Update of /cvsroot/magicajax/magicajax/Core/Collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6302/Core/Collections Added Files: ReadOnlyArrayList.cs Log Message: Put source files to module 'magicajax' divided in directories Core, Examples, and CustomControls. --- NEW FILE: ReadOnlyArrayList.cs --- #region LGPL License /* MagicAjax Library Copyright (C) 2005 MagicAjax Project Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Collections; namespace MagicAjax.Collections { public class ReadOnlyArrayList : System.Collections.ReadOnlyCollectionBase { public ReadOnlyArrayList(ArrayList list) { this.InnerList.AddRange (list); } public object this[int index] { get { return this.InnerList[index]; } } } } |
From: Argiris K. <be...@us...> - 2005-11-11 06:17:58
|
Update of /cvsroot/magicajax/magicajax/Core/Configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6302/Core/Configuration Added Files: MagicAjaxConfiguration.cs MagicAjaxSectionHandler.cs Log Message: Put source files to module 'magicajax' divided in directories Core, Examples, and CustomControls. --- NEW FILE: MagicAjaxConfiguration.cs --- using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; namespace MagicAjax.Configuration { public enum PageStoreMode { NoStore, Session, Cache } public struct PageStore { private PageStoreMode _mode; private int _cacheTimeout; private int _maxConcurrentPages; private bool _maxPagesLimitAlert; public PageStoreMode Mode { get { return _mode; } } public int CacheTimeout { get { return _cacheTimeout; } } public int MaxConcurrentPages { get { return _maxConcurrentPages; } } public bool MaxPagesLimitAlert { get { return _maxPagesLimitAlert; } } public PageStore(PageStoreMode mode, int cacheTimeout, int maxConcurrentPages, bool maxPagesLimitAlert) { _mode = mode; _cacheTimeout = cacheTimeout; _maxConcurrentPages = maxConcurrentPages; _maxPagesLimitAlert = maxPagesLimitAlert; } } /// <summary> /// Summary description for MagicAjaxConfiguration. /// </summary> public class MagicAjaxConfiguration { private string _scriptPath; private PageStore _pageStore; public string ScriptPath { get { return _scriptPath; } } public PageStore PageStore { get { return _pageStore; } } public MagicAjaxConfiguration(XmlNode xml) { // Default values _scriptPath = null; // Null implicates that the embedded javascripts will be used (default) PageStoreMode mode = PageStoreMode.NoStore; int cacheTimeout = 5; int maxPages = 5; bool maxPagesLimitAlert = false; if (xml != null) { XmlAttribute attrib = (XmlAttribute)xml.Attributes.GetNamedItem("callBackScriptPath"); if (attrib != null) { // Resolve relative scriptPath url's (starting with "~") _scriptPath = CallBackHelper.ResolveUrl(attrib.Value); } XmlNode pageStore = xml["pageStore"]; attrib = (XmlAttribute)pageStore.Attributes.GetNamedItem("mode"); if (attrib != null) { switch (attrib.Value.ToLower()) { case "nostore": mode = PageStoreMode.NoStore; break; case "session": mode = PageStoreMode.Session; break; case "cache": mode = PageStoreMode.Cache; break; default: throw new ConfigurationException("MagicAjax configuration: mode for pageStore must be \"NoStore\" or \"Session\" or \"Cache\"."); } } attrib = (XmlAttribute)pageStore.Attributes.GetNamedItem("cacheTimeout"); if (attrib != null) { try { cacheTimeout = Int32.Parse(attrib.Value); } catch { throw new ConfigurationException("MagicAjax configuration: cacheTimeout for pageStore must be integer."); } if (cacheTimeout < 1) throw new ConfigurationException("MagicAjax configuration: cacheTimeout for pageStore must be 1 or greater."); } attrib = (XmlAttribute)pageStore.Attributes.GetNamedItem("maxConcurrentPages"); if (attrib != null) { try { maxPages = Int32.Parse(attrib.Value); } catch { throw new ConfigurationException("MagicAjax configuration: maxConcurrentPages for pageStore must be integer."); } if (maxPages < 1) throw new ConfigurationException("MagicAjax configuration: maxConcurrentPages for pageStore must be 1 or greater."); } attrib = (XmlAttribute)pageStore.Attributes.GetNamedItem("maxPagesLimitAlert"); if (attrib != null) { try { maxPagesLimitAlert = bool.Parse(attrib.Value); } catch { throw new ConfigurationException("MagicAjax configuration: maxPagesLimitAlert for pageStore must be boolean."); } } } _pageStore = new PageStore(mode, cacheTimeout, maxPages, maxPagesLimitAlert); } } } --- NEW FILE: MagicAjaxSectionHandler.cs --- using System; using System.Xml; using System.Configuration; namespace MagicAjax.Configuration { /// <summary> /// Summary description for MagicAjaxSectionHandler. /// </summary> public class MagicAjaxSectionHandler : IConfigurationSectionHandler { #region IConfigurationSectionHandler Members public object Create(object parent, object configContext, XmlNode section) { return new MagicAjaxConfiguration(section); } #endregion } } |
From: Argiris K. <be...@us...> - 2005-11-11 06:17:58
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6302/Core/UI/Design Added Files: AjaxPanelDesigner.cs Log Message: Put source files to module 'magicajax' divided in directories Core, Examples, and CustomControls. --- NEW FILE: AjaxPanelDesigner.cs --- using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.Design; namespace MagicAjax.UI.Design { public class AjaxPanelDesigner : System.Web.UI.Design.ReadWriteControlDesigner { } } |
From: Argiris K. <be...@us...> - 2005-11-11 06:17:58
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6302/Core/UI Added Files: AjaxControl.cs AjaxPage.cs AjaxUserControl.cs RenderedByScriptControl.cs Log Message: Put source files to module 'magicajax' divided in directories Core, Examples, and CustomControls. --- NEW FILE: AjaxUserControl.cs --- #region LGPL License /* MagicAjax Library Copyright (C) 2005 MagicAjax Project Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Web; namespace MagicAjax.UI { /// <summary> /// Includes the CallBack event, Context, Request and Response, for convenience. /// </summary> /// <remarks> /// You can implement the ICallBackEventHandler on your usercontrol to handle the /// CallBack event, and use the HttpContext.Current, CallBackHelper.Request and /// CallBackHelper.Response properties. /// /// You cannot use the Context, Request and Response of the System.Web.UI.UserControl /// because, during a CallBack, the Context of the page is invalid. If you don't want /// to replace the UserControl.Request and UserControl.Response from your code for /// CallBackHelper.Request and CallBackHelper.Response, and your usercontrol is inherited /// from System.Web.UI.UserControl, you can use AjaxUserControl for convenience. /// </remarks> public class AjaxUserControl : System.Web.UI.UserControl, ICallBackEventHandler { /// <summary> /// Raised by MagicAjaxModule when a CallBack occurs /// </summary> public event EventHandler CallBack; /// <summary> /// The base UserControl Request property doesn't work during a CallBack. Use this instead. /// </summary> public new HttpRequest Request { get { return Context.Request; } } /// <summary> /// The base UserControl Response property doesn't work during a CallBack. Use this instead. /// </summary> public new HttpResponse Response { get { return Context.Response; } } /// <summary> /// Raises the CallBack event. /// </summary> /// <remarks> /// Called by MagicAjaxModule. /// </remarks> public void RaiseCallBackEvent() { OnCallBack (EventArgs.Empty); } protected override HttpContext Context { get { return HttpContext.Current; } } protected virtual void OnCallBack(EventArgs e) { if (CallBack != null) CallBack(this, e); } } } --- NEW FILE: AjaxPage.cs --- #region LGPL License /* MagicAjax Library Copyright (C) 2005 MagicAjax Project Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Web; namespace MagicAjax.UI { /// <summary> /// Includes the CallBack event, Context, Request and Response, for convenience. /// </summary> /// <remarks> /// Inhering from AjaxPage is not required to apply AJAX on your pages. You can /// implement the ICallBackEventHandler on your page to handle the CallBack event, and /// use the HttpContext.Current, CallBackHelper.Request and CallBackHelper.Response /// properties. /// /// You cannot use the Context, Request and Response of the System.Web.UI.Page /// because, during a CallBack, the Context of the page is invalid. If you don't want /// to replace the Page.Request and Page.Response from your code for /// CallBackHelper.Request and CallBackHelper.Response, and your page is inherited /// from System.Web.UI.Page, you can use AjaxPage for convenience. /// </remarks> public class AjaxPage : System.Web.UI.Page, ICallBackEventHandler { /// <summary> /// Raised by MagicAjaxModule when a CallBack occurs /// </summary> public event EventHandler CallBack; /// <summary> /// The base Page Request property doesn't work during a CallBack. Use this instead. /// </summary> public new HttpRequest Request { get { return Context.Request; } } /// <summary> /// The base Page Response property doesn't work during a CallBack. Use this instead. /// </summary> public new HttpResponse Response { get { return Context.Response; } } /// <summary> /// Raises the CallBack event. /// </summary> /// <remarks> /// Called by MagicAjaxModule. /// </remarks> public void RaiseCallBackEvent() { OnCallBack (EventArgs.Empty); } protected override HttpContext Context { get { return HttpContext.Current; } } protected virtual void OnCallBack(EventArgs e) { if (CallBack != null) CallBack(this, e); } } } --- NEW FILE: AjaxControl.cs --- #region LGPL License /* MagicAjax Library Copyright (C) 2005 MagicAjax Project Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; namespace MagicAjax.UI { /// <summary> /// The base control for controls to get notified for callback events from the client. /// </summary> public class AjaxControl : System.Web.UI.WebControls.WebControl, ICallBackEventHandler { /// <summary> /// Raised by the MagicAjaxModule. /// </summary> public event EventHandler CallBack; /// <summary> /// Implements the ICallBackEventHandler interface. It is called by the MagicAjaxModule. /// </summary> public void RaiseCallBackEvent() { OnCallBack(EventArgs.Empty); } public bool IsPageNoStoreMode { get { return (MagicAjaxModule.Instance.Configuration.PageStore.Mode == Configuration.PageStoreMode.NoStore); } } public AjaxControl() { } public AjaxControl(HtmlTextWriterTag tag) : base(tag) { } protected override void OnPreRender(EventArgs e) { // Register 'CallBackObject.js' script MagicAjaxModule.Instance.EnableAjaxOnPage(this.Page); base.OnPreRender (e); } protected virtual void OnCallBack(EventArgs e) { if (CallBack != null) CallBack(this, e); } } } --- NEW FILE: RenderedByScriptControl.cs --- #region LGPL License /* MagicAjax Library Copyright (C) 2005 MagicAjax Project Team This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #endregion using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; namespace MagicAjax.UI { #region Public Class RenderStartEventArgs /// <summary> /// It contains the HtmlTextWriter writer event argument to be used during a /// RenderStart event. /// </summary> public class RenderStartEventArgs : EventArgs { private bool abortRendering = false; private HtmlTextWriter writer; public bool AbortRendering { get { return abortRendering; } set { abortRendering = value; } } public HtmlTextWriter Writer { get { return writer; } } public RenderStartEventArgs(HtmlTextWriter writer) { this.writer = writer; } } #endregion /// <summary> /// The event handler for a RenderStart event. /// </summary> public delegate void RenderStartEventHandler(object sender, RenderStartEventArgs e); /// <summary> /// This control manages its appearance on the page using javascript that sends /// to the client during a CallBack. /// </summary> /// <remarks> /// It provides the basic functionality for controls like AjaxPanel. It manages /// its tag attributes using javascript. /// </remarks> public abstract class RenderedByScriptControl : AjaxControl, IPreWriteScriptEventHandler, IScriptWriter { protected abstract void RenderByScript(); private bool _isRenderedOnPage = false; private bool _monitorVisibilityState = true; private string _currentTagHtml = null; private bool _isHtmlRendered = false; public event RenderStartEventHandler RenderStart; public event EventHandler RenderEnd; public event EventHandler PreWriteScript; public override bool Visible { get { return base.Visible; } set { if ( CallBackHelper.IsCallBack && IsRenderedOnPage && MonitorVisibilityState && value != base.Visible ) CallBackHelper.WriteSetVisibilityOfElementScript (ClientID, value); base.Visible = value; } } /// <summary> /// Determines whether the RenderedByScriptControl control has been rendered /// on the page, either by normal rendering or by script. /// </summary> /// <remarks> /// IsRenderedOnPage is set to true during a normal rendering or a rendering /// by script. It is set to false at WriteScript method when the Visible property /// is false. /// </remarks> [Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRenderedOnPage { get { return _isRenderedOnPage; } } /// <summary> /// Gets or sets whether every time "Visible" property is changed /// CallBackHelper.WriteSetVisibilityOfElementScript method should be called. /// Default is true. /// </summary> /// <remarks> /// If this property is true, every time you change the "Visible" property during a /// CallBack, the display attribute of the style of the control on the page will /// be set to "" or "none" by calling the CallBackHelper.WriteSetVisibilityOfElementScript /// method. /// </remarks> [Bindable(false), Category("Behavior"), DefaultValue(true)] public bool MonitorVisibilityState { get { return _monitorVisibilityState; } set { _monitorVisibilityState = value; } } /// <summary> /// Returns the tag name of the control. /// </summary> /// <returns></returns> public string GetTagName() { return TagKey.ToString(); } public RenderedByScriptControl() { this.ID = ""; } public RenderedByScriptControl(HtmlTextWriterTag tag) : base(tag) { this.ID = ""; } /// <summary> /// It defines whether the RenderedByScriptControl was already rendered during /// a normal rendering. /// </summary> /// <remarks> /// The RenderedByScriptControl can be normally rendered by the Render method /// even during a CallBack (i.e when all the controls of an AjaxPanel is new /// and the AjaxPanel renders all of them in a single html rendering). /// In this case it's not necessary to send any javascript to the client. /// </remarks> protected bool IsHtmlRendered { get { return _isHtmlRendered; } } protected override void OnCallBack(EventArgs e) { _isHtmlRendered = false; base.OnCallBack(e); } protected override void OnPreRender(EventArgs e) { if ( ! IsChildOfRenderedByScriptControl(this) ) { // Firefox, when performing a refresh, loads the page but keeps any INPUT // field values. Thus, the html of a RenderedByScriptControl is restored // as if the page was loaded because of the browser's "Back Button". // To resolve this, the name of the storing fields is different for // each page request. string hiddenStore = this.ClientID + "$RBS_Store" + DateTime.Now.Ticks; Page.RegisterHiddenField(hiddenStore, null); Page.RegisterArrayDeclaration("RBS_Controls", String.Format("document.all[\"{0}$RBS_Holder\"]", this.ClientID)); Page.RegisterArrayDeclaration("RBS_Controls_Store", String.Format("document.all[\"{0}\"]", hiddenStore)); } base.OnPreRender (e); } protected bool IsChildOfRenderedByScriptControl(Control control) { if (control.Parent == null || control.Parent == control.Page) return false; else if (control.Parent is RenderedByScriptControl) return true; else return IsChildOfRenderedByScriptControl(control.Parent); } /// <summary> /// Normal rendering. /// </summary> /// <remarks> /// It raises the RenderStart and RenderEnd events. If the rendering is not /// aborted during the RenderStart event, it renders the control and sets /// the _isHtmlRendered variable to true. /// </remarks> /// <param name="writer"></param> protected override void Render(HtmlTextWriter writer) { if ( IsPageNoStoreMode ) _isRenderedOnPage = true; RenderStartEventArgs eventArgs = new RenderStartEventArgs(writer); OnRenderStart(eventArgs); if (!eventArgs.AbortRendering) { // Put the html of this control inside a SPAN tag so that it can // be saved and restored when the page is loaded from the Browser's cache, // i.e. when the back button is pressed. writer.Write("<span id='{0}$RBS_Holder'>", this.ClientID); base.Render (writer); writer.Write("</span>"); _isHtmlRendered = true; _isRenderedOnPage = true; } OnRenderEnd(EventArgs.Empty); } /// <summary> /// It stores the tag html for later checking. /// </summary> /// <param name="writer"></param> public override void RenderBeginTag(HtmlTextWriter writer) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); HtmlTextWriter strwriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); base.RenderBeginTag (strwriter); _currentTagHtml = sb.ToString(); base.RenderBeginTag (writer); } /// <summary> /// Called by MagicAjaxModule /// </summary> public virtual void RaisePreWriteScriptEvent() { OnPreWriteScript (EventArgs.Empty); } /// <summary> /// If the tag html of the control is changed, send the attributes using javascript. /// </summary> /// <returns>True if rendering by script was needed, False if it was not</returns> public virtual void WriteScript() { if ( ! this.Visible ) { _isRenderedOnPage = false; return; } // If there was a normal rendering, javascript is not needed if (IsHtmlRendered) return; if ( ! IsRenderedOnPage ) { Control con = FindNextVisibleSibling(); CallBackHelper.WriteAddElementScript (Parent.ClientID, this.GetTagName(), this.ClientID, "", (con == null) ? null : con.ClientID); } System.Text.StringBuilder sb = new System.Text.StringBuilder(); HtmlTextWriter strwriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); // Take care of the tag of the control base.RenderBeginTag (strwriter); string html = sb.ToString(); sb.Length = 0; if(_currentTagHtml != html) { CallBackHelper.WriteSetAttributesOfControl (ClientID, FormatAttributes(html)); _currentTagHtml = html; } this.RenderByScript(); _isRenderedOnPage = true; } protected virtual void OnRenderStart(RenderStartEventArgs eventArgs) { if (RenderStart != null) RenderStart(this, eventArgs); } protected virtual void OnRenderEnd(EventArgs e) { if (RenderEnd != null) RenderEnd(this, e); } protected virtual void OnPreWriteScript(EventArgs e) { if (PreWriteScript != null) PreWriteScript(this, e); } /// <summary> /// Finds the next visible control of the control collection of this /// control's parent that has its ID attribute set. /// </summary> /// <returns></returns> private Control FindNextVisibleSibling() { for (int i=Parent.Controls.IndexOf(this) + 1; i < Parent.Controls.Count; i++) { Control con = Parent.Controls[i]; if (con.Visible && con.ID != null) return con; } return null; } /// <summary> /// It finds the attributes from the html of the control's tag, and formats them /// so that they are send by CallBackHelper.WriteSetAttributesOfControl method. /// </summary> /// <param name="html">The html tag of the control</param> /// <returns></returns> private string FormatAttributes(string html) { System.Text.StringBuilder sb = new System.Text.StringBuilder(html); System.Text.StringBuilder attribs = new System.Text.StringBuilder(); int mode = 0; for (int i=0; i < sb.Length; i++) { char ch = sb[i]; if (ch == '>') break; switch (mode) { case 0: if (ch == ' ') mode++; break; case 1: switch (ch) { case '\"': mode++; break; case ' ': attribs.Append ('|'); break; default: attribs.Append (ch); break; } break; case 2: if (ch == '\"') mode--; else attribs.Append (ch); break; } } return attribs.ToString(); } } } |
From: Argiris K. <be...@us...> - 2005-11-11 06:17:58
|
Update of /cvsroot/magicajax/magicajax/CustomControls/UI/Design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6302/CustomControls/UI/Design Added Files: AjaxCascadeTableDesigner.cs AjaxTabbedPanelDesigner.cs Log Message: Put source files to module 'magicajax' divided in directories Core, Examples, and CustomControls. --- NEW FILE: AjaxTabbedPanelDesigner.cs --- using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.Design; namespace MagicAjax.UI.Design { public class AjaxTabbedPanelDesigner : System.Web.UI.Design.ControlDesigner { public override string GetDesignTimeHtml() { // TODO: Íá êÜíù íá åìöáíßæåé ôá ðåñéå÷üìåíá óôïí designer return GetEmptyDesignTimeHtml(); } } } --- NEW FILE: AjaxCascadeTableDesigner.cs --- using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.Design; namespace MagicAjax.UI.Design { public class AjaxCascadeTableDesigner : System.Web.UI.Design.ControlDesigner { public override string GetDesignTimeHtml() { // TODO: Íá êÜíù íá åìöáíßæåé ôá ðåñéå÷üìåíá óôïí designer return GetEmptyDesignTimeHtml(); } } } |
From: Argiris K. <be...@us...> - 2005-11-11 06:14:37
|
Update of /cvsroot/magicajax/magicajax/CustomControls/UI/Design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6043/Design Log Message: Directory /cvsroot/magicajax/magicajax/CustomControls/UI/Design added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:14:37
|
Update of /cvsroot/magicajax/magicajax/CustomControls/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6043/Controls Log Message: Directory /cvsroot/magicajax/magicajax/CustomControls/UI/Controls added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:14:06
|
Update of /cvsroot/magicajax/magicajax/CustomControls/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5952/UI Log Message: Directory /cvsroot/magicajax/magicajax/CustomControls/UI added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:14:06
|
Update of /cvsroot/magicajax/magicajax/CustomControls/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5952/script Log Message: Directory /cvsroot/magicajax/magicajax/CustomControls/script added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:13:30
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5811/Design Log Message: Directory /cvsroot/magicajax/magicajax/Core/UI/Design added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:13:29
|
Update of /cvsroot/magicajax/magicajax/Core/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5811/Controls Log Message: Directory /cvsroot/magicajax/magicajax/Core/UI/Controls added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:24
|
Update of /cvsroot/magicajax/magicajax/Core/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597/UI Log Message: Directory /cvsroot/magicajax/magicajax/Core/UI added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:24
|
Update of /cvsroot/magicajax/magicajax/Core/Configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597/Configuration Log Message: Directory /cvsroot/magicajax/magicajax/Core/Configuration added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:23
|
Update of /cvsroot/magicajax/magicajax/Core/Collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597/Collections Log Message: Directory /cvsroot/magicajax/magicajax/Core/Collections added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:22
|
Update of /cvsroot/magicajax/magicajax/Core/Interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597/Interfaces Log Message: Directory /cvsroot/magicajax/magicajax/Core/Interfaces added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:22
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597/script Log Message: Directory /cvsroot/magicajax/magicajax/Core/script added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:06
|
Update of /cvsroot/magicajax/magicajax/CustomControls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5540/CustomControls Log Message: Directory /cvsroot/magicajax/magicajax/CustomControls added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:06
|
Update of /cvsroot/magicajax/magicajax/Examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5540/Examples Log Message: Directory /cvsroot/magicajax/magicajax/Examples added to the repository |
From: Argiris K. <be...@us...> - 2005-11-11 06:12:06
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5540/Core Log Message: Directory /cvsroot/magicajax/magicajax/Core added to the repository |
From: Dion O. <dol...@us...> - 2005-11-10 22:48:46
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1/Examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11723/MagicAjax NET 1.1/Examples Modified Files: Examples.aspx Log Message: Added a 'Regular Postback' button to the example page, to show that ViewState is kept on MagicAjax controls. Really amazing! Index: Examples.aspx =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/Examples/Examples.aspx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Examples.aspx 9 Nov 2005 21:06:05 -0000 1.3 --- Examples.aspx 10 Nov 2005 22:48:36 -0000 1.4 *************** *** 9,20 **** </head> <body> ! <h4>MagicAjax demo's</h4> <form id="form1" runat="server"> <hr /> <h5>1. Simple button showing server time</h5> <cc1:ajaxpanel ID="Ajaxpanel1" runat="server"> ! <asp:Button runat="server" ID="ShowTime" Text="Show Server Date and Time" OnClick="ShowTime_Click" /> ! <asp:Label runat="server" ID="lblShowTime" /> </cc1:ajaxpanel> --- 9,22 ---- </head> <body> ! <h4>MagicAjax demo's (.NET version <%= System.Environment.Version %>)</h4> <form id="form1" runat="server"> + <span style="float:right"><asp:Button runat="server" Text="Regular PostBack" /></span> + <hr /> <h5>1. Simple button showing server time</h5> <cc1:ajaxpanel ID="Ajaxpanel1" runat="server"> ! <asp:Button runat="server" ID="ShowTime" Text="Show server's date & time" OnClick="ShowTime_Click" /> ! <asp:Label runat="server" ID="lblShowTime" BackColor="Blue" ForeColor="White" /> </cc1:ajaxpanel> *************** *** 86,89 **** --- 88,92 ---- model.Items.Add(new ListItem("- Select car model -", "")); model.Visible = true; + select.Enabled = false; switch (brand.SelectedValue) |
From: Dion O. <dol...@us...> - 2005-11-10 21:00:52
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19241/MagicAjax NET 1.1 Modified Files: AssemblyInfo.cs CallBackHelper.cs MagicAjaxModule.cs Added Files: MagicAjax NET 2.0.csproj Log Message: - Added .NET 2.0 MagicAjax project (with preprocessor directive NET_2_0 defined) - Added 3 lines of .NET 2.0 specific code in MagicAjaxModule.cs (using the NET_2_0 preprocessor directive) Index: CallBackHelper.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/CallBackHelper.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CallBackHelper.cs 10 Nov 2005 12:53:08 -0000 1.4 --- CallBackHelper.cs 10 Nov 2005 21:00:40 -0000 1.5 *************** *** 392,395 **** --- 392,396 ---- public static string EncodeString(string str) { + //TODO: use 1 regular expression (faster) System.Text.StringBuilder sb = new System.Text.StringBuilder(str); sb.Replace("\\", "\\\\"); --- NEW FILE: MagicAjax NET 2.0.csproj --- (This appears to be a binary file; contents omitted.) Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/AssemblyInfo.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssemblyInfo.cs 24 Oct 2005 23:41:39 -0000 1.1 --- AssemblyInfo.cs 10 Nov 2005 21:00:40 -0000 1.2 *************** *** 17,21 **** [assembly: AssemblyCopyright("© 2005 MagicAjax.NET Project Team")] [assembly: AssemblyTrademark("")] ! [assembly: AssemblyCulture("")] // --- 17,26 ---- [assembly: AssemblyCopyright("© 2005 MagicAjax.NET Project Team")] [assembly: AssemblyTrademark("")] ! [assembly: AssemblyCulture("")] ! ! #if NET_2_0 ! //Webresources ! [assembly: WebResourceAttribute("MagicAjax.script.CallBackObject.js", "text/javascript")] ! #endif // Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/MagicAjaxModule.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MagicAjaxModule.cs 10 Nov 2005 12:53:08 -0000 1.4 --- MagicAjaxModule.cs 10 Nov 2005 21:00:40 -0000 1.5 *************** *** 156,168 **** if (location == null) { using (System.IO.StreamReader reader = new System.IO.StreamReader(typeof(MagicAjaxModule).Assembly.GetManifestResourceStream("MagicAjax.script.CallBackObject.js"))) { ! includeScript = "<script language=\"javascript\" type=\"text/javascript\">\r\n<!--\r\n" + reader.ReadToEnd() + "\r\n//-->\r\n</script>"; } } else { // Point to external script source file ! includeScript = String.Format("<script language=\"javascript\" src=\"{0}/{1}\"></script>", location, "CallBackObject.js"); } page.RegisterClientScriptBlock( "CALLBACK_FOR_AJAX", includeScript ); --- 156,174 ---- if (location == null) { + #if NET_2_0 + //use the webresource url for CallBackObject.js + includeScript = String.Format("<script type=\"text/javascript\" src=\"{0}\"></script>", page.ClientScript.GetWebResourceUrl(typeof(MagicAjaxModule), "MagicAjax.script.CallBackObject.js")); + #else + //read and output the embedded CallBackObject.js file from the manifest using (System.IO.StreamReader reader = new System.IO.StreamReader(typeof(MagicAjaxModule).Assembly.GetManifestResourceStream("MagicAjax.script.CallBackObject.js"))) { ! includeScript = String.Format("<script type=\"text/javascript\">\r\n<!--\r\n{0}\r\n//-->\r\n</script>", reader.ReadToEnd()); } + #endif } else { // Point to external script source file ! includeScript = String.Format("<script type=\"text/javascript\" src=\"{0}/{1}\"></script>", location, "CallBackObject.js"); } page.RegisterClientScriptBlock( "CALLBACK_FOR_AJAX", includeScript ); *************** *** 375,378 **** --- 381,389 ---- _response = _context.Response; + if (!(_context.Handler is Page)) + { + return; //if this wasn't a .aspx request, don't process + } + string pageKey = _request.QueryString["__AJAX_PAGEUNLOAD"]; if (pageKey != null) *************** *** 389,392 **** --- 400,409 ---- Page requestPage = (Page) _context.Handler; + #if NET_2_0 + // For ASP.NET 2.0, disable event validation on the page + requestPage.EnableEventValidation = false; + //TODO: check if there is another way to avoid the event-validation exceptions in the controls + #endif + // Continue only if it is a postback or a callback if ( "GET" == _request.HttpMethod ) *************** *** 410,414 **** --- 427,433 ---- string vsValue = _filter.GetViewStateFieldValue(); if (vsValue != null && _form["__VIEWSTATE"] != vsValue) + { CallBackHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); + } CallBackHelper.End(); *************** *** 742,746 **** --- 761,769 ---- public string GetViewStateFieldValue() { + #if NET_2_0 + string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\""; + #else string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" value=\""; + #endif string html = GetHtmlPage(); int si = html.IndexOf(search); |
From: Argiris K. <be...@us...> - 2005-11-10 12:53:17
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1/UI/Controls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21307/UI/Controls Modified Files: AjaxPanel.cs Log Message: Many changes to get NoStore page mode working. Set it as the default mode. Index: AjaxPanel.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/UI/Controls/AjaxPanel.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AjaxPanel.cs 24 Oct 2005 23:42:38 -0000 1.1 --- AjaxPanel.cs 10 Nov 2005 12:53:09 -0000 1.2 *************** *** 71,77 **** /// </remarks> [Designer("MagicAjax.UI.Design.AjaxPanelDesigner, MagicAjax"), ! ParseChildrenAttribute(false), ! PersistChildren(true), ! ToolboxData("<{0}:AjaxPanel runat=server>AjaxPanel</{0}:AjaxPanel>")] public class AjaxPanel : RenderedByScriptControl, IFormDataLoadedEventHandler, INamingContainer { --- 71,77 ---- /// </remarks> [Designer("MagicAjax.UI.Design.AjaxPanelDesigner, MagicAjax"), ! ParseChildrenAttribute(false), ! PersistChildren(true), ! ToolboxData("<{0}:AjaxPanel runat=server>AjaxPanel</{0}:AjaxPanel>")] public class AjaxPanel : RenderedByScriptControl, IFormDataLoadedEventHandler, INamingContainer { *************** *** 83,86 **** --- 83,87 ---- private Hashtable _controlHtmls = new Hashtable(); private NoVerifyRenderingPage _noVerifyPage = new NoVerifyRenderingPage(); + private ControlCollectionState _controlState = new ControlCollectionState(); #endregion *************** *** 138,228 **** #region Public Methods - #region override RenderByScript - /// <summary> - /// It scans child controls for added, removed or altered controls and sends - /// the appropriate javascript to the client. - /// </summary> - public override void RenderByScript() - { - DisableVerifyRendering (true); - - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - HtmlTextWriter litewriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); - - System.Text.StringBuilder sbFull = new System.Text.StringBuilder(); - HtmlTextWriter fullwriter = new HtmlTextWriter(new System.IO.StringWriter(sbFull)); - - bool allControlsAreNew = (Controls.Count == _addedControls.Count); - - if ( ! this.IsRenderedOnPage || allControlsAreNew ) - { - // Render all the controls in a single html rendering. - - for (int i=0; i < Controls.Count; i++) - { - Control con = Controls[i]; - - fullwriter.WriteBeginTag ("span"); - fullwriter.WriteAttribute ("id", GetAjaxElemID(con)); - fullwriter.Write (HtmlTextWriter.TagRightChar); - - ExtendedRenderControl (con, fullwriter, litewriter); - - fullwriter.WriteEndTag ("span"); - - _controlHtmls[con] = sb.ToString(); - sb.Length = 0; - } - - if (sbFull.Length > 0) - { - CallBackHelper.WriteSetHtmlOfElementScript (sbFull.ToString(), ClientID); - } - } - else - { - foreach (Control con in _removedControls) - { - _controlHtmls.Remove (con); - CallBackHelper.WriteRemoveElementScript (ClientID, GetAjaxElemID(con)); - } - - for (int i=0; i < Controls.Count; i++) - { - Control con = Controls[i]; - - string html; - sbFull.Length = sb.Length = 0; - - if (_addedControls.Contains(con)) - { - // It's a new control, create it on the client at the appropriate place. - ExtendedRenderControl (con, fullwriter, litewriter); - - CallBackHelper.WriteAddElementScript (ClientID, "span", GetAjaxElemID(con), sbFull.ToString(), GetNextExistingElement(i)); - _controlHtmls[con] = sb.ToString(); - } - else - { - ExtendedRenderControl (con, litewriter); - html = sb.ToString(); - - // If it's html rendering is the same, ignore it. - if (html != (string)_controlHtmls[con]) - { - ExtendedWriteSetHtmlOfElementScript (html, GetAjaxElemID(con)); - _controlHtmls[con] = html; - } - } - } - } - - DisableVerifyRendering (false); - - _addedControls.Clear(); - _removedControls.Clear(); - } - #endregion - #region RaiseFormDataLoadedEvent /// <summary> --- 139,142 ---- *************** *** 333,337 **** { if (_addedControls.Contains(control)) ! _addedControls.Remove (control); else _removedControls.Add (control); --- 247,251 ---- { if (_addedControls.Contains(control)) ! _addedControls.Remove (control); else _removedControls.Add (control); *************** *** 352,377 **** protected override void RenderChildren(HtmlTextWriter writer) { DisableVerifyRendering (true); - System.Text.StringBuilder sbFull = new System.Text.StringBuilder(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); - HtmlTextWriter fullwriter = new HtmlTextWriter(new System.IO.StringWriter(sbFull)); HtmlTextWriter litewriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); ! for (int i=0; i < Controls.Count; i++) { ! Control con = Controls[i]; ! writer.WriteBeginTag ("span"); ! writer.WriteAttribute ("id", GetAjaxElemID(con)); ! writer.Write (HtmlTextWriter.TagRightChar); ! ! ExtendedRenderControl (con, fullwriter, litewriter); ! writer.Write (sbFull.ToString()); ! _controlHtmls[con] = sb.ToString(); ! sbFull.Length = 0; ! sb.Length = 0; ! writer.WriteEndTag ("span"); } --- 266,457 ---- protected override void RenderChildren(HtmlTextWriter writer) { + if ( CallBackHelper.IsCallBack && IsPageNoStoreMode ) + { + LoadControlState(); + DoScriptRendering (writer); + } + else + { + DisableVerifyRendering (true); + + System.Text.StringBuilder sbFull = new System.Text.StringBuilder(); + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + HtmlTextWriter fullwriter = new HtmlTextWriter(new System.IO.StringWriter(sbFull)); + HtmlTextWriter litewriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); + + for (int i=0; i < Controls.Count; i++) + { + Control con = Controls[i]; + + writer.WriteBeginTag ("span"); + writer.WriteAttribute ("id", GetAjaxElemID(con)); + writer.Write (HtmlTextWriter.TagRightChar); + + ExtendedRenderControl (con, fullwriter, litewriter); + writer.Write (sbFull.ToString()); + _controlHtmls[con] = sb.ToString(); + sbFull.Length = 0; + sb.Length = 0; + + writer.WriteEndTag ("span"); + } + + DisableVerifyRendering (false); + + _addedControls.Clear(); + _removedControls.Clear(); + } + + if ( IsPageNoStoreMode ) + SaveControlState(); + } + #endregion + + protected virtual void SaveControlState() + { + _controlState.SetControlIDs (_controlHtmls); + _controlState.Save (this.UniqueID); + } + + protected virtual void LoadControlState() + { + _controlState = ControlCollectionState.LoadState (this.UniqueID); + + if (_controlState == null) + { + // State expired + Page.Response.Redirect (Page.Request.RawUrl); + } + + // Find new and previous controls + _addedControls.Clear(); + _controlHtmls.Clear(); + foreach (Control con in this.Controls) + { + if ( _controlState.ControlIDHtmls.ContainsKey(con.ClientID) ) + { + _controlHtmls[con] = _controlState.ControlIDHtmls[con.ClientID]; + } + else + { + _addedControls.Add (con); + } + } + + // Find removed controls + _removedControls.Clear(); + foreach (string clientID in _controlState.ControlIDHtmls.Keys) + { + int i; + for (i=0; i < this.Controls.Count; i++) + { + if (this.Controls[i].ClientID == clientID) + break; + } + + if (i == this.Controls.Count) + { + // The control is removed. Add a control with the same id + // so that DoScriptRendering "removes" it from page + if ( clientID.StartsWith (this.ClientID) ) + { + Literal lit = new Literal(); + lit.ID = clientID.Substring(this.ClientID.Length + 1); + _removedControls.Add (lit); + } + } + } + } + + #region override RenderByScript + protected override void RenderByScript() + { + DoScriptRendering (new HtmlTextWriter(System.IO.TextWriter.Null)); + } + #endregion + + #region DoScriptRendering + /// <summary> + /// It scans child controls for added, removed or altered controls and sends + /// the appropriate javascript to the client. + /// </summary> + protected virtual void DoScriptRendering (HtmlTextWriter output) + { DisableVerifyRendering (true); System.Text.StringBuilder sb = new System.Text.StringBuilder(); HtmlTextWriter litewriter = new HtmlTextWriter(new System.IO.StringWriter(sb)); ! System.Text.StringBuilder sbFull = new System.Text.StringBuilder(); ! HtmlTextWriter fullwriter = new HtmlTextWriter(new System.IO.StringWriter(sbFull)); ! ! bool allControlsAreNew = (Controls.Count == _addedControls.Count); ! ! if ( ! this.IsRenderedOnPage || allControlsAreNew ) { ! // Render all the controls in a single html rendering. ! for (int i=0; i < Controls.Count; i++) ! { ! Control con = Controls[i]; ! fullwriter.WriteBeginTag ("span"); ! fullwriter.WriteAttribute ("id", GetAjaxElemID(con)); ! fullwriter.Write (HtmlTextWriter.TagRightChar); ! ! ExtendedRenderControl (con, fullwriter, litewriter); ! ! fullwriter.WriteEndTag ("span"); ! ! _controlHtmls[con] = sb.ToString(); ! sb.Length = 0; ! } ! ! if (sbFull.Length > 0) ! { ! string html = sbFull.ToString(); ! CallBackHelper.WriteSetHtmlOfElementScript (html, ClientID); ! output.Write (html); ! } ! } ! else ! { ! foreach (Control con in _removedControls) ! { ! _controlHtmls.Remove (con); ! CallBackHelper.WriteRemoveElementScript (ClientID, GetAjaxElemID(con)); ! } ! ! for (int i=0; i < Controls.Count; i++) ! { ! Control con = Controls[i]; ! ! string html; ! sbFull.Length = sb.Length = 0; ! ! if (_addedControls.Contains(con)) ! { ! // It's a new control, create it on the client at the appropriate place. ! ExtendedRenderControl (con, fullwriter, litewriter); ! ! html = sbFull.ToString(); ! CallBackHelper.WriteAddElementScript (ClientID, "span", GetAjaxElemID(con), html, GetNextExistingElement(i)); ! output.Write (html); ! ! _controlHtmls[con] = sb.ToString(); ! } ! else ! { ! ExtendedRenderControl (con, output, litewriter); ! html = sb.ToString(); ! ! // If it's html rendering is the same, ignore it. ! if (html != (string)_controlHtmls[con]) ! { ! ExtendedWriteSetHtmlOfElementScript (html, GetAjaxElemID(con)); ! _controlHtmls[con] = html; ! } ! } ! } } *************** *** 490,494 **** } ! HtmlTextWriter extwriter = new HtmlTextWriter(extTextWriter); control.RenderControl (extwriter); --- 570,574 ---- } ! HtmlTextWriter extwriter = new HtmlTextWriter(extTextWriter); control.RenderControl (extwriter); *************** *** 522,525 **** --- 602,609 ---- // at the first CallBack. + // Try not using DisableVerify at all if it's IsPageNoStoreMode + if ( this.IsPageNoStoreMode ) + return; + Page page = (disable) ? _noVerifyPage : this.Page; for (int i=0; i < Controls.Count; i++) *************** *** 645,648 **** --- 729,772 ---- #endregion + #region Private Class ControlCollectionState + [Serializable] + private class ControlCollectionState + { + private Hashtable _controlIDHtmls; + + public static ControlCollectionState LoadState(string panelUniqueID) + { + return (ControlCollectionState) HttpContext.Current.Session[GetPageKey(panelUniqueID)]; + } + + public static string GetPageKey (string panelUniqueID) + { + return String.Format("__ControlState_{0}_{1}", HttpContext.Current.Request.RawUrl, panelUniqueID); + } + + public Hashtable ControlIDHtmls + { + get { return _controlIDHtmls; } + } + + public void SetControlIDs (Hashtable controlHtmls) + { + _controlIDHtmls.Clear(); + foreach (Control con in controlHtmls.Keys) + _controlIDHtmls.Add (con.ClientID, (string)controlHtmls[con]); + } + + public void Save(string panelUniqueID) + { + HttpContext.Current.Session[GetPageKey(panelUniqueID)] = this; + } + + public ControlCollectionState() + { + _controlIDHtmls = new Hashtable(); + } + } + #endregion + #region Private Class ExtendedTextWriter /// <summary> |
From: Argiris K. <be...@us...> - 2005-11-10 12:53:17
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21307/script Modified Files: CallBackObject.js Log Message: Many changes to get NoStore page mode working. Set it as the default mode. Index: CallBackObject.js =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/script/CallBackObject.js,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CallBackObject.js 8 Nov 2005 07:53:33 -0000 1.3 --- CallBackObject.js 10 Nov 2005 12:53:09 -0000 1.4 *************** *** 1,5 **** __AJAXCboList = new Array(); __bPageIsStored = false; - __initialRBSControlsHtml = new Array(); __PreviousOnFormSubmit = null; __PreviousPostBack = null; --- 1,4 ---- *************** *** 118,129 **** window.onunload = this.OnPageUnload; } - else - { - if (typeof(RBS_Controls) != "undefined") - { - for (var i=0; i < RBS_Controls.length; i++) - __initialRBSControlsHtml[RBS_Controls[i].id] = RBS_Controls[i].innerHTML; - } - } __bPageIsStored = bPageIsStored; --- 117,120 ---- *************** *** 230,235 **** var eName = ''; ! theData = '__AJAX_EVENTTARGET=' + escape(eventTarget.split("$").join(":")) + '&'; ! theData += '__AJAX_EVENTARGUMENT=' + encodeURIComponent(eventArgument) + '&'; if ( ! __bPageIsStored ) --- 221,227 ---- var eName = ''; ! theData = '__EVENTTARGET=' + escape(eventTarget.split("$").join(":")) + '&'; ! theData += '__EVENTARGUMENT=' + encodeURIComponent(eventArgument) + '&'; ! theData += '__AJAX_CALLBACK=true&'; if ( ! __bPageIsStored ) *************** *** 292,305 **** __AJAXCboList.push(oThis); AJAXCbo = new CallBackObject(); - var httpMethod = "POST"; - - if ( ! __bPageIsStored ) - { - // Do a GET callback so that the page can be initialized - httpMethod = "GET"; - thePage += (thePage.indexOf("?") == -1) ? "?" : "&"; - thePage += "__AJAX_FORMDATA=" + encodeURIComponent(theData); - theData = null; - } if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 ) --- 284,287 ---- *************** *** 308,312 **** { // Asynchronous ! this.XmlHttp.open(httpMethod, thePage, true); this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); }; this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); --- 290,294 ---- { // Asynchronous ! this.XmlHttp.open("POST", thePage, true); this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); }; this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); *************** *** 321,325 **** function() { ! oThis.XmlHttp.open(httpMethod, thePage, false); oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); oThis.XmlHttp.send(theData); --- 303,307 ---- function() { ! oThis.XmlHttp.open("POST", thePage, false); oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); oThis.XmlHttp.send(theData); *************** *** 360,374 **** return false; - // If the page is not stored at the server, restore the initial page - // before applying the changes that occured during the callback. - if ( ! __bPageIsStored ) - { - if (typeof(RBS_Controls) != "undefined") - { - for (var i=0; i < RBS_Controls.length; i++) - AJAXCbo.RestoreHtml(RBS_Controls[i], __initialRBSControlsHtml[RBS_Controls[i].id]); - } - } - eval(responseText); --- 342,345 ---- |
From: Argiris K. <be...@us...> - 2005-11-10 12:53:17
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21307 Modified Files: CallBackHelper.cs MagicAjaxModule.cs Web.config Log Message: Many changes to get NoStore page mode working. Set it as the default mode. Index: Web.config =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/Web.config,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Web.config 7 Nov 2005 06:44:08 -0000 1.4 --- Web.config 10 Nov 2005 12:53:08 -0000 1.5 *************** *** 14,18 **** "Session" : Saves the page object in session, works only for "InProc" SessionState "Cache" : Saves the page object in cache ! Default is "Session" pageStore/cacheTimeout - The time in minutes that the page will be kept in cache, if "Cache" is selected for pageStore. Default is 5 --- 14,18 ---- "Session" : Saves the page object in session, works only for "InProc" SessionState "Cache" : Saves the page object in cache ! Default is "NoStore" pageStore/cacheTimeout - The time in minutes that the page will be kept in cache, if "Cache" is selected for pageStore. Default is 5 *************** *** 23,27 **** <magicAjax> <pageStore ! mode="Session" cacheTimeout="5" maxConcurrentPages="5" --- 23,27 ---- <magicAjax> <pageStore ! mode="NoStore" cacheTimeout="5" maxConcurrentPages="5" Index: CallBackHelper.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/CallBackHelper.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CallBackHelper.cs 3 Nov 2005 11:38:38 -0000 1.3 --- CallBackHelper.cs 10 Nov 2005 12:53:08 -0000 1.4 *************** *** 54,57 **** --- 54,59 ---- private CallBackHelper() { } + private static System.Text.StringBuilder sbScript = null; + #region Static Properties /// <summary> *************** *** 90,94 **** { if ( IsCallBack ) ! return MagicAjaxModule.Instance.Form["__AJAX_EVENTARGUMENT"]; else return null; --- 92,96 ---- { if ( IsCallBack ) ! return MagicAjaxModule.Instance.Form["__EVENTARGUMENT"]; else return null; *************** *** 106,110 **** get { ! return ( MagicAjaxModule.Instance.Form["__AJAX_EVENTTARGET"] == "__AJAX_CALLBACKTIMER" ); } } --- 108,112 ---- get { ! return ( MagicAjaxModule.Instance.Form["__EVENTTARGET"] == "__AJAX_CALLBACKTIMER" ); } } *************** *** 335,339 **** public static void WriteSetFieldScript(string fieldName, string fieldValue) { ! Write( String.Format("AJAXCbo.SetFieldScript({0},\"{1}\");\r\n", EncodeString(fieldValue), fieldName) ); } --- 337,341 ---- public static void WriteSetFieldScript(string fieldName, string fieldValue) { ! Write( String.Format("AJAXCbo.SetFieldScript(\"{0}\",{1});\r\n", fieldName, EncodeString(fieldValue)) ); } *************** *** 415,419 **** public static void Write( string text) { ! Response.Write (text + "\r\n"); } --- 417,432 ---- public static void Write( string text) { ! // Use the string builder ! //Response.Write (text + "\r\n"); ! sbScript.Append (text + "\r\n"); ! } ! ! internal static void Init() ! { ! HttpResponse hr = CallBackHelper.Response; ! hr.StatusCode = 200; ! hr.StatusDescription = "OK"; ! ! sbScript = new System.Text.StringBuilder(); } *************** *** 430,440 **** HttpResponse hr = CallBackHelper.Response; ! hr.StatusCode = 200; ! hr.StatusDescription = "OK"; hr.Flush(); - - MagicAjaxModule.Instance.CompletedCallBack = true; hr.End(); } --- 443,453 ---- HttpResponse hr = CallBackHelper.Response; + + hr.Clear(); + hr.Write (sbScript.ToString()); ! MagicAjaxModule.Instance.CompletedCallBack = true; hr.Flush(); hr.End(); } Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/MagicAjaxModule.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MagicAjaxModule.cs 7 Nov 2005 06:44:08 -0000 1.3 --- MagicAjaxModule.cs 10 Nov 2005 12:53:08 -0000 1.4 *************** *** 214,218 **** { // Find an empty slot ! pageInfoIndex = -1; for (int i=0; i < storedPages.Count; i++) { --- 214,218 ---- { // Find an empty slot ! pageInfoIndex = -1; for (int i=0; i < storedPages.Count; i++) { *************** *** 358,362 **** childHash = ~childHash; ! int conHash = String.Format("{0}_{1}", control.GetType(), control.ID).GetHashCode(); return conHash ^ childHash; --- 358,362 ---- childHash = ~childHash; ! int conHash = String.Format("{0}_{1}", control.GetType(), control.ID).GetHashCode(); return conHash ^ childHash; *************** *** 389,430 **** Page requestPage = (Page) _context.Handler; ! if ( PageStoreMode.NoStore == _config.PageStore.Mode ) ! { ! // The page is not stored ! string strFormData = _request.QueryString["__AJAX_FORMDATA"]; ! if (strFormData == null) ! return; ! // Get the form data ! string[] pairs = strFormData.Split('&'); ! _form = new NameValueCollection(pairs.Length); ! for (int i=0; i < pairs.Length; i++) { ! string[] parts = pairs[i].Split('='); ! _form.Add (_context.Server.UrlDecode(parts[0]), _context.Server.UrlDecode(parts[1])); ! } ! // Remove the '__AJAX_FORMDATA' query key ! int si = _request.RawUrl.IndexOf("?") + 1; ! int ei = _request.RawUrl.IndexOf("&__AJAX_FORMDATA="); ! if (ei == -1) ! ei = si; ! _context.RewritePath(_request.FilePath, _request.PathInfo, _request.RawUrl.Substring(si, ei-si)); ! _context.Handler.ProcessRequest(_context); ! _response.Clear(); ! _isCallBack = true; ! // Restore the validators ! if (requestPage.Validators.Count == 0) ! { ! ArrayList validators = FindValidators(requestPage); ! foreach (IValidator valid in validators) ! requestPage.Validators.Add (valid); } - ProcessCallBack (requestPage); - _response.Cache.SetNoStore(); - CallBackHelper.End(); } else --- 389,417 ---- Page requestPage = (Page) _context.Handler; ! // Continue only if it is a postback or a callback ! if ( "GET" == _request.HttpMethod ) ! return; ! _isCallBack = (_request.Form["__AJAX_CALLBACK"] != null); ! _form = _request.Form; ! if ( PageStoreMode.NoStore == _config.PageStore.Mode ) ! { ! if ( _isCallBack ) { ! _filter = new PageFilter(_response.Filter); ! _response.Filter = _filter; ! CallBackHelper.Init(); ! _context.Handler.ProcessRequest (_context); ! _response.Flush(); ! string vsValue = _filter.GetViewStateFieldValue(); ! if (vsValue != null && _form["__VIEWSTATE"] != vsValue) ! CallBackHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); ! ! CallBackHelper.End(); } } else *************** *** 432,441 **** // The page is stored - // Continue only if it is a postback or a callback - if ( "GET" == _request.HttpMethod ) - return; - - _isCallBack = (_request.Form["__AJAX_EVENTTARGET"] != null); - _form = _request.Form; pageKey = _form[PageKeyFieldName]; --- 419,422 ---- *************** *** 478,481 **** --- 459,464 ---- } + CallBackHelper.Init(); + ProcessCallBack(_currentPageInfo.Page); *************** *** 490,497 **** protected virtual void RequestedPage_Init(object sender, EventArgs e) { ! Page requestPage = (Page) sender; System.Web.UI.HtmlControls.HtmlForm storedForm = (System.Web.UI.HtmlControls.HtmlForm) _currentPageInfo.Page.Controls[1]; ! // Remove the HtmlForm of requested page ! requestPage.Controls.RemoveAt (1); requestPage.Controls.AddAt (1, storedForm); } --- 473,480 ---- protected virtual void RequestedPage_Init(object sender, EventArgs e) { ! Page requestPage = (Page) sender; System.Web.UI.HtmlControls.HtmlForm storedForm = (System.Web.UI.HtmlControls.HtmlForm) _currentPageInfo.Page.Controls[1]; ! // Remove the HtmlForm of requested page ! requestPage.Controls.RemoveAt (1); requestPage.Controls.AddAt (1, storedForm); } *************** *** 524,532 **** else { ! // Handler Server.Transfer ! response.Clear(); string html = _filter.GetHtmlPage(); CallBackHelper.WriteSetHtmlOfPageScript (html); ! CallBackHelper.WriteEndSignature(); } } --- 507,515 ---- else { ! // Handle Server.Transfer ! CallBackHelper.Init(); string html = _filter.GetHtmlPage(); CallBackHelper.WriteSetHtmlOfPageScript (html); ! CallBackHelper.End(); } } *************** *** 551,556 **** if ( CallBackHelper.CallBackType == CallBackType.Control ) { ! string target = _form["__AJAX_EVENTTARGET"]; ! string argument = _form["__AJAX_EVENTARGUMENT"]; RaisePostBackEventInChild (page, target, argument); } --- 534,539 ---- if ( CallBackHelper.CallBackType == CallBackType.Control ) { ! string target = _form["__EVENTTARGET"]; ! string argument = _form["__EVENTARGUMENT"]; RaisePostBackEventInChild (page, target, argument); } *************** *** 674,678 **** { bool oldSelected = cbList.Items[listItem].Selected; ! handler.LoadPostData(String.Format("{0}:{1}", con.UniqueID, listItem), _form); if (oldSelected != cbList.Items[listItem].Selected) changed = true; --- 657,661 ---- { bool oldSelected = cbList.Items[listItem].Selected; ! handler.LoadPostData(String.Format("{0}:{1}", con.UniqueID, listItem), _form); if (oldSelected != cbList.Items[listItem].Selected) changed = true; *************** *** 748,766 **** private class PageFilter : Stream { ! private Stream responseStream; ! private Stream memStream; ! public PageFilter (Stream responseStream) { ! this.responseStream = responseStream; ! this.memStream = new MemoryStream(); } public string GetHtmlPage() { ! byte[] buffer = new byte[memStream.Length]; ! memStream.Position = 0; ! memStream.Read (buffer, 0, (int)memStream.Length); return HttpContext.Current.Response.ContentEncoding.GetString(buffer); --- 731,765 ---- private class PageFilter : Stream { ! private Stream _responseStream; ! private Stream _memStream; ! public PageFilter (Stream _responseStream) { ! this._responseStream = _responseStream; ! this._memStream = new MemoryStream(); ! } ! ! public string GetViewStateFieldValue() ! { ! string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" value=\""; ! string html = GetHtmlPage(); ! int si = html.IndexOf(search); ! if (si == -1) ! return null; ! ! si += search.Length; ! int ei = html.IndexOf('\"', si); ! if (ei == -1) ! return null; ! ! return html.Substring(si, ei-si); } public string GetHtmlPage() { ! byte[] buffer = new byte[_memStream.Length]; ! _memStream.Position = 0; ! _memStream.Read (buffer, 0, (int)_memStream.Length); return HttpContext.Current.Response.ContentEncoding.GetString(buffer); *************** *** 785,828 **** public override void Close() { ! responseStream.Close (); } public override void Flush() { ! responseStream.Flush (); } public override long Length { ! get { return responseStream.Length; } } public override long Position { ! get { return responseStream.Position; } ! set { responseStream.Position = value; } } public override long Seek(long offset, SeekOrigin origin) { ! return responseStream.Seek (offset, origin); } public override void SetLength(long length) { ! responseStream.SetLength (length); } public override int Read(byte[] buffer, int offset, int count) { ! return responseStream.Read (buffer, offset, count); } public override void Write(byte[] buffer, int offset, int count) { - responseStream.Write (buffer, offset, count); - if ( CallBackHelper.IsCallBack ) ! memStream.Write (buffer, offset, count); } #endregion --- 784,834 ---- public override void Close() { ! _responseStream.Close (); } public override void Flush() { ! _responseStream.Flush (); } public override long Length { ! get { return _responseStream.Length; } } public override long Position { ! get { return _responseStream.Position; } ! set { _responseStream.Position = value; } } public override long Seek(long offset, SeekOrigin origin) { ! return _responseStream.Seek (offset, origin); } public override void SetLength(long length) { ! _responseStream.SetLength (length); } public override int Read(byte[] buffer, int offset, int count) { ! return _responseStream.Read (buffer, offset, count); } public override void Write(byte[] buffer, int offset, int count) { if ( CallBackHelper.IsCallBack ) ! { ! _memStream.Write (buffer, offset, count); ! ! if ( MagicAjaxModule.Instance.CompletedCallBack ) ! _responseStream.Write (buffer, offset, count); ! } ! else ! { ! _responseStream.Write (buffer, offset, count); ! } } #endregion |
From: Argiris K. <be...@us...> - 2005-11-10 12:53:16
|
Update of /cvsroot/magicajax/MagicAjax NET 1.1/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21307/UI Modified Files: AjaxControl.cs RenderedByScriptControl.cs Log Message: Many changes to get NoStore page mode working. Set it as the default mode. Index: AjaxControl.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/UI/AjaxControl.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AjaxControl.cs 24 Oct 2005 23:42:38 -0000 1.1 --- AjaxControl.cs 10 Nov 2005 12:53:09 -0000 1.2 *************** *** 45,48 **** --- 45,53 ---- } + public bool IsPageNoStoreMode + { + get { return (MagicAjaxModule.Instance.Configuration.PageStore.Mode == Configuration.PageStoreMode.NoStore); } + } + public AjaxControl() { Index: RenderedByScriptControl.cs =================================================================== RCS file: /cvsroot/magicajax/MagicAjax NET 1.1/UI/RenderedByScriptControl.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RenderedByScriptControl.cs 24 Oct 2005 23:42:38 -0000 1.1 --- RenderedByScriptControl.cs 10 Nov 2005 12:53:09 -0000 1.2 *************** *** 70,74 **** public abstract class RenderedByScriptControl : AjaxControl, IPreWriteScriptEventHandler, IScriptWriter { ! public abstract void RenderByScript(); private bool _isRenderedOnPage = false; --- 70,74 ---- public abstract class RenderedByScriptControl : AjaxControl, IPreWriteScriptEventHandler, IScriptWriter { ! protected abstract void RenderByScript(); private bool _isRenderedOnPage = false; *************** *** 81,93 **** public event EventHandler PreWriteScript; - // Disable EnableViewState so that the properties it sustains doesn't interfere with - // the funtionality provided by RenderedByScriptControl. - [Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override bool EnableViewState - { - get { return false; } - set { } - } - public override bool Visible { --- 81,84 ---- *************** *** 152,161 **** public RenderedByScriptControl() { - base.EnableViewState = false; this.ID = ""; } public RenderedByScriptControl(HtmlTextWriterTag tag) : base(tag) { - base.EnableViewState = false; this.ID = ""; } --- 143,150 ---- *************** *** 206,210 **** else if (control.Parent is RenderedByScriptControl) return true; ! else return IsChildOfRenderedByScriptControl(control.Parent); } --- 195,199 ---- else if (control.Parent is RenderedByScriptControl) return true; ! else return IsChildOfRenderedByScriptControl(control.Parent); } *************** *** 221,224 **** --- 210,216 ---- protected override void Render(HtmlTextWriter writer) { + if ( IsPageNoStoreMode ) + _isRenderedOnPage = true; + RenderStartEventArgs eventArgs = new RenderStartEventArgs(writer); OnRenderStart(eventArgs); |