Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Version 1.1, updated for ASP.NET 4.

  • Loading branch information...
commit 0196c97f10278c2fbbf68df165b32ba699ce6f0b 1 parent 1cc0540
Dave Ward authored April 15, 2010
51  PostBackRitalin.csproj
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2  
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  2
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
   <PropertyGroup>
4 4
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 5
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,9 +10,30 @@
10 10
     <AppDesignerFolder>Properties</AppDesignerFolder>
11 11
     <RootNamespace>PostBackRitalin</RootNamespace>
12 12
     <AssemblyName>PostBackRitalin</AssemblyName>
13  
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  13
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14 14
     <FileAlignment>512</FileAlignment>
15 15
     <Nonshipping>true</Nonshipping>
  16
+    <FileUpgradeFlags>
  17
+    </FileUpgradeFlags>
  18
+    <UpgradeBackupLocation>
  19
+    </UpgradeBackupLocation>
  20
+    <OldToolsVersion>3.5</OldToolsVersion>
  21
+    <PublishUrl>publish\</PublishUrl>
  22
+    <Install>true</Install>
  23
+    <InstallFrom>Disk</InstallFrom>
  24
+    <UpdateEnabled>false</UpdateEnabled>
  25
+    <UpdateMode>Foreground</UpdateMode>
  26
+    <UpdateInterval>7</UpdateInterval>
  27
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
  28
+    <UpdatePeriodically>false</UpdatePeriodically>
  29
+    <UpdateRequired>false</UpdateRequired>
  30
+    <MapFileExtensions>true</MapFileExtensions>
  31
+    <ApplicationRevision>0</ApplicationRevision>
  32
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
  33
+    <IsWebBootstrapper>false</IsWebBootstrapper>
  34
+    <UseApplicationTrust>false</UseApplicationTrust>
  35
+    <BootstrapperEnabled>true</BootstrapperEnabled>
  36
+    <TargetFrameworkProfile />
16 37
   </PropertyGroup>
17 38
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18 39
     <DebugSymbols>true</DebugSymbols>
@@ -22,6 +43,7 @@
22 43
     <DefineConstants>DEBUG;TRACE</DefineConstants>
23 44
     <ErrorReport>prompt</ErrorReport>
24 45
     <WarningLevel>4</WarningLevel>
  46
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
25 47
   </PropertyGroup>
26 48
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27 49
     <DebugType>pdbonly</DebugType>
@@ -30,6 +52,7 @@
30 52
     <DefineConstants>TRACE</DefineConstants>
31 53
     <ErrorReport>prompt</ErrorReport>
32 54
     <WarningLevel>4</WarningLevel>
  55
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
33 56
   </PropertyGroup>
34 57
   <ItemGroup>
35 58
     <Reference Include="System" />
@@ -37,7 +60,7 @@
37 60
     <Reference Include="System.Design" />
38 61
     <Reference Include="System.Drawing" />
39 62
     <Reference Include="System.Web" />
40  
-    <Reference Include="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
  63
+    <Reference Include="System.Web.Extensions" />
41 64
     <Reference Include="System.Xml" />
42 65
   </ItemGroup>
43 66
   <ItemGroup>
@@ -53,6 +76,28 @@
53 76
   <ItemGroup>
54 77
     <EmbeddedResource Include="PostBackRitalin.min.js" />
55 78
   </ItemGroup>
  79
+  <ItemGroup>
  80
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
  81
+      <Visible>False</Visible>
  82
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
  83
+      <Install>false</Install>
  84
+    </BootstrapperPackage>
  85
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
  86
+      <Visible>False</Visible>
  87
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
  88
+      <Install>true</Install>
  89
+    </BootstrapperPackage>
  90
+    <BootstrapperPackage Include="Microsoft.VisualBasic.PowerPacks.10.0">
  91
+      <Visible>False</Visible>
  92
+      <ProductName>Microsoft Visual Basic PowerPacks 10.0</ProductName>
  93
+      <Install>true</Install>
  94
+    </BootstrapperPackage>
  95
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
  96
+      <Visible>False</Visible>
  97
+      <ProductName>Windows Installer 3.1</ProductName>
  98
+      <Install>true</Install>
  99
+    </BootstrapperPackage>
  100
+  </ItemGroup>
56 101
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
57 102
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
58 103
        Other similar extension points exist, see Microsoft.Common.targets.
56  PostBackRitalin.js
@@ -19,11 +19,15 @@
19 19
 };
20 20
 
21 21
 PostBackRitalin.prototype = {
22  
-  _isMonitoredRequest: function(panelID) {
  22
+  _isMonitoredRequest: function (panelID) {
23 23
     if (this._monitoredUpdatePanels === null) {
24 24
       return true;
25 25
     }
26 26
 
  27
+    if (panelID === null) {
  28
+      return false;
  29
+    }
  30
+
27 31
     for (var i = 0; i < this._monitoredUpdatePanels.length; i++) {
28 32
       if (panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID) !== null) {
29 33
         return true;
@@ -33,11 +37,15 @@ PostBackRitalin.prototype = {
33 37
     return false;
34 38
   },
35 39
 
36  
-  _isDisableAllElementsPanel: function(panelID) {
  40
+  _isDisableAllElementsPanel: function (panelID) {
37 41
     if (this._monitoredUpdatePanels === null) {
38 42
       return false;
39 43
     }
40 44
 
  45
+    if (panelID === null) {
  46
+      return false;
  47
+    }
  48
+
41 49
     for (var i = 0; i < this._monitoredUpdatePanels.length; i++) {
42 50
       if (panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID) !== null) {
43 51
         return this._monitoredUpdatePanels[i].DisableAllElements;
@@ -45,7 +53,23 @@ PostBackRitalin.prototype = {
45 53
     }
46 54
   },
47 55
 
48  
-  get_waitText: function(panelID) {
  56
+  _findContainingPanel: function (el) {
  57
+    // If the element is null, we're at the top of the DOM and haven't found it.
  58
+    if (el === null || this._monitoredUpdatePanels === null)
  59
+      return null;
  60
+
  61
+    if (el.id) {
  62
+      for (var i = 0; i < this._monitoredUpdatePanels.length; i++) {
  63
+        if (el.id.match(this._monitoredUpdatePanels[i].UpdatePanelID) !== null) {
  64
+          return this._monitoredUpdatePanels[i].UpdatePanelID;
  65
+        }
  66
+      }
  67
+    }
  68
+
  69
+    return this._findContainingPanel(el.parentNode);
  70
+  },
  71
+
  72
+  get_waitText: function (panelID) {
49 73
     if (this._monitoredUpdatePanels) {
50 74
       for (var i = 0; i < this._monitoredUpdatePanels.length; i++) {
51 75
         if (panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID) !== null) {
@@ -61,7 +85,7 @@ PostBackRitalin.prototype = {
61 85
     return null;
62 86
   },
63 87
 
64  
-  get_waitImage: function(panelID) {
  88
+  get_waitImage: function (panelID) {
65 89
     if (this._monitoredUpdatePanels) {
66 90
       for (var i = 0; i < this._monitoredUpdatePanels.length; i++) {
67 91
         if (panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID) !== null) {
@@ -77,7 +101,7 @@ PostBackRitalin.prototype = {
77 101
     return null;
78 102
   },
79 103
 
80  
-  _disableAllElements: function(panelID) {
  104
+  _disableAllElements: function (panelID) {
81 105
     var panel = $get(panelID);
82 106
 
83 107
     if (panel !== null) {
@@ -103,20 +127,11 @@ PostBackRitalin.prototype = {
103 127
     }
104 128
   },
105 129
 
106  
-  _parseSendingPanel: function(SenderString) {
107  
-    // Grab just the sending UpdatePanel's ID.
108  
-    var tmp = SenderString.split('|')[0];
109  
-
110  
-    // Replace any $ characters with underscores.
111  
-    tmp = tmp.replace(/\$/g, '_');
112  
-
113  
-    return tmp;
114  
-  },
115  
-
116  
-  _beginRequest: function(sender, args) {
117  
-    var sendingPanel = this._parseSendingPanel(sender._postBackSettings.panelID);
  130
+  _beginRequest: function (sender, args) {
118 131
     var element = args.get_postBackElement();
119 132
 
  133
+    var sendingPanel = this._findContainingPanel(element);
  134
+
120 135
     if (element !== null && this._isMonitoredRequest(sendingPanel)) {
121 136
       if (element.type == 'submit' || element.type == 'button') {
122 137
         element.disabled = true;
@@ -158,9 +173,10 @@ PostBackRitalin.prototype = {
158 173
     }
159 174
   },
160 175
 
161  
-  _endRequest: function(sender, args) {
  176
+  _endRequest: function (sender, args) {
162 177
     var element = sender._postBackSettings.sourceElement;
163  
-    var sendingPanel = this._parseSendingPanel(sender._postBackSettings.panelID);
  178
+
  179
+    var sendingPanel = this._findContainingPanel(element);
164 180
 
165 181
     // Check to make sure the item hasn't been removed during the postback.
166 182
     if (element !== null && this._isMonitoredRequest(sendingPanel)) {
@@ -187,7 +203,7 @@ PostBackRitalin.prototype = {
187 203
     }
188 204
   },
189 205
 
190  
-  _initialize: function() {
  206
+  _initialize: function () {
191 207
     this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
192 208
 
193 209
     this._beginRequestHandler = Function.createDelegate(this, this._beginRequest);
10  PostBackRitalin.min.js
... ...
@@ -1,16 +1,20 @@
1 1
 
2 2
 var PostBackRitalin=function(waitText,waitImage,monitoredUpdatePanels,preload,waitClass){this._waitText=waitText;this._waitImage=waitImage;this._waitClass=waitClass;this._monitoredUpdatePanels=monitoredUpdatePanels;this._preload=preload;this._pageRequestManager=null;this._beginRequestHandler=null;this._endRequestHandler=null;this._oldText=null;this._oldImage=null;this._oldHref=null;this._initialize();};PostBackRitalin.prototype={_isMonitoredRequest:function(panelID){if(this._monitoredUpdatePanels===null){return true;}
  3
+if(panelID===null){return false;}
3 4
 for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return true;}}
4 5
 return false;},_isDisableAllElementsPanel:function(panelID){if(this._monitoredUpdatePanels===null){return false;}
5  
-for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].DisableAllElements;}}},get_waitText:function(panelID){if(this._monitoredUpdatePanels){for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].WaitText;}}}
  6
+if(panelID===null){return false;}
  7
+for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].DisableAllElements;}}},_findContainingPanel:function(el){if(el===null||this._monitoredUpdatePanels===null)
  8
+return null;if(el.id){for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(el.id.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].UpdatePanelID;}}}
  9
+return this._findContainingPanel(el.parentNode);},get_waitText:function(panelID){if(this._monitoredUpdatePanels){for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].WaitText;}}}
6 10
 if(this._waitText!==null){return this._waitText;}
7 11
 return null;},get_waitImage:function(panelID){if(this._monitoredUpdatePanels){for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(panelID.match(this._monitoredUpdatePanels[i].UpdatePanelID)!==null){return this._monitoredUpdatePanels[i].WaitImage;}}}
8 12
 if(this._waitImage!==null){return this._waitImage;}
9 13
 return null;},_disableAllElements:function(panelID){var panel=$get(panelID);if(panel!==null){var inputs=panel.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type=='submit'||inputs[i].type=='button'||inputs[i].type=='image'){inputs[i].disabled=true;}}
10  
-var anchors=panel.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){if(anchors[i].href.match('javascript:__doPostBack')!==null){anchors[i].href='#';if(this._waitClass!==null){Sys.UI.DomElement.addCssClass(anchors[i],this._waitClass);}}}}},_parseSendingPanel:function(SenderString){var tmp=SenderString.split('|')[0];tmp=tmp.replace(/\$/g,'_');return tmp;},_beginRequest:function(sender,args){var sendingPanel=this._parseSendingPanel(sender._postBackSettings.panelID);var element=args.get_postBackElement();if(element!==null&&this._isMonitoredRequest(sendingPanel)){if(element.type=='submit'||element.type=='button'){element.disabled=true;element.blur();this._oldText=element.value;var waitText=this.get_waitText(sendingPanel);if(waitText!==null){element.value=waitText;}}
  14
+var anchors=panel.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){if(anchors[i].href.match('javascript:__doPostBack')!==null){anchors[i].href='#';if(this._waitClass!==null){Sys.UI.DomElement.addCssClass(anchors[i],this._waitClass);}}}}},_beginRequest:function(sender,args){var element=args.get_postBackElement();var sendingPanel=this._findContainingPanel(element);if(element!==null&&this._isMonitoredRequest(sendingPanel)){if(element.type=='submit'||element.type=='button'){element.disabled=true;element.blur();this._oldText=element.value;var waitText=this.get_waitText(sendingPanel);if(waitText!==null){element.value=waitText;}}
11 15
 else if(element.type=='image'){element.disabled=true;element.blur();this._oldImage=element.src;var waitImage=this.get_waitImage(sendingPanel);if(waitImage!==null){element.src=waitImage;}}
12 16
 else if(element.tagName=='A'){this._oldHref=element.href;element.href='#';element.blur();if(this._waitClass!==null){Sys.UI.DomElement.addCssClass(element,this._waitClass);}}
13  
-if(this._isDisableAllElementsPanel(sendingPanel)){this._disableAllElements(sendingPanel);}}},_endRequest:function(sender,args){var element=sender._postBackSettings.sourceElement;var sendingPanel=this._parseSendingPanel(sender._postBackSettings.panelID);if(element!==null&&this._isMonitoredRequest(sendingPanel)){element.disabled=false;if(element.type=='submit'||element.type=='button'){element.value=this._oldText;this._oldText=null;}
  17
+if(this._isDisableAllElementsPanel(sendingPanel)){this._disableAllElements(sendingPanel);}}},_endRequest:function(sender,args){var element=sender._postBackSettings.sourceElement;var sendingPanel=this._findContainingPanel(element);if(element!==null&&this._isMonitoredRequest(sendingPanel)){element.disabled=false;if(element.type=='submit'||element.type=='button'){element.value=this._oldText;this._oldText=null;}
14 18
 else if(element.type=='image'){element.src=this._oldImage;this._oldImage=null;}
15 19
 else if(element.tagName=='A'){element.href=this._oldHref;this._oldHref=null;if(this._waitClass!==null){Sys.UI.DomElement.removeCssClass(element,this._waitClass);}}}},_initialize:function(){this._pageRequestManager=Sys.WebForms.PageRequestManager.getInstance();this._beginRequestHandler=Function.createDelegate(this,this._beginRequest);this._pageRequestManager.add_beginRequest(this._beginRequestHandler);this._endRequestHandler=Function.createDelegate(this,this._endRequest);this._pageRequestManager.add_endRequest(this._endRequestHandler);if(this._preload){var image=new Image();if(this._waitImage!==null){image.src=this._waitImage;}
16 20
 if(this._monitoredUpdatePanels!==null){for(var i=0;i<this._monitoredUpdatePanels.length;i++){if(this._monitoredUpdatePanels[i].WaitImage!==null){image.src=this._monitoredUpdatePanels[i].WaitImage;}}}}}};
6  PostBackRitalin.sln
... ...
@@ -1,11 +1,11 @@
1 1
 
2  
-Microsoft Visual Studio Solution File, Format Version 10.00
3  
-# Visual Studio 2008
  2
+Microsoft Visual Studio Solution File, Format Version 11.00
  3
+# Visual Studio 2010
4 4
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostBackRitalin", "PostBackRitalin.csproj", "{C92CD4C3-7271-4AE6-8654-7734725F247F}"
5 5
 EndProject
6 6
 Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "PostBackRitalinTest", "..\..\Visual Studio Websites\PostBackRitalinTest\", "{A5B95E5E-E0F8-41D4-900C-25A6EF3F258E}"
7 7
 	ProjectSection(WebsiteProperties) = preProject
8  
-		TargetFramework = "3.5"
  8
+		TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
9 9
 		ProjectReferences = "{C92CD4C3-7271-4AE6-8654-7734725F247F}|PostBackRitalin.dll;"
10 10
 		Debug.AspNetCompiler.VirtualPath = "/PostBackRitalinTest"
11 11
 		Debug.AspNetCompiler.PhysicalPath = "..\..\Visual Studio Websites\PostBackRitalinTest\"
6  Properties/AssemblyInfo.cs
@@ -11,7 +11,7 @@
11 11
 [assembly: AssemblyConfiguration("")]
12 12
 [assembly: AssemblyCompany("Encosia")]
13 13
 [assembly: AssemblyProduct("PostBack Ritalin")]
14  
-[assembly: AssemblyCopyright("Copyright ©  2008")]
  14
+[assembly: AssemblyCopyright("Copyright © 2010")]
15 15
 [assembly: AssemblyTrademark("")]
16 16
 [assembly: AssemblyCulture("")]
17 17
 
@@ -33,8 +33,8 @@
33 33
 // You can specify all the values or you can default the Build and Revision Numbers 
34 34
 // by using the '*' as shown below:
35 35
 // [assembly: AssemblyVersion("1.0.*")]
36  
-[assembly: AssemblyVersion("1.0.0")]
37  
-[assembly: AssemblyFileVersion("1.0.0")]
  36
+[assembly: AssemblyVersion("1.1.0")]
  37
+[assembly: AssemblyFileVersion("1.1.0")]
38 38
 
39 39
 [assembly: WebResource("PostBackRitalin.PostBackRitalin.js", "application/x-javascript")]
40 40
 [assembly: WebResource("PostBackRitalin.PostBackRitalin.min.js", "application/x-javascript")]

0 notes on commit 0196c97

Please sign in to comment.
Something went wrong with that request. Please try again.