<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ByteCyclist.com &#187; Programming</title>
	<atom:link href="http://www.bytecyclist.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bytecyclist.com</link>
	<description>A site made of bytes by a cyclist.</description>
	<lastBuildDate>Tue, 20 Sep 2011 20:49:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Json.Net Action Result with Asp.Net MVC</title>
		<link>http://www.bytecyclist.com/2010/10/08/json-dot-net-action-result-with-asp-dot-net-mvc/</link>
		<comments>http://www.bytecyclist.com/2010/10/08/json-dot-net-action-result-with-asp-dot-net-mvc/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 14:00:01 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Json]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=284</guid>
		<description><![CDATA[Well this has probably been done 100 times before but so what, the world could always use more code. When working with ASP.Net MVC I started and fell in love with James Newton-King&#8217;s Json.Net library. It is simple awesome and &#8230; <a href="http://www.bytecyclist.com/2010/10/08/json-dot-net-action-result-with-asp-dot-net-mvc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well this has probably been done 100 times before but so what, the world could always use more code. When working with ASP.Net MVC I started and fell in love with <a href="http://james.newtonking.com/pages/json-net.aspx">James Newton-King&#8217;s Json.Net library</a>.  It is simple awesome and does an amazing job in different parts of my app.  The control over the serialzation and deserialization is very good and thought it would be well suited for my MVC application.</p>
<p>You might be thinking, why not just use the one that comes with .Net. It&#8217;s in the box and is just as good. Well my preference was control, I wanted to control my model better and I wanted to output Json differently in different situations. So I created a new ActionResult that does just that but with the <a href="http://james.newtonking.com/pages/json-net.aspx">Json.Net library</a>.  Enjoy!</p>
<p>Example usage in any controller action:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> ActionResult List<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> Year, <span style="color: #6666cc; font-weight: bold;">int</span> Month<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Year <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
        Year <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Year</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Month <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
        Month <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Month</span><span style="color: #008000;">;</span>
&nbsp;
    var calendarMonth <span style="color: #008000;">=</span> _calendarService<span style="color: #008000;">.</span><span style="color: #0000FF;">GetCalendarMonth</span><span style="color: #008000;">&#40;</span>Year, Month, <span style="color: #008000;">!</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsAdmin</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> JsonNetResult<span style="color: #008000;">&#40;</span>calendarMonth<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The code is below, but it can also be downloaded <a href="http://gist.github.com/gists/606739/download">here</a> and found on <a href="http://github.com">Github</a> <a href="http://gist.github.com/606739">here</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.Mvc</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Newtonsoft.Json</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Newtonsoft.Json.Converters</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> com<span style="color: #008000;">.</span><span style="color: #0000FF;">bytecyclist</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> JsonNetResult <span style="color: #008000;">:</span> ActionResult
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> Encoding ContentEncoding <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> ContentType <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">object</span> Data <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> JsonSerializerSettings SerializerSettings <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> Formatting Formatting <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> JsonNetResult<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            SerializerSettings <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> JsonSerializerSettings<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            SerializerSettings<span style="color: #008000;">.</span><span style="color: #0000FF;">Converters</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> JavaScriptDateTimeConverter<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Formatting <span style="color: #008000;">=</span> Formatting<span style="color: #008000;">.</span><span style="color: #0000FF;">None</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> JsonNetResult<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> data<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Data <span style="color: #008000;">=</span> data<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> ExecuteResult<span style="color: #008000;">&#40;</span>ControllerContext context<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>context <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;context&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            var response <span style="color: #008000;">=</span> context<span style="color: #008000;">.</span><span style="color: #0000FF;">HttpContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span><span style="color: #008000;">;</span>
            response<span style="color: #008000;">.</span><span style="color: #0000FF;">ContentType</span> <span style="color: #008000;">=</span> <span style="color: #008000;">!</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span>ContentType<span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> ContentType <span style="color: #008000;">:</span> <span style="color: #666666;">&quot;application/json&quot;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>ContentEncoding <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                response<span style="color: #008000;">.</span><span style="color: #0000FF;">ContentEncoding</span> <span style="color: #008000;">=</span> ContentEncoding<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Data <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
            var writer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> JsonTextWriter<span style="color: #008000;">&#40;</span>response<span style="color: #008000;">.</span><span style="color: #0000FF;">Output</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> Formatting <span style="color: #008000;">=</span> Formatting <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
            var serializer <span style="color: #008000;">=</span> JsonSerializer<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span><span style="color: #008000;">&#40;</span>SerializerSettings<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            serializer<span style="color: #008000;">.</span><span style="color: #0000FF;">Serialize</span><span style="color: #008000;">&#40;</span>writer, Data<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            writer<span style="color: #008000;">.</span><span style="color: #0000FF;">Flush</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2010/10/08/json-dot-net-action-result-with-asp-dot-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Asp.Net MVC Navigation Menu</title>
		<link>http://www.bytecyclist.com/2010/10/01/simple-asp-net-mvc-navigation-menu/</link>
		<comments>http://www.bytecyclist.com/2010/10/01/simple-asp-net-mvc-navigation-menu/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 19:44:59 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[MVC 2]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=304</guid>
		<description><![CDATA[Well it&#8217;s October first, it has been a really long time since I have last written anything. Oh well. Recently I have been working on applying some updates to an MVC site I maintain, as usual I updated the dependencies, &#8230; <a href="http://www.bytecyclist.com/2010/10/01/simple-asp-net-mvc-navigation-menu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well it&#8217;s October first, it has been a really long time since I have last written anything. Oh well.  Recently I have been working on applying some updates to an MVC site I maintain, as usual I updated the dependencies, ran some tests, and looked over the code.  It&#8217;s been a while since I last opened the project since it has been in production.  Of course, I was not happy with a couple things in the application and was constantly fixing the same bugs in the navigation menu.</p>
<p>There are always the same questions with a navigation menu, how do you render the html, how do you know what item is selected, how to achieve 2 level menus, and how do you trim by security.  To give some history; I went from defining only a single level with no selection (action links in an un-ordered list).  Then I found a project on <a href="http://codeplex.com/">codeplex</a> called <a href="http://mvcsitemap.codeplex.com/">ASP.NET MVC SiteMap Provider</a>, this is great it has a ton of features, fits the provider model of ASP.Net, easy to define and use in simple cases.  Unfortunately, it is not as mature as I would like.  Plus it adds another dependency that is hard to work with and does not always work the way I would expect it to.  Needless to say it is buggy (my opinion and experience only, others may differ).</p>
<p>Which brings me to my subject line.  I wanted to create my own navigation system and have full control over the levels, rendering and selection of the items. Perfect, I needed a partial to render the menu and top level items in my own un-ordered list. I also needed some helpers to render those items in my partial, in this case the top level is a list of my controllers.</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;">&lt;ul id=&quot;navigation&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Home&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Calendar&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Media&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Messages&quot;</span>, <span style="color: #cc0000;">&quot;Forum&quot;</span>, <span style="color: #cc0000;">&quot;Index&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Goods&quot;</span>, <span style="color: #cc0000;">&quot;Catalog&quot;</span>, <span style="color: #cc0000;">&quot;Index&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Links&quot;</span>, <span style="color: #cc0000;">&quot;Link&quot;</span>, <span style="color: #cc0000;">&quot;Index&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Contact&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">LoginStatusNavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span>
&lt;/ul&gt;
&nbsp;
&lt;div class=&quot;clearboth&quot;&gt;&lt;/div&gt;
&nbsp;
&lt;ul id=&quot;subnavigation&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">SubNavListItems</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">NavItem</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Join Our Mailing List!&quot;</span>, <span style="color: #cc0000;">&quot;Contact&quot;</span>, <span style="color: #cc0000;">&quot;MailingList&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span>
&lt;/ul&gt;</pre></div></div>

<p>I also added a helper to render the login/logout link in the navigation based on whether the request was authenticated.  The second level navigation was where the work came in. Essentially I wanted to render some of the actions from the current controller based on a attribute assigned to the action. The rending will then sort the list based on the sort order and perform security trimming.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>NavigationItem<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;About Us&quot;</span>, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> ActionResult Index<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> View<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Index&quot;</span>, GetIndexModel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#91;</span>NavigationItem<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Secured Page&quot;</span>, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>, Authorize<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> ActionResult Admin<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> View<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Index&quot;</span>, GetIndexModel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>In order to do that I created a custom Attribute to store the link text and the order it should be in.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>AttributeUsage<span style="color: #008000;">&#40;</span>AttributeTargets<span style="color: #008000;">.</span><span style="color: #0000FF;">Method</span>, Inherited <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span>, AllowMultiple <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #0600FF; font-weight: bold;">sealed</span> <span style="color: #6666cc; font-weight: bold;">class</span> NavigationItemAttribute <span style="color: #008000;">:</span> Attribute
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> NavigationItemAttribute<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> text<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#40;</span>text, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> NavigationItemAttribute<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> text, <span style="color: #6666cc; font-weight: bold;">int</span> order<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Text <span style="color: #008000;">=</span> text<span style="color: #008000;">;</span>
        SortOrder <span style="color: #008000;">=</span> order<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Text <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> SortOrder <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>After that I needed a way to cache all this information in order to look it up later from my helpers. Populating this cache involves doing some basic reflection and type checking of controller actions. Then storing the results in a dictionary based on controller name as the key and a list of actions with the NavigationItemAttribute (stored as a ControllerNavigationItem, which is a POCO object to store data).  Since I only wanted to do this reflection once, I created a singleton to do the work.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">sealed</span> <span style="color: #6666cc; font-weight: bold;">class</span> ControllerNavigationItemCollection
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> ControllerNavigationItemCollection _instance<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">object</span> padlock <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> IDictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, IEnumerable<span style="color: #008000;">&lt;</span>ControllerNavigationItem<span style="color: #008000;">&gt;&gt;</span> Controllers <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
    ControllerNavigationItemCollection<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Controllers <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, IEnumerable<span style="color: #008000;">&lt;</span>ControllerNavigationItem<span style="color: #008000;">&gt;&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        PopulateCollection<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> PopulateCollection<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var asm <span style="color: #008000;">=</span> Assembly<span style="color: #008000;">.</span><span style="color: #0000FF;">GetExecutingAssembly</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        var controllers <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">from</span> t <span style="color: #0600FF; font-weight: bold;">in</span> asm<span style="color: #008000;">.</span><span style="color: #0000FF;">GetTypes</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                           <span style="color: #0600FF; font-weight: bold;">where</span>
                               <span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>Controller<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsAssignableFrom</span><span style="color: #008000;">&#40;</span>t<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span>
                               <span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>Controller<span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> t
                           <span style="color: #0600FF; font-weight: bold;">select</span> t<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToList</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        controllers<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">ForEach</span><span style="color: #008000;">&#40;</span>t <span style="color: #008000;">=&gt;</span> Controllers<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>t<span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span>, GetControllerNavItems<span style="color: #008000;">&#40;</span>t<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> IEnumerable<span style="color: #008000;">&lt;</span>ControllerNavigationItem<span style="color: #008000;">&gt;</span> GetControllerNavItems<span style="color: #008000;">&#40;</span>Type controllerType<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var controllerDescriptor <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ReflectedControllerDescriptor<span style="color: #008000;">&#40;</span>controllerType<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        var actions <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">from</span> a <span style="color: #0600FF; font-weight: bold;">in</span> controllerDescriptor<span style="color: #008000;">.</span><span style="color: #0000FF;">GetCanonicalActions</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                       let subNavAttr <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>NavigationItemAttribute<span style="color: #008000;">&#41;</span>a<span style="color: #008000;">.</span><span style="color: #0000FF;">GetCustomAttributes</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>NavigationItemAttribute<span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SingleOrDefault</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                       let authorize <span style="color: #008000;">=</span> a<span style="color: #008000;">.</span><span style="color: #0000FF;">GetCustomAttributes</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>AuthorizeAttribute<span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SingleOrDefault</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                       <span style="color: #0600FF; font-weight: bold;">where</span> a<span style="color: #008000;">.</span><span style="color: #0000FF;">IsDefined</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>NavigationItemAttribute<span style="color: #008000;">&#41;</span>, <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span>
                       <span style="color: #0600FF; font-weight: bold;">select</span> <span style="color: #008000;">new</span> ControllerNavigationItem
                       <span style="color: #008000;">&#123;</span>
                           Action <span style="color: #008000;">=</span> a<span style="color: #008000;">.</span><span style="color: #0000FF;">ActionName</span>,
                           Controller <span style="color: #008000;">=</span> a<span style="color: #008000;">.</span><span style="color: #0000FF;">ControllerDescriptor</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ControllerName</span>,
                           IsSecure <span style="color: #008000;">=</span> authorize <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span>,
                           SortOrder <span style="color: #008000;">=</span> subNavAttr<span style="color: #008000;">.</span><span style="color: #0000FF;">SortOrder</span>,
                           Text <span style="color: #008000;">=</span> subNavAttr<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span>
                       <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AsEnumerable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> actions<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> ControllerNavigationItemCollection Current
    <span style="color: #008000;">&#123;</span>
        get
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">lock</span> <span style="color: #008000;">&#40;</span>padlock<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> _instance <span style="color: #008000;">??</span> <span style="color: #008000;">&#40;</span>_instance <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ControllerNavigationItemCollection<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Finnaly to render the second level navigation I look up the list based on the current controller and loop over the items, only rendering the secure and authenticated items or the public items in the order defined by the attribute.</p>
<p>In hindsight, there are some things I could have made better or more features I could support. Currently it just checks to see if your logged in and doesn&#8217;t take into account any specific roles on the action.  Also it lacks support for MVC 2 Areas, but I don&#8217;t have any yet so I will cross that bridge when I get to it. This solution was simply an exercise for me in creating a singleton, using reflection to find controllers and actions, and to fill a common need in an ASP.Net MVC application.  Hope you found this interesting or useful.</p>
<p>Download the code <a href="http://gist.github.com/gists/606514/download">here</a> or check out the <a href="http://gist.github.com/606514">Gist</a> on <a href="http://github.com">Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2010/10/01/simple-asp-net-mvc-navigation-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jMonthCalendar Options, Events, &amp; Methods Documentation</title>
		<link>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-options-events-methods-documentation/</link>
		<comments>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-options-events-methods-documentation/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 21:09:05 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=264</guid>
		<description><![CDATA[In this post I am going to cover all the custom event/options as well as methods that can be configured and used in jMonthCalendar. All of these are options that can be supplied at initialization in order to manipulate the &#8230; <a href="http://www.bytecyclist.com/2009/08/09/jmonthcalendar-options-events-methods-documentation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this post I am going to cover all the custom event/options as well as methods that can be configured and used in jMonthCalendar.  All of these are options that can be supplied at initialization in order to manipulate the calendar further or be able to tie into some additional logic ot rules.  As well as methods that are exposed for manipulating the calendar after initialization.  This is my first attempt at formal documentation, so bare with me.</p>
<p><span id="more-264"></span></p>
<h2>Options</h2>
<h3>containerId &#8211; default: #jMonthCalendar</h3>
<p>Use this to configure where your calendar should be placed in the page. You must have a matching DOM element with the ID</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> containerId<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#MyContainerId'</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>headerHeight &#8211; default: 50</h3>
<p>This sets the height of the navigation header.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> headerHeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">50</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>firstDayOfWeek &#8211; default: 0</h3>
<p>This determines which day of the week weeks should start on (default 0 refers to sunday). Monday is 1, Tuesday is 2, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> firstDayOfWeek<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>calendarStartDate &#8211; default: new Date()</h3>
<p>This determines which month to display when the calendar is first loaded. The default is to start in the current month (today).</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> calendarStartDate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2009</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>dragableEvents &#8211; default: true</h3>
<p>This determines weather or not you want event blocks to be dragable. Note this depends on jquery.ui.dragable.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> dragableEvents<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>dragHoverClass &#8211; default: &#8216;DateBoxOver&#8217;</h3>
<p>This is the css class that is added when an element is being hovered over an acceptable date cell.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> dragHoverClass<span style="color: #339933;">:</span> <span style="color: #3366CC;">'SomeCssClass'</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>navLinks (object of values)</h3>
<p>These are the label text and switches to determine the header navigation.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> 	
	navLinks<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		enableToday<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		enableNextYear<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		enablePrevYear<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		p<span style="color: #339933;">:</span><span style="color: #3366CC;">'&amp;lsaquo; Prev'</span><span style="color: #339933;">,</span> 
		n<span style="color: #339933;">:</span><span style="color: #3366CC;">'Next &amp;rsaquo;'</span><span style="color: #339933;">,</span> 
		t<span style="color: #339933;">:</span><span style="color: #3366CC;">'Today'</span><span style="color: #339933;">,</span>
		showMore<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Show More'</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Events</h2>
<h3>onMonthChanging</h3>
<p>This event is triggered upon changing the calendar&#8217;s month. If the callback function returns false, the change will be prevented. Note: this would be an excelent point to do an AJAX call for the next months events.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// supply this callback as an option with the collowing signature</span>
$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onMonthChanging<span style="color: #009900;">&#40;</span>newDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> ... <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// AJAX call sample for more events</span>
$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onMonthChanging<span style="color: #009900;">&#40;</span>newDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onMonthChanged</h3>
<p>This event is triggered after calendar&#8217;s month has been changed.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onMonthChanged<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> newDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> ... <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onEventLinkClick</h3>
<p>This event is triggered when the anchor tag of the event is clicked. Note: good place to link out to another page.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onEventLinkClick<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onEventBlockClick</h3>
<p>This event is triggered when the div container of the event is clicked. Note: this our the link click would be a good place to show tooltips.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onEventBlockClick<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onEventBlockOver</h3>
<p>This event is triggered when your mouse is over the event div container.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onEventBlockOver<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onEventBlockOut</h3>
<p>This event is triggered when you mouse moves off the event div container.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onEventBlockOut<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onDayLinkClick</h3>
<p>This event is triggered when the user clicks on the label of the day (number in upper right corner)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onDayLinkClick<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onDayCellClick</h3>
<p>This event is triggered when the user clicks on the cell that contains the event div containers.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onDayCellClick<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onDayCellDblClick</h3>
<p>This event is triggered wehn the user double clicks ont eh cell that contains the event div containers.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onDayCellDblClick<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onEventDropped</h3>
<p>This event is fired after a user drags and drops and event onto a new day.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onEventDropped<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> calEvent<span style="color: #339933;">,</span> newDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>calEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>newDate<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>onShowMoreClick</h3>
<p>This event is triggered when the user wishes to &#8220;see more&#8221; events than what can be displayed in the cell. Note: this would be a good place to use a tooltip or dialog as well.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    onShowMoreClick<span style="color: #009900;">&#40;</span>dayEvents<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #006600; font-style: italic;">// dayEvents is an array of events </span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>dayEvents.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Methods</h3>
<h3>Initialize(options, eventArray)</h3>
<p>This is the main method needed to be called to get a calendar on the page. You can initialize it with the options and event callbacks mentioned above to get a more custom plugin.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> containerId<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#MyContainerId'</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>ChangeMonth(newDate)</h3>
<p>This method will change the current selected month of the calendar. This method will fire the callback onMonthChanging and onMonthChanged.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">ChangeMonth</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2009</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>ReplaceEventCollection(eventArray)</h3>
<p>This will replace all events in the plugin with the new event array passed in. This will clear all existing events being displayed and redraw all the events after the replacement.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">ReplaceEventCollection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>AddEvents(eventArray)</h3>
<p>This method will add a single event to the plugin or an array of events by merging into the existing array of events. After which the method will clear all visible event on the calendar and draw the events in the updated array.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">AddEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>ClearEventsOnCalendar()</h3>
<p>This method will remove all the events in the plugin and and remove any being displayed.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">ClearEventsOnCalendar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-options-events-methods-documentation/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>jMonthCalendar-1.3.2-beta Release</title>
		<link>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-132-beta-release/</link>
		<comments>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-132-beta-release/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 06:21:36 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/2009/08/09/jmonthcalendar-132-beta-release/</guid>
		<description><![CDATA[I have released a new version of jMonthCalendar (1.3.2-beta). Below I will provide a sample of the use of event callback as options. Well this release is pretty straight forward for the most part. It includes changes to how the &#8230; <a href="http://www.bytecyclist.com/2009/08/09/jmonthcalendar-132-beta-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have released a new version of jMonthCalendar (1.3.2-beta).  Below I will provide a sample of the use of event callback as options.  Well this release is pretty straight forward for the most part.  It includes changes to how the custom events are fired mostly and addresses various bug fixes.  As well as includes some reduction in file size. <b>UPDATE</b> Beta2 is released to fix some minor bug issues.</p>
<p><span id="more-260"></span><br />
Download location: <a href="http://jmonthcalendar.googlecode.com/files/jMonthCalendar-1.3.2-beta.zip" target="_blank">jMonthCalendar-1.3.2-Beta</a></p>
<p>The biggest change in this release is how events are handled.  Before I was not passing the DOM event back to you for control, I was simply just calling the methods you configured as options and passing parameters.  Now, the original DOM event is bubbled up to the custom event in most cases.  Along with the original DOM event I am also stuffing in the custom data for the callback into the <a href="http://docs.jquery.com/Events/jQuery.Event" target="_blank">jQuery event object</a>.</p>
<p>jQuery provides a nice way of encapsulating the original DOM event into a <a href="http://docs.jquery.com/Events/jQuery.Event" target="_blank">jQuery event object</a>.  A property on that object is &#8216;data&#8217; (which can be waht ever I want).  So now, all custom events are mostly passed one single parameter (with the exception of onMonthChanging and onShowMoreClick); the jquery typed event.  Inside that event object I have put the data I want to send back, like the date or event object clicked on.  Don&#8217;t worry I will get to a sample of what I am talking about.</p>
<p>First I will start off by showing you the old way of doing it prior to this release.</p>
<h3>OLD Way</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        onMonthChanging<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// this could be an Ajax call to the backend to get this months events</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;on month changing&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #006600; font-style: italic;">// $.jMonthCalendar.ReplaceEventCollection(events);</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        onEventLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>calEvent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #006600; font-style: italic;">// calEvent will be the calendar event you clicked on</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;event link click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        onDayLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #006600; font-style: italic;">// date might be wrong here, held reference from last item</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>dateIn.<span style="color: #660066;">toLocaleDateString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    $.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Okay, so the obvious problem with that is that there is no way to get to the original DOM event.</p>
<h3>NEW recommended Way</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        onMonthChanging<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// this could be an Ajax call to the backend to get this months events</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;on month changing&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #006600; font-style: italic;">// $.jMonthCalendar.ReplaceEventCollection(events);</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        onEventLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #006600; font-style: italic;">// event is the jQuery event passed</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;event link click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #006600; font-style: italic;">// can get to the actual calendar event now through the Data property</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #006600; font-style: italic;">// want to prevent event bubbling use:</span>
            event.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        onDayLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">data</span>.<span style="color: #660066;">Date</span>.<span style="color: #660066;">toLocaleDateString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    $.<span style="color: #660066;">jMonthCalendar</span>.<span style="color: #660066;">Initialize</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/08/09/jmonthcalendar-132-beta-release/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Getting Started with jMonthCalendar</title>
		<link>http://www.bytecyclist.com/2009/06/12/getting-started-with-jmonthcalendar/</link>
		<comments>http://www.bytecyclist.com/2009/06/12/getting-started-with-jmonthcalendar/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 17:46:38 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jMonthCalendar]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=222</guid>
		<description><![CDATA[So you are interested in using jMonthCalendar and are unsure how to start using it&#8230;? Well hopefully I can give the 5 minute startup that will help you along the way. In this post I will show you how to &#8230; <a href="http://www.bytecyclist.com/2009/06/12/getting-started-with-jmonthcalendar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you are interested in using jMonthCalendar and are unsure how to start using it&#8230;?  Well hopefully I can give the 5 minute startup that will help you along the way.  In this post I will show you how to install and place a calendar on the page as well as show you how to populate the calendar with some events. Easy enough right?  I hope so.</p>
<p><span id="more-222"></span><br />
Getting started with jMonthCalendar is really quite easy, it is like any other Javascript library or jQuery plugin in that it requires a Javascript file and reference in the page.</p>
<h3>Step 1 &#8211; Download</h3>
<p>Well you will first need a copy of jQuery if you don&#8217;t already have one, I recomend jQuery 1.3.2 which can be found <a href="http://docs.jquery.com/Downloading_jQuery#Current_Release" target="_blank">here</a>, you either want the uncompressed version or the compressed version depending on your preferences.</p>
<p>You will will also need a copy of jMonthCalendar which can be downloaded <a href="http://jmonthcalendar.googlecode.com/files/jMonthCalendar-1.3.1-beta.zip">here</a>.  The download contains the Javascript files, a sample html page, and some default css (which can be changed to suit your needs).</p>
<h3>Step 2 &#8211; Include in Html</h3>
<p>After the files are downloaded you will want to move them to a directory in your project/website that can be references either relativley or absolutly.  You&#8217;ll want to include a reference to the jQuery file you downloaded as well as the jMonthCalendar plugin.  You can place these references in the head of the html or the body, with Javascript it is all the same. You&#8217;ll want to put these two line in your html document:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jMonthCalendar.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>If you want to use the default styles now is the time to either copy the contents of the core.css (from the jMonthCalendar download) into your css file or include a reference in the head like so:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;css/core.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<h3>Step 3 &#8211; Create place holder in the Html body</h3>
<p>In order to draw the calendar on to the page, the plugin needs to know where to put it.  Add and empty div tag someplace in the body of the html like so: (The ID of the div is VERY important, you can change the ID but you must tell the plugin what it should look for through the options.)</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jMonthCalendar&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h3>Step 4 &#8211; Initialize calendar on page load.</h3>
<p>To draw the calendar after the page has loaded you will need to hook up that standard jQuery onLoad event.  This usually happens once on the page and is surrounded in a script block at either the top or the bottom of the page.  The safest place to do this is with another script block right after step 2.  This will create the calendar and draw it on the screen using the empty div you created in step 3.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
    $().ready(function() {
	$.jMonthCalendar.Initialize(null, null);
    });
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Thats it! That is all you need to do in order to display the calendar on te page. There are of course configurable options and events that you can tie into to perform advanced operations but I will save that for another post. The next topic I will cover is, &#8220;okay now what&#8230;&#8221;, how to load events into the calendar.</p>
<p><b>Update:</b> Added the first bits of documentation for the plugin <a href="http://www.bytecyclist.com/2009/08/09/jmonthcalendar-options-events-methods-documentation/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/06/12/getting-started-with-jmonthcalendar/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>jMonthCalendar 1.3.0 Beta</title>
		<link>http://www.bytecyclist.com/2009/06/12/jmonthcalendar-130-beta/</link>
		<comments>http://www.bytecyclist.com/2009/06/12/jmonthcalendar-130-beta/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 17:45:50 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=219</guid>
		<description><![CDATA[jMonthCalendar has reached a new milestone! It now supports multi-day events (events that span multiple days). Plus it retains all the same features as before including drag and drop and event stacking. This release is a huge change from the &#8230; <a href="http://www.bytecyclist.com/2009/06/12/jmonthcalendar-130-beta/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>jMonthCalendar has reached a new milestone!</strong> It now supports multi-day events (events that span multiple days).  Plus it retains all the same features as before including drag and drop and event stacking. This release is a huge change from the previous version and is thus labeled as Beta.  Most significant to the change is how events are rendered onto the calendar. In this post I am going to go over the new features and how they will affect existing users. I will also try to cover some of the new functionality and how it might be used.<span id="more-219"></span></p>
<p><strong>Change Log</strong></p>
<ul>
<li>Events that span multiple days with continuation over days, weeks, months, years.</li>
<li>jQuery 1.3.2 Support</li>
<li>Events are now pre-sorted for multi day events on top.</li>
<li>&#8220;Show More Events&#8221; setting/hoot that passes the days worth of event object as an array.</li>
<li>Start of jQuery UI theme support, arrows for spanning events.</li>
<li>Removed initialize for static height and width, now all set on the main calendar using CSS (everything else is dynamic).</li>
<li>Note: you must specify an EventID in the event objects, they are required now.</li>
</ul>
<p>The biggest change to this release is the fact that multi-day events are being drawn now. In order to add this I had to make a huge amount of changes under the hood and thus I am adding a Beta to the release to warn people.Ã‚Â  At the same time I want to see how it behalves for people and fix any issues people might have.</p>
<p>In the last release events were being appended into the table cell tag of the specified day. This created huge problems as you can&#8217;t do a column span on the event easily, plus how are you supposed to handle overflow and events that wrap over weeks or months. So I chose to rewrite how the events were drawn and make them absolutely positioned. I also added an object for each day on the calendar and set some properties, that made it a lot easier to reference the object from an array and grab the days worth of events.</p>
<p>Some people may look into this and think that I have missed how to display &#8220;More Events&#8221; (events that overflow the day). I have left this out and added a hook instead. I was unable to settle on an implementation and with so many other good balloon pop ups, I thought I would leave it up to you. There is a new hook called onShowMoreClick that passes an array of events to it. The array of events is a representation to all the events for that day, including the non-visible ones. I hope to provide a series of usage posts on how this might be done using my favorite plugins.</p>
<p>One last piece of information is regrading drag and drop events. They are supported with multi-day events even. They will fire the same hooks as in the past: onEventDropped (passing the event and the new date).</p>
<p>Please let me know what you think in the comments, I am very proud of where this plugin has come so far and hope to keep pushing it&#8217;s feature set. If you experience any issues please feel free to leave a comment, email, or better yet; file an issue over at the Google Code Home page.</p>
<p><strong>Download jMonthCalendar 1.3.0 Beta:</strong></p>
<p><a href="http://www.bytecyclist.com/wp-content/uploads/2009/06/jmonthcalendar-130-beta.zip">jmonthcalendar-130-beta Direct Download<br />
</a></p>
<p><a href="http://jmonthcalendar.googlecode.com/files/jMonthCalendar-1.3.0-beta.zip" target="_blank">Google Code</a><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/06/12/jmonthcalendar-130-beta/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>log4net Dynamic Properties in XML Configuration.</title>
		<link>http://www.bytecyclist.com/2009/06/12/log4net-dynamic-properties-in-xml-configuration/</link>
		<comments>http://www.bytecyclist.com/2009/06/12/log4net-dynamic-properties-in-xml-configuration/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 17:34:17 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=211</guid>
		<description><![CDATA[I just learned about a new feature today of log4net that would have saved me a few hours of time had I known or been able to find this earlier.Ã‚Â  I learned that you can have dynamic properties stored into &#8230; <a href="http://www.bytecyclist.com/2009/06/12/log4net-dynamic-properties-in-xml-configuration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just learned about a new feature today of log4net that would have saved me a few hours of time had I known or been able to find this earlier.Ã‚Â  I learned that you can have dynamic properties stored into log4net&#8217;s global context from code and then access them from the XML configuration file. This is useful in the case where dynamic configuration of log4net is needed.<span id="more-211"></span></p>
<p><strong>My Case:</strong> I have been building console application that will run nightly to sync some integration records and I wanted to setup logging in order to see that status of the job and gather some reporting information (counts, time run, etc).Ã‚Â  There was a catch though this process would run multiple times in a night but each time for a different customer.Ã‚Â  This would make it difficult to read the logs for a particular customer as all I would have to go on is the file date and time.</p>
<p>I needed a way to break my log files into different customers yet retain the rolling file appender features of log4net.Ã‚Â  My first pass at with was to configure log4net using the basic configurator all in code and create the appender, with a dynamic file name, and set the level of the logger programitacally. This was not my preferred way but was my only hope to getting the application out of developement. Then I found how to set properties into log4net&#8217;s global context and access them through the configuration file. I did run into a small problem that my app.config file was not being read in so I had to add these two variable to my assembly.</p>
<pre lang="C#">
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
[assembly: log4net.Config.Repository]
</pre>
<p>My goal was to make the file name dynamic based on the CustomerID passed into the application. Please not the file tag as it is the ticket to my case.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;root<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;level</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;INFO&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender-ref</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;RollingLogFileAppender&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/root<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- New Log File once per execution --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;RollingLogFileAppender&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Appender.RollingFileAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Util.PatternString&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;logs\logFile_%property{BrokerID}.txt&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> <span style="color: #808080; font-style: italic;">&lt;!-- Awesomeness --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appendToFile</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rollingStyle</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Size&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maxSizeRollBackups</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maximumFileSize</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;50GB&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;layout</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Layout.PatternLayout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;conversionPattern</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;%date [%thread] %-5level %logger - %message%newline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Here is a sample of my log4net configuration section.  Please note the file tag and type attribute to be log4net.Util.PatternString. The pattern of the value is important to, it must be %property{property_name} to get the right replacement. This is the ticket to dynamic values.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> InitLogger<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">//This is freaking awesome, put a property into the log4net context and using the </span>
    <span style="color: #008080; font-style: italic;">//  log4net.Util.PatternString type you can dynamically set values for the logging context from code.</span>
    log4net<span style="color: #008000;">.</span><span style="color: #0000FF;">GlobalContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Properties</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;CustomerID&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>CustomerID<span style="color: #008000;">!=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> CustomerID<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">:</span> <span style="color: #666666;">&quot;Error&quot;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Here is an example of my small InitLogger.  This method is the very first item to be called when the main routine starts up. All that needs to be done now is get a logger and start logging.  A file will be created based on the CustomerID which in this case is retrieved from the command line arguments before InitLogger is called. If no CustomerID is passed in than the file will be to logFile_Error.txt</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> ILog Logger<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>args<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
        CustomerID<span style="color: #008000;">=</span> Util<span style="color: #008000;">.</span><span style="color: #0000FF;">GetInt</span><span style="color: #008000;">&#40;</span>args<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    InitLogger<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    Logger <span style="color: #008000;">=</span> LogManager<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLogger</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Process&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Pretty cool I think, I hope this saves people some headaches.  I wish I would have found this a few days ago.  Oh well it is to my benefit to learn.  Happy coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/06/12/log4net-dynamic-properties-in-xml-configuration/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jMonthCalendar: Minor Release 1.2.2</title>
		<link>http://www.bytecyclist.com/2009/05/01/jmonthcalendar-minor-release-122/</link>
		<comments>http://www.bytecyclist.com/2009/05/01/jmonthcalendar-minor-release-122/#comments</comments>
		<pubDate>Fri, 01 May 2009 15:02:06 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=197</guid>
		<description><![CDATA[Well it has been awhile since I posted anything new so I thought that I would provide a rundown of the minor new features and fixes in jMonthCalendar 1.2.2 New Features: Dragable Events support using jQuery UI (Optional usage). Add &#8230; <a href="http://www.bytecyclist.com/2009/05/01/jmonthcalendar-minor-release-122/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well it has been awhile since I posted anything new so I thought that I would provide a rundown of the minor new features and fixes in jMonthCalendar 1.2.2<span id="more-197"></span></p>
<p>New Features:</p>
<ul>
<li>Dragable Events support using jQuery UI (Optional usage).</li>
<li>Add ability to enable or disable calendar links (today link, next year, and previous year).</li>
<li>Default Next and Previous link text changed.</li>
<li>Added onDayCellDblClick event that passes the date you are double clicking.</li>
<li>Added onEventDropped event that passes the event object and the new date being dropped into.</li>
<li>Removed my custom Date extensions and replaced it with <a href="http://www.datejs.com/">Datejs</a>, more on this below.</li>
<li>Complete Build Process to build, pack and minify the source.</li>
</ul>
<p>The drag and drop stuff is pretty cool and makes the calendar even slicker.  Have to provide props to the reader (<a href="http://mattias-jakobsson.net/Item/19/Extended%20jMonthCalendar%20with%20drag%20n%20drop">Mattias Jakobsson</a>) who took it upon their own to add it in.  With the addition of the event when the event is dropped this would allow a developer to update an event using AJAX, allowing the user to easily reorganize events.  jQuery UI is not a dependency and this feature is totally optional.</p>
<p>As for the date extension stuff, it was not something I wanted to maintain, and didn&#8217;t use that often.  I hope to add another option in the setup to allow for a date parsing options on the inbound JSON.</p>
<p>Another item I am proud of is a unified build process.  I wanted to make releases as easy as possible so I thought I would spend some time learning ANT and looking at other scripts (jQuery, Dojo, and other projects for JavaScript).  I managed to write a pretty neat ANT script that will produce all the artifacts for a release and zip it up.  I will save the details for another post.</p>
<p>The last point I will mention is now the ability to override the navigation links and turn them on or off depending on your usage.  This was asked for and was a simple addition to source.  If you have any suggestions, send them along I will add them in to the source if I feel they fit the project goal.  Below is an updated definition of all the options available for the plugin.</p>
<p>FYI: The next release will make a change in how the calendar is sized and will absolutely position events over the calendar for Multi Day Event capabilities.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	height<span style="color: #339933;">:</span> <span style="color: #CC0000;">650</span><span style="color: #339933;">,</span>
	width<span style="color: #339933;">:</span> <span style="color: #CC0000;">980</span><span style="color: #339933;">,</span>
	navHeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span>
	labelHeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span>
	firstDayOfWeek<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
	calendarStartDate<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	dragableEvents<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	activeDroppableClass<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	hoverDroppableClass<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	navLinks<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		enableToday<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		enableNextYear<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		enablePrevYear<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		p<span style="color: #339933;">:</span><span style="color: #3366CC;">'&amp;lsaquo; Prev'</span><span style="color: #339933;">,</span> 
		n<span style="color: #339933;">:</span><span style="color: #3366CC;">'Next &amp;rsaquo;'</span><span style="color: #339933;">,</span> 
		t<span style="color: #339933;">:</span><span style="color: #3366CC;">'Today'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onMonthChanging<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onMonthChanged<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onEventLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onEventBlockClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onEventBlockOver<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onEventBlockOut<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onDayLinkClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>date<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onDayCellClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>date<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onDayCellDblClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dateIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	onEventDropped<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> newDate<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	locale<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		days<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;Sunday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Monday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Tuesday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Wednesday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Thursday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Friday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Saturday&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sunday&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		daysShort<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;Sun&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Mon&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Tue&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Wed&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Thu&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Fri&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sat&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sun&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		daysMin<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;Su&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Mo&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Tu&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;We&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Th&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Fr&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sa&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Su&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		months<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;January&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;February&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;March&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;April&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;May&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;June&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;July&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;August&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;September&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;October&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;November&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;December&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		monthsShort<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;Jan&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Feb&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Mar&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Apr&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;May&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Jun&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Jul&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Aug&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Sep&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Oct&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Nov&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Dec&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		weekMin<span style="color: #339933;">:</span> <span style="color: #3366CC;">'wk'</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/05/01/jmonthcalendar-minor-release-122/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>New Project Home For jMonthCalendar</title>
		<link>http://www.bytecyclist.com/2009/03/24/new-project-home-for-jmonthcalendar/</link>
		<comments>http://www.bytecyclist.com/2009/03/24/new-project-home-for-jmonthcalendar/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 00:07:34 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=181</guid>
		<description><![CDATA[It has been awhile since I have had anything to announce with jMonthCalendar. I have been quite busy lately and have been procrastinating at bug fixes and enhancements. Lately, I&#8217;ve been working on an idea to set up project wiki, &#8230; <a href="http://www.bytecyclist.com/2009/03/24/new-project-home-for-jmonthcalendar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It has been awhile since I have had anything to announce with jMonthCalendar.  I have been quite busy lately and have been procrastinating at bug fixes and enhancements.  Lately, I&#8217;ve been working on an idea to set up project wiki, issue, and source management system using  <a href="http://www.redmine.org/">Redmine</a> and Subversion.  My current host does not play well with Subversion and was lacking on memory and access needed to run <a href="http://www.redmine.org/">Redmine</a> the way I wanted.  So I have moved the project and source over to Google Code.<span id="more-181"></span></p>
<p>A few weeks ago I started down the path of setting up a new server/host using <a href="http://www.slicehost.com/">SliceHost</a> for the purpose of installing a Subversion server and a RoR application <a href="http://www.redmine.org">Redmine</a>.  They are great, I can&#8217;t speak anymore highly of their product.Ã‚Â  Everything got setup and installed perfectly as expected.  I got the RoR app up quickly using <a href="http://www.modrails.com/">Phusion Passenger</a> which saved me a ton of pain.</p>
<p>Unfortunately I went to sleep worrying about how I was going to manage an application, open source project and still keep a secure Subversion repository and server while still being able to develop. The other night I decided I would save some and make by life simpler by moving the project over to code.google.com and ditch my slice.Ã‚Â  Google Code will, now going forward, provide jMonthCalendar a project home, wiki, issues, downloads and Subversion source control. It currently allows anonymous Subversion browsing and the ability to add members to the project for collaborative development.  Google code offers everything I would need for an open source project, allowing me to focus on the fun stuff, coding. Along with the new project home I also created a Google Group (found below) for open discussion, support, suggestions, etc.  Please feel free to stop buy and check it out.</p>
<p>Comments and suggestions will be greatly appreciated, also if you are currently using jMonthCalendar please let me know, I would love to feature/link your site on the home page.Ã‚Â  Happy Coding.</p>
<blockquote><p><strong>If you are interested in jMonthCalendar or looking for the new details, please see below.</strong><br />
<strong>Latest Release:</strong> jMonthCalendar 1.2.1 (bug fixes)<br />
<strong>Downloads:</strong> <a href="http://code.google.com/p/jmonthcalendar/downloads/list" target="_blank">http://code.google.com/p/jmonthcalendar/downloads/list</a><br />
<strong>Project home:</strong> <a href="http://code.google.com/p/jmonthcalendar/" target="_blank">http://code.google.com/p/jmonthcalendar/</a><br />
<strong>Google Group:</strong> <a href="http://groups.google.com/group/jmonthcalendar" target="_blank">http://groups.google.com/group/jmonthcalendar<br />
</a><strong>Source Code: </strong><a href="http://groups.google.com/group/jmonthcalendar"></a><a href="http://code.google.com/p/jmonthcalendar/source/list" target="_blank">http://code.google.com/p/jmonthcalendar/source/list</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/03/24/new-project-home-for-jmonthcalendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jMonthCalendar: Minor Release 1.2.0</title>
		<link>http://www.bytecyclist.com/2009/02/12/jmonthcalendar-minor-release-120/</link>
		<comments>http://www.bytecyclist.com/2009/02/12/jmonthcalendar-minor-release-120/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:04:52 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=174</guid>
		<description><![CDATA[Wow, let me first start by saying it has been too long since I posted any updates on jMonthCalendar. I hope that the new release of jMonthCalendar 1.2.0 excites you as much as it does me. 1.2.0 sets the stage &#8230; <a href="http://www.bytecyclist.com/2009/02/12/jmonthcalendar-minor-release-120/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Wow, let me first start by saying it has been too long since I posted any updates on jMonthCalendar.  I hope that the new release of jMonthCalendar 1.2.0 excites you as much as it does me.  1.2.0 sets the stage for some pretty cool stuff. Continue reading to see a short list of the new features and where this project is going next.<br />
<span id="more-174"></span><br />
On the short list of new features there is:</p>
<ul>
<li>Today Link (navigate back to today&#8217;s date)</li>
<li>Year navigation, jump to &#8217;10 or back to &#8217;08 in the active month</li>
<li>Ability to click a day cell or day link and fire your own custom logic (i.e. add event on that day)</li>
<li>JSON date parsing, parse what some from that event object if the calendar is un-aware.</li>
<li>Fixed in-line sizing, configurable by options conscruct</li>
<li>Deprecating Date property, replaced by StartDate</li>
<li>Added EndDate property to event object</li>
</ul>
<p>While not all of all of them seem flashy, the last three or four points make the calendar that much closer to having multi-day events and event overflow support.</p>
<p>I am happy to report that I am currently using the calendar on an ASP.Net MVC site on my development machine.Ã‚Â  I hope to have a new calendaring system ready soon.Ã‚Â  This should concern you only because when I find issues while developing and using it, I fix them and everyone benefits.Ã‚Â  In more detail my calendar does a JSON GetData call to a controller actions, which executes and returns JSON formatted events.Ã‚Â  I am using <a href="http://james.newtonking.com/projects/json-net.aspx" target="_blank">James Newton-King&#8217;s JSON.Net</a> library to map and serialize my C# objects.Ã‚Â  I use the attributes on my properties to rename or exclude them from serialization.Ã‚Â  Very nice library and commend James for the work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2009/02/12/jmonthcalendar-minor-release-120/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

