Tuesday, 8 June 2010

N2CMS Meet VWT2OC: Day 3 – Grinding to a Halt!

Well, it was going way too well to last.  It’s become apparent that the existing site is in some sort of half migrated mangled state after the hosting provider changed systems.  This has been like a half-brick to the head as when they’ve tried to fix the issue, more and more keep getting uncovered.  The sites been down for most of the day as a result (and is still down 24 hours later …. curse you WebHost4Life!)

A Change of Plans

Until the hosting issue resolved, I can’t really work on the Membership System, so I’m going to look at implementing n2cms editor addon’s and deploying what I’ve got for client approval. 

My new overall plan of action is:

  • Day 3 – Editor Addons and Deployment
    • Define Skeleton Feature Projects
    • Implement Skeleton Editor Addons
    • Deploy to temporary hosted location for client approval of WIP
  • Day 4 – Membership Model (WebHost4Life willing)
    • Basic Admin Screens for Members
    • Restore Live Site after WebHost4Life have recovered it
  • Day 5 - Import Data
    • Implement Club Member/Membership Data Model in n2cms
    • Initial member import routine from current site
  • Day 6 - Memerships and Member Areas
    • Membership Reports/Maintenance from with N2CMS
    • Initial ‘My Account’ page for front end
  • Day 7 – eCommerce
    • Import Membership Purchasing Mechanism for legacy app
    • Integrate NoChex/Paypal payment gateways
  • Day 8 – Review of Progress and Bug Fixing
    • Review functionality and prioritise urgent issues with work so far
Define Skeleton Feature Projects

The legacy VWT2OC website maintained quite a good seperation between the eCommerce part of paid memberships and the club members it self.  I’d like to try and keep that separation in the new build by creating two new ‘features’ for n2cms: Store and Club.


Each of these will need Editor components as there will be lots of data which isn’t really page related – as well AddOn still UI plugins.  This means that each 'feature’ will need three projects:

  1. A Core Class Library defining the content items and details
  2. A Editor Addon Web Application Project that can be deployed along side N2.Management (which doesn’t need to be deployed as the same application as the front end)
  3. An Addon Project which will add new front end components

These will be deployed into the project using the standard n2cms xcopy-a-like mechanism, so that’s what the build procedure will support.  I’ll develop these features within the VWT2OC Solution with a view of possibly submitting them to the n2cms project later.

The Web Application projects will have the following Post-Build Event defined:

   1: $(SolutionDir)Tools\CodeBehindRemover\CodeBehindRemover /i:$(ProjectDir) /o:$(SolutionDir)Website\ /e:ascx,aspx,master,asmx,ashx
   3: robocopy $(ProjectDir) $(SolutionDir)Website\ /XD .svn obj /XF *.cs *.ascx *.aspx *.master *.asmx *.ashx *.csproj *.sln *.suo *.user *.cache /S
   4: if errorlevel 1 set errorlevel=0

This will mean that there is no ‘hard’ reference between the two new features and the VWT2OC website project.  They will be dropped in to the project and loaded dynamically like every other n2cms addon and extension.

Skeleton Editor Addons

Integration new administration screens to the n2cms editor site is quite simple as all you need to do it decorate a standard page class with the ToolbarPluginAttribute decorator:

   1: namespace N2.Edit.Club
   2: {
   3:     /// <summary>
   4:     /// Lists the Available Club Management features
   5:     /// </summary>
   6:     [ToolbarPluginAttribute("CLUB" // the text to appear next to the icon
   7:         , "club" // the name of the feature (used as a div id wrapping the button)
   8:         , "Club/ClubManagement.aspx" // the page to open
   9:         , ToolbarArea.Navigation //appear in the top leve group of buttons
  10:         , Targets.Navigation // this page is a new menu, so display in the navigation frame
  11:         , "~/N2/Resources/icons/group.png" //the icon to use
  12:         , 110 // sort order - where to appear in the toolbar
  13:         , ToolTip = "Administer Club"
  14:         , AuthorizedRoles = new string[] { "Administrators", "Admin" }
  15:         , GlobalResourceClassName = "Toolbar")
  16:     ]
  17:     public partial class ClubManagement : System.Web.UI.Page
  18:     {
  20:     }
  21: }

This results in a ‘Club’ button in the toolbar which, when clicked, opens the target page in the navigation frame:


Buy giving the links within this page a target of ‘preview’ we can open actual administration screens within the preview frame:

   1: <li><a href="Titles/Titles.aspx" target="preview">Titles</a></li>


Before deploying to a preview location there are a few more tweaks that need to be done for the build process:

  1. Remove any extraneous files/folders from project that may break pre-compilation from the project
    1. \Addons\Demo
    2. \Addons\MyAddon
    3. \Addons\UITests
    4. \Templates\UI\Parts\Statistics.ascx
  2. Add a Web Deployment Project for the VWT2OC project
  3. Configure Web Deployment:
    1. Precompile the UI components
    2. Ensure that SourceWebVirtualPath is ‘/’
    3. Update the connection strings to the preview database
    4. Exclude installation folders and files
    5. Deletion of Temporary files

For your entertainment - this is my modified Web Deployment project file:

   1: <!-- 
   2:   Microsoft Visual Studio 2008 Web Deployment Project 
   3:   http://go.microsoft.com/fwlink/?LinkID=104956
   5: -->
   6: <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   7:   <PropertyGroup>
   8:     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
   9:     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  10:     <ProductVersion>9.0.21022</ProductVersion>
  11:     <SchemaVersion>2.0</SchemaVersion>
  12:     <ProjectGuid>{990B76AF-AC0D-47D8-9D9A-485F4FDED792}</ProjectGuid>
  13:     <SourceWebPhysicalPath>..\Website</SourceWebPhysicalPath>
  14:     <SourceWebProject>{0943038B-9FE4-40C2-93DE-0F9908348EFF}|Website\Website.csproj</SourceWebProject>
  15:     <SourceWebVirtualPath>/</SourceWebVirtualPath>
  16:     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  17:     <DebugSymbols>true</DebugSymbols>
  18:     <EnableUpdateable>false</EnableUpdateable>
  19:     <UseMerge>true</UseMerge>
  20:     <SingleAssemblyName>VWT2OC.Website</SingleAssemblyName>
  21:     <DeleteAppCodeCompiledFiles>false</DeleteAppCodeCompiledFiles>
  22:     <DeleteAppDataFolder>false</DeleteAppDataFolder>
  23:     <UseWebConfigReplacement>true</UseWebConfigReplacement>
  24:   </PropertyGroup>
  25:   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  27:     <OutputPath>.\Debug</OutputPath>
  29:   </PropertyGroup>
  30:   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  32:     <OutputPath>.\Release</OutputPath>
  33:   </PropertyGroup>
  34:   <ItemGroup>
  35:   </ItemGroup>
  36:   <ItemGroup>
  37:     <WebConfigReplacementFiles Include="App_Data\connectionStrings.config.live">
  38:       <Section>connectionStrings</Section>
  39:     </WebConfigReplacementFiles>
  40:     <WebConfigReplacementFiles Include="App_Data\yafnet.config.live">
  41:       <Section>yafnet</Section>
  42:     </WebConfigReplacementFiles>
  43:   </ItemGroup>
  44:   <ItemGroup>
  45:     <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*.*" />
  46:     <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.csproj*" />
  47:     <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\N2\Installation\**\*.*" />
  48:     <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\App_Data\**\*.*" Exclude="$(SourceWebPhysicalPath)\App_Data\*.config*" />
  49:   </ItemGroup>
  50:   <ItemGroup>
  51:     <DeleteAfterBuild Include="$(OutputPath)\App_Data\yafnet.config.live" />
  52:     <DeleteAfterBuild Include="$(OutputPath)\yafnet.config" />
  53:     <DeleteAfterBuild Include="$(OutputPath)\App_Data\connectionStrings.config.live" />
  54:     <DeleteAfterBuild Include="$(OutputPath)\obj\**\*.*" />
  55:     <DeleteAfterBuild Include="$(OutputPath)\bin\*.tmp" />
  56:   </ItemGroup>
  57:   <Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets" />
  58:   <Target Name="AfterBuild">
  59:     <Delete Files="@(DeleteAfterBuild)" />
  60:   </Target>
  61: </Project>

I then modified the build configuration so the deployment project was only built for ‘release’ builds.

No comments:

Post a Comment

Got something to say? Let it out then!
Comments are moderated, so it may take a while to for them to be displayed here!