<?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>Field Guide to Programmers &#187; scal</title>
	<atom:link href="http://www.fieldguidetoprogrammers.com/category/scal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fieldguidetoprogrammers.com</link>
	<description>Code, Toys, Bits of Odd Fluff</description>
	<lastBuildDate>Fri, 19 Jun 2009 16:05:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Scal v0.2 Released</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/scal-v02-released/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/scal-v02-released/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 00:14:04 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/scal-v02-released/</guid>
		<description><![CDATA[I&#8217;m excited to announce the general release of scal v0.2! This new version comes as a result of many hours of coding work by Ian Tyndall along with contributions from Andrew Reutter and others in the prototype community. A big thanks to everyone who contributed to this version, especially Ian. For this release, we&#8217;ve set [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m excited to announce the general release of scal v0.2!</p>
<p>This new version comes as a result of many hours of coding work by Ian Tyndall along with contributions from Andrew Reutter and others in the prototype community.  A big thanks to everyone who contributed to this version, especially Ian.</p>
<p>For this release, we&#8217;ve set up a new project website at <a href="http://scal.fieldguidetoprogrammers.com">http://scal.fieldguidetoprogrammers.com</a>.  The new site is packed with documentation and live examples of scal v0.2 in action.</p>
<p>At this point, there will be no further development or changes for v0.1.  Also, I&#8217;ll be changing over all of the scal links on this site to point to pages on the new project sub-domain.</p>
<p>Strange bits of code, tricks and tips about Drupal and WordPress, along with other fluff will continue to appear in this space from time to time.  However, most of my energy will be spent working on a <s>complete waste of time</s> new novel.</p>
<p>Happy Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/scal-v02-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scal goes SVN</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/scal-goes-svn/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/scal-goes-svn/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 12:48:00 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/scal-goes-svn/</guid>
		<description><![CDATA[Ok, scal has actually been in svn since the beginning, just on my local machine. However, as more code snippets started coming in (along with Ian&#8217;s great work), I thought it was time to move the source into a public svn repository. I chose Google&#8217;s project hosting because it was quick and easy. They have [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, scal has actually been in <a href="http://subversion.tigris.org/">svn</a> since the beginning, just on my local machine.  However, as more code snippets started coming in (along with Ian&#8217;s great work), I thought it was time to move the source into a public svn repository.</p>
<p>I chose Google&#8217;s project hosting because it was quick and easy.  They have a nice wiki too and simple issue tracker too.</p>
<p><a href="http://code.google.com/p/scaljs/">Scal&#8217;s svn repository</a></p>
<p>If you are interested in joining the project, drop me an email with your Google account.  Of course, anyone can checkout the code with anonymous access.  Just click on the source tab once you hop over to the project page.</p>
<p>The latest version of scal (v0.2) is in the trunk.  v0.1 is archived under branches.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/scal-goes-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scal v0.2 Pre-release.  Comments please.</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/scal-v02-pre-release-comments-please/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/scal-v02-pre-release-comments-please/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 12:28:41 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/scal-v02-pre-release-comments-please/</guid>
		<description><![CDATA[Some major revisions are coming for scal. Enough that I am incrementing the version from 0.1 to 0.2. (I know, gasps all around) The latest version of scal cleans up the code tremendously. We have Ian Tyndall to thank for the vast majority of these changes. Thomas Walpole also contributed some great prototype knowledge to [...]]]></description>
			<content:encoded><![CDATA[<p>Some major revisions are coming for scal.  Enough that I am incrementing the version from 0.1 to 0.2.  (I know, gasps all around)</p>
<p>The latest version of scal cleans up the code tremendously.  We have Ian Tyndall to thank for the vast majority of these changes.  Thomas Walpole also contributed some great prototype knowledge to the early development of this version.</p>
<p>Props aside, when you start cleaning up messy code, you end up finding a lot of ways to do things <i>better</i>.  That&#8217;s a nice way of saying that Ian&#8217;s trimmed the fat from scal.  <img src='http://www.fieldguidetoprogrammers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The latest version of scal is <b>not</b> 100% backwards compatible with the old version.  In fact, you may wonder if there is anything left of the old scal when you look under the hood.</p>
<p>That said, I know many people have built <b>custom styles</b> for scal.  This is the one area where everything ought to work as before (though there are two minor changes to the main css file to deal with cell border issues).</p>
<h2>Changes</h2>
<p>Here is a brief summary of the upcoming changes.  It is not exhaustive.  New documentation is being written along with samples and a nice unit test suite.</p>
<p><b>CSS:</b></p>
<p>Removed border for dayselected classes (scal and googleblue).  That&#8217;s it.</p>
<p><b>Properties:</b></p>
<p><s>selecteddate</s> &#8211; Replaced/merged with currentdate (this was always a bit confusing, the docs even say so)</p>
<p><b>Public Methods:</b></p>
<p><s>buildCalendar</s> &#8211; No longer needed.  Instantiating the scal class now builds the calendar.<br />
<s>getCalendar</s> &#8211; Redundant function.<br />
<s>openCalendar</s> &#8211; Replaced by toggleCalendar<br />
<s>closeCalendar</s> &#8211; Ditto<br />
<s>showCalendar</s> &#8211; Ditto, plus it was a bit redundant</p>
<p><b>Private Methods:</b></p>
<p><s>prevmonth</s> &#8211; Replaced by _switchMonth (up/down)<br />
<s>nextmonth</s> &#8211; Replaced by _switchMonth (up/down)</p>
<p><b>Methods Untouched:</b></p>
<p>setCurrentDate(date)<br />
updateDayValue(week,day,value)</p>
<h2>Download</h2>
<p>While in pre-release, scal v0.2 is only available here as a zip archive.  This includes the new unit tests along with the scal code and styles.  Please feel free to post comments here about the latest version.</p>
<p><a href="http://www.fieldguidetoprogrammers.com/downloads/scal_0.2.zip">scal_0.2.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/scal-v02-pre-release-comments-please/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>iPhone and scal</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/iphone-and-scal/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/iphone-and-scal/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 17:39:27 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/iphone-and-scal/</guid>
		<description><![CDATA[Andrew Reutter contributed a sweet new style for scal. Plus, he&#8217;s got scal working on his iPhone (hence the new style). Here&#8217;s what Andrew had to say: I am in the process of adapting it for use on the iPhone. I&#8217;ve done two things: 1) Hammered out the attached css. The css comes pretty darn [...]]]></description>
			<content:encoded><![CDATA[<p>Andrew Reutter contributed a sweet new style for scal.  Plus, he&#8217;s got scal working on his iPhone (hence the new style).  Here&#8217;s what Andrew had to say:</p>
<blockquote><p>I am in the process of adapting it for use on the iPhone.  I&#8217;ve done two things:</p>
<p>1) Hammered out the attached css.  The css comes pretty darn close to emulating the look<br />
and feel of the calendar app on iPhone, without using any images.  In<br />
safari, you even get the drop shadows, though the Safari<br />
implementation on iPhone, lamely enough, does not support the entirety<br />
of webkit.</p>
<p>The one presentation aspect I was unable to duplicate without diving<br />
into your Javascript was that the calendar app on iPhone always<br />
highlights the current day, even if it is not the selected day.  Were<br />
you to modify scal.js to assign a specific class name to the current<br />
day, I would be able to do so.  I think it has applicability beyond the<br />
iPhone.</p>
<p>2) Made _very_ minor changes to scal.js to remove the dependency on<br />
Scriptaculous.  If you change lines 141 and 142 to read:</p>
<p>        this.openeffect = this.options.openeffect || function(e)<br />
{$(e).style.display = &#8216;block&#8217;;};<br />
        this.closeeffect = this.options.closeeffect || function(e)<br />
{$(e).style.display = &#8216;none&#8217;;};</p>
<p>then I believe your code would work just fine without including<br />
Scriptaculous.  On a mobile device, every byte counts, and with your<br />
durations set to 0 the effect is no different than using Appear/Fade.<br />
I would go so far as to recommend this change in your default codebase<br />
- people can still use effects if they want to pass them in, but don&#8217;t<br />
need Scriptaculous if they don&#8217;t want effects.  There might, of<br />
course, be implications I&#8217;m not considering, but I just made the<br />
change to get past the fact that Appear was not defined; I am not<br />
using open/close links on my calendar anyway.
</p></blockquote>
<p>I think adding a style class to the current day is a fantastic idea.  I&#8217;m going to include that in the next release.</p>
<p>Andrew&#8217;s style is in the current <a href="/styles/scal.css">scal.css</a>.  I&#8217;ve renamed it &#8220;iphonic&#8221;, to remove any chance Apple might see this as a confusing use of their trademarks.  To see it in action, just check out the front page of the site.  I&#8217;ve added iphonic as a style option in the tester.  </p>
<p>Also, as Andrew notes above, the switch out for Scriptaculous open and closing may or may not work.  More testing needs to happen in this area, but from a design standpoint I&#8217;d like to abstract scal from Scriptaculous a bit.  Nothing against Scriptaculous.  I just think the control would benefit from having Scriptaculous as an add-on and not a requirement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/iphone-and-scal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to test your scal tweaks and changes</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/how-to-test-your-scal-tweaks-and-changes/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/how-to-test-your-scal-tweaks-and-changes/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 12:07:17 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/how-to-test-your-scal-tweaks-and-changes/</guid>
		<description><![CDATA[As contributions roll in, I find I&#8217;ve been a bit lax in providing a decent way to test scal. This is true both from the development side of things as well as the user&#8217;s (i.e. you) point of view. To that end, I&#8217;ve created a super stripped-down version of the home page that just includes [...]]]></description>
			<content:encoded><![CDATA[<p>As contributions roll in, I find I&#8217;ve been a bit lax in providing a decent way to test scal.  This is true both from the development side of things as well as the user&#8217;s (i.e. you) point of view.  To that end, I&#8217;ve created a super stripped-down version of the home page that just includes the scal calendar along with the functions I&#8217;ve used to set up the &#8220;test&#8221; version.</p>
<p><a href="http://www.fieldguidetoprogrammers.com/scaltester.html">scal test page</a></p>
<p>I have a number of little functions I work with when I&#8217;m trying out new scal additions.  Over time, I&#8217;ll add them to the &#8220;suite&#8221;, but for the moment at least there is a nice tester without my mugshot floating in the background. <img src='http://www.fieldguidetoprogrammers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/how-to-test-your-scal-tweaks-and-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scal v0.1b8 Released &#8211; More enhancements on the way</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/scal-v01b8-released-more-enhancements-on-the-way/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/scal-v01b8-released-more-enhancements-on-the-way/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 18:57:06 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/scal-v01b8-released-more-enhancements-on-the-way/</guid>
		<description><![CDATA[First, a big thanks to Ian Tyndall for supplying the code for the update. Here&#8217;s a snippet from Ian&#8217;s email to me: I recently picked up scal and started putting it to use. During this, I&#8217;ve made some minor enhancements that you might be interested in. I&#8217;ve removed the dependency on Builder and replaced it [...]]]></description>
			<content:encoded><![CDATA[<p>First, a big thanks to Ian Tyndall for supplying the code for the update.  Here&#8217;s a snippet from Ian&#8217;s email to me:<br />
<blockquote>I recently picked up scal and started putting it to use. During this, I&#8217;ve made some minor enhancements that you might be interested in.</p>
<p>I&#8217;ve removed the dependency on Builder and replaced it with the functionality of the new dom builder from prototype 1.6.0_rc1.</p>
<p>I&#8217;ve added destroy functionality to remove the observables when the calendar is closed.</p>
<p>Besides this, I only made minor performance/syntax enhancements.</p></blockquote>
<p>Minor enhancements?  There are 40 differences between these two versions of scal and Ian is responsible for the lot.  A big thanks!</p>
<p>You know, it&#8217;s funny how these things happen.  Just two days ago I read this post on Kangax&#8217;s website:</p>
<p><a href="http://thinkweb2.com/projects/prototype/2007/10/05/refactoring-with-prototype/">Refactoring with Prototype</a> <br /> <br />
<blockquote>I&#8217;m not surprised to see prototype code that sucks. Been there, done that (and I&#8217;m sure still doing it) &#8211; nobody is perfect. What surprises me though is how ridiculous some explanations (of writing crappy code) sound. &#8220;I don&#8217;t really know javascript. I do PHP professionally&#8221; is my favorite. Don&#8217;t get me wrong, I understand that experience and deep understanding of language is essential for writing smarter code. It could be a real challenge to wrap your mind around some of the dynamic concepts of such languages as javascript. That I can understand. What I don&#8217;t understand, though, is how people don&#8217;t follow some of the fundamental principles of programming. Do we really need to know javascript to prevent repetition, unnecessary constructions or poor optimization? I seriously doubt it</p></blockquote>
<p>Kangax goes on to give a clinic on prototype/javascript.  And as Kangax has gently suggested I clean up scal, I hang my head in shame that Ian had to come to the rescue before I could get to it.  <img src='http://www.fieldguidetoprogrammers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>About 50 people a day wander in here and check out scal.  I know a few are using it as I&#8217;ve had comments via email, so I&#8217;m inspired to dig in and keep hacking away at this control.  I hope everyone finds it useful.</p>
<h2>Important note about scal v0.1b8:</h2>
<p>Prototype v1.6.0_rc1 is REQUIRED.  You won&#8217;t get far with the previous release of prototype (as you might expect from Ian&#8217;s comments).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/scal-v01b8-released-more-enhancements-on-the-way/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Turning an AJAX Control into a Dashboard Widget</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/turning-an-ajax-control-into-a-dashboard-widget/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/turning-an-ajax-control-into-a-dashboard-widget/#comments</comments>
		<pubDate>Sat, 06 Oct 2007 13:49:20 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[OSX]]></category>
		<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/turning-an-ajax-control-into-a-dashboard-widget/</guid>
		<description><![CDATA[I wouldn&#8217;t say I&#8217;m a heavy user of Dashboard, but I really like the idea of creating widgets. Widgets are also used in the iPhone and iPod Touch, so if I ever make the switch [crave] there&#8217;s no doubt I&#8217;ll want to develop some useless toys for my $$$ toy. Since I&#8217;ve already developed a [...]]]></description>
			<content:encoded><![CDATA[<p><!--noadsense--><br />
I wouldn&#8217;t say I&#8217;m a heavy user of Dashboard, but I really like the idea of creating widgets.  Widgets are also used in the iPhone and iPod Touch, so if I ever make the switch [<i>crave</i>] there&#8217;s no doubt I&#8217;ll want to develop some useless toys for my $$$ toy.  <img src='http://www.fieldguidetoprogrammers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Since I&#8217;ve already developed a <a href="http://www.fieldguidetoprogrammers.com/#scal">calendar control</a> using the Prototype js and scriptaculous frameworks, I have the basic materials I need to build the widget.</p>
<p>Before you begin, you might want to take a look at the  <a href="http://developer.apple.com/documentation/AppleApplications/Conceptual/Dashboard_Tutorial/index.html">Dashboard Widget Tutorial on Apple&#8217;s Developer site</a>.  I found it helpful, though ultimately I wanted to dig into the code.  You probably do to, so let&#8217;s take a look at the structure of a Widget.<br />
<span id="more-18"></span></p>
<h2>The Widget Structure</h2>
<p>Any widgets you&#8217;ve installed on your system are stored in ~/Library/Widgets.  If you look at that directory in the Finder, you will see something like this:</p>
<p><img src="http://www.fieldguidetoprogrammers.com/images/blog/widgets.jpg" alt="Mah Widgets" title="Mah Widgets" /></p>
<p>The Widget application file is an archive, just like most Mac applications.  This means you can open it up and see what&#8217;s going on under the hood.  You can also hack it if you want (customize menus, images, even code in some places).  This is one of the hallmarks of the MacOS and OSX.  Well, maybe that&#8217;s a bit strong.  Let&#8217;s just say the feature has been around for awhile and it&#8217;s kinda cool.</p>
<p>To reveal the contents of the widget, right click on the icon and choose &#8220;Show Package Contents&#8221;.  This will open the archive as a folder and show you all the goodies inside.</p>
<p><img src="http://www.fieldguidetoprogrammers.com/images/blog/scal_widget.jpg" alt="Scal's Goodies" title="Scal's Goodies" /></p>
<p><span style="color:red;">[TIP]</span> If you are a <a href="http://macromates.com/">TextMate</a> user, you can just drag the icon of the widget onto TextMate.  This will launch a new project using the Widget&#8217;s folder and give you easy editing access to all of files inside the Widget.</p>
<p>The basic structure of a Widget is pretty simple.  You have index.html, info.plist, a couple of png image files, and a stylesheet.  The images are used by Dashboard to show placement when you add the Widget and as an icon in the list of Widgets.  The plist file holds the base information about the control (name, size, etc).  The index.html file is of course where the action takes place.</p>
<p>The screenshot above shows a lot of files in addition to the basic four.  Don&#8217;t be scared.  These files are just the support files for prototype and scriptaculous and my calendar control (scal).  </p>
<h2>Scal Widget</h2>
<p><a href="http://www.fieldguidetoprogrammers.com/downloads/scalwidget.zip">Download Scal Widget (ZIP)</a></p>
<p>Once you&#8217;ve downloaded and expanded the ZIP archive, you can double-click the Scal.wdgt file to install the control in Dashboard. However, as I said above, you could also right click on the icon and choose &#8220;Show Package Contents&#8221; to open the widget as a folder.  Lastly, I set up Scal to use the &#8220;dashblack&#8221; theme, so if nothing else you can see how not-close my CSS is to Apple&#8217;s.</p>
<p><img src="http://www.fieldguidetoprogrammers.com/images/blog/dashboard.jpg" alt="Scal's on Dashboard" title="Scal's on Dashboard" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/turning-an-ajax-control-into-a-dashboard-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to format Scal&#8217;s Date Output</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/how-to-format-scals-date-output/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/how-to-format-scals-date-output/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 01:14:18 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/how-to-format-scals-date-output/</guid>
		<description><![CDATA[When you create the scal object, there is a parameter called update_id that you use to reference the HTML element you wish to update with the &#8220;clicked&#8221; day value. By default, this puts in a raw Javascript Date object. However, instead of providing the id of an HTML element you can also reference a function [...]]]></description>
			<content:encoded><![CDATA[<p>When you create the scal object, there is a parameter called update_id that you use to reference the HTML element you wish to update with the &#8220;clicked&#8221; day value.  By default, this puts in a raw Javascript Date object.  However, instead of providing the id of an HTML element you can also reference a function that can format the Date or really do anything you would like.<br />
<span id="more-12"></span><br />
<a href="http://www.fieldguidetoprogrammers.com">On the homepage</a>, I use a function override to show the date in a normal format.  If you do a View Source, you can see the example, but I will reproduce it below for reference:</p>
<pre class="codebox">
samplecal = new scal('samplecal',updateyear,{titleformat:'mmmm yyyy',closebutton:'X',dayheadlength:2,weekdaystart:0});
// note that updateyear does not appear in quotes.
// This means that scal will call a function in my
// code named updateyear() when someone clicks on a cell.

function updateyear(){
   $('samplecal_value').update( samplecal.selecteddate.format('mmmm dd, yyyy'));
};

// Here is the sample update function.  I have a div in my HTML called samplecal_value.
// The updateyear() function, updates that value with the selecteddate property of the
// samplecal object (which is a Javascript Date object).
</pre>
<p><b>The format function above is actually an addition I made to the Date object.  This is already included in scal.js.</b></p>
<p>As noted in the source, I borrowed this function from Hector Rivas&#8217;s article at <a href="http://www.codeproject.com/jscript/dateformat.asp">http://www.codeproject.com/jscript/dateformat.asp</a>.  I&#8217;ve reproduced that here so that you can see the various formats available to you when constructing your Date format.</p>
<pre class="codebox">
Date.prototype.format = function(f)
	{
	    if (!this.valueOf())
	        return '&nbsp;';

	    var d = this;

	    return f.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,
	        function($1)
	        {
	            switch ($1.toLowerCase())
	            {
	            case 'yyyy': return d.getFullYear();
	            case 'mmmm': return scalmonthnames[d.getMonth()];
	            case 'mmm':  return (scalmonthnames[d.getMonth()]).substr(0, 3);
	            case 'mm':   return (d.getMonth() + 1);
	            case 'dddd': return scaldaynames[d.getDay()];
	            case 'ddd':  return scaldaynames[d.getDay()].substr(0, 3);
	            case 'dd':   return d.getDate();
	            case 'hh':   return ((h = d.getHours() % 12) ? h : 12);
	            case 'nn':   return d.getMinutes();
	            case 'ss':   return d.getSeconds();
	            case 'a/p':  return d.getHours() < 12 ? 'a' : 'p';
	            }
	        }
	    );
	};
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/how-to-format-scals-date-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Scal&#8217;s Mini Planner</title>
		<link>http://www.fieldguidetoprogrammers.com/scal/using-scals-mini-planner/</link>
		<comments>http://www.fieldguidetoprogrammers.com/scal/using-scals-mini-planner/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 13:29:27 +0000</pubDate>
		<dc:creator>jamiegrove</dc:creator>
				<category><![CDATA[scal]]></category>

		<guid isPermaLink="false">http://www.fieldguidetoprogrammers.com/blog/scal/using-scals-mini-planner/</guid>
		<description><![CDATA[Scal is designed to be a basic Javascript calendar. However, a suggestion came in about adding a planner-like function that kept day information intact as a user scrolled through the months. I thought that was a good idea and so I put it into a release. As the documentation states: I do not recommend using [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fieldguidetoprogrammers.com/#scal">Scal</a> is designed to be a basic Javascript calendar.  However, a suggestion came in about adding a planner-like function that kept day information intact as a user scrolled through the months.  I thought that was a good idea and so I put it into a release.<br />
<span id="more-11"></span><br />
As the documentation states:</p>
<blockquote><p>
<b>I do not recommend using the planner when you are using a compressed calendar style (i.e. one that does not show the day cell). Of the sample styles, iscal is probably the best to use.</b>
</p></blockquote>
<p>Below is a basic usage example I sent back to the suggester in email.  Enjoy!</p>
<p>> I really liked your idea about adding events to scal.  The static<br />
> building of the calendar each month is a bit of a drag.  So, I&#8217;ve<br />
> added a new &#8220;planner&#8221; property that automatically sets the DayValue<br />
> for a cell.  You probably noticed the updateDayValue function in the<br />
> list.  The new function is called setPlannerValue.  This function<br />
> ties a bit of text to a particular day, and if we are displaying that<br />
> month at the moment the day cell is filled in accordingly.</p>
<p>> Here&#8217;s how it might look using the sample code on<br />
> http://www.fieldguidetoprogrammers.com:</p>
<p><code></p>
<pre class="codebox">
samplecal = new scal('samplecal',updateyear,{titleformat:'mmmm yyyy',closebutton:'X',dayheadlength:2,weekdaystart:0});
// new code
samplecal.setPlannerValue(2007,8,28,"Here be dragons!");
// end new code
samplecal.showCalendar();
</pre>
<p></code></p>
<p>> Doing this would cause the text &#8220;Here be dragons!&#8221; to show up in the<br />
> day cell for 8/28/2007.  If you skipped off to September or November<br />
> and then came back to August 2007, &#8220;Here be dragons!&#8221; would appear<br />
> accordingly on the 28th.</p>
<p>> You could also pass in styled HTML instead of plain text, so this<br />
> should cover your color coded bar idea too (which is a good one).  I<br />
> suspect that your styled HTML could also contain some nifty code to<br />
> flash a pop-up on mouseover that would enable you to expand the event<br />
> information.  That seems like it would be easy to do with scriptaculous.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fieldguidetoprogrammers.com/scal/using-scals-mini-planner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
