├── .gitattributes ├── .gitignore ├── License.md ├── ProgressReporting ├── Libraries │ ├── Rxx.dll │ └── Rxx.pdb ├── ProgressReporting.sln ├── ProgressReporting │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── JobController.cs │ │ └── PageController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Hubs │ │ ├── PageViewersHub.cs │ │ ├── ProgressHub.cs │ │ └── SensorEventsConnection.cs │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── GlobalJobViewModel.cs │ │ ├── IdentityModels.cs │ │ └── SensorEvent.cs │ ├── ProgressReporting.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-2.1.0.intellisense.js │ │ ├── jquery-2.1.0.js │ │ ├── jquery-2.1.0.min.js │ │ ├── jquery-2.1.0.min.map │ │ ├── jquery.signalR-2.0.2.js │ │ ├── jquery.signalR-2.0.2.min.js │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.7.1.js │ │ ├── respond.js │ │ └── respond.min.js │ ├── Services │ │ ├── Database.cs │ │ ├── Job.cs │ │ └── JobManager.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Job │ │ │ ├── GlobalJob.cshtml │ │ │ └── Index.cshtml │ │ ├── Page │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── packages.config └── SensorEventsClient │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SensorEventsClient.csproj │ └── packages.config └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | 217 | packages/ -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /ProgressReporting/Libraries/Rxx.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/Libraries/Rxx.dll -------------------------------------------------------------------------------- /ProgressReporting/Libraries/Rxx.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/Libraries/Rxx.pdb -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30110.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgressReporting", "ProgressReporting\ProgressReporting.csproj", "{FB0E7A62-7E98-48AD-A706-B70AA6E940D8}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SensorEventsClient", "SensorEventsClient\SensorEventsClient.csproj", "{1A942189-C575-4636-B1CB-D357DC2A82E5}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {FB0E7A62-7E98-48AD-A706-B70AA6E940D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {FB0E7A62-7E98-48AD-A706-B70AA6E940D8}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {FB0E7A62-7E98-48AD-A706-B70AA6E940D8}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {FB0E7A62-7E98-48AD-A706-B70AA6E940D8}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {1A942189-C575-4636-B1CB-D357DC2A82E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1A942189-C575-4636-B1CB-D357DC2A82E5}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1A942189-C575-4636-B1CB-D357DC2A82E5}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1A942189-C575-4636-B1CB-D357DC2A82E5}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace ProgressReporting 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | bundles.Add(new ScriptBundle("~/bundles/signalR").Include( 18 | "~/Scripts/jquery.signalR-{version}.js").Include()); 19 | 20 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 21 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 22 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 23 | "~/Scripts/modernizr-*")); 24 | 25 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 26 | "~/Scripts/bootstrap.js", 27 | "~/Scripts/respond.js")); 28 | 29 | bundles.Add(new StyleBundle("~/Content/css").Include( 30 | "~/Content/bootstrap.css", 31 | "~/Content/site.css")); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace ProgressReporting 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace ProgressReporting 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Job", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/App_Start/Startup.Auth.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity; 2 | using Microsoft.Owin; 3 | using Microsoft.Owin.Security.Cookies; 4 | using Owin; 5 | 6 | namespace ProgressReporting 7 | { 8 | public partial class Startup 9 | { 10 | // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 11 | public void ConfigureAuth(IAppBuilder app) 12 | { 13 | // Enable the application to use a cookie to store information for the signed in user 14 | app.UseCookieAuthentication(new CookieAuthenticationOptions 15 | { 16 | AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 17 | LoginPath = new PathString("/Account/Login") 18 | }); 19 | // Use a cookie to temporarily store information about a user logging in with a third party login provider 20 | app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); 21 | 22 | // Uncomment the following lines to enable logging in with third party login providers 23 | //app.UseMicrosoftAccountAuthentication( 24 | // clientId: "", 25 | // clientSecret: ""); 26 | 27 | //app.UseTwitterAuthentication( 28 | // consumerKey: "", 29 | // consumerSecret: ""); 30 | 31 | //app.UseFacebookAuthentication( 32 | // appId: "", 33 | // appSecret: ""); 34 | 35 | //app.UseGoogleAuthentication(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | 19 | /* styles for validation helpers */ 20 | .field-validation-error { 21 | color: #b94a48; 22 | } 23 | 24 | .field-validation-valid { 25 | display: none; 26 | } 27 | 28 | input.input-validation-error { 29 | border: 1px solid #b94a48; 30 | } 31 | 32 | input[type="checkbox"].input-validation-error { 33 | border: 0 none; 34 | } 35 | 36 | .validation-summary-errors { 37 | color: #b94a48; 38 | } 39 | 40 | .validation-summary-valid { 41 | display: none; 42 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Content/bootstrap-theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | .btn-default, 8 | .btn-primary, 9 | .btn-success, 10 | .btn-info, 11 | .btn-warning, 12 | .btn-danger { 13 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 14 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 15 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 16 | } 17 | 18 | .btn-default:active, 19 | .btn-primary:active, 20 | .btn-success:active, 21 | .btn-info:active, 22 | .btn-warning:active, 23 | .btn-danger:active, 24 | .btn-default.active, 25 | .btn-primary.active, 26 | .btn-success.active, 27 | .btn-info.active, 28 | .btn-warning.active, 29 | .btn-danger.active { 30 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 31 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 32 | } 33 | 34 | .btn:active, 35 | .btn.active { 36 | background-image: none; 37 | } 38 | 39 | .btn-default { 40 | text-shadow: 0 1px 0 #fff; 41 | background-image: -webkit-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); 42 | background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%); 43 | background-repeat: repeat-x; 44 | border-color: #dbdbdb; 45 | border-color: #ccc; 46 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); 47 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 48 | } 49 | 50 | .btn-default:hover, 51 | .btn-default:focus { 52 | background-color: #e0e0e0; 53 | background-position: 0 -15px; 54 | } 55 | 56 | .btn-default:active, 57 | .btn-default.active { 58 | background-color: #e0e0e0; 59 | border-color: #dbdbdb; 60 | } 61 | 62 | .btn-primary { 63 | background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%); 64 | background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%); 65 | background-repeat: repeat-x; 66 | border-color: #2b669a; 67 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0); 68 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 69 | } 70 | 71 | .btn-primary:hover, 72 | .btn-primary:focus { 73 | background-color: #2d6ca2; 74 | background-position: 0 -15px; 75 | } 76 | 77 | .btn-primary:active, 78 | .btn-primary.active { 79 | background-color: #2d6ca2; 80 | border-color: #2b669a; 81 | } 82 | 83 | .btn-success { 84 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); 85 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); 86 | background-repeat: repeat-x; 87 | border-color: #3e8f3e; 88 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); 89 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 90 | } 91 | 92 | .btn-success:hover, 93 | .btn-success:focus { 94 | background-color: #419641; 95 | background-position: 0 -15px; 96 | } 97 | 98 | .btn-success:active, 99 | .btn-success.active { 100 | background-color: #419641; 101 | border-color: #3e8f3e; 102 | } 103 | 104 | .btn-warning { 105 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); 106 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); 107 | background-repeat: repeat-x; 108 | border-color: #e38d13; 109 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); 110 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 111 | } 112 | 113 | .btn-warning:hover, 114 | .btn-warning:focus { 115 | background-color: #eb9316; 116 | background-position: 0 -15px; 117 | } 118 | 119 | .btn-warning:active, 120 | .btn-warning.active { 121 | background-color: #eb9316; 122 | border-color: #e38d13; 123 | } 124 | 125 | .btn-danger { 126 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); 127 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); 128 | background-repeat: repeat-x; 129 | border-color: #b92c28; 130 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); 131 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 132 | } 133 | 134 | .btn-danger:hover, 135 | .btn-danger:focus { 136 | background-color: #c12e2a; 137 | background-position: 0 -15px; 138 | } 139 | 140 | .btn-danger:active, 141 | .btn-danger.active { 142 | background-color: #c12e2a; 143 | border-color: #b92c28; 144 | } 145 | 146 | .btn-info { 147 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); 148 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); 149 | background-repeat: repeat-x; 150 | border-color: #28a4c9; 151 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); 152 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 153 | } 154 | 155 | .btn-info:hover, 156 | .btn-info:focus { 157 | background-color: #2aabd2; 158 | background-position: 0 -15px; 159 | } 160 | 161 | .btn-info:active, 162 | .btn-info.active { 163 | background-color: #2aabd2; 164 | border-color: #28a4c9; 165 | } 166 | 167 | .thumbnail, 168 | .img-thumbnail { 169 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 170 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 171 | } 172 | 173 | .dropdown-menu > li > a:hover, 174 | .dropdown-menu > li > a:focus { 175 | background-color: #e8e8e8; 176 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 177 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 178 | background-repeat: repeat-x; 179 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 180 | } 181 | 182 | .dropdown-menu > .active > a, 183 | .dropdown-menu > .active > a:hover, 184 | .dropdown-menu > .active > a:focus { 185 | background-color: #357ebd; 186 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); 187 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 188 | background-repeat: repeat-x; 189 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 190 | } 191 | 192 | .navbar-default { 193 | background-image: -webkit-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); 194 | background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%); 195 | background-repeat: repeat-x; 196 | border-radius: 4px; 197 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); 198 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 199 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 200 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 201 | } 202 | 203 | .navbar-default .navbar-nav > .active > a { 204 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%); 205 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%); 206 | background-repeat: repeat-x; 207 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0); 208 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075); 209 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075); 210 | } 211 | 212 | .navbar-brand, 213 | .navbar-nav > li > a { 214 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); 215 | } 216 | 217 | .navbar-inverse { 218 | background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222222 100%); 219 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%); 220 | background-repeat: repeat-x; 221 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); 222 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 223 | } 224 | 225 | .navbar-inverse .navbar-nav > .active > a { 226 | background-image: -webkit-linear-gradient(top, #222222 0%, #282828 100%); 227 | background-image: linear-gradient(to bottom, #222222 0%, #282828 100%); 228 | background-repeat: repeat-x; 229 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0); 230 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 231 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 232 | } 233 | 234 | .navbar-inverse .navbar-brand, 235 | .navbar-inverse .navbar-nav > li > a { 236 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 237 | } 238 | 239 | .navbar-static-top, 240 | .navbar-fixed-top, 241 | .navbar-fixed-bottom { 242 | border-radius: 0; 243 | } 244 | 245 | .alert { 246 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); 247 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 248 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 249 | } 250 | 251 | .alert-success { 252 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); 253 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); 254 | background-repeat: repeat-x; 255 | border-color: #b2dba1; 256 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); 257 | } 258 | 259 | .alert-info { 260 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); 261 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); 262 | background-repeat: repeat-x; 263 | border-color: #9acfea; 264 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); 265 | } 266 | 267 | .alert-warning { 268 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); 269 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); 270 | background-repeat: repeat-x; 271 | border-color: #f5e79e; 272 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); 273 | } 274 | 275 | .alert-danger { 276 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); 277 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); 278 | background-repeat: repeat-x; 279 | border-color: #dca7a7; 280 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); 281 | } 282 | 283 | .progress { 284 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); 285 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); 286 | background-repeat: repeat-x; 287 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); 288 | } 289 | 290 | .progress-bar { 291 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%); 292 | background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); 293 | background-repeat: repeat-x; 294 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); 295 | } 296 | 297 | .progress-bar-success { 298 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); 299 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); 300 | background-repeat: repeat-x; 301 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); 302 | } 303 | 304 | .progress-bar-info { 305 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); 306 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); 307 | background-repeat: repeat-x; 308 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); 309 | } 310 | 311 | .progress-bar-warning { 312 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); 313 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); 314 | background-repeat: repeat-x; 315 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); 316 | } 317 | 318 | .progress-bar-danger { 319 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); 320 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); 321 | background-repeat: repeat-x; 322 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); 323 | } 324 | 325 | .list-group { 326 | border-radius: 4px; 327 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 328 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 329 | } 330 | 331 | .list-group-item.active, 332 | .list-group-item.active:hover, 333 | .list-group-item.active:focus { 334 | text-shadow: 0 -1px 0 #3071a9; 335 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%); 336 | background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); 337 | background-repeat: repeat-x; 338 | border-color: #3278b3; 339 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); 340 | } 341 | 342 | .panel { 343 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 344 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 345 | } 346 | 347 | .panel-default > .panel-heading { 348 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 349 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 350 | background-repeat: repeat-x; 351 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 352 | } 353 | 354 | .panel-primary > .panel-heading { 355 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); 356 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 357 | background-repeat: repeat-x; 358 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 359 | } 360 | 361 | .panel-success > .panel-heading { 362 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); 363 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); 364 | background-repeat: repeat-x; 365 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); 366 | } 367 | 368 | .panel-info > .panel-heading { 369 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); 370 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); 371 | background-repeat: repeat-x; 372 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); 373 | } 374 | 375 | .panel-warning > .panel-heading { 376 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); 377 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); 378 | background-repeat: repeat-x; 379 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); 380 | } 381 | 382 | .panel-danger > .panel-heading { 383 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); 384 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); 385 | background-repeat: repeat-x; 386 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); 387 | } 388 | 389 | .well { 390 | background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); 391 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); 392 | background-repeat: repeat-x; 393 | border-color: #dcdcdc; 394 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); 395 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 396 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 397 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Content/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | .btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);background-repeat:repeat-x;border-color:#2b669a;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff2d6ca2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);background-repeat:repeat-x;border-color:#3e8f3e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff419641',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);background-repeat:repeat-x;border-color:#e38d13;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffeb9316',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);background-repeat:repeat-x;border-color:#b92c28;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc12e2a',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);background-repeat:repeat-x;border-color:#28a4c9;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2aabd2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#357ebd;background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);background-repeat:repeat-x;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff8f8f8',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075)}.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff3f3f3',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.075);box-shadow:inset 0 3px 9px rgba(0,0,0,0.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,0.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:linear-gradient(to bottom,#222 0,#282828 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff282828',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.25);box-shadow:inset 0 3px 9px rgba(0,0,0,0.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);background-repeat:repeat-x;border-color:#b2dba1;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffc8e5bc',GradientType=0)}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);background-repeat:repeat-x;border-color:#9acfea;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffb9def0',GradientType=0)}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);background-repeat:repeat-x;border-color:#f5e79e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fff8efc0',GradientType=0)}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);background-repeat:repeat-x;border-color:#dca7a7;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffe7c3c3',GradientType=0)}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff5f5f5',GradientType=0)}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3071a9',GradientType=0)}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff449d44',GradientType=0)}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff31b0d5',GradientType=0)}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffec971f',GradientType=0)}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc9302c',GradientType=0)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);background-repeat:repeat-x;border-color:#3278b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3278b3',GradientType=0)}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffd0e9c6',GradientType=0)}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffc4e3f3',GradientType=0)}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fffaf2cc',GradientType=0)}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffebcccc',GradientType=0)}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);background-repeat:repeat-x;border-color:#dcdcdc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1)} -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Controllers/AccountController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Claims; 5 | using System.Threading.Tasks; 6 | using System.Web; 7 | using System.Web.Mvc; 8 | using Microsoft.AspNet.Identity; 9 | using Microsoft.AspNet.Identity.EntityFramework; 10 | using Microsoft.Owin.Security; 11 | using ProgressReporting.Models; 12 | 13 | namespace ProgressReporting.Controllers 14 | { 15 | [Authorize] 16 | public class AccountController : Controller 17 | { 18 | public AccountController() 19 | : this(new UserManager(new UserStore(new ApplicationDbContext()))) 20 | { 21 | } 22 | 23 | public AccountController(UserManager userManager) 24 | { 25 | UserManager = userManager; 26 | } 27 | 28 | public UserManager UserManager { get; private set; } 29 | 30 | // 31 | // GET: /Account/Login 32 | [AllowAnonymous] 33 | public ActionResult Login(string returnUrl) 34 | { 35 | ViewBag.ReturnUrl = returnUrl; 36 | return View(); 37 | } 38 | 39 | // 40 | // POST: /Account/Login 41 | [HttpPost] 42 | [AllowAnonymous] 43 | [ValidateAntiForgeryToken] 44 | public async Task Login(LoginViewModel model, string returnUrl) 45 | { 46 | if (ModelState.IsValid) 47 | { 48 | var user = await UserManager.FindAsync(model.UserName, model.Password); 49 | if (user != null) 50 | { 51 | await SignInAsync(user, model.RememberMe); 52 | return RedirectToLocal(returnUrl); 53 | } 54 | else 55 | { 56 | ModelState.AddModelError("", "Invalid username or password."); 57 | } 58 | } 59 | 60 | // If we got this far, something failed, redisplay form 61 | return View(model); 62 | } 63 | 64 | // 65 | // GET: /Account/Register 66 | [AllowAnonymous] 67 | public ActionResult Register() 68 | { 69 | return View(); 70 | } 71 | 72 | // 73 | // POST: /Account/Register 74 | [HttpPost] 75 | [AllowAnonymous] 76 | [ValidateAntiForgeryToken] 77 | public async Task Register(RegisterViewModel model) 78 | { 79 | if (ModelState.IsValid) 80 | { 81 | var user = new ApplicationUser() { UserName = model.UserName }; 82 | var result = await UserManager.CreateAsync(user, model.Password); 83 | if (result.Succeeded) 84 | { 85 | await SignInAsync(user, isPersistent: false); 86 | return RedirectToAction("Index", "Home"); 87 | } 88 | else 89 | { 90 | AddErrors(result); 91 | } 92 | } 93 | 94 | // If we got this far, something failed, redisplay form 95 | return View(model); 96 | } 97 | 98 | // 99 | // POST: /Account/Disassociate 100 | [HttpPost] 101 | [ValidateAntiForgeryToken] 102 | public async Task Disassociate(string loginProvider, string providerKey) 103 | { 104 | ManageMessageId? message = null; 105 | IdentityResult result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey)); 106 | if (result.Succeeded) 107 | { 108 | message = ManageMessageId.RemoveLoginSuccess; 109 | } 110 | else 111 | { 112 | message = ManageMessageId.Error; 113 | } 114 | return RedirectToAction("Manage", new { Message = message }); 115 | } 116 | 117 | // 118 | // GET: /Account/Manage 119 | public ActionResult Manage(ManageMessageId? message) 120 | { 121 | ViewBag.StatusMessage = 122 | message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed." 123 | : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set." 124 | : message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed." 125 | : message == ManageMessageId.Error ? "An error has occurred." 126 | : ""; 127 | ViewBag.HasLocalPassword = HasPassword(); 128 | ViewBag.ReturnUrl = Url.Action("Manage"); 129 | return View(); 130 | } 131 | 132 | // 133 | // POST: /Account/Manage 134 | [HttpPost] 135 | [ValidateAntiForgeryToken] 136 | public async Task Manage(ManageUserViewModel model) 137 | { 138 | bool hasPassword = HasPassword(); 139 | ViewBag.HasLocalPassword = hasPassword; 140 | ViewBag.ReturnUrl = Url.Action("Manage"); 141 | if (hasPassword) 142 | { 143 | if (ModelState.IsValid) 144 | { 145 | IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); 146 | if (result.Succeeded) 147 | { 148 | return RedirectToAction("Manage", new { Message = ManageMessageId.ChangePasswordSuccess }); 149 | } 150 | else 151 | { 152 | AddErrors(result); 153 | } 154 | } 155 | } 156 | else 157 | { 158 | // User does not have a password so remove any validation errors caused by a missing OldPassword field 159 | ModelState state = ModelState["OldPassword"]; 160 | if (state != null) 161 | { 162 | state.Errors.Clear(); 163 | } 164 | 165 | if (ModelState.IsValid) 166 | { 167 | IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword); 168 | if (result.Succeeded) 169 | { 170 | return RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess }); 171 | } 172 | else 173 | { 174 | AddErrors(result); 175 | } 176 | } 177 | } 178 | 179 | // If we got this far, something failed, redisplay form 180 | return View(model); 181 | } 182 | 183 | // 184 | // POST: /Account/ExternalLogin 185 | [HttpPost] 186 | [AllowAnonymous] 187 | [ValidateAntiForgeryToken] 188 | public ActionResult ExternalLogin(string provider, string returnUrl) 189 | { 190 | // Request a redirect to the external login provider 191 | return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl })); 192 | } 193 | 194 | // 195 | // GET: /Account/ExternalLoginCallback 196 | [AllowAnonymous] 197 | public async Task ExternalLoginCallback(string returnUrl) 198 | { 199 | var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); 200 | if (loginInfo == null) 201 | { 202 | return RedirectToAction("Login"); 203 | } 204 | 205 | // Sign in the user with this external login provider if the user already has a login 206 | var user = await UserManager.FindAsync(loginInfo.Login); 207 | if (user != null) 208 | { 209 | await SignInAsync(user, isPersistent: false); 210 | return RedirectToLocal(returnUrl); 211 | } 212 | else 213 | { 214 | // If the user does not have an account, then prompt the user to create an account 215 | ViewBag.ReturnUrl = returnUrl; 216 | ViewBag.LoginProvider = loginInfo.Login.LoginProvider; 217 | return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { UserName = loginInfo.DefaultUserName }); 218 | } 219 | } 220 | 221 | // 222 | // POST: /Account/LinkLogin 223 | [HttpPost] 224 | [ValidateAntiForgeryToken] 225 | public ActionResult LinkLogin(string provider) 226 | { 227 | // Request a redirect to the external login provider to link a login for the current user 228 | return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId()); 229 | } 230 | 231 | // 232 | // GET: /Account/LinkLoginCallback 233 | public async Task LinkLoginCallback() 234 | { 235 | var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId()); 236 | if (loginInfo == null) 237 | { 238 | return RedirectToAction("Manage", new { Message = ManageMessageId.Error }); 239 | } 240 | var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login); 241 | if (result.Succeeded) 242 | { 243 | return RedirectToAction("Manage"); 244 | } 245 | return RedirectToAction("Manage", new { Message = ManageMessageId.Error }); 246 | } 247 | 248 | // 249 | // POST: /Account/ExternalLoginConfirmation 250 | [HttpPost] 251 | [AllowAnonymous] 252 | [ValidateAntiForgeryToken] 253 | public async Task ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) 254 | { 255 | if (User.Identity.IsAuthenticated) 256 | { 257 | return RedirectToAction("Manage"); 258 | } 259 | 260 | if (ModelState.IsValid) 261 | { 262 | // Get the information about the user from the external login provider 263 | var info = await AuthenticationManager.GetExternalLoginInfoAsync(); 264 | if (info == null) 265 | { 266 | return View("ExternalLoginFailure"); 267 | } 268 | var user = new ApplicationUser() { UserName = model.UserName }; 269 | var result = await UserManager.CreateAsync(user); 270 | if (result.Succeeded) 271 | { 272 | result = await UserManager.AddLoginAsync(user.Id, info.Login); 273 | if (result.Succeeded) 274 | { 275 | await SignInAsync(user, isPersistent: false); 276 | return RedirectToLocal(returnUrl); 277 | } 278 | } 279 | AddErrors(result); 280 | } 281 | 282 | ViewBag.ReturnUrl = returnUrl; 283 | return View(model); 284 | } 285 | 286 | // 287 | // POST: /Account/LogOff 288 | [HttpPost] 289 | [ValidateAntiForgeryToken] 290 | public ActionResult LogOff() 291 | { 292 | AuthenticationManager.SignOut(); 293 | return RedirectToAction("Index", "Home"); 294 | } 295 | 296 | // 297 | // GET: /Account/ExternalLoginFailure 298 | [AllowAnonymous] 299 | public ActionResult ExternalLoginFailure() 300 | { 301 | return View(); 302 | } 303 | 304 | [ChildActionOnly] 305 | public ActionResult RemoveAccountList() 306 | { 307 | var linkedAccounts = UserManager.GetLogins(User.Identity.GetUserId()); 308 | ViewBag.ShowRemoveButton = HasPassword() || linkedAccounts.Count > 1; 309 | return (ActionResult)PartialView("_RemoveAccountPartial", linkedAccounts); 310 | } 311 | 312 | protected override void Dispose(bool disposing) 313 | { 314 | if (disposing && UserManager != null) 315 | { 316 | UserManager.Dispose(); 317 | UserManager = null; 318 | } 319 | base.Dispose(disposing); 320 | } 321 | 322 | #region Helpers 323 | // Used for XSRF protection when adding external logins 324 | private const string XsrfKey = "XsrfId"; 325 | 326 | private IAuthenticationManager AuthenticationManager 327 | { 328 | get 329 | { 330 | return HttpContext.GetOwinContext().Authentication; 331 | } 332 | } 333 | 334 | private async Task SignInAsync(ApplicationUser user, bool isPersistent) 335 | { 336 | AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); 337 | var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); 338 | AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity); 339 | } 340 | 341 | private void AddErrors(IdentityResult result) 342 | { 343 | foreach (var error in result.Errors) 344 | { 345 | ModelState.AddModelError("", error); 346 | } 347 | } 348 | 349 | private bool HasPassword() 350 | { 351 | var user = UserManager.FindById(User.Identity.GetUserId()); 352 | if (user != null) 353 | { 354 | return user.PasswordHash != null; 355 | } 356 | return false; 357 | } 358 | 359 | public enum ManageMessageId 360 | { 361 | ChangePasswordSuccess, 362 | SetPasswordSuccess, 363 | RemoveLoginSuccess, 364 | Error 365 | } 366 | 367 | private ActionResult RedirectToLocal(string returnUrl) 368 | { 369 | if (Url.IsLocalUrl(returnUrl)) 370 | { 371 | return Redirect(returnUrl); 372 | } 373 | else 374 | { 375 | return RedirectToAction("Index", "Home"); 376 | } 377 | } 378 | 379 | private class ChallengeResult : HttpUnauthorizedResult 380 | { 381 | public ChallengeResult(string provider, string redirectUri) : this(provider, redirectUri, null) 382 | { 383 | } 384 | 385 | public ChallengeResult(string provider, string redirectUri, string userId) 386 | { 387 | LoginProvider = provider; 388 | RedirectUri = redirectUri; 389 | UserId = userId; 390 | } 391 | 392 | public string LoginProvider { get; set; } 393 | public string RedirectUri { get; set; } 394 | public string UserId { get; set; } 395 | 396 | public override void ExecuteResult(ControllerContext context) 397 | { 398 | var properties = new AuthenticationProperties() { RedirectUri = RedirectUri }; 399 | if (UserId != null) 400 | { 401 | properties.Dictionary[XsrfKey] = UserId; 402 | } 403 | context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider); 404 | } 405 | } 406 | #endregion 407 | } 408 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Controllers/JobController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using ProgressReporting.Models; 8 | using ProgressReporting.Services; 9 | 10 | namespace ProgressReporting.Controllers 11 | { 12 | public class JobController : Controller 13 | { 14 | public ActionResult Index() 15 | { 16 | return View(); 17 | } 18 | 19 | public ActionResult GlobalJob() 20 | { 21 | var viewModel = new GlobalJobViewModel(); 22 | 23 | var globalJob = GetExistingGlobalJob(); 24 | if (globalJob != null && globalJob.IsComplete) 25 | { 26 | Database.Instance.StoreGlobalJobId(""); 27 | } 28 | else 29 | { 30 | viewModel.Job = globalJob; 31 | } 32 | 33 | return View(viewModel); 34 | } 35 | 36 | private Job GetExistingGlobalJob() 37 | { 38 | var viewModel = new GlobalJobViewModel(); 39 | 40 | var jobId = Database.Instance.GetGlobalJobId(); 41 | if (!string.IsNullOrEmpty(jobId)) 42 | { 43 | return JobManager.Instance.GetJob(jobId); 44 | } 45 | else 46 | { 47 | return null; 48 | } 49 | } 50 | 51 | [HttpPost] 52 | public ActionResult DoGlobalJob() 53 | { 54 | var job = GetExistingGlobalJob(); 55 | 56 | if (job == null || job.IsComplete) 57 | { 58 | // if we were doing this for real, we'd want to do more to protect against a race condition 59 | // where to global jobs could be kicked off 60 | job = JobManager.Instance.DoJobAsync(j => 61 | { 62 | for (var progress = 0; progress <= 100; progress++) 63 | { 64 | if (j.CancellationToken.IsCancellationRequested) 65 | { 66 | return; 67 | } 68 | 69 | Thread.Sleep(200); 70 | j.ReportProgress(progress); 71 | } 72 | }); 73 | 74 | Database.Instance.StoreGlobalJobId(job.Id); 75 | } 76 | 77 | return Json(new 78 | { 79 | JobId = job.Id, 80 | Progress = job.Progress 81 | }); 82 | } 83 | 84 | public ActionResult Job() 85 | { 86 | return View(); 87 | } 88 | 89 | [HttpPost] 90 | public ActionResult DoJob() 91 | { 92 | var job = JobManager.Instance.DoJobAsync(j => 93 | { 94 | for (var progress = 0; progress <= 100; progress++) 95 | { 96 | if (j.CancellationToken.IsCancellationRequested) 97 | { 98 | return; 99 | } 100 | 101 | Thread.Sleep(200); 102 | j.ReportProgress(progress); 103 | } 104 | }); 105 | 106 | return Json(new 107 | { 108 | JobId = job.Id, 109 | Progress = job.Progress 110 | }); 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Controllers/PageController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace ProgressReporting.Controllers 8 | { 9 | public class PageController : Controller 10 | { 11 | // 12 | // GET: /Page/ 13 | public ActionResult Index() 14 | { 15 | return View(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ProgressReporting.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace ProgressReporting 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Hubs/PageViewersHub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using System.Web; 7 | using Microsoft.AspNet.SignalR; 8 | 9 | namespace ProgressReporting.Hubs 10 | { 11 | public class PageViewersHub : Hub 12 | { 13 | public static int _viewerCount; 14 | 15 | public void ViewerCountChanged(int viewerCount) 16 | { 17 | Clients.All.viewerCountChanged(viewerCount); 18 | } 19 | 20 | public override Task OnConnected() 21 | { 22 | Interlocked.Increment(ref _viewerCount); 23 | ViewerCountChanged(_viewerCount); 24 | 25 | return base.OnConnected(); 26 | } 27 | 28 | public override Task OnDisconnected() 29 | { 30 | Interlocked.Decrement(ref _viewerCount); 31 | ViewerCountChanged(_viewerCount); 32 | 33 | return base.OnDisconnected(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Hubs/ProgressHub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using Microsoft.AspNet.SignalR; 6 | using Microsoft.AspNet.SignalR.Hubs; 7 | using ProgressReporting.Services; 8 | 9 | namespace ProgressReporting.Hubs 10 | { 11 | public class ProgressHub : Hub 12 | { 13 | public void TrackJob(string jobId) 14 | { 15 | Groups.Add(Context.ConnectionId, jobId); 16 | } 17 | 18 | public void CancelJob(string jobId) 19 | { 20 | var job = JobManager.Instance.GetJob(jobId); 21 | if (job != null) 22 | { 23 | job.Cancel(); 24 | } 25 | } 26 | 27 | public void ProgressChanged(string jobId, int progress) 28 | { 29 | Clients.Group(jobId).progressChanged(jobId, progress); 30 | } 31 | 32 | public void JobCompleted(string jobId) 33 | { 34 | Clients.Group(jobId).jobCompleted(jobId); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Hubs/SensorEventsConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reactive.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNet.SignalR; 6 | using ProgressReporting.Models; 7 | 8 | namespace ProgressReporting.Hubs 9 | { 10 | public class SensorEventsConnection : PersistentConnection 11 | { 12 | private static int _connectionCount; 13 | private static IPersistentConnectionContext _context; 14 | private static IDisposable _subscription; 15 | 16 | protected override Task OnConnected(IRequest request, string connectionId) 17 | { 18 | var currentValue = Interlocked.Increment(ref _connectionCount); 19 | if (currentValue == 1) 20 | { 21 | StartSendingEvents(); 22 | } 23 | 24 | return base.OnConnected(request, connectionId); 25 | } 26 | 27 | protected override Task OnDisconnected(IRequest request, string connectionId) 28 | { 29 | var currentValue = Interlocked.Decrement(ref _connectionCount); 30 | if (currentValue == 0) 31 | { 32 | StopSendingEvents(); 33 | } 34 | 35 | return base.OnDisconnected(request, connectionId); 36 | } 37 | 38 | private static void StartSendingEvents() 39 | { 40 | var random = new Random(); 41 | if (_context == null) 42 | { 43 | _context = GlobalHost.ConnectionManager.GetConnectionContext(); 44 | } 45 | 46 | _subscription = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(50)) 47 | .Select(_ => new SensorEvent() { Reading = random.NextDouble(), SensorId = random.Next(1,4)}) 48 | .Subscribe(sensorEvent => _context.Connection.Broadcast(sensorEvent)); 49 | } 50 | 51 | private static void StopSendingEvents() 52 | { 53 | _subscription.Dispose(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Models/AccountViewModels.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace ProgressReporting.Models 4 | { 5 | public class ExternalLoginConfirmationViewModel 6 | { 7 | [Required] 8 | [Display(Name = "User name")] 9 | public string UserName { get; set; } 10 | } 11 | 12 | public class ManageUserViewModel 13 | { 14 | [Required] 15 | [DataType(DataType.Password)] 16 | [Display(Name = "Current password")] 17 | public string OldPassword { get; set; } 18 | 19 | [Required] 20 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 21 | [DataType(DataType.Password)] 22 | [Display(Name = "New password")] 23 | public string NewPassword { get; set; } 24 | 25 | [DataType(DataType.Password)] 26 | [Display(Name = "Confirm new password")] 27 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 28 | public string ConfirmPassword { get; set; } 29 | } 30 | 31 | public class LoginViewModel 32 | { 33 | [Required] 34 | [Display(Name = "User name")] 35 | public string UserName { get; set; } 36 | 37 | [Required] 38 | [DataType(DataType.Password)] 39 | [Display(Name = "Password")] 40 | public string Password { get; set; } 41 | 42 | [Display(Name = "Remember me?")] 43 | public bool RememberMe { get; set; } 44 | } 45 | 46 | public class RegisterViewModel 47 | { 48 | [Required] 49 | [Display(Name = "User name")] 50 | public string UserName { get; set; } 51 | 52 | [Required] 53 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] 54 | [DataType(DataType.Password)] 55 | [Display(Name = "Password")] 56 | public string Password { get; set; } 57 | 58 | [DataType(DataType.Password)] 59 | [Display(Name = "Confirm password")] 60 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 61 | public string ConfirmPassword { get; set; } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Models/GlobalJobViewModel.cs: -------------------------------------------------------------------------------- 1 | using ProgressReporting.Services; 2 | 3 | namespace ProgressReporting.Models 4 | { 5 | public class GlobalJobViewModel 6 | { 7 | public Job Job { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.Identity.EntityFramework; 2 | 3 | namespace ProgressReporting.Models 4 | { 5 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 6 | public class ApplicationUser : IdentityUser 7 | { 8 | } 9 | 10 | public class ApplicationDbContext : IdentityDbContext 11 | { 12 | public ApplicationDbContext() 13 | : base("DefaultConnection") 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Models/SensorEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ProgressReporting.Models 7 | { 8 | public class SensorEvent 9 | { 10 | public int SensorId { get; set; } 11 | 12 | public double Reading { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/ProgressReporting.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {FB0E7A62-7E98-48AD-A706-B70AA6E940D8} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | ProgressReporting 15 | ProgressReporting 16 | v4.5 17 | false 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | true 26 | full 27 | false 28 | bin\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | pdbonly 35 | true 36 | bin\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | 43 | False 44 | ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll 45 | 46 | 47 | False 48 | ..\packages\EntityFramework.6.0.2\lib\net45\EntityFramework.dll 49 | 50 | 51 | False 52 | ..\packages\EntityFramework.6.0.2\lib\net45\EntityFramework.SqlServer.dll 53 | 54 | 55 | False 56 | ..\packages\Microsoft.AspNet.SignalR.Core.2.0.2\lib\net45\Microsoft.AspNet.SignalR.Core.dll 57 | 58 | 59 | False 60 | ..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.0.2\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll 61 | 62 | 63 | 64 | False 65 | ..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll 66 | 67 | 68 | False 69 | ..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll 70 | 71 | 72 | False 73 | ..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll 74 | 75 | 76 | False 77 | ..\packages\Microsoft.Owin.Security.Cookies.2.1.0\lib\net45\Microsoft.Owin.Security.Cookies.dll 78 | 79 | 80 | False 81 | ..\packages\Microsoft.Owin.Security.Facebook.2.1.0\lib\net45\Microsoft.Owin.Security.Facebook.dll 82 | 83 | 84 | False 85 | ..\packages\Microsoft.Owin.Security.Google.2.1.0\lib\net45\Microsoft.Owin.Security.Google.dll 86 | 87 | 88 | False 89 | ..\packages\Microsoft.Owin.Security.MicrosoftAccount.2.1.0\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll 90 | 91 | 92 | False 93 | ..\packages\Microsoft.Owin.Security.OAuth.2.1.0\lib\net45\Microsoft.Owin.Security.OAuth.dll 94 | 95 | 96 | False 97 | ..\packages\Microsoft.Owin.Security.Twitter.2.1.0\lib\net45\Microsoft.Owin.Security.Twitter.dll 98 | 99 | 100 | ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll 101 | 102 | 103 | 104 | 105 | 106 | ..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll 107 | 108 | 109 | ..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll 110 | 111 | 112 | ..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll 113 | 114 | 115 | ..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | False 125 | ..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.Helpers.dll 126 | 127 | 128 | False 129 | ..\packages\Microsoft.AspNet.Mvc.5.1.0\lib\net45\System.Web.Mvc.dll 130 | 131 | 132 | False 133 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.2\lib\net40\System.Web.Optimization.dll 134 | 135 | 136 | False 137 | ..\packages\Microsoft.AspNet.Razor.3.1.0\lib\net45\System.Web.Razor.dll 138 | 139 | 140 | False 141 | ..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.dll 142 | 143 | 144 | False 145 | ..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Deployment.dll 146 | 147 | 148 | False 149 | ..\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Razor.dll 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | True 162 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 163 | 164 | 165 | 166 | 167 | 168 | 169 | False 170 | ..\packages\WebGrease.1.6.0\lib\WebGrease.dll 171 | 172 | 173 | 174 | 175 | ..\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll 176 | 177 | 178 | ..\packages\Microsoft.AspNet.Identity.Owin.1.0.0\lib\net45\Microsoft.AspNet.Identity.Owin.dll 179 | 180 | 181 | ..\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll 182 | 183 | 184 | ..\packages\Owin.1.0\lib\net40\Owin.dll 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | Global.asax 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | Web.config 243 | 244 | 245 | Web.config 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | Designer 271 | 272 | 273 | 274 | 10.0 275 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | True 288 | True 289 | 3669 290 | / 291 | http://localhost:3669/ 292 | False 293 | False 294 | 295 | 296 | False 297 | 298 | 299 | 300 | 301 | 307 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ProgressReporting")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ProgressReporting")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4cc424aa-3887-47ed-921a-e6345ecc1b7f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/jquery.validate.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation 16 | * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"Warning: No message defined for "+e.name+"")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery); -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/jquery.validate.unobtrusive.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | 20 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 21 | /*global document: false, jQuery: false */ 22 | 23 | (function ($) { 24 | var $jQval = $.validator, 25 | adapters, 26 | data_validation = "unobtrusiveValidation"; 27 | 28 | function setValidationValues(options, ruleName, value) { 29 | options.rules[ruleName] = value; 30 | if (options.message) { 31 | options.messages[ruleName] = options.message; 32 | } 33 | } 34 | 35 | function splitAndTrim(value) { 36 | return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); 37 | } 38 | 39 | function escapeAttributeValue(value) { 40 | // As mentioned on http://api.jquery.com/category/selectors/ 41 | return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); 42 | } 43 | 44 | function getModelPrefix(fieldName) { 45 | return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); 46 | } 47 | 48 | function appendModelPrefix(value, prefix) { 49 | if (value.indexOf("*.") === 0) { 50 | value = value.replace("*.", prefix); 51 | } 52 | return value; 53 | } 54 | 55 | function onError(error, inputElement) { // 'this' is the form element 56 | var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), 57 | replaceAttrValue = container.attr("data-valmsg-replace"), 58 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null; 59 | 60 | container.removeClass("field-validation-valid").addClass("field-validation-error"); 61 | error.data("unobtrusiveContainer", container); 62 | 63 | if (replace) { 64 | container.empty(); 65 | error.removeClass("input-validation-error").appendTo(container); 66 | } 67 | else { 68 | error.hide(); 69 | } 70 | } 71 | 72 | function onErrors(event, validator) { // 'this' is the form element 73 | var container = $(this).find("[data-valmsg-summary=true]"), 74 | list = container.find("ul"); 75 | 76 | if (list && list.length && validator.errorList.length) { 77 | list.empty(); 78 | container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); 79 | 80 | $.each(validator.errorList, function () { 81 | $("
  • ").html(this.message).appendTo(list); 82 | }); 83 | } 84 | } 85 | 86 | function onSuccess(error) { // 'this' is the form element 87 | var container = error.data("unobtrusiveContainer"), 88 | replaceAttrValue = container.attr("data-valmsg-replace"), 89 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null; 90 | 91 | if (container) { 92 | container.addClass("field-validation-valid").removeClass("field-validation-error"); 93 | error.removeData("unobtrusiveContainer"); 94 | 95 | if (replace) { 96 | container.empty(); 97 | } 98 | } 99 | } 100 | 101 | function onReset(event) { // 'this' is the form element 102 | var $form = $(this); 103 | $form.data("validator").resetForm(); 104 | $form.find(".validation-summary-errors") 105 | .addClass("validation-summary-valid") 106 | .removeClass("validation-summary-errors"); 107 | $form.find(".field-validation-error") 108 | .addClass("field-validation-valid") 109 | .removeClass("field-validation-error") 110 | .removeData("unobtrusiveContainer") 111 | .find(">*") // If we were using valmsg-replace, get the underlying error 112 | .removeData("unobtrusiveContainer"); 113 | } 114 | 115 | function validationInfo(form) { 116 | var $form = $(form), 117 | result = $form.data(data_validation), 118 | onResetProxy = $.proxy(onReset, form); 119 | 120 | if (!result) { 121 | result = { 122 | options: { // options structure passed to jQuery Validate's validate() method 123 | errorClass: "input-validation-error", 124 | errorElement: "span", 125 | errorPlacement: $.proxy(onError, form), 126 | invalidHandler: $.proxy(onErrors, form), 127 | messages: {}, 128 | rules: {}, 129 | success: $.proxy(onSuccess, form) 130 | }, 131 | attachValidation: function () { 132 | $form 133 | .unbind("reset." + data_validation, onResetProxy) 134 | .bind("reset." + data_validation, onResetProxy) 135 | .validate(this.options); 136 | }, 137 | validate: function () { // a validation function that is called by unobtrusive Ajax 138 | $form.validate(); 139 | return $form.valid(); 140 | } 141 | }; 142 | $form.data(data_validation, result); 143 | } 144 | 145 | return result; 146 | } 147 | 148 | $jQval.unobtrusive = { 149 | adapters: [], 150 | 151 | parseElement: function (element, skipAttach) { 152 | /// 153 | /// Parses a single HTML element for unobtrusive validation attributes. 154 | /// 155 | /// The HTML element to be parsed. 156 | /// [Optional] true to skip attaching the 157 | /// validation to the form. If parsing just this single element, you should specify true. 158 | /// If parsing several elements, you should specify false, and manually attach the validation 159 | /// to the form when you are finished. The default is false. 160 | var $element = $(element), 161 | form = $element.parents("form")[0], 162 | valInfo, rules, messages; 163 | 164 | if (!form) { // Cannot do client-side validation without a form 165 | return; 166 | } 167 | 168 | valInfo = validationInfo(form); 169 | valInfo.options.rules[element.name] = rules = {}; 170 | valInfo.options.messages[element.name] = messages = {}; 171 | 172 | $.each(this.adapters, function () { 173 | var prefix = "data-val-" + this.name, 174 | message = $element.attr(prefix), 175 | paramValues = {}; 176 | 177 | if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy) 178 | prefix += "-"; 179 | 180 | $.each(this.params, function () { 181 | paramValues[this] = $element.attr(prefix + this); 182 | }); 183 | 184 | this.adapt({ 185 | element: element, 186 | form: form, 187 | message: message, 188 | params: paramValues, 189 | rules: rules, 190 | messages: messages 191 | }); 192 | } 193 | }); 194 | 195 | $.extend(rules, { "__dummy__": true }); 196 | 197 | if (!skipAttach) { 198 | valInfo.attachValidation(); 199 | } 200 | }, 201 | 202 | parse: function (selector) { 203 | /// 204 | /// Parses all the HTML elements in the specified selector. It looks for input elements decorated 205 | /// with the [data-val=true] attribute value and enables validation according to the data-val-* 206 | /// attribute values. 207 | /// 208 | /// Any valid jQuery selector. 209 | var $forms = $(selector) 210 | .parents("form") 211 | .andSelf() 212 | .add($(selector).find("form")) 213 | .filter("form"); 214 | 215 | // :input is a psuedoselector provided by jQuery which selects input and input-like elements 216 | // combining :input with other selectors significantly decreases performance. 217 | $(selector).find(":input").filter("[data-val=true]").each(function () { 218 | $jQval.unobtrusive.parseElement(this, true); 219 | }); 220 | 221 | $forms.each(function () { 222 | var info = validationInfo(this); 223 | if (info) { 224 | info.attachValidation(); 225 | } 226 | }); 227 | } 228 | }; 229 | 230 | adapters = $jQval.unobtrusive.adapters; 231 | 232 | adapters.add = function (adapterName, params, fn) { 233 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation. 234 | /// The name of the adapter to be added. This matches the name used 235 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 236 | /// [Optional] An array of parameter names (strings) that will 237 | /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and 238 | /// mmmm is the parameter name). 239 | /// The function to call, which adapts the values from the HTML 240 | /// attributes into jQuery Validate rules and/or messages. 241 | /// 242 | if (!fn) { // Called with no params, just a function 243 | fn = params; 244 | params = []; 245 | } 246 | this.push({ name: adapterName, params: params, adapt: fn }); 247 | return this; 248 | }; 249 | 250 | adapters.addBool = function (adapterName, ruleName) { 251 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 252 | /// the jQuery Validate validation rule has no parameter values. 253 | /// The name of the adapter to be added. This matches the name used 254 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 255 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 256 | /// of adapterName will be used instead. 257 | /// 258 | return this.add(adapterName, function (options) { 259 | setValidationValues(options, ruleName || adapterName, true); 260 | }); 261 | }; 262 | 263 | adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { 264 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 265 | /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and 266 | /// one for min-and-max). The HTML parameters are expected to be named -min and -max. 267 | /// The name of the adapter to be added. This matches the name used 268 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). 269 | /// The name of the jQuery Validate rule to be used when you only 270 | /// have a minimum value. 271 | /// The name of the jQuery Validate rule to be used when you only 272 | /// have a maximum value. 273 | /// The name of the jQuery Validate rule to be used when you 274 | /// have both a minimum and maximum value. 275 | /// [Optional] The name of the HTML attribute that 276 | /// contains the minimum value. The default is "min". 277 | /// [Optional] The name of the HTML attribute that 278 | /// contains the maximum value. The default is "max". 279 | /// 280 | return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { 281 | var min = options.params.min, 282 | max = options.params.max; 283 | 284 | if (min && max) { 285 | setValidationValues(options, minMaxRuleName, [min, max]); 286 | } 287 | else if (min) { 288 | setValidationValues(options, minRuleName, min); 289 | } 290 | else if (max) { 291 | setValidationValues(options, maxRuleName, max); 292 | } 293 | }); 294 | }; 295 | 296 | adapters.addSingleVal = function (adapterName, attribute, ruleName) { 297 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 298 | /// the jQuery Validate validation rule has a single value. 299 | /// The name of the adapter to be added. This matches the name used 300 | /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name). 301 | /// [Optional] The name of the HTML attribute that contains the value. 302 | /// The default is "val". 303 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value 304 | /// of adapterName will be used instead. 305 | /// 306 | return this.add(adapterName, [attribute || "val"], function (options) { 307 | setValidationValues(options, ruleName || adapterName, options.params[attribute]); 308 | }); 309 | }; 310 | 311 | $jQval.addMethod("__dummy__", function (value, element, params) { 312 | return true; 313 | }); 314 | 315 | $jQval.addMethod("regex", function (value, element, params) { 316 | var match; 317 | if (this.optional(element)) { 318 | return true; 319 | } 320 | 321 | match = new RegExp(params).exec(value); 322 | return (match && (match.index === 0) && (match[0].length === value.length)); 323 | }); 324 | 325 | $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { 326 | var match; 327 | if (nonalphamin) { 328 | match = value.match(/\W/g); 329 | match = match && match.length >= nonalphamin; 330 | } 331 | return match; 332 | }); 333 | 334 | if ($jQval.methods.extension) { 335 | adapters.addSingleVal("accept", "mimtype"); 336 | adapters.addSingleVal("extension", "extension"); 337 | } else { 338 | // for backward compatibility, when the 'extension' validation method does not exist, such as with versions 339 | // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for 340 | // validating the extension, and ignore mime-type validations as they are not supported. 341 | adapters.addSingleVal("extension", "extension", "accept"); 342 | } 343 | 344 | adapters.addSingleVal("regex", "pattern"); 345 | adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); 346 | adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); 347 | adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength"); 348 | adapters.add("equalto", ["other"], function (options) { 349 | var prefix = getModelPrefix(options.element.name), 350 | other = options.params.other, 351 | fullOtherName = appendModelPrefix(other, prefix), 352 | element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; 353 | 354 | setValidationValues(options, "equalTo", element); 355 | }); 356 | adapters.add("required", function (options) { 357 | // jQuery Validate equates "required" with "mandatory" for checkbox elements 358 | if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { 359 | setValidationValues(options, "required", true); 360 | } 361 | }); 362 | adapters.add("remote", ["url", "type", "additionalfields"], function (options) { 363 | var value = { 364 | url: options.params.url, 365 | type: options.params.type || "GET", 366 | data: {} 367 | }, 368 | prefix = getModelPrefix(options.element.name); 369 | 370 | $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { 371 | var paramName = appendModelPrefix(fieldName, prefix); 372 | value.data[paramName] = function () { 373 | return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val(); 374 | }; 375 | }); 376 | 377 | setValidationValues(options, "remote", value); 378 | }); 379 | adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { 380 | if (options.params.min) { 381 | setValidationValues(options, "minlength", options.params.min); 382 | } 383 | if (options.params.nonalphamin) { 384 | setValidationValues(options, "nonalphamin", options.params.nonalphamin); 385 | } 386 | if (options.params.regex) { 387 | setValidationValues(options, "regex", options.params.regex); 388 | } 389 | }); 390 | 391 | $(function () { 392 | $jQval.unobtrusive.parse(document); 393 | }); 394 | }(jQuery)); -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this);b.data("validator").resetForm();b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(c){var b=a(c),d=b.data(e),f=a.proxy(n,c);if(!d){d={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(m,c),invalidHandler:a.proxy(l,c),messages:{},rules:{},success:a.proxy(k,c)},attachValidation:function(){b.unbind("reset."+e,f).bind("reset."+e,f).validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(e,d)}return d}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(b){var c=a(b).parents("form").andSelf().add(a(b).find("form")).filter("form");a(b).find(":input").filter("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});c.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){return a(b.form).find(":input").filter("[name='"+f(c)+"']").val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/respond.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | 4 | window.matchMedia = window.matchMedia || (function( doc, undefined ) { 5 | 6 | "use strict"; 7 | 8 | var bool, 9 | docElem = doc.documentElement, 10 | refNode = docElem.firstElementChild || docElem.firstChild, 11 | // fakeBody required for 12 | fakeBody = doc.createElement( "body" ), 13 | div = doc.createElement( "div" ); 14 | 15 | div.id = "mq-test-1"; 16 | div.style.cssText = "position:absolute;top:-100em"; 17 | fakeBody.style.background = "none"; 18 | fakeBody.appendChild(div); 19 | 20 | return function(q){ 21 | 22 | div.innerHTML = "­"; 23 | 24 | docElem.insertBefore( fakeBody, refNode ); 25 | bool = div.offsetWidth === 42; 26 | docElem.removeChild( fakeBody ); 27 | 28 | return { 29 | matches: bool, 30 | media: q 31 | }; 32 | 33 | }; 34 | 35 | }( document )); 36 | 37 | 38 | 39 | 40 | 41 | /*! Respond.js v1.3.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 42 | (function( win ){ 43 | 44 | "use strict"; 45 | 46 | //exposed namespace 47 | var respond = {}; 48 | win.respond = respond; 49 | 50 | //define update even in native-mq-supporting browsers, to avoid errors 51 | respond.update = function(){}; 52 | 53 | //expose media query support flag for external use 54 | respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; 55 | 56 | //if media queries are supported, exit here 57 | if( respond.mediaQueriesSupported ){ 58 | return; 59 | } 60 | 61 | //define vars 62 | var doc = win.document, 63 | docElem = doc.documentElement, 64 | mediastyles = [], 65 | rules = [], 66 | appendedEls = [], 67 | parsedSheets = {}, 68 | resizeThrottle = 30, 69 | head = doc.getElementsByTagName( "head" )[0] || docElem, 70 | base = doc.getElementsByTagName( "base" )[0], 71 | links = head.getElementsByTagName( "link" ), 72 | requestQueue = [], 73 | 74 | //loop stylesheets, send text content to translate 75 | ripCSS = function(){ 76 | 77 | for( var i = 0; i < links.length; i++ ){ 78 | var sheet = links[ i ], 79 | href = sheet.href, 80 | media = sheet.media, 81 | isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 82 | 83 | //only links plz and prevent re-parsing 84 | if( !!href && isCSS && !parsedSheets[ href ] ){ 85 | // selectivizr exposes css through the rawCssText expando 86 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 87 | translate( sheet.styleSheet.rawCssText, href, media ); 88 | parsedSheets[ href ] = true; 89 | } else { 90 | if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) || 91 | href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ 92 | requestQueue.push( { 93 | href: href, 94 | media: media 95 | } ); 96 | } 97 | } 98 | } 99 | } 100 | makeRequests(); 101 | }, 102 | 103 | //recurse through request queue, get css text 104 | makeRequests = function(){ 105 | if( requestQueue.length ){ 106 | var thisRequest = requestQueue.shift(); 107 | 108 | ajax( thisRequest.href, function( styles ){ 109 | translate( styles, thisRequest.href, thisRequest.media ); 110 | parsedSheets[ thisRequest.href ] = true; 111 | 112 | // by wrapping recursive function call in setTimeout 113 | // we prevent "Stack overflow" error in IE7 114 | win.setTimeout(function(){ makeRequests(); },0); 115 | } ); 116 | } 117 | }, 118 | 119 | //find media blocks in css text, convert to style blocks 120 | translate = function( styles, href, media ){ 121 | var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), 122 | ql = qs && qs.length || 0; 123 | 124 | //try to get CSS path 125 | href = href.substring( 0, href.lastIndexOf( "/" ) ); 126 | 127 | var repUrls = function( css ){ 128 | return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); 129 | }, 130 | useMedia = !ql && media; 131 | 132 | //if path exists, tack on trailing slash 133 | if( href.length ){ href += "/"; } 134 | 135 | //if no internal queries exist, but media attr does, use that 136 | //note: this currently lacks support for situations where a media attr is specified on a link AND 137 | //its associated stylesheet has internal CSS media queries. 138 | //In those cases, the media attribute will currently be ignored. 139 | if( useMedia ){ 140 | ql = 1; 141 | } 142 | 143 | for( var i = 0; i < ql; i++ ){ 144 | var fullq, thisq, eachq, eql; 145 | 146 | //media attr 147 | if( useMedia ){ 148 | fullq = media; 149 | rules.push( repUrls( styles ) ); 150 | } 151 | //parse for styles 152 | else{ 153 | fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; 154 | rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); 155 | } 156 | 157 | eachq = fullq.split( "," ); 158 | eql = eachq.length; 159 | 160 | for( var j = 0; j < eql; j++ ){ 161 | thisq = eachq[ j ]; 162 | mediastyles.push( { 163 | media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", 164 | rules : rules.length - 1, 165 | hasquery : thisq.indexOf("(") > -1, 166 | minw : thisq.match( /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 167 | maxw : thisq.match( /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) 168 | } ); 169 | } 170 | } 171 | 172 | applyMedia(); 173 | }, 174 | 175 | lastCall, 176 | 177 | resizeDefer, 178 | 179 | // returns the value of 1em in pixels 180 | getEmValue = function() { 181 | var ret, 182 | div = doc.createElement('div'), 183 | body = doc.body, 184 | fakeUsed = false; 185 | 186 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 187 | 188 | if( !body ){ 189 | body = fakeUsed = doc.createElement( "body" ); 190 | body.style.background = "none"; 191 | } 192 | 193 | body.appendChild( div ); 194 | 195 | docElem.insertBefore( body, docElem.firstChild ); 196 | 197 | ret = div.offsetWidth; 198 | 199 | if( fakeUsed ){ 200 | docElem.removeChild( body ); 201 | } 202 | else { 203 | body.removeChild( div ); 204 | } 205 | 206 | //also update eminpx before returning 207 | ret = eminpx = parseFloat(ret); 208 | 209 | return ret; 210 | }, 211 | 212 | //cached container for 1em value, populated the first time it's needed 213 | eminpx, 214 | 215 | //enable/disable styles 216 | applyMedia = function( fromResize ){ 217 | var name = "clientWidth", 218 | docElemProp = docElem[ name ], 219 | currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, 220 | styleBlocks = {}, 221 | lastLink = links[ links.length-1 ], 222 | now = (new Date()).getTime(); 223 | 224 | //throttle resize calls 225 | if( fromResize && lastCall && now - lastCall < resizeThrottle ){ 226 | win.clearTimeout( resizeDefer ); 227 | resizeDefer = win.setTimeout( applyMedia, resizeThrottle ); 228 | return; 229 | } 230 | else { 231 | lastCall = now; 232 | } 233 | 234 | for( var i in mediastyles ){ 235 | if( mediastyles.hasOwnProperty( i ) ){ 236 | var thisstyle = mediastyles[ i ], 237 | min = thisstyle.minw, 238 | max = thisstyle.maxw, 239 | minnull = min === null, 240 | maxnull = max === null, 241 | em = "em"; 242 | 243 | if( !!min ){ 244 | min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 245 | } 246 | if( !!max ){ 247 | max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 248 | } 249 | 250 | // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true 251 | if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ 252 | if( !styleBlocks[ thisstyle.media ] ){ 253 | styleBlocks[ thisstyle.media ] = []; 254 | } 255 | styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); 256 | } 257 | } 258 | } 259 | 260 | //remove any existing respond style element(s) 261 | for( var j in appendedEls ){ 262 | if( appendedEls.hasOwnProperty( j ) ){ 263 | if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){ 264 | head.removeChild( appendedEls[ j ] ); 265 | } 266 | } 267 | } 268 | 269 | //inject active styles, grouped by media type 270 | for( var k in styleBlocks ){ 271 | if( styleBlocks.hasOwnProperty( k ) ){ 272 | var ss = doc.createElement( "style" ), 273 | css = styleBlocks[ k ].join( "\n" ); 274 | 275 | ss.type = "text/css"; 276 | ss.media = k; 277 | 278 | //originally, ss was appended to a documentFragment and sheets were appended in bulk. 279 | //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! 280 | head.insertBefore( ss, lastLink.nextSibling ); 281 | 282 | if ( ss.styleSheet ){ 283 | ss.styleSheet.cssText = css; 284 | } 285 | else { 286 | ss.appendChild( doc.createTextNode( css ) ); 287 | } 288 | 289 | //push to appendedEls to track for later removal 290 | appendedEls.push( ss ); 291 | } 292 | } 293 | }, 294 | //tweaked Ajax functions from Quirksmode 295 | ajax = function( url, callback ) { 296 | var req = xmlHttp(); 297 | if (!req){ 298 | return; 299 | } 300 | req.open( "GET", url, true ); 301 | req.onreadystatechange = function () { 302 | if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){ 303 | return; 304 | } 305 | callback( req.responseText ); 306 | }; 307 | if ( req.readyState === 4 ){ 308 | return; 309 | } 310 | req.send( null ); 311 | }, 312 | //define ajax obj 313 | xmlHttp = (function() { 314 | var xmlhttpmethod = false; 315 | try { 316 | xmlhttpmethod = new win.XMLHttpRequest(); 317 | } 318 | catch( e ){ 319 | xmlhttpmethod = new win.ActiveXObject( "Microsoft.XMLHTTP" ); 320 | } 321 | return function(){ 322 | return xmlhttpmethod; 323 | }; 324 | })(); 325 | 326 | //translate CSS 327 | ripCSS(); 328 | 329 | //expose update for re-running respond later on 330 | respond.update = ripCSS; 331 | 332 | //adjust on resize 333 | function callMedia(){ 334 | applyMedia( true ); 335 | } 336 | if( win.addEventListener ){ 337 | win.addEventListener( "resize", callMedia, false ); 338 | } 339 | else if( win.attachEvent ){ 340 | win.attachEvent( "onresize", callMedia ); 341 | } 342 | })(this); 343 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(a){return g.innerHTML='­',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:a}}}(document); 4 | 5 | /*! Respond.js v1.3.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 6 | (function(a){"use strict";function x(){u(!0)}var b={};if(a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var q,r,t,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],l=j.getElementsByTagName("link"),m=[],n=function(){for(var b=0;l.length>b;b++){var c=l[b],d=c.href,e=c.media,f=c.rel&&"stylesheet"===c.rel.toLowerCase();d&&f&&!h[d]&&(c.styleSheet&&c.styleSheet.rawCssText?(p(c.styleSheet.rawCssText,d,e),h[d]=!0):(!/^([a-zA-Z:]*\/\/)/.test(d)&&!k||d.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&m.push({href:d,media:e}))}o()},o=function(){if(m.length){var b=m.shift();v(b.href,function(c){p(c,b.href,b.media),h[b.href]=!0,a.setTimeout(function(){o()},0)})}},p=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=d&&d.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c;b.length&&(b+="/"),i&&(g=1);for(var j=0;g>j;j++){var k,l,m,n;i?(k=c,f.push(h(a))):(k=d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),m=k.split(","),n=m.length;for(var o=0;n>o;o++)l=m[o],e.push({media:l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},s=function(){var a,b=c.createElement("div"),e=c.body,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=c.createElement("body"),e.style.background="none"),e.appendChild(b),d.insertBefore(e,d.firstChild),a=b.offsetWidth,f?d.removeChild(e):e.removeChild(b),a=t=parseFloat(a)},u=function(b){var h="clientWidth",k=d[h],m="CSS1Compat"===c.compatMode&&k||c.body[h]||k,n={},o=l[l.length-1],p=(new Date).getTime();if(b&&q&&i>p-q)return a.clearTimeout(r),r=a.setTimeout(u,i),void 0;q=p;for(var v in e)if(e.hasOwnProperty(v)){var w=e[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?t||s():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?t||s():1)),w.hasquery&&(z&&A||!(z||m>=x)||!(A||y>=m))||(n[w.media]||(n[w.media]=[]),n[w.media].push(f[w.rules]))}for(var C in g)g.hasOwnProperty(C)&&g[C]&&g[C].parentNode===j&&j.removeChild(g[C]);for(var D in n)if(n.hasOwnProperty(D)){var E=c.createElement("style"),F=n[D].join("\n");E.type="text/css",E.media=D,j.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(c.createTextNode(F)),g.push(E)}},v=function(a,b){var c=w();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},w=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}();n(),b.update=n,a.addEventListener?a.addEventListener("resize",x,!1):a.attachEvent&&a.attachEvent("onresize",x)}})(this); 7 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Services/Database.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace ProgressReporting.Services 8 | { 9 | public class Database 10 | { 11 | public static readonly Database Instance = new Database(); 12 | 13 | ConcurrentDictionary _values = new ConcurrentDictionary(); 14 | 15 | public string GetGlobalJobId() 16 | { 17 | object result; 18 | return _values.TryGetValue("GlobalJobId", out result) ? (string)result : ""; 19 | } 20 | 21 | public void StoreGlobalJobId(string jobId) 22 | { 23 | _values["GlobalJobId"] = jobId; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Services/Job.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace ProgressReporting.Services 5 | { 6 | public class Job 7 | { 8 | public event EventHandler ProgressChanged; 9 | public event EventHandler Completed; 10 | 11 | private volatile int _progress; 12 | private volatile bool _completed; 13 | private CancellationTokenSource _cancellationTokenSource; 14 | 15 | public Job(string id) 16 | { 17 | Id = id; 18 | _cancellationTokenSource = new CancellationTokenSource(); 19 | } 20 | 21 | public string Id { get; private set; } 22 | 23 | public int Progress 24 | { 25 | get { return _progress; } 26 | } 27 | 28 | public bool IsComplete 29 | { 30 | get { return _completed; } 31 | } 32 | 33 | public CancellationToken CancellationToken 34 | { 35 | get { return _cancellationTokenSource.Token; } 36 | } 37 | 38 | public void ReportProgress(int progress) 39 | { 40 | if (_progress != progress) 41 | { 42 | _progress = progress; 43 | OnProgressChanged(); 44 | } 45 | } 46 | 47 | public void ReportComplete() 48 | { 49 | if (!IsComplete) 50 | { 51 | _completed = true; 52 | OnCompleted(); 53 | } 54 | } 55 | 56 | protected virtual void OnCompleted() 57 | { 58 | var handler = Completed; 59 | if (handler != null) handler(this, EventArgs.Empty); 60 | } 61 | 62 | protected virtual void OnProgressChanged() 63 | { 64 | var handler = ProgressChanged; 65 | if (handler != null) handler(this, EventArgs.Empty); 66 | } 67 | 68 | public void Cancel() 69 | { 70 | _cancellationTokenSource.Cancel(); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Services/JobManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Web; 7 | using Microsoft.AspNet.SignalR; 8 | using ProgressReporting.Hubs; 9 | 10 | namespace ProgressReporting.Services 11 | { 12 | public class JobManager 13 | { 14 | public static readonly JobManager Instance = new JobManager(); 15 | 16 | public JobManager() 17 | { 18 | _hubContext = GlobalHost.ConnectionManager.GetHubContext(); 19 | } 20 | ConcurrentDictionary _runningJobs = new ConcurrentDictionary(); 21 | private IHubContext _hubContext; 22 | 23 | public Job DoJobAsync(Action action) 24 | { 25 | var job = new Job(Guid.NewGuid().ToString()); 26 | 27 | // this will (should!) never fail, because job.Id is globally unique 28 | _runningJobs.TryAdd(job.Id, job); 29 | 30 | Task.Factory.StartNew(() => 31 | { 32 | action(job); 33 | job.ReportComplete(); 34 | _runningJobs.TryRemove(job.Id, out job); 35 | }, 36 | TaskCreationOptions.LongRunning); 37 | 38 | BroadcastJobStatus(job); 39 | 40 | return job; 41 | } 42 | 43 | private void BroadcastJobStatus(Job job) 44 | { 45 | job.ProgressChanged += HandleJobProgressChanged; 46 | job.Completed += HandleJobCompleted; 47 | } 48 | 49 | private void HandleJobCompleted(object sender, EventArgs e) 50 | { 51 | var job = (Job) sender; 52 | 53 | _hubContext.Clients.Group(job.Id).jobCompleted(job.Id); 54 | 55 | job.ProgressChanged -= HandleJobProgressChanged; 56 | job.Completed -= HandleJobCompleted; 57 | } 58 | 59 | private void HandleJobProgressChanged(object sender, EventArgs e) 60 | { 61 | var job = (Job) sender; 62 | _hubContext.Clients.Group(job.Id).progressChanged(job.Id, job.Progress); 63 | } 64 | 65 | public Job GetJob(string id) 66 | { 67 | Job result; 68 | return _runningJobs.TryGetValue(id, out result) ? result : null; 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | using ProgressReporting.Hubs; 4 | 5 | [assembly: OwinStartupAttribute(typeof(ProgressReporting.Startup))] 6 | namespace ProgressReporting 7 | { 8 | public partial class Startup 9 | { 10 | public void Configuration(IAppBuilder app) 11 | { 12 | app.MapSignalR("/sensor/events"); 13 | app.MapSignalR(); 14 | ConfigureAuth(app); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/ExternalLoginConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.ExternalLoginConfirmationViewModel 2 | @{ 3 | ViewBag.Title = "Register"; 4 | } 5 |

    @ViewBag.Title.

    6 |

    Associate your @ViewBag.LoginProvider account.

    7 | 8 | @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

    Association Form

    13 |
    14 | @Html.ValidationSummary(true) 15 |

    16 | You've successfully authenticated with @ViewBag.LoginProvider. 17 | Please enter a user name for this site below and click the Register button to finish 18 | logging in. 19 |

    20 |
    21 | @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) 22 |
    23 | @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) 24 | @Html.ValidationMessageFor(m => m.UserName) 25 |
    26 |
    27 |
    28 |
    29 | 30 |
    31 |
    32 | } 33 | 34 | @section Scripts { 35 | @Scripts.Render("~/bundles/jqueryval") 36 | } 37 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

    @ViewBag.Title.

    6 |

    Unsuccessful login with service.

    7 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.LoginViewModel 2 | 3 | @{ 4 | ViewBag.Title = "Log in"; 5 | } 6 | 7 |

    @ViewBag.Title.

    8 |
    9 |
    10 |
    11 | @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 12 | { 13 | @Html.AntiForgeryToken() 14 |

    Use a local account to log in.

    15 |
    16 | @Html.ValidationSummary(true) 17 |
    18 | @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) 19 |
    20 | @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) 21 | @Html.ValidationMessageFor(m => m.UserName) 22 |
    23 |
    24 |
    25 | @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) 26 |
    27 | @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) 28 | @Html.ValidationMessageFor(m => m.Password) 29 |
    30 |
    31 |
    32 |
    33 |
    34 | @Html.CheckBoxFor(m => m.RememberMe) 35 | @Html.LabelFor(m => m.RememberMe) 36 |
    37 |
    38 |
    39 |
    40 |
    41 | 42 |
    43 |
    44 |

    45 | @Html.ActionLink("Register", "Register") if you don't have a local account. 46 |

    47 | } 48 |
    49 |
    50 |
    51 |
    52 | @Html.Partial("_ExternalLoginsListPartial", new { Action = "ExternalLogin", ReturnUrl = ViewBag.ReturnUrl }) 53 |
    54 |
    55 |
    56 | @section Scripts { 57 | @Scripts.Render("~/bundles/jqueryval") 58 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using ProgressReporting.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

    @ViewBag.Title.

    8 | 9 |

    @ViewBag.StatusMessage

    10 |
    11 |
    12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
    22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
    25 |
    26 |
    27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.RegisterViewModel 2 | @{ 3 | ViewBag.Title = "Register"; 4 | } 5 | 6 |

    @ViewBag.Title.

    7 | 8 | @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

    Create a new account.

    12 |
    13 | @Html.ValidationSummary() 14 |
    15 | @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) 16 |
    17 | @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) 18 |
    19 |
    20 |
    21 | @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) 22 |
    23 | @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) 24 |
    25 |
    26 |
    27 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 28 |
    29 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 30 |
    31 |
    32 |
    33 |
    34 | 35 |
    36 |
    37 | } 38 | 39 | @section Scripts { 40 | @Scripts.Render("~/bundles/jqueryval") 41 | } 42 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/_ChangePasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @model ProgressReporting.Models.ManageUserViewModel 3 | 4 |

    You're logged in as @User.Identity.GetUserName().

    5 | 6 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 7 | { 8 | @Html.AntiForgeryToken() 9 |

    Change Password Form

    10 |
    11 | @Html.ValidationSummary() 12 |
    13 | @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) 14 |
    15 | @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) 16 |
    17 |
    18 |
    19 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 20 |
    21 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 22 |
    23 |
    24 |
    25 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 26 |
    27 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 28 |
    29 |
    30 | 31 |
    32 |
    33 | 34 |
    35 |
    36 | } 37 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/_ExternalLoginsListPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.Owin.Security 2 | 3 |

    Use another service to log in.

    4 |
    5 | @{ 6 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); 7 | if (loginProviders.Count() == 0) 8 | { 9 |
    10 |

    There are no external authentication services configured. See this article 11 | for details on setting up this ASP.NET application to support logging in via external services.

    12 |
    13 | } 14 | else 15 | { 16 | string action = Model.Action; 17 | string returnUrl = Model.ReturnUrl; 18 | using (Html.BeginForm(action, "Account", new { ReturnUrl = returnUrl })) 19 | { 20 | @Html.AntiForgeryToken() 21 |
    22 |

    23 | @foreach (AuthenticationDescription p in loginProviders) 24 | { 25 | 26 | } 27 |

    28 |
    29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/_RemoveAccountPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model ICollection 2 | 3 | @if (Model.Count > 0) 4 | { 5 |

    Registered Logins

    6 | 7 | 8 | @foreach (var account in Model) 9 | { 10 | 11 | 12 | 30 | 31 | } 32 | 33 |
    @account.LoginProvider 13 | @if (ViewBag.ShowRemoveButton) 14 | { 15 | using (Html.BeginForm("Disassociate", "Account")) 16 | { 17 | @Html.AntiForgeryToken() 18 |
    19 | @Html.Hidden("loginProvider", account.LoginProvider) 20 | @Html.Hidden("providerKey", account.ProviderKey) 21 | 22 |
    23 | } 24 | } 25 | else 26 | { 27 | @:   28 | } 29 |
    34 | } 35 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Account/_SetPasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.ManageUserViewModel 2 | 3 |

    4 | You do not have a local username/password for this site. Add a local 5 | account so you can log in without an external login. 6 |

    7 | 8 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

    Create Local Login

    13 |
    14 | @Html.ValidationSummary() 15 |
    16 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 17 |
    18 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 19 |
    20 |
    21 |
    22 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 23 |
    24 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 25 |
    26 |
    27 |
    28 |
    29 | 30 |
    31 |
    32 | } 33 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Job/GlobalJob.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.GlobalJobViewModel 2 | 3 | @{ 4 | ViewBag.Title = "Global Job"; 5 | } 6 | 7 |

    A Global Job

    8 |

    All users will see the progress of this job when they navigate to this page. Try refreshing the page too!

    9 |
    10 | 11 | 12 |
    13 | 14 | 20 | 21 | 24 | 25 | @section scripts { 26 | @Scripts.Render("~/bundles/signalR") 27 | 28 | 92 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Job/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.GlobalJobViewModel 2 | 3 | @{ 4 | ViewBag.Title = "Do a Job"; 5 | } 6 | 7 |

    A Job

    8 | 9 |
    10 | 11 |
    12 | 13 | 19 | 20 | 23 | 24 | @section scripts { 25 | 26 | 27 | 68 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Page/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model ProgressReporting.Models.GlobalJobViewModel 2 | 3 | @{ 4 | ViewBag.Title = "My Page"; 5 | } 6 | 7 |

    My Page

    8 | 9 |

    There are currently 0 people viewing this page.

    10 | 11 |

    The pages being viewed are:

    12 | 13 |
      14 | 15 |
    16 | 17 | @section scripts { 18 | 19 | 20 | 29 | } -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

    Error.

    8 |

    An error occurred while processing your request.

    9 | 10 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 12 | 31 |
    32 | @RenderBody() 33 |
    34 |
    35 |

    © @DateTime.Now.Year - My ASP.NET Application

    36 |
    37 |
    38 | 39 | @Scripts.Render("~/bundles/jquery") 40 | @Scripts.Render("~/bundles/bootstrap") 41 | @RenderSection("scripts", required: false) 42 | 43 | 44 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/ProgressReporting/favicon.ico -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samueldjack/SignalRDemo/79ee51033e110306b5ba32dbe88d0cf293dd2858/ProgressReporting/ProgressReporting/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /ProgressReporting/ProgressReporting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /ProgressReporting/SensorEventsClient/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ProgressReporting/SensorEventsClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reactive.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNet.SignalR.Client; 8 | using ProgressReporting.Models; 9 | 10 | namespace SensorEventsClient 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | var connection = new Connection("http://localhost:3669/sensor/events"); 17 | 18 | connection.Start().Wait(); 19 | 20 | connection.AsObservable() 21 | .GroupBy(e => e.SensorId) 22 | .CombineLatest() 23 | .Select(latest => latest.Where(e => e.Reading > 0.75).ToList()) 24 | .Where(latest => latest.Count() >= 2) 25 | .Subscribe(latest => Console.WriteLine("Sensors {0} show readings greater than 0.75", string.Join(",", latest.Select(e => e.SensorId)))); 26 | 27 | Console.Read(); 28 | 29 | connection.Stop(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ProgressReporting/SensorEventsClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SensorEventsClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SensorEventsClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7c7e0e89-9e1f-4084-af21-8fb87b8947f0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ProgressReporting/SensorEventsClient/SensorEventsClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1A942189-C575-4636-B1CB-D357DC2A82E5} 8 | Exe 9 | Properties 10 | SensorEventsClient 11 | SensorEventsClient 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Microsoft.AspNet.SignalR.Client.2.0.2\lib\net45\Microsoft.AspNet.SignalR.Client.dll 37 | 38 | 39 | ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll 40 | 41 | 42 | False 43 | ..\Libraries\Rxx.dll 44 | 45 | 46 | 47 | 48 | ..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll 49 | 50 | 51 | ..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll 52 | 53 | 54 | ..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll 55 | 56 | 57 | ..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | SensorEvent.cs 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 84 | -------------------------------------------------------------------------------- /ProgressReporting/SensorEventsClient/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SignalRDemo 2 | =========== 3 | 4 | Code to support my three-part series [Getting Started with SignalR - and not a Chat room in sight!](http://blog.functionalfun.net/2014/02/real-world-signalr.html) 5 | --------------------------------------------------------------------------------