Commits

Anonymous committed fce93c5

Added Stacky.Mvc.

  • Participants
  • Parent commits 3175955

Comments (0)

Files changed (58)

trunk/examples/Stacky.Mvc/Stacky.Mvc.Tests/App.config

+<?xml version="1.0" encoding="utf-8" ?>
+<!-- 
+    Note: Add entries to the App.config file for configuration settings
+    that apply only to the Test project.
+-->
+<configuration>
+    <appSettings>
+
+    </appSettings>
+
+    <connectionStrings>
+
+    </connectionStrings>
+</configuration>

trunk/examples/Stacky.Mvc/Stacky.Mvc.Tests/Controllers/AccountControllerTest.cs

+//using System;
+//using System.Security.Principal;
+//using System.Web;
+//using System.Web.Mvc;
+//using System.Web.Routing;
+//using System.Web.Security;
+//using Microsoft.VisualStudio.TestTools.UnitTesting;
+//using Stacky.Mvc;
+//using Stacky.Mvc.Controllers;
+//using Stacky.Mvc.Models;
+
+//namespace Stacky.Mvc.Tests.Controllers
+//{
+
+//    [TestClass]
+//    public class AccountControllerTest
+//    {
+
+//        [TestMethod]
+//        public void ChangePassword_Get_ReturnsView()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+
+//            // Act
+//            ActionResult result = controller.ChangePassword();
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            Assert.AreEqual(10, ((ViewResult)result).ViewData["PasswordLength"]);
+//        }
+
+//        [TestMethod]
+//        public void ChangePassword_Post_ReturnsRedirectOnSuccess()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            ChangePasswordModel model = new ChangePasswordModel()
+//            {
+//                OldPassword = "goodOldPassword",
+//                NewPassword = "goodNewPassword",
+//                ConfirmPassword = "goodNewPassword"
+//            };
+
+//            // Act
+//            ActionResult result = controller.ChangePassword(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
+//            RedirectToRouteResult redirectResult = (RedirectToRouteResult)result;
+//            Assert.AreEqual("ChangePasswordSuccess", redirectResult.RouteValues["action"]);
+//        }
+
+//        [TestMethod]
+//        public void ChangePassword_Post_ReturnsViewIfChangePasswordFails()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            ChangePasswordModel model = new ChangePasswordModel()
+//            {
+//                OldPassword = "goodOldPassword",
+//                NewPassword = "badNewPassword",
+//                ConfirmPassword = "badNewPassword"
+//            };
+
+//            // Act
+//            ActionResult result = controller.ChangePassword(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//            Assert.AreEqual("The current password is incorrect or the new password is invalid.", controller.ModelState[""].Errors[0].ErrorMessage);
+//            Assert.AreEqual(10, viewResult.ViewData["PasswordLength"]);
+//        }
+
+//        [TestMethod]
+//        public void ChangePassword_Post_ReturnsViewIfModelStateIsInvalid()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            ChangePasswordModel model = new ChangePasswordModel()
+//            {
+//                OldPassword = "goodOldPassword",
+//                NewPassword = "goodNewPassword",
+//                ConfirmPassword = "goodNewPassword"
+//            };
+//            controller.ModelState.AddModelError("", "Dummy error message.");
+
+//            // Act
+//            ActionResult result = controller.ChangePassword(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//            Assert.AreEqual(10, viewResult.ViewData["PasswordLength"]);
+//        }
+
+//        [TestMethod]
+//        public void ChangePasswordSuccess_ReturnsView()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+
+//            // Act
+//            ActionResult result = controller.ChangePasswordSuccess();
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//        }
+
+//        [TestMethod]
+//        public void LogOff_LogsOutAndRedirects()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+
+//            // Act
+//            ActionResult result = controller.LogOff();
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
+//            RedirectToRouteResult redirectResult = (RedirectToRouteResult)result;
+//            Assert.AreEqual("Home", redirectResult.RouteValues["controller"]);
+//            Assert.AreEqual("Index", redirectResult.RouteValues["action"]);
+//            Assert.IsTrue(((MockFormsAuthenticationService)controller.FormsService).SignOut_WasCalled);
+//        }
+
+//        [TestMethod]
+//        public void LogOn_Get_ReturnsView()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+
+//            // Act
+//            ActionResult result = controller.LogOn();
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//        }
+
+//        [TestMethod]
+//        public void LogOn_Post_ReturnsRedirectOnSuccess_WithoutReturnUrl()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            LogOnModel model = new LogOnModel()
+//            {
+//                UserName = "someUser",
+//                Password = "goodPassword",
+//                RememberMe = false
+//            };
+
+//            // Act
+//            ActionResult result = controller.LogOn(model, null);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
+//            RedirectToRouteResult redirectResult = (RedirectToRouteResult)result;
+//            Assert.AreEqual("Home", redirectResult.RouteValues["controller"]);
+//            Assert.AreEqual("Index", redirectResult.RouteValues["action"]);
+//            Assert.IsTrue(((MockFormsAuthenticationService)controller.FormsService).SignIn_WasCalled);
+//        }
+
+//        [TestMethod]
+//        public void LogOn_Post_ReturnsRedirectOnSuccess_WithReturnUrl()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            LogOnModel model = new LogOnModel()
+//            {
+//                UserName = "someUser",
+//                Password = "goodPassword",
+//                RememberMe = false
+//            };
+
+//            // Act
+//            ActionResult result = controller.LogOn(model, "/someUrl");
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(RedirectResult));
+//            RedirectResult redirectResult = (RedirectResult)result;
+//            Assert.AreEqual("/someUrl", redirectResult.Url);
+//            Assert.IsTrue(((MockFormsAuthenticationService)controller.FormsService).SignIn_WasCalled);
+//        }
+
+//        [TestMethod]
+//        public void LogOn_Post_ReturnsViewIfModelStateIsInvalid()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            LogOnModel model = new LogOnModel()
+//            {
+//                UserName = "someUser",
+//                Password = "goodPassword",
+//                RememberMe = false
+//            };
+//            controller.ModelState.AddModelError("", "Dummy error message.");
+
+//            // Act
+//            ActionResult result = controller.LogOn(model, null);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//        }
+
+//        [TestMethod]
+//        public void LogOn_Post_ReturnsViewIfValidateUserFails()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            LogOnModel model = new LogOnModel()
+//            {
+//                UserName = "someUser",
+//                Password = "badPassword",
+//                RememberMe = false
+//            };
+
+//            // Act
+//            ActionResult result = controller.LogOn(model, null);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//            Assert.AreEqual("The user name or password provided is incorrect.", controller.ModelState[""].Errors[0].ErrorMessage);
+//        }
+
+//        [TestMethod]
+//        public void Register_Get_ReturnsView()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+
+//            // Act
+//            ActionResult result = controller.Register();
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            Assert.AreEqual(10, ((ViewResult)result).ViewData["PasswordLength"]);
+//        }
+
+//        [TestMethod]
+//        public void Register_Post_ReturnsRedirectOnSuccess()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            RegisterModel model = new RegisterModel()
+//            {
+//                UserName = "someUser",
+//                Email = "goodEmail",
+//                Password = "goodPassword",
+//                ConfirmPassword = "goodPassword"
+//            };
+
+//            // Act
+//            ActionResult result = controller.Register(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
+//            RedirectToRouteResult redirectResult = (RedirectToRouteResult)result;
+//            Assert.AreEqual("Home", redirectResult.RouteValues["controller"]);
+//            Assert.AreEqual("Index", redirectResult.RouteValues["action"]);
+//        }
+
+//        [TestMethod]
+//        public void Register_Post_ReturnsViewIfRegistrationFails()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            RegisterModel model = new RegisterModel()
+//            {
+//                UserName = "duplicateUser",
+//                Email = "goodEmail",
+//                Password = "goodPassword",
+//                ConfirmPassword = "goodPassword"
+//            };
+
+//            // Act
+//            ActionResult result = controller.Register(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//            Assert.AreEqual("Username already exists. Please enter a different user name.", controller.ModelState[""].Errors[0].ErrorMessage);
+//            Assert.AreEqual(10, viewResult.ViewData["PasswordLength"]);
+//        }
+
+//        [TestMethod]
+//        public void Register_Post_ReturnsViewIfModelStateIsInvalid()
+//        {
+//            // Arrange
+//            AccountController controller = GetAccountController();
+//            RegisterModel model = new RegisterModel()
+//            {
+//                UserName = "someUser",
+//                Email = "goodEmail",
+//                Password = "goodPassword",
+//                ConfirmPassword = "goodPassword"
+//            };
+//            controller.ModelState.AddModelError("", "Dummy error message.");
+
+//            // Act
+//            ActionResult result = controller.Register(model);
+
+//            // Assert
+//            Assert.IsInstanceOfType(result, typeof(ViewResult));
+//            ViewResult viewResult = (ViewResult)result;
+//            Assert.AreEqual(model, viewResult.ViewData.Model);
+//            Assert.AreEqual(10, viewResult.ViewData["PasswordLength"]);
+//        }
+
+//        private static AccountController GetAccountController()
+//        {
+//            AccountController controller = new AccountController()
+//            {
+//                FormsService = new MockFormsAuthenticationService(),
+//                MembershipService = new MockMembershipService()
+//            };
+//            controller.ControllerContext = new ControllerContext()
+//            {
+//                Controller = controller,
+//                RequestContext = new RequestContext(new MockHttpContext(), new RouteData())
+//            };
+//            return controller;
+//        }
+
+//        private class MockFormsAuthenticationService : IFormsAuthenticationService
+//        {
+//            public bool SignIn_WasCalled;
+//            public bool SignOut_WasCalled;
+
+//            public void SignIn(string userName, bool createPersistentCookie)
+//            {
+//                // verify that the arguments are what we expected
+//                Assert.AreEqual("someUser", userName);
+//                Assert.IsFalse(createPersistentCookie);
+
+//                SignIn_WasCalled = true;
+//            }
+
+//            public void SignOut()
+//            {
+//                SignOut_WasCalled = true;
+//            }
+//        }
+
+//        private class MockHttpContext : HttpContextBase
+//        {
+//            private readonly IPrincipal _user = new GenericPrincipal(new GenericIdentity("someUser"), null /* roles */);
+
+//            public override IPrincipal User
+//            {
+//                get
+//                {
+//                    return _user;
+//                }
+//                set
+//                {
+//                    base.User = value;
+//                }
+//            }
+//        }
+
+//        private class MockMembershipService : IMembershipService
+//        {
+//            public int MinPasswordLength
+//            {
+//                get { return 10; }
+//            }
+
+//            public bool ValidateUser(string userName, string password)
+//            {
+//                return (userName == "someUser" && password == "goodPassword");
+//            }
+
+//            public MembershipCreateStatus CreateUser(string userName, string password, string email)
+//            {
+//                if (userName == "duplicateUser")
+//                {
+//                    return MembershipCreateStatus.DuplicateUserName;
+//                }
+
+//                // verify that values are what we expected
+//                Assert.AreEqual("goodPassword", password);
+//                Assert.AreEqual("goodEmail", email);
+
+//                return MembershipCreateStatus.Success;
+//            }
+
+//            public bool ChangePassword(string userName, string oldPassword, string newPassword)
+//            {
+//                return (userName == "someUser" && oldPassword == "goodOldPassword" && newPassword == "goodNewPassword");
+//            }
+//        }
+
+//    }
+//}

trunk/examples/Stacky.Mvc/Stacky.Mvc.Tests/Controllers/HomeControllerTest.cs

+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.Text;
+//using System.Web.Mvc;
+//using Microsoft.VisualStudio.TestTools.UnitTesting;
+//using Stacky.Mvc;
+//using Stacky.Mvc.Controllers;
+
+//namespace Stacky.Mvc.Tests.Controllers
+//{
+//    [TestClass]
+//    public class HomeControllerTest
+//    {
+//        [TestMethod]
+//        public void Index()
+//        {
+//            // Arrange
+//            HomeController controller = new HomeController();
+
+//            // Act
+//            ViewResult result = controller.Index() as ViewResult;
+
+//            // Assert
+//            ViewDataDictionary viewData = result.ViewData;
+//            Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
+//        }
+
+//        [TestMethod]
+//        public void About()
+//        {
+//            // Arrange
+//            HomeController controller = new HomeController();
+
+//            // Act
+//            ViewResult result = controller.About() as ViewResult;
+
+//            // Assert
+//            Assert.IsNotNull(result);
+//        }
+//    }
+//}

trunk/examples/Stacky.Mvc/Stacky.Mvc.Tests/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Stacky.Mvc.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Stacky.Mvc.Tests")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("99619352-b5a5-4b65-9f0e-1f6fa3ded5fe")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

trunk/examples/Stacky.Mvc/Stacky.Mvc.Tests/Stacky.Mvc.Tests.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{16197640-8F85-4378-A9CD-E7821C30CF5F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>StackOverflow.Net.Mvc.Tests</RootNamespace>
+    <AssemblyName>StackOverflow.Net.Mvc.Tests</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Web.ApplicationServices" />
+    <Reference Include="System.Web.Extensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Web.Abstractions" />
+    <Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+    <Reference Include="System.Web.Routing" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Controllers\HomeControllerTest.cs" />
+    <Compile Include="Controllers\AccountControllerTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

trunk/examples/Stacky.Mvc/Stacky.Mvc.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stacky.Mvc", "Stacky.Mvc\Stacky.Mvc.csproj", "{66473FE8-4FED-4600-8073-D8A04696635D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stacky.Mvc.Tests", "Stacky.Mvc.Tests\Stacky.Mvc.Tests.csproj", "{16197640-8F85-4378-A9CD-E7821C30CF5F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stacky", "..\..\source\Stacky\Stacky.csproj", "{76872B7B-53CE-41E1-B41C-8F0BEC5455D4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{66473FE8-4FED-4600-8073-D8A04696635D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{66473FE8-4FED-4600-8073-D8A04696635D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{66473FE8-4FED-4600-8073-D8A04696635D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{66473FE8-4FED-4600-8073-D8A04696635D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{16197640-8F85-4378-A9CD-E7821C30CF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{16197640-8F85-4378-A9CD-E7821C30CF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{16197640-8F85-4378-A9CD-E7821C30CF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{16197640-8F85-4378-A9CD-E7821C30CF5F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{76872B7B-53CE-41E1-B41C-8F0BEC5455D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{76872B7B-53CE-41E1-B41C-8F0BEC5455D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{76872B7B-53CE-41E1-B41C-8F0BEC5455D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{76872B7B-53CE-41E1-B41C-8F0BEC5455D4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/Site.css

+/*http://colorschemedesigner.com/#3v41R2zGr52Wr light*/
+/*http://colorschemedesigner.com/#3v41RqVvfhoYf dark*/
+/*Html*/
+*
+{
+    -moz-background-clip:border;
+    -moz-background-inline-policy:continuous;
+    -moz-background-origin:padding;
+    background:transparent none repeat scroll 0 0;
+    border:0 none;
+    font-size:100%;
+    margin:0;
+    padding:0;
+    vertical-align:baseline;
+}
+
+body
+{
+    line-height: 1;
+    text-align: center;
+    font-family: 'Helvetica Neue', Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;
+    font-size: 13px;
+    background: 
+}
+
+ul
+{
+    list-style-image: none;
+    list-style-position: outside;
+    list-style-type: none;
+}
+
+/* Master Page*/
+#page-container
+{
+	text-align: left;
+	width: 900px;
+	margin: 0 auto;
+	display: block;
+}
+
+#header-container
+{
+}
+
+#content-container
+{
+}
+
+#page-content
+{
+}
+
+#sidebar-content
+{
+}
+
+#footer-container
+{
+}
+
+/* Site Global - Tags*/
+.tag
+{
+}
+
+.tag-link
+{
+}
+
+.moderator-tag
+{
+}
+
+/* Header Control */
+.search-container
+{
+	position:relative;
+	background-color: #7DB0FF;
+	border-bottom-left-radius: 8px 8px;
+	border-bottom-right-radius: 8px 8px;
+	float: right;
+	height: 28px;
+	line-height: 22px;
+	overflow: hidden;
+	width: auto;
+	right: 0px;
+	z-index: 2;
+	top:-5px;
+	padding: 5px 8px 5px 8px;
+}
+
+.search-bar
+{
+}
+
+.search-text-box
+{
+	margin: 0px;
+	max-width: 200px;
+	width: 200px;
+	padding: 3px;
+	background: #ffffff;
+}
+
+.site-menu-container
+{
+
+	background-color: #E9E9E9;
+	border-bottom-left-radius: 8px 8px;
+	border-bottom-right-radius: 8px 8px;
+	float: left;
+	margin: 0px;
+	height: 28px;
+	line-height: 22px;
+	overflow: hidden;
+	width: 100%;
+	z-index: 1;
+	padding: 5px 0px 5px 8px;
+	border-left: 1px silver solid;
+		border-bottom: 1px silver solid;
+			border-right: 1px silver solid;
+}
+
+.site-menu
+{
+	margin: 0px;
+	-webkit-padding-start: 40px;
+	display: block;
+	background: transparent;
+	border: 0px;
+	font-size: 100%;
+	padding: 0px;
+	vertical-align: baseline;
+}
+
+.site-menu ul
+{
+	list-style: disc;
+}
+
+.site-menu li
+{
+	float: left;
+}
+
+.site-menu-item
+{
+}
+
+.site-menu-item-selected
+{
+}
+
+.site-menu-item-link
+{
+}
+
+.navigation-menu-container
+{
+}
+
+.navigation-menu
+{
+}
+
+.navigation-menu-item
+{
+}
+
+.navigation-menu-item-selected
+{
+}
+
+.navigation-menu-item-link
+{
+}
+
+.sub-navigation-menu-container
+{
+}
+
+.sub-navigation-menu
+{
+}
+
+.sub-navigation-menu-item
+{
+}
+
+.sub-navigation-menu-item-selected
+{
+}
+
+.sub-navigation-menu-item-link
+{
+}
+
+/* Pager Control */
+.pager-container
+{
+}
+
+.pager-items
+{
+}
+
+.pager-item
+{
+}
+
+.pager-item-selected
+{
+}
+
+.pager-item-link
+{
+}
+
+.page-size-container
+{
+}
+
+.page-size-items
+{
+}
+
+.page-size-item
+{
+}
+
+.page-size-item-selected
+{
+}
+
+.page-size-item-link
+{
+}
+
+/*Questions*/
+.questions-container
+{
+}
+
+.question-container
+{
+}
+
+.question-vote-answers
+{
+}
+
+.question-vote-count
+{
+}
+
+.question-vote-views
+{
+}
+
+.question-vote-answers-text
+{
+}
+
+.question-vote-count-text
+{
+}
+
+.question-vote-views-text
+{
+}
+
+.question
+{
+}
+
+.question-title
+{
+}
+
+.question-title-link
+{
+}
+
+.external-link
+{
+}
+
+.external-link-image
+{
+}
+
+.question-body
+{
+}
+
+.tags-container
+{
+}
+
+.user-container
+{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/prettify.css

+.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}pre.prettyprint{padding:2px;border:1px solid #888}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/sad01.png

Added
New image

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/sad02.png

Added
New image

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/sad03.png

Added
New image

trunk/examples/Stacky.Mvc/Stacky.Mvc/Content/sad04.png

Added
New image

trunk/examples/Stacky.Mvc/Stacky.Mvc/Controllers/BadgesController.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Stacky.Mvc.Controllers
+{
+    public class BadgesController : Controller
+    {
+        public ActionResult Badges()
+        {
+            return View();
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Controllers/QuestionsController.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Stacky.Mvc.Models;
+
+
+namespace Stacky.Mvc.Controllers
+{
+    public class QuestionsController : Controller
+    {
+        public ActionResult Active()
+        {
+            try
+            {
+                SiteState state = new SiteState(Url);
+                StackyRepository repository = new StackyRepository(state);
+                return View("Questions", new QuestionsModel(repository.GetQuestions(sortBy: QuestionSort.Activity, includeBody: true, page: state.Page, pageSize: state.PageSize), state));
+            }
+            catch (ApiException ex)
+            {
+                return View("Error", new HandleErrorInfo(ex, "Question", "Active"));
+            }
+        }
+
+        public ActionResult Questions()
+        {
+            try
+            {
+                SiteState state = new SiteState(Url);
+                StackyRepository repository = new StackyRepository(state);
+
+                QuestionSort sort = QuestionSort.Hot;
+
+                switch (state.Sort)
+                {
+                    case "Newest":
+                        sort = QuestionSort.Newest;
+                        break;
+                    case "Featured":
+                        sort = QuestionSort.Featured;
+                        break;
+                    case "Hot":
+                        sort = QuestionSort.Hot;
+                        break;
+                    case "Votes":
+                        sort = QuestionSort.Votes;
+                        break;
+                    case "Active":
+                        sort = QuestionSort.Activity;
+                        break;
+                    default:
+                        break;
+                }
+
+                return View(new QuestionsModel(repository.GetQuestions(sortBy: sort, includeBody: true, page: state.Page, pageSize: state.PageSize), state));
+            }
+            catch (ApiException ex)
+            {
+                return View("Error", new HandleErrorInfo(ex, "Question", "Active"));
+            }
+        }
+
+        public ActionResult Unanswered()
+        {
+            try
+            {
+                SiteState state = new SiteState(Url);
+                StackyRepository repository = new StackyRepository(state);
+
+                QuestionSort sort = QuestionSort.Unanswered;
+
+                switch (state.Sort)
+                {
+                    case "Newest":
+                        sort = QuestionSort.UnansweredNewest;
+                        break;
+                    case "Votes":
+                        sort = QuestionSort.UnansweredVotes;
+                        break;
+                    default:
+                        break;
+                }
+
+                return View("Questions", new QuestionsModel(repository.GetQuestions(sortBy: sort, includeBody: true, page: state.Page, pageSize: state.PageSize), state));
+            }
+            catch (ApiException ex)
+            {
+                return View("Error", new HandleErrorInfo(ex, "Question", "Active"));
+            }
+        }
+
+        public ActionResult Tagged(string id)
+        {
+            try
+            {
+                SiteState state = new SiteState(Url);
+                StackyRepository repository = new StackyRepository(state);
+
+                return View("Questions", new QuestionsModel(repository.GetQuestions(tags: new string[] { id }, includeBody: true, page: state.Page, pageSize: state.PageSize), state));
+            }
+            catch (ApiException ex)
+            {
+                return View("Error", new HandleErrorInfo(ex, "Question", "Active"));
+            }
+        }
+
+        public ActionResult Question(int id)
+        {
+            try
+            {
+                SiteState state = new SiteState(Url);
+                StackyRepository repository = new StackyRepository(state);
+                Question question = repository.GetQuestion(id, true, true);
+                IPagedList<Answer> answers = null;
+                if (state.Page != 1)
+                {
+                    answers = repository.GetQuestionAnswers(id, page: state.Page, includeBody: true, includeComments: true);
+                }
+
+                return View(new QuestionModel(question, answers, state));
+            }
+            catch (ApiException ex)
+            {
+                return View("Error", new HandleErrorInfo(ex, "Question", "Active"));
+            }
+        }
+    }
+}
+

trunk/examples/Stacky.Mvc/Stacky.Mvc/Controllers/TagsController.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Stacky.Mvc.Controllers
+{
+    public class TagsController : Controller
+    {
+        public ActionResult Tags()
+        {
+            return View();
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Controllers/UsersController.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Stacky.Mvc.Controllers
+{
+    public class UsersController : Controller
+    {
+        public ActionResult Users()
+        {
+            return View();
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Global.asax

+<%@ Application Codebehind="Global.asax.cs" Inherits="Stacky.Mvc.MvcApplication" Language="C#" %>

trunk/examples/Stacky.Mvc/Stacky.Mvc/Global.asax.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+
+namespace Stacky.Mvc
+{
+    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
+    // visit http://go.microsoft.com/?LinkId=9394801
+
+    public class MvcApplication : System.Web.HttpApplication
+    {
+        public static void RegisterRoutes(RouteCollection routes)
+        {
+            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+
+            
+
+
+            routes.MapRoute(
+                "Default", // Route name
+                "{controller}/{action}/{api}/{id}", // URL with parameters
+                new { controller = "Questions", action = "Active", api = "StackOverflow", id = UrlParameter.Optional } // Parameter defaults
+            );
+
+            routes.MapRoute(
+                "SODefault", // Route name
+                "{controller}/{action}", // URL with parameters
+                new { controller = "Questions", action = "Active", api = "StackOverflow", id = UrlParameter.Optional } // Parameter defaults
+            );
+        }
+
+        protected void Application_Start()
+        {
+            AreaRegistration.RegisterAllAreas();
+
+            RegisterRoutes(RouteTable.Routes);
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Helpers/SiteState.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Stacky.Mvc
+{
+    public class SiteState
+    {
+        public string SiteUrl { get; private set; }
+        public HostSite HostSite { get; private set; }
+        public string SiteAction { get; private set; }
+        public string SiteController { get; private set; }
+        public string Sort { get; private set; }
+        public int PageSize { get; set; }
+        public int Page { get; set; }
+        public int ItemCount { get; set; }
+        public int MaxPages { get; set; }
+        public string QueryString { get; private set; }
+
+        public SiteState(System.Web.Mvc.UrlHelper url)
+        {
+            SiteUrl = url.GetHostSiteBaseUrl();
+            HostSite = url.GetHostSite();
+            SiteAction = url.RequestContext.RouteData.Values["action"].ToString();
+            SiteController = url.RequestContext.RouteData.Values["controller"].ToString();
+            Sort = url.RequestContext.HttpContext.Request.QueryString["Sort"];
+
+            int tempInt = 0;
+
+            if (int.TryParse(url.RequestContext.HttpContext.Request.QueryString["Page"], out tempInt))
+            {
+                Page = tempInt;
+                if (Page < 1)
+                {
+                    Page = 1;
+                }
+            }
+            else
+            {
+                Page = 1;
+            }
+
+
+            if (int.TryParse(url.RequestContext.HttpContext.Request.QueryString["PageSize"], out tempInt))
+            {
+                PageSize = tempInt;
+            }
+            else
+            {
+                PageSize = 30;
+            }
+
+            QueryString = url.RequestContext.HttpContext.Request.QueryString.ToString();
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Helpers/StringExtensions.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Text.RegularExpressions;
+
+namespace Stacky.Mvc
+{
+    public static class StringExtensions
+    {
+        public static String HtmlSanitize(this string input)
+        {
+            //Quick and dirty. I am sure there is a better way to do this.
+            if (!string.IsNullOrEmpty(input))
+            {
+                return new Regex("<[^>]+?>").Replace(input, "");
+            }
+            return string.Empty;
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Helpers/UrlHelperExtensions.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Stacky.Mvc
+{
+    public static class UrlHelperExtensions
+    {
+        public static HostSite GetHostSite(this System.Web.Mvc.UrlHelper url)
+        {
+            try
+            {
+                return (HostSite)Enum.Parse(typeof(HostSite), url.RequestContext.RouteData.Values["api"].ToString());
+            }
+            catch
+            {
+                return HostSite.StackOverflow;
+            }
+        }
+
+        public static string GetHostSiteBaseUrl(this System.Web.Mvc.UrlHelper url)
+        {
+            HostSite site = url.GetHostSite();
+            string address = site.GetAddress();
+            if (!string.IsNullOrEmpty(address))
+            {
+                return "http://" + address.Replace("api.", string.Empty);
+            }
+            return string.Empty;
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Models/StackyRepository.cs

+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Web;
+
+namespace Stacky.Mvc.Models
+{
+    public class StackyRepository
+    {
+        private string _apiVersion = string.Empty;
+        private string _apiKey = string.Empty;
+        IUrlClient _urlClient = null;
+        IProtocol _protocol = null;
+        StackyClient _client = null;
+
+        private StackyRepository()
+        {
+            _apiVersion = ConfigurationManager.AppSettings["StackOverflow.Net.ApiVersion"];
+            _apiKey = ConfigurationManager.AppSettings["StackOverflow.Net.ApiKey"];
+            _urlClient = new UrlClient();
+            _protocol = new JsonProtocol();
+        }
+
+        public StackyRepository(SiteState state) : this()
+        {
+            _client = new StackyClient(_apiVersion, _apiKey, state.HostSite, _urlClient, _protocol);
+        }
+
+        public IPagedList<Question> GetQuestions(QuestionSort sortBy = QuestionSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, DateTime? fromDate = null, DateTime? toDate = null, string[] tags = null)
+        {
+            return _client.GetQuestions(sortBy: sortBy, sortDirection: sortDirection, page: page, pageSize: pageSize, includeBody: includeBody, includeComments: includeComments, fromDate: fromDate, toDate: toDate, tags: tags);
+        }
+
+        public Question GetQuestion(int questionId, bool includeBody, bool includeComments)
+        {
+            return _client.GetQuestion(questionId, includeBody, includeComments);
+        }
+
+        public IPagedList<Answer> GetQuestionAnswers(int questionId, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
+        {
+            return _client.GetQuestionAnswers(questionId, sortBy,  sortDirection, page, pageSize, includeBody, includeComments, min, max, fromDate, toDate);
+        }
+    }
+}

trunk/examples/Stacky.Mvc/Stacky.Mvc/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Stacky.Mvc")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Stacky.Mvc")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("eb7f5b0a-2e34-4d83-a7ec-9d04b52e8b30")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

trunk/examples/Stacky.Mvc/Stacky.Mvc/Scripts/Junk.js

+if (top != self) {
+    top.location.replace(document.location);
+    alert("For security reasons, framing is not allowed; click OK to remove the frames.")
+}
+$(function () {
+    $.ajaxSetup({
+        cache: false
+    })
+});
+$.fn.extend({
+    fadeOutAndRemove: function (a) {
+        return this.each(function () {
+            var c = $(this);
+            c.fadeOut("fast", function () {
+                c.remove()
+            })
+        })
+    },
+    charCounter: function (a) {
+        return this.each(function () {
+            $(this).bind("blur focus keyup", function () {
+                var f = a.min;
+                var d = a.max;
+                var g = a.setIsValid ||
+                function () { };
+                var h = this.value ? this.value.length : 0;
+                var e = h > d * 0.8 ? "supernova" : h > d * 0.6 ? "hot" : h > d * 0.4 ? "warm" : "cool";
+                var c = "";
+                if (h == 0) {
+                    c = "enter at least " + f + " characters";
+                    g(false)
+                } else {
+                    if (h < f) {
+                        c = (f - h) + " more to go..";
+                        g(false)
+                    } else {
+                        c = (d - h) + " character" + (d - h != 1 ? "s" : "") + " left";
+                        g(h <= d)
+                    }
+                }
+                $(this).parents("form").find("span.text-counter").text(c).removeClass().addClass("text-counter").addClass(e)
+            })
+        })
+    }
+});
+
+function moveScroller() {
+    var a = function () {
+        var c = $(window).scrollTop();
+        var e = $("#scroller-anchor").offset({
+            scroll: false
+        }).top;
+        var d = $("#scroller");
+        if (c > e) {
+            d.css({
+                position: "fixed",
+                top: "0px"
+            })
+        } else {
+            if (c <= e) {
+                d.css({
+                    position: "relative",
+                    top: ""
+                })
+            }
+        }
+    };
+    $(window).scroll(a);
+    a()
+}
+function enableSubmitButton(a) {
+    setSubmitButtonDisabled(a, false)
+}
+function disableSubmitButton(a) {
+    setSubmitButtonDisabled(a, true)
+}
+function setSubmitButtonDisabled(c, a) {
+    $(c).find("input[type='submit']").attr("disabled", a ? "disabled" : "")
+}
+function setConfirmUnload(a, c) {
+    window.onbeforeunload = a ?
+    function () {
+        if (c && $.trim(c.val())) {
+            return a
+        }
+    } : null
+}
+function showAjaxError(a, d) {
+    var e = $('<div class="error-notification supernovabg"><h2>' + d + "</h2>(click on this box to dismiss)</div>");
+    var c = function () {
+        $(".error-notification").fadeOut("fast", function () {
+            $(this).remove()
+        })
+    };
+    e.click(function (f) {
+        c()
+    });
+    $(a).append(e);
+    e.fadeIn("fast");
+    setTimeout(c, 1000 * 30)
+}
+function styleCode() {
+    if (typeof disableStyleCode != "undefined") {
+        return
+    }
+    var a = false;
+    $("pre code").parent().each(function () {
+        if (!$(this).hasClass("prettyprint")) {
+            $(this).addClass("prettyprint");
+            a = true
+        }
+    });
+    if (a) {
+        prettyPrint()
+    }
+}
+function appendLoader(a) {
+    $(a).append('<img class="ajax-loader" src="' + imagePath + 'ajax-loader.gif" title="loading..." alt="loading..." />')
+}
+function removeLoader() {
+    $("img.ajax-loader").remove()
+}
+function savePreference(c, d, e) {
+    var a = "";
+    if (typeof forUserId != "undefined") {
+        a = forUserId
+    }
+    $.post("/users/save-preference", {
+        fkey: preffkey,
+        key: c,
+        value: d,
+        forUserId: a
+    }, e)
+}
+var notify = function () {
+    var f = 0;
+    var e = -1;
+    var h = "m";
+    var c = function (j) {
+        var i = "<div" + (j.messageTypeId ? ' id="notify-' + j.messageTypeId + '"' : "") + ' style="display:none"><span class="notify-close"<a title="dismiss this notification" onclick="notify.close(' + (j.messageTypeId ? j.messageTypeId : "") + ')">&times;</a></span>' + j.text;
+        if (j.showProfile) {
+            var k = escape("/users/" + j.userId);
+            i += ' See your <a href="/messages/mark-as-read?messagetypeid=' + j.messageTypeId + "&returnurl=" + escape(k) + '">profile</a>.'
+        }
+        i += "</div>";
+        $("#notify-container").append(i)
+    };
+    var d = function (i) {
+        $.cookie(h, (i ? i : "0"), {
+            expires: 90,
+            path: "/"
+        })
+    };
+    var g = function () {
+        var i = parseInt($.cookie(h));
+        if (isNaN(i)) {
+            i = 0
+        }
+        if (i < 5) {
+            $(".module.newuser").show();
+            d(++i)
+        }
+    };
+    var a = function () {
+        $("#notify-container div").fadeIn("slow")
+    };
+    return {
+        showFirstTime: function () {
+            if ($.cookie(h)) {
+                g()
+            } else {
+                $(".module.newuser").show();
+                $("body").css("margin-top", "2.5em");
+                c({
+                    messageTypeId: e,
+                    text: 'First time here? Check out the <a onclick="notify.closeFirstTime()">FAQ</a>!'
+                });
+                a()
+            }
+        },
+        showMessages: function (j) {
+            for (var k = 0; k < j.length; k++) {
+                c(j[k])
+            }
+            f = j.length;
+            a()
+        },
+        show: function (i) {
+            $("body").css("margin-top", "2.5em");
+            c({
+                text: i
+            });
+            a()
+        },
+        close: function (i) {
+            var k;
+            var j = 0;
+            f--;
+            if (i && i != e) {
+                $.post("/messages/mark-as-read", {
+                    messagetypeid: i
+                });
+                k = $("#notify-" + i);
+                if (f > 0) {
+                    j = parseInt($("body").css("margin-top").match(/\d+/));
+                    j = j - (j / (f + 1))
+                }
+            } else {
+                if (i && i == e) {
+                    d()
+                }
+                k = $("#notify-container")
+            }
+            k.fadeOut("fast", function () {
+                $("body").css("margin-top", j + "px");
+                k.remove()
+            })
+        },
+        closeFirstTime: function () {
+            d();
+            document.location = "/faq"
+        }
+    }
+} ();
+
+function applyPrefs(d) {
+    var c = $("#ignoredTags > a");
+    var f = $("#interestingTags > a");
+    if (d && c.length == 0 && f.length == 0) {
+        return
+    }
+    $("div.question-summary").removeClass("tagged-ignored tagged-ignored-hidden tagged-interesting");
+    var g = getTagsSelector(c);
+    var e = getTagsSelector(f);
+    if (g.length > 0) {
+        var a = $("#hideIgnored").is(":checked") ? "tagged-ignored-hidden" : "tagged-ignored";
+        $(g).parents("div.question-summary").addClass(a)
+    }
+    if (e.length > 0) {
+        $(e).parents("div.question-summary").addClass("tagged-interesting")
+    }
+}
+function getTagsSelector(d) {
+    var c = "";
+    var a = "";
+    d.each(function () {
+        var e = false;
+        a = $(this).text();
+        if (a.indexOf("#") > -1) {
+            a = a.replace(/#/g, "ñ")
+        }
+        if (a.indexOf("+") > -1) {
+            a = a.replace(/\+/g, "ç")
+        }
+        if (a.indexOf(".") > -1) {
+            a = a.replace(/\./g, "û")
+        }
+        if (a.indexOf("*") > -1) {
+            e = true
+        }
+        if (e) {
+            c += "div.tags:regex(class, t-" + a.replace(/\*/g, ".*") + "),"
+        } else {
+            c += "div.t-" + a + ","
+        }
+    });
+    if (c.length > 0) {
+        c = c.substring(0, c.length - 1)
+    }
+    return c
+}
+function saveTags(a, j, d, e) {
+    var k = $.trim($(a).val());
+    var g = k.split(" ");
+    var h = false;
+    for (var f = 0; f < g.length; f++) {
+        if ($.trim(g[f]).length != 0) {
+            $(j).children().each(function () {
+                if ($(this).text() == g[f]) {
+                    $(this).fadeTo(500, 0.1).fadeTo(500, 1);
+                    h = true;
+                    return
+                }
+            });
+            if (!h) {
+                var c = $.URLEncode(g[f]);
+                $(j).append('<a id="' + g[f] + '" href="/questions/tagged/' + c + '" class="' + e + '" title="show questions tagged \'' + g[f] + "'\">" + g[f] + "</a> ");
+                initDeleteBindings(d)
+            }
+            h = false
+        }
+    }
+    $(a).val("").focus();