<?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>Intelligence Among Us</title>
	<atom:link href="http://www.intelligenceamong.us/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.intelligenceamong.us</link>
	<description>it&#039;s there...use it.</description>
	<lastBuildDate>Fri, 13 Aug 2010 02:59:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Helping Those that Helped You Help Yourself</title>
		<link>http://www.intelligenceamong.us/?p=519</link>
		<comments>http://www.intelligenceamong.us/?p=519#comments</comments>
		<pubDate>Fri, 13 Aug 2010 02:59:57 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=519</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>When the foundation of your life is crumbling around you it can be difficult to know where to turn for help.  It&#8217;s also difficult to define what help means and it tends to manifest itself in different ways.  The winter of 2006 was a difficult time for my family.  Cindy had been finally diagnosed with bipolar disorder, moved to Chatham 3 hours away, spent time in and was kicked out of rehab.  Eventually she came home where the noose of depression tightened around her neck to the point where she was committed for 8 weeks and received electro-shock therapy which essentially erased her short term memory.  In retrospect this was probably a blessing.</p>
<p>The point of this post is not to rehash the past but rather to provide some historical context to something we are doing with the girls this month.  </p>
<p>I honestly don&#8217;t remember how I stumbled onto the Canadian Mental Health Clinic in Orangeville during those dark days.  There was such a bewildering patch work of agencies that did nothing that its a blur.  It may have been as simple as me driving by and seeing the sign in the window.  Regardless, when I slumped into the couch in the waiting room and starting pouring my heart out to the people working there I knew these were people that could and wanted to help.  They certainly couldn&#8217;t change the situation but what they could do was listen to me, tell me what I can expect, empathize and help me see the forest through the trees.  For that I am truly grateful.</p>
<p>Chloe and Melody have been wanting to hold a lemonade stand for a while now so we decided that we&#8217;ll hold one and half the proceeds will go to charity.  Naturally the girls asked me what &#8220;charity&#8221; was.  I explained that it means helping other people &#8211; for example other kids whose mom or dad died.  Melody was instantly thrilled with the idea of sharing and helping others.  Chloe tilted her head, looked at me like I had 2 heads, and said, &#8220;Why would I want to do that??&#8221;  I&#8217;m not going to lie to you &#8211; the bloodthirsty capitalist in me certainly understood where she was coming from <img src='http://www.intelligenceamong.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />    After some thought I decided to donate all the money to charity and give the girls 10 bucks each for the hard work they will do leading up to and during the event.   Sometimes buying your kids off is the right thing to do but I doubt you will find that in a Barbara Coloroso book.</p>
<p>I&#8217;ve decided to donate all the money to the Canadian Mental Health Association and specifically the Orangeville branch in Cindy&#8217;s memory.  I&#8217;ve contacted the OPP and they will be sending an officer over.  I&#8217;ve also contacted the local papers and they will be doing a story on the event and sending a reporter over to cover the festivities.</p>
<p>When Chloe and Melody smile, laugh and are kind to other kids Cindy&#8217;s life and legacy live on.  If we can, in some small way, help another family smile again, I will know that I have done something to ensure that she is not forgotten.</p>
<p>To my family, friends and co-workers that have helped and continue to help me &#8211; thank you.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=519&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=519</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why would I look up at the sky?  I can&#8217;t see Mommy there.</title>
		<link>http://www.intelligenceamong.us/?p=515</link>
		<comments>http://www.intelligenceamong.us/?p=515#comments</comments>
		<pubDate>Fri, 04 Jun 2010 00:39:09 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=515</guid>
		<description><![CDATA[Yesterday morning was hard for Chloe.  She couldn&#8217;t sleep the night before so she was tired in the morning.  She got upset about not being able to find an outfit she wanted to wear.  On the way to day care she started to cry and talked about how much she missed Mommy.  Mel was totally [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday morning was hard for Chloe.  She couldn&#8217;t sleep the night before so she was tired in the morning.  She got upset about not being able to find an outfit she wanted to wear.  On the way to day care she started to cry and talked about how much she missed Mommy.  Mel was totally fine.  When we got to the day care we sat on the grass and talked about Cindy and why Chloe was missing her so much at that time.  I said that I&#8217;m sure she was looking down from heaven and could see them and Chloe said, &#8220;Why would I look up at the sky?  If she is there why can&#8217;t I see her?&#8221;  Good question and I had no idea how to answer it.</p>
<p>We talked for a few more minutes and then went in.  When Brenda, the wonderful woman at the day care, saw Chloe she scooped her up onto her lap and comforted her in such an incredibly compassionate way.  Chloe melted into her arms and told her why she was feeling sad.  It brought me a lot of comfort to see my little girl being taken care of like that.  It also reinforced to me that it doesn&#8217;t matter where love and caring come from.  All that matters is that the more of it they have in their lives the better.   Thank you Brenda.</p>
<p>There is a 10 year old named Megan at the day care who is such an amazing kid.  Shortly after Cindy&#8217;s death she spent her own money to buy the girls the most beautiful little stuffed animals.  Yesterday when she saw Chloe was upset she did both the girls&#8217; hair in beautiful braids.  It was nice but it also made me wonder how I can be such a tool when it comes to braids and a 10 year old can be such a whiz.  Her parents should be so proud and the girls look up to her so much.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=515&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=515</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nighttime Tears</title>
		<link>http://www.intelligenceamong.us/?p=510</link>
		<comments>http://www.intelligenceamong.us/?p=510#comments</comments>
		<pubDate>Thu, 27 May 2010 13:44:16 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=510</guid>
		<description><![CDATA[After Cindy&#8217;s death, Tanja printed and framed a really nice picture of Cindy and the girl&#8217;s from the first day of school last year.  We put them on their night tables and I know its brought them comfort.  Last night Melody came out of her room crying and said that the picture of Mommy was [...]]]></description>
			<content:encoded><![CDATA[<p>After Cindy&#8217;s death, Tanja printed and framed a really nice picture of Cindy and the girl&#8217;s from the first day of school last year.  We put them on their night tables and I know its brought them comfort.  Last night Melody came out of her room crying and said that the picture of Mommy was making her upset.  I went up and we talked and she said that she just felt so sad when she looked at the picture because mommy is dead and she&#8217;ll never get to see her again.   Despite the fact that this kind of sadness has been mercifully rare so far, the tears seem to come at night.</p>
<p>We decided that maybe it would be a good idea to take the picture down for a little while and put it somewhere safe.  Knowing that she could take it out whenever she wanted to seemed to make her feel better.  I think she felt a small sense of control over the situation.</p>
<p>I told her how upset I felt the other day at the cemetary and that I cried afterwards and reiterated to her that there is no right or wrong time to feel sad and that we just need to make sure to always talk about things.    She seemed to feel better.  A lot of these little steps will make up this journey.   They are such good kids.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=510&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=510</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Our first visit to Cindy&#8217;s grave</title>
		<link>http://www.intelligenceamong.us/?p=508</link>
		<comments>http://www.intelligenceamong.us/?p=508#comments</comments>
		<pubDate>Wed, 26 May 2010 14:20:33 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=508</guid>
		<description><![CDATA[We were in Chatham this weekend visiting friends and on the way home we stopped to visit Cindy&#8217;s grave for the first time since the funeral.   It was a holiday Monday and very hot.  I felt a lot of trepidation walking up to her final resting place.  The girls were fine and in good spirits. [...]]]></description>
			<content:encoded><![CDATA[<p>We were in Chatham this weekend visiting friends and on the way home we stopped to visit Cindy&#8217;s grave for the first time since the funeral.   It was a holiday Monday and very hot.  I felt a lot of trepidation walking up to her final resting place.  The girls were fine and in good spirits.</p>
<p>Looking at the headstone I noticed that Chloe&#8217;s name was spelled incorrectly which I found quite upsetting.  It seemed like some kind of symbolic final metaphorical insult on a troubled life.  I need to find out how to get it fixed.   I think the heat of the day and the emptiness of the cemetary contributed to my reaction as well.</p>
<p>Melody left a picture and a piece of wood she had from the weekened.  Chloe actually found it funny that her name was spelled wrong.  We stayed for 10 minutes.  As we pulled away Mel yelled, &#8220;Good-bye Mommy!  I love you!&#8221;   I started to cry as we left and needed to get out of the car for a few minutes.  Tanja was wonderful as she always is.</p>
<p>The finality of  it all was somewhat overwhelming and it causes me to retrace the convoluted and complicated events that led here over and over.  Life moves on and we&#8217;ll be fine but I imagine these visits will always be hard.  I think that&#8217;s OK.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=508&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=508</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A letter to Julian Fantino and hopefully positive outcomes</title>
		<link>http://www.intelligenceamong.us/?p=505</link>
		<comments>http://www.intelligenceamong.us/?p=505#comments</comments>
		<pubDate>Thu, 20 May 2010 14:06:06 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=505</guid>
		<description><![CDATA[Over the year and a between the time of our separation and Cindy&#8217;s death I didn&#8217;t have much of an opportunity to get a sense for how she was doing at work although I assumed based on how she typically acted things were not going that well.  Sometime at the beginning of the year she [...]]]></description>
			<content:encoded><![CDATA[<p>Over the year and a between the time of our separation and Cindy&#8217;s death I didn&#8217;t have much of an opportunity to get a sense for how she was doing at work although I assumed based on how she typically acted things were not going that well.  Sometime at the beginning of the year she was involved in a car accident.  She told me afterwards that she had had a panic attack while driving her cruiser and crashed her car.</p>
<p>At her funeral I had the opportunity to speak with some of her co-workers and got some insight into just how much difficulty she was having and it was very concerning both as someone that cared about Cindy and a citizen.  I heard about how she was having breakdowns at work,  behaving erractically and one co-worker believed that the car accident I mentioned was actually as a result of her attempting to commit suicide.  </p>
<p>I thought about this a lot afterwards and felt like based on my experience I might be able to provide some insight to the OPP in order to help them help their people.  As a citizen I feel like I need to do what I can to mitigate the risk of a mentally ill person from managing to slip through the cracks as a front-line police officer.  So I wrote a letter to Julian Fantino, the Commissioner of the OPP to express my thoughts.  A few weeks later I received a letter from the Deputy Commissioner of the OPP telling me that the officer in charge of their EAP and critical care program would like to meet with me.</p>
<p>She came to my home earlier this week and we had a great talk about Cindy and what can be done going forward.  She was really open and communicative and obviously is passionately committed to what she is doing.  We talked a lot about the stigma of mental illness, the culture of policing, privacy concerns etc.  I feel that a major contributing factor to the lack of understanding about mental illness is that&#8217;s a very abstract concept for people that have never experienced it.  How could you possibly understand suicidal depression or mania that lasts months and the repercussions unless you have lived it first hand?  </p>
<p>I told her that I would be more than happy to speak to groups of police officers about Cindy and my experiences with mental illness because I &#8216;m sure I could be effective at telling the story in a context that is relevant to police and help them better understand what it all means.  She seemed very interested in the idea and I will do my best to make sure it happens.  I feel a strong need to help others as a result of this experience and in a way I feel like it&#8217;s honouring Cindy&#8217;s legacy.</p>
<p>Here is the letter:</p>
<p>Commissioner Fantino,</p>
<p>My name is Jason MacKenzie and I am the ex-husband of Cindy MacKenzie, an OPP Constable of nearly 12 years, who recently took her own life after a long, painful and ultimately unsuccessful battle with Bipolar Disorder. <br />
 <br />
I have great concerns with the manner in which the OPP dealt with her over the years and continued to allow her to serve as a front-line police officer despite her mental illness.  My intention is in no way to apportion blame but is rather to hopefully provide some insight to help you serve both your own officers and the public more effectively in the future.<br />
 <br />
She was on short-term disability for approxiately half of the last 5 years and struggled mightily while at work.  There were times she worked as a desk officer and times she was on the road.  During her return after her first stint on disability in 2006 she was only kept in the office for 2-3 days before returning to the road.  She recently, I believe in December of 2009, was involved in a traffic accident while  on the road in her cruiser.  She told me afterwards that she experienced a panic attack which led to the crash.  I&#8217;m not certain whether she was forthright with her supervisor as to the exact cause of the incident.  I&#8217;m certain the Traffic Report would detail that clearly.<br />
 <br />
Each time she returned to work she had a supporting letter from her doctor.  I can understand that this could be seen as sufficient but it clearly was not.  There was a period in 2006 where she was seriously considering driving her cruiser into an oncoming transport truck because she was suffering so profoundly.  When she told me this I took her to her psychiatrist and she was institutionalized for a period of time.<br />
 <br />
I know that some of her fellow officers were aware of the difficulty she was experiencing at work and in fact at her funeral this was mentioned to me a few times.  It would be  difficult for someone to report a colleague and to be honest I&#8217;m not sure that I possess the strength of character to have done it had I been in the situation either.  Regardless, her safety, that of her fellow officers and the public makes it imperative that there is more proactivity when dealing with people in this situation.  This might include regular and ongoing interviews with her co-workers and more importantly implementing the organizational and cultural changes that would allow these officers to feel more comfortable coming forward.<br />
 <br />
I also understand the need for privacy both from a legislative and human perspective but talking to her friends over the past week as yielded a lot of information indicating the level to which she was struggling.<br />
 <br />
The pieces of the puzzle were all there, albeit scattered and difficult to assemble.  But families, supervisors, colleagues and the OPP as an organization need to work together more closely to achieve better outcomes going forward.<br />
 <br />
On a more positive note, many officers attended her funeral last week and it brought much comfort to Cindy&#8217;s family and friends.  The return salute my 5 year old daughter received made her happy.<br />
 <br />
Thank you and best regards,</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=505&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=505</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Life &amp; Death</title>
		<link>http://www.intelligenceamong.us/?p=502</link>
		<comments>http://www.intelligenceamong.us/?p=502#comments</comments>
		<pubDate>Tue, 18 May 2010 20:43:30 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=502</guid>
		<description><![CDATA[I&#8217;ve decided to change the focus of my blog from IT related topics to something much more personal.   My ex-wife recently committed suicide after a long struggle with bipolar disorder.   I want this blog to reflect my (and her) story and that of my girls.  I&#8217;m not sure what exactly I hope to accomplish.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to change the focus of my blog from IT related topics to something much more personal.   My ex-wife recently committed suicide after a long struggle with bipolar disorder.   I want this blog to reflect my (and her) story and that of my girls.  I&#8217;m not sure what exactly I hope to accomplish.  I suppose it&#8217;s to put words to mental illness from the perspective of a man and father of two girls.   I don&#8217;t want to dwell on the negative but I want to articulate how to try to find the positives in situations that feel completely out of control.  My intention is for this to be both a recap of past events as well as the challenges that come with dealing with the present and looking forward.  My life is great and will continue to be.  For that I am thankful.</p>
<p>March 26, 2010 “Jason.  Jason!!!  Are you home?”  I woke up from a deep sleep to the sounds of someone calling my name clearly coming from inside my home.  I stumbled downstairs to see a uniformed police officer that I knew and asked him what the hell he was doing in my landing.  He asked me where my kids, who were sleeping soundly upstairs, were.  Disoriented, I told him they were with my ex-wife.  His look of true concern shook the cobwebs off and I corrected myself and told him they were upstairs.  He told me to sit down and that he had bad news.  “Brother, I have some bad news.  Cindy’s dead.”  And with that everything changed forever.</p>
<p>I think my experience can help others that are going through what I went through.  That’s it.  That’s the reason I have decided to put my experiences to paper (or in binary <img src='http://www.intelligenceamong.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).  Then again, I suppose it’s also a cathartic exercise to help me make sense of the last 5 or 6 years and get some perspective on the future.  It’s also important to me to give a voice to the suffering I have witnessed so that others can understand what the implications of mental illness can be.</p>
<p>How can a relationship that for the first 13 years was so joyous and unbelievable so totally destruct at the hands of bipolar disorder in a matter of months? How does a vibrant, strong and kind woman claw herself up from a horrific upbringing, build a wonderful life and then have it end in suicide?  How do raise our children and move on while honoring her memory?</p>
<p>I’ve thought about tailoring this story and perspective to dads.  I’ve also thought about focusing on mental illness, my own frailties, kids and everythinlg else under the sun.  In the end I decided to just tell my story as honestly as I can and let the reader decide if it’s of benefit to them.</p>
<p>I want to share honestly the things I have done during this time that I am incredibly proud of as well as the things I’m not.  Your character and mettle are not tested during the good times.  The rigidity of your spine is tested during the hard times.   When my simplistic view of how life and people should be was shattered I realized that as long I could look myself in the mirror and feel like I had a lot more to be proud of then what I was ashamed then I would be ok.  That doesn’t make dealing with the shame or regrets much easier.</p>
<p>I have raised good kids during times of chaos, protecting them and loving them the best way I can.  And you know what?  It’s not that hard.  Sitting them down and telling them their mother is dead…that’s hard.  There are some simple, fundamental principles I adhere to always with my kids that have nothing to do with dealing with a mentally ill mom.  They are universal and you certainly don’t need a self-help book to explain them.  They’re common sense if you have the wherewithal to compartmentalize your own drama and put them first.</p>
<p>I want to tell the good parts of this story because it helps provide some context into the later stages but also shows why, for some time, I couldn’t see the forest through the trees.  When my family was crumbling around me and my perfect financial future was disintegrating I was so busy trying to get through each day I almost couldn’t see how bad things really were.  I’m an extremely rational person and logically I must have known how bad things were getting but there were so many other day to day issues to deal with I just couldn’t put it together.</p>
<p>I also want to share the frustrations of dealing with government agencies, psychiatrists, the police – both as an employer and a law enforcement agency, support lines and on and on and on.  I found myself screaming at people on the phone that my wife was slowly killing herself and no one would do a goddamned thing to intervene.  How about a psychiatrist having your wife on some many medications that she was living like a fucking zombie?  All those years of medical school for what? To be a pill pusher?  Can you imagine a child protection agency telling you that there was no imminent danger to your children 48 hours before their mother committed suicide?  Can you imagine being at the funeral having co-workers tell you how unstable she really was?  I’m not going to go on a rant and blame everyone because everyone did the best they could.</p>
<p>This is as much a love story as it is a story of mental illness and I think the dichotomy will be familiar to those who have experienced it and enlightening to those that haven’t.   It’s almost impossible to imagine the devastation  mental illness can cause unless you have experienced it or witnessed it firsthand.   Our perspectives are shaped by our experiences.  That’s human nature.  I know my world view has irrevocably changed, for the better, due to what I have seen and lived.  That’s my choice.</p>
<p>I want to also focus on the present and future. Meeting someone wonderful, incorporating them into you and your childrens&#8217; lives, planning for the future etc.</p>
<p>If this helps anyone then it&#8217;s more than worth it.  In fact, if it helps me it&#8217;s more than worth it.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=502&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=502</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>4 Clicks or 1?  Using jQuery to Start a SharePoint Workflow.</title>
		<link>http://www.intelligenceamong.us/?p=486</link>
		<comments>http://www.intelligenceamong.us/?p=486#comments</comments>
		<pubDate>Mon, 19 Apr 2010 08:57:04 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sharepoint designer]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=486</guid>
		<description><![CDATA[The IT Urgent Change process needs to be automated.  It’s relatively simple and after gathering the requirements its clear that this can be accomplished using SharePoint and a SharePoint Designer workflow.  The workflow is created and published to the list.  The decision is made that the workflow will be started manually as opposed to automatically [...]]]></description>
			<content:encoded><![CDATA[<p>The IT Urgent Change process needs to be automated.  It’s relatively simple and after gathering the requirements its clear that this can be accomplished using SharePoint and a SharePoint Designer workflow.  The workflow is created and published to the list.  The decision is made that the workflow will be started manually as opposed to automatically when the Change Request is created.  Everyone in IT has contribute access to the list and there are no security requirements related to who can or can&#8217;t start a workflow.</p>
<p>This means a user must take the following steps to initiate the workflow:</p>
<p>1. Click the context menu and click the Workflows menu item<br />
<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture.png"><img class="alignnone size-full wp-image-494" title="New Picture" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture.png" alt="" width="252" height="216" /></a></p>
<p>2. Select the Change Process Workflow.<br />
<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-1.png"><img class="alignnone size-full wp-image-488" title="New Picture (1)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-1.png" alt="" width="269" height="123" /></a></p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-1.png"></a>3. Initiate the Workflow<br />
<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-2.png"><img class="alignnone size-full wp-image-489" title="New Picture (2)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-2.png" alt="" width="206" height="106" /></a></p>
<p>That’s a few more clicks than should be required so I wanted to find a way to make starting a workflow a one-click affair.  I knew this should be relatively simple with jQuery and the Dataview Web Part so I’d like to detail how I accomplished this so others can hopefully benefit from it.</p>
<p>The end result looks like this:<br />
<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-3.png"><img class="alignnone size-full wp-image-490" title="New Picture (3)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-3.png" alt="" width="781" height="352" /></a></p>
<p>When the user clicks the Start Workflow link they see a nice Ajax loading image as seen below:<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-4.png"><img class="alignnone size-full wp-image-491" title="New Picture (4)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-4.png" alt="" width="783" height="359" /></a></p>
<p>When the workflow has been initiated they are presented with a confirmation message telling them the process is underway:<a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-5.png"><img class="alignnone size-full wp-image-492" title="New Picture (5)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-5.png" alt="" width="783" height="348" /></a></p>
<p>On to the solution!  First I need to give a shout out to Marc Anderson , the creator of the jQuery Library for SharePoint Web Services which can be found here: <a href="http://spservices.codeplex.com/">http://spservices.codeplex.com/</a>.  This is such a handy tool for interacting with the SharePoint web services from the client and this was my first opportunity to use it.  I simply downloaded the JS files and put them in my SharePoint Scripting Resource Centre site collection as first conceived by Mark Miller at EndUserSharePoint.com.  The original post can be found here: <a href="http://www.endusersharepoint.com/2010/01/05/build-a-sharepoint-scripting-resource-center/">http://www.endusersharepoint.com/2010/01/05/build-a-sharepoint-scripting-resource-center/</a></p>
<p>Once that was done I need to do a few things.  I created a Web Part Page and opened SharePoint Designer.  I then added the Change Request list to one of the web part zones.  In order to get the customizations that wanted needed to create a DataView out of it so I simply right clicked on the list and converted it to a XSLT Dataview.   That’s all I really need to do here so I saved the page and opened it up in the browser.  What you can do with a dataview is almost limitless.  The best way to tackle customizations is to make all the changes you can using the SPD interface.  Once you have reached the limits of what you can do there you can start customizing the XSL.  Refer to the following series by Marc to learn everything you need to know about XSL and the DVWP.  <a href="http://www.endusersharepoint.com/2010/01/19/unlocking-the-mysteries-of-data-view-web-part-xsl-tags-part-1-overview/">http://www.endusersharepoint.com/2010/01/19/unlocking-the-mysteries-of-data-view-web-part-xsl-tags-part-1-overview/</a></p>
<p>When you modify a dataview in the browser you have a different set of options then when you work with a regular list.  The important thing we want to do here is modify the XSL in order to achieve the look and functionality we want.</p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-6.png"><img class="alignnone size-full wp-image-493" title="New Picture (6)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/04/New-Picture-6.png" alt="" width="239" height="458" /></a></p>
<p>In the interests of saving my sanity I copied the XSL and pasted it into SharePoint Designer (just a new XML document) so I could at least have the benefit of some colour in my life.  I added the following snippet  which I’ll explain as I go.</p>
<p>&lt;xsl:if test=&#8221;not(normalize-space(@ChangePr) = &#8217;5&#8242; or normalize-space(@ChangePr) = &#8217;2&#8242;)&#8221;&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;xsl:attribute name=&#8221;id&#8221;&gt;</p>
<p>&lt;xsl:text&gt;WorkflowDiv&lt;/xsl:text&gt;</p>
<p>&lt;xsl:value-of select=&#8221;@ID&#8221; disable-output-escaping=&#8221;yes&#8221;/&gt;</p>
<p>&lt;/xsl:attribute&gt;</p>
<p>&lt;a href=&#8221;#&#8221;&gt;</p>
<p>&lt;xsl:attribute name=&#8221;onclick&#8221;&gt;</p>
<p>&lt;xsl:text&gt;javascript:StartWorkflow(&#8216;&lt;/xsl:text&gt;</p>
<p>&lt;xsl:value-of select=&#8221;@EncodedAbsUrl&#8221; disable-output-escaping=&#8221;yes&#8221;/&gt;</p>
<p>&lt;xsl:text&gt;&#8217;,'&lt;/xsl:text&gt;</p>
<p>&lt;xsl:value-of select=&#8221;@ID&#8221; disable-output-escaping=&#8221;yes&#8221;/&gt;</p>
<p>&lt;xsl:text&gt;&#8217;);&lt;/xsl:text&gt;</p>
<p>&lt;/xsl:attribute&gt;</p>
<p>Start Workflow&lt;/a&gt;</p>
<p>&lt;img style=&#8221;visibility:hidden&#8221; src=&#8221;http://employeeportal/sites/sprc/PublishingImages/ajax-loader.gif&#8221;&gt;</p>
<p>&lt;xsl:attribute name=&#8221;id&#8221;&gt;</p>
<p>&lt;xsl:text&gt;Loader&lt;/xsl:text&gt;</p>
<p>&lt;xsl:value-of select=&#8221;@ID&#8221; disable-output-escaping=&#8221;yes&#8221;/&gt;</p>
<p>&lt;/xsl:attribute&gt;</p>
<p>&lt;/img&gt;&lt;/div&gt;</p>
<p>&lt;/xsl:if&gt;</p>
<p>The result I want to achieve with this is another column in the dataview with the “Start Workflow” link that will call a Javascript function and passes in a few parameters and uses the jQuery Library for SP Web Services to kick off the workflow.</p>
<p>The following section says that we’re only going to render the link when the workflow is not complete or cancelled.  When you covert a list view to a dataview your workflow column which normally reads “In Progress’, “Completed” etc. switches to the numerical value.  Why?  I haven’t a clue.  But the easiest way is to use SPD to create some conditional formatting and then just copy the XSL that is generated.</p>
<p>&lt;xsl:if test=&#8221;not(normalize-space(@ChangePr) = &#8217;5&#8242; or normalize-space(@ChangePr) = &#8217;2&#8242;)&#8221;&gt;</p>
<p>You can see that the 2 values we pass to our StartWorkflow function are the EncodedAbsUrl and the ID of the list item in question.  The EncodedAbsUrl for a list item looks like this: <a href="http://servername/sites/its/Lists/Change%20Request/107_.000">http://servername/sites/its/Lists/Change%20Request/107_.000</a>.   We also output a hidden image with our nice loading image downloaded from <a href="http://www.ajaxload.info/">http://www.ajaxload.info</a> that will appear beside each item while the workflow is initiating.</p>
<p>Also note that our loading image and the div that wraps everything have an id property that concatenates on the list item id to it that we’ll use in our client side script.</p>
<p>On to the jQuery.   We need to add a Content Editor Web Part to our page and place the following script inside:</p>
<p><strong>Our jQuery and jQuery Web Services references</strong></p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;/sites//sprc/Resources%20%20jQuery/jquery-1.3.2.min.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script  type=&#8221;text/javascript&#8221; src=&#8221; /sites/sprc/Resources%20%20jQuery/jQuery%20SP%20Services/jquery.SPServices-0.5.4.min.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>function StartWorkflow(ItemURL, ItemID)</p>
<p>{</p>
<p>var loadingImage = &#8216;Loader&#8217; + ItemID</p>
<p>var workflowDiv = &#8216;WorkflowDiv&#8217; + ItemID</p>
<p>//Show our loading image</p>
<p>document.getElementById(loadingImage).style.visibility = &#8216;visible&#8217;;</p>
<p>$().SPServices({</p>
<p>operation: &#8220;StartWorkflow&#8221;,</p>
<p>item: ItemURL,</p>
<p>templateId: &#8220;{04ee1c93-f6b7-49b3-a79c-fa3142ecd688}&#8221;,</p>
<p>workflowParameters: &#8220;&lt;root /&gt;&#8221;,</p>
<p>completefunc: function() {</p>
<p>document.getElementById(workflowDiv).innerHTML = &#8216;Workflow Started&#8217;;</p>
<p>}</p>
<p>});</p>
<p>}</p>
<p>&lt;/script&gt;<br />
As you can see there is very little scripting required here.  We take the URL of the list item and the item id.  We then show the loading image and make the web service call through Marc’s library:</p>
<p>There are 4 parameters.</p>
<ol>
<li>The operation is “Start Workflow”</li>
<li>The URL is the value of the EncodedAbsUrl for the list item mentioned earlier.</li>
</ol>
<p>The template id is the guid of the workflow template that we created in SharePoint Designer.  You can find this out by following the first 2 steps at the very beginning of this article and then copying the URL from your browser.  It will look something like this: <a href="http://servername/sites/its/Workflows/Change%20Process/Change%20Proce.aspx?List=d0fa2d98-6086-4c97-be85-4746c801e7f3&amp;ID=89&amp;TemplateID=%7b04ee1c93-f6b7-49b3-a79c-fa3142ecd688%7d&amp;Source=http%3A%2F%2Femployeeportal%2Fsites%2Fits%2FLists%2FChange%2520Request%2FAllItems%2Easpx">http://servername/sites/its/Workflows/Change%20Process/Change%20Proce.aspx?List=d0fa2d98-6086-4c97-be85-4746c801e7f3&amp;ID=89&amp;TemplateID={04ee1c93-f6b7-49b3-a79c-fa3142ecd688}&amp;Source=http%3A%2F%2Femployeeportal%2Fsites%2Fits%2FLists%2FChange%2520Request%2FAllItems%2Easpx</a>.  You can see that there is a TemplateID value in the query string and that’s what we want</p>
<ol>
<li>Our workflow doesn’t have an initiation screen so we simply pass it an XML node.  You have to do this or the workflow will throw an exception.  This took some digging to find out why the workflow wouldn&#8217;t start.</li>
<li>completefunc – what we want to happen when we’re done.  In this case we just want to get rid of the image and let the user know the workflow started.  Remember that AJAX is asynchronous so if you try to take post-initiation actions with code inline it will actually run prior to the workflow having been started.  If you want something to happen after the call to the SPServices library is done, put it in the completefunc.</li>
</ol>
<p>There is no error handling in this solution yet but if you go to Marc’s Codeplex site you can see methods on how you can have error information returned and then trap them. It’s pretty straightforward.</p>
<p>That is how I used, jQuery, the jQuery Library for SharePoint Web Services and the DataView Web Part to allow a workflow to be started with one click.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=486&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=486</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery vs Webparts solution</title>
		<link>http://www.intelligenceamong.us/?p=471</link>
		<comments>http://www.intelligenceamong.us/?p=471#comments</comments>
		<pubDate>Sat, 27 Mar 2010 01:05:27 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=471</guid>
		<description><![CDATA[As I mentioned in my last post, I had to come up with a simple way of fetching an employee&#8217;s phone number and allowing them to update it through SharePoint. I contemplated developing a web part that would interact with the HR system but with the length of time a deployment can take I thought [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/03/ajax-loader.gif"><img class="alignnone size-full wp-image-479" title="ajax-loader" src="http://www.intelligenceamong.us/wp-content/uploads/2010/03/ajax-loader.gif" alt="" width="16" height="16" /></a></p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/03/ajax-loader.gif"></a>As I mentioned in my last post, I had to come up with a simple way of fetching an employee&#8217;s phone number and allowing them to update it through SharePoint. I contemplated developing a web part that would interact with the HR system but with the length of time a deployment can take I thought that it might be simpler to use jQuery. This way I don&#8217;t have to develop and deploy any custom .Net code. I simply have to write some HTML and jQuery and embed that into the page.</p>
<p>A few caveats. Security is not really an issue here. There is no requirement to ensure that people can only update their own phone number. Although since there is a mapping between a user&#8217;s AD account and their HR Employee ID that logic could easily be handled in the web services if required. The other is the fact that cross-domain scripting is not supported so your HTML page will need to be on the same server as the web services.</p>
<p>The last caveat is that the page is hideous and logic is sketchy &#8211; this was only a POC to demonstrate a different approach to tackling these types of problems.</p>
<p>How the page works is that a user loads the page and is presente d with a textbox and a button. They enter their Employee ID into the text box and click the button. This uses ajax to call a .Net ASMX web service called EmployeeInfo which accepts the Employee ID in the form an integer and returns an Employee object.  We then simply render that on the screen, hide that button and show another one.  The user can then enter a new phone number in the textbox, click the button which calls the UpdatedEmployee Web Service.  This web service accepts the Employee ID and Phone Number and returns a Response object that has a property called ResponseStatus which we can check in our client code.</p>
<p>This first thing if of course to add a reference to our jQuery library which is stored in a SharePoint library.</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;&lt;url&gt;/jquery-1.3.2.min.js&#8221;&gt;&lt;/script&gt;</p>
<p>What follows is the HTML code which is simple &#8211; and hideous.<br />
<code><br />
&lt;div id="instructions"&gt;Enter Employee ID&lt;/div&gt;<br />
</code><code>&lt;div id="controls"&gt;<br />
&lt;input id="txtEmployeeID" type="text" /&gt;<br />
&lt;input type="button" value="Search" id="Button1" onclick="CallWebService('http://&lt;url&gt;/Service.asmx/EmployeeInfo', document.getElementById('txtEmployeeID').value, '')" /&gt;<br />
&lt;input type="button" value="Update Phone Number" id="btnUpdate" onclick="CallWebService('http://&lt;url&gt;/Service.asmx/UpdateEmployee', _employeeid, document.getElementById('txtEmployeeID').value, '')"<br />
style="display:none;" /&gt;<br />
&lt;/div&gt;<br />
&lt;div id="loadingDiv" style="display:none"&gt;&lt;img src="http://jaymoss/PublishingImages/ajax-loader.gif" /&gt;&lt;/div&gt;<br />
&lt;div id="ResultSet"&gt;&lt;/div&gt;</code></p>
<p>It&#8217;s very straightforward. A textbox to enter the Employee ID and a button to request the employee information. Another button to submit the phone number back for updating and a few DIV tags to control formatting.  You can see  in the onclick events of the buttons that we are calling the same Javascript function and passing in different parameters.  Below is the code that int.eracts with the .Net web services.</p>
<p>I don&#8217;t want to spend too much time on the simple logic so I&#8217;ll focus on the Ajax piece.  All you need to do is call the AJAX function and pass in the correct parameters.  The url parameter is the actual url of your web service.   The data is returned in JSON.  More information on decorating your web services to be compatible with this format is located here: <a href="http://stackoverflow.com/questions/211348/how-to-let-an-asmx-file-output-json">http://stackoverflow.com/questions/211348/how-to-let-an-asmx-file-output-json</a>.</p>
<p>var data;</p>
<div>function CallWebService(url, employeeid, phonenumber)</div>
<p><span style="white-space: pre;"> </span>if (phonenumber.length == 0)</p>
<p><span style="white-space: pre;"> </span>{</p>
<p><span style="white-space: pre;"> </span>data = &#8220;{&#8216;employeeid&#8217;:'&#8221; + employeeid +&#8221;&#8216;}&#8221;;</p>
<p>_employeeid = employeeid;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>data = &#8220;{&#8216;employeeid&#8217;:'&#8221; + employeeid + &#8220;&#8216;, &#8216;phonenumber&#8217;: &#8216;&#8221;+ phonenumber +&#8221;&#8216;}&#8221;;</p>
<p>$(&#8216;#ResultSet&#8217;).attr(&#8216;style&#8217;, &#8216;display:none&#8217;);</p>
<p>$(&#8216;#loadingDiv&#8217;).attr(&#8216;style&#8217;, &#8216;display:block&#8217;);</p>
<p>$(&#8216;#controls&#8217;).attr(&#8216;style&#8217;, &#8216;display:none&#8217;);</p>
<p>}</p>
<p>$.ajax({<span style="white-space: pre;"> </span></p>
<p>type: &#8220;POST&#8221;,</p>
<p>url: url,</p>
<p>contentType: &#8220;application/json; charset=utf-8&#8243;,</p>
<p>data: data,</p>
<p>dataType: &#8220;json&#8221;,</p>
<p>success: success,</p>
<p>error: ajaxFailed</p>
<p>});</p>
<p>}</p>
<p>Since our web services accept parameters we pass them in the data parameter.  All you really need to know is that the format is {&#8216;parameter&#8217;:'value&#8217;}.  Multiple parameters are separated by commas.  You can pass arrays as well which is well documented online.</p>
<p>The last two parameters are the function to be called if the call is successful and if it fails.  In our case the success function is creatively named &#8220;success&#8221; and the error function is called &#8220;ajaxFailed&#8221;  below are the functions themselves.</p>
<p>Side note:  I&#8217;m having a hard time concentrating on this post because I&#8217;m watching all the pre-fight hype of the GSP vs Dan Hardy fight.  This is going to be ugly.  Dan Hardy doesn&#8217;t have a prayer but I digress.  <span style="color: #ff0000;">Update:  I can&#8217;t believe it went the distance.</span></p>
<p>function success(data, status)</p>
<p>{</p>
<p>hideLoader();</p>
<p>if (data.d['ResponseStatus'] == &#8220;Success!&#8221;)</p>
<p>{</p>
<p>alert(&#8216;Employee Phone Number Successfully Updated&#8217;);</p>
<p>$(&#8216;#controls&#8217;).attr(&#8216;style&#8217;, &#8216;display:none&#8217;);</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>$(&#8216;#ResultSet&#8217;).html(data.d['EmployeeName'] + &#8216; &lt;br&gt; &#8216; + data.d['PhoneNumber']);</p>
<p>$(&#8216;#txtEmployeeID&#8217;).attr(&#8216;value&#8217;, &#8221;);</p>
<p>$(&#8216;#Button1&#8242;).attr(&#8216;style&#8217;, &#8216;display:none&#8217;);</p>
<p>$(&#8216;#btnUpdate&#8217;).attr(&#8216;style&#8217;, &#8216;display:block&#8217;);</p>
<p>}</p>
<p>}</p>
<p>function ajaxFailed(xmlRequest)</p>
<p>{</p>
<p>hideLoader();</p>
<p>alert(xmlRequest.status);</p>
<p>}</p>
<p>Data is the JSON object is returned where you can check the properties of the object returned by your web services.  Easy as pie!</p>
<p>Upload the HTML to the web server the web services reside on and you&#8217;re golden.  You can then use a simple Page Viewer Web Part to display your masterpiece inside SharePoint and your users will never be the wiser.</p>
<p>Obviously, there are many situations when a custom developed web part is required but my intention has been to demonstrate an alternative approach to accomplish a specific problem without writing custom .Net code.</p>
<p>Enjoy and all comments are always welcome!</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=471&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=471</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery vs Webpart</title>
		<link>http://www.intelligenceamong.us/?p=469</link>
		<comments>http://www.intelligenceamong.us/?p=469#comments</comments>
		<pubDate>Wed, 24 Mar 2010 23:13:28 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=469</guid>
		<description><![CDATA[I was recently presented with the following issue. We need a web part that will allow someone to enter their employee id and update their phone number which will then be posted back to the HR system. Web part?? Come on! This can be accomplished with jQuery, some nice HTML formatting and&#8230;..oh wait&#8230;that&#8217;s it. Anyone [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently presented with the following issue.  We need a web part that will allow someone to enter their employee id and update their phone number which will then be posted back to the HR system.   Web part?? Come on!</p>
<p>This can be accomplished with jQuery, some nice HTML formatting and&#8230;..oh wait&#8230;that&#8217;s it.</p>
<p>Anyone that knows jQuery will know that there are cross-domain scripting issues that we have to deal with by design.  So we may have &#8220;develop&#8221; and HTML page that uses jquery and ajax to do the calls and host it on the web server that serves up the required web services.</p>
<p>Code to follow but give me a break.  You could do this in a traditional web part deployed as a feature and go through the entire SDLC or write some simple HTML and call the pre-existing services.</p>
<p>Code to follow.  </p>
<p>Tell me I&#8217;m wrong please.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=469&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=469</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Blogging Part Deux</title>
		<link>http://www.intelligenceamong.us/?p=450</link>
		<comments>http://www.intelligenceamong.us/?p=450#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:27:43 +0000</pubDate>
		<dc:creator>Jason MacKenzie</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.intelligenceamong.us/?p=450</guid>
		<description><![CDATA[This is a continuation of my previous post on enhancing the SharePoint Blog user interface with jQuery. In that sample I demonstrated how to use jQuery along with a customized Content Query Web Part in order to create a nice accordion effect for recent blog comments. In this example I will take things further and [...]]]></description>
			<content:encoded><![CDATA[<p><strong> </strong>This is a continuation of my <a href="http://www.intelligenceamong.us/?p=441">previous post</a> on enhancing the SharePoint Blog user interface with jQuery.  In that sample I demonstrated how to use jQuery along with a customized Content Query Web Part in order to create a nice accordion effect for recent blog comments.  In this example I will take things further and demonstrate:</p>
<ul>
<li>How to include the most recent blog posts using  jQuery to create a nice scrolling effect</li>
<li>Use the concepts introduced by Mark Miller for creating a <a href="http://www.endusersharepoint.com/2010/01/05/build-a-sharepoint-scripting-resource-center/">Scripting Resource Center</a></li>
<li>How to change the look and feel of your jQuery components by using jQuery themes</li>
<li>Finally I will use the <a href="http://blog.vossers.com/index.php/category/jquery/">jQuery Dynamic List Filter</a> and MOSS Filter web parts to create a dynamic page for searching posts and comments</li>
<li>I&#8217;ll also use the <a href="http://www.codeplex.com/ChartPart/">ChartPart </a>web parts and some SPD workflows to create some graphs to visualize information about the blog </li>
</ul>
<p>The completed blog home page looks like the image below. Please check the following screen cast to see it in action.  Note that some of the more dynamic effects aren&#8217;t visible in the video due to the fact that Camtasia Studio seems to consume a lot of resources.  You can see them in the video attached to the previous blog post. <a href="http://www.screencast.com/users/JasonMacKenzie/folders/Default/media/7e067f8b-af00-4a69-aae0-59c2fc41a198">http://www.screencast.com/users/JasonMacKenzie/folders/Default/media/7e067f8b-af00-4a69-aae0-59c2fc41a198</a></p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture.png"><img class="alignnone size-medium wp-image-455" title="New Picture" src="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture-300x233.png" alt="" width="300" height="233" /></a></p>
<p><strong>Blog Scrolling</strong></p>
<p>The first effect I wanted to achieve was to create a scrolling list of recent blog posts.  In order to achieve this I used the Content Query Web Part along with the Scrollable plugin from <a href="http://flowplayer.org/tools/demos/scrollable/index.html">jQuery Tools</a>.  The vertical scrolling requires the HTML to be output in the following structure:</p>
<p><code>&lt;div id="actions"&gt;<br />
    &lt;a class="prevPage"&gt;&amp;laquo; Back&lt;/a&gt;<br />
    &lt;a class="nextPage"&gt;More pictures &amp;raquo;&lt;/a&gt;<br />
&lt;/div&gt;<br />
&lt;!-- root element for scrollable --&gt;<br />
&lt;div class="scrollable vertical"&gt;<br />
    &lt;!-- root element for the items --&gt;<br />
    &lt;div class="items"&gt;<br />
        &lt;!-- first item. can contain anything --&gt;<br />
        &lt;div&gt;<br />
            &lt;!-- image --&gt;<br />
            &lt;img src="http://farm1.static.flickr.com/_m.jpg" /&gt;<br />
            &lt;!-- title --&gt;<br />
            &lt;h3&gt;1. Barcelona Pavilion&lt;/h3&gt;<br />
            &lt;!-- content --&gt;<br />
            &lt;p&gt;<br />
                The Pavilion was not only a pioneer ...<br />
            &lt;/p&gt;<br />
        &lt;/div&gt;<br />
        &lt;!-- second item (and so on) --&gt;<br />
        &lt;div&gt;<br />
            ...<br />
        &lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/div&gt;</code></p>
<p>So, as in the last post I&#8217;ll create a custom item template in ItemStyles.xsl in order to achieve this effect.  I won&#8217;t go into to detail explaining this as y0u can read my previous post for the mechanics of it.  I&#8217;ll post the template in it&#8217;s entirety for you to use:</p>
<p><code>&lt;xsl:template name="ScrollableBlogPosts" match="Row[@Style='ScrollableBlogPosts']" mode="itemstyle"&gt;<br />
                        &lt;xsl:variable&gt;<br />
            &lt;xsl:call-template&gt;<br />
                &lt;xsl:with-param select="'ImageUrl'"/&gt;<br />
            &lt;/xsl:call-template&gt;<br />
        &lt;/xsl:variable&gt;<br />
                        &lt;xsl:variable&gt;<br />
            &lt;xsl:call-template&gt;<br />
                &lt;xsl:with-param select="'LinkUrl'"/&gt;<br />
            &lt;/xsl:call-template&gt;<br />
        &lt;/xsl:variable&gt;<br />
                        &lt;xsl:variable&gt;<br />
            &lt;xsl:call-template&gt;<br />
                &lt;xsl:with-param select="@Title"/&gt;<br />
                &lt;xsl:with-param select="'LinkUrl'"/&gt;<br />
            &lt;/xsl:call-template&gt;<br />
        &lt;/xsl:variable&gt;<br />
                        &lt;xsl:variable&gt;<br />
            &lt;xsl:if test="@OpenInNewWindow = 'True'" &gt;_blank&lt;/xsl:if&gt;<br />
        &lt;/xsl:variable&gt;<br />
                        &lt;xsl:if test="count(preceding-sibling::*)=0"&gt;<br />
                         &lt;div&gt;&lt;/div&gt;<br />
            &lt;style&gt;<br />
            &lt;xsl:text disable-output-escaping="yes"&#038;gt<br />
.vertical {position:relative; overflow:hidden; height: 665px; width: 650px;  border-top:1px solid #ddd;  }<br />
.items {position:absolute; height:20000em;  margin: 0px;}<br />
.items div {margin:2px 0; padding:2px;}<br />
.items img {float:left;margin-right:20px; height:180px; width:240px;}<br />
.items h3 {margin:0 0 5px 0; font-size:16px;color:#456; font-weight:normal;}<br />
#actions {width:100%px;margin:30px 0 10px 0;}<br />
#actions a {font-size:11px; cursor:pointer; color:#666;}<br />
#actions a:hover {text-decoration:underline;color:#000;}<br />
 .disabled {visibility:hidden;}<br />
 .nextPage {float:right;}<br />
               &lt;/xsl:text&gt;<br />
              &lt;/style&gt;<br />
                        &lt;div&gt;<br />
            &lt;a&gt;Previous&lt;/a&gt;<br />
            &lt;a&gt;More Blog Posts&lt;/a&gt;<br />
&lt;/div&gt;<br />
                        &lt;a&gt;&lt;/a&gt;<br />
                        &lt;xsl:text disable-output-escaping="yes"&gt;<br />
                        &lt;!-- root element for scrollable --&gt;<br />
                        &amp;lt;div&amp;gt;<br />
                         &lt;!-- root element for the items --&gt;<br />
                         &amp;lt;div&amp;gt;<br />
                        &lt;/xsl:text&gt;<br />
                                    &lt;/xsl:if&gt;<br />
&lt;div&gt;&lt;div&gt;&lt;strong&gt;&lt;a style="font-size:medium;color:gray" href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}"&gt;<br />
 &lt;xsl:value-of select="@Title"&gt;&lt;/xsl:value-of&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/div&gt;&lt;xsl:value-of select="@Body" disable-output-escaping="yes"&gt;&lt;/xsl:value-of&gt;<br />
Posted at  &lt;xsl:value-of select="ddwrt:FormatDateTime(string(@PubDate) ,1033 ,'dd-MM-yyyy')" /&gt;<br />
Posted By: &lt;xsl:value-of select="@Author"&gt;&lt;/xsl:value-of&gt; |<br />
&lt;a style="font-size:x-small;color:black" href="{$SafeLinkUrl}#Comments" target="{$LinkTarget}" title="{@LinkToolTip}"&gt;<br />
Comments&lt;/a&gt;<br />
&lt;hr style="color:white;border-bottom:1px solid black;"&gt;&lt;/hr&gt;<br />
&lt;/div&gt;<br />
                &lt;xsl:if test="count(following-sibling::*)=0"&gt;<br />
                                    &lt;xsl:text disable-output-escaping="yes"&gt;<br />
                                     &amp;lt;/div&amp;gt;<br />
                                    &amp;lt;/div&amp;gt;<br />
                                     &lt;/xsl:text&gt;<br />
                        &lt;/xsl:if&gt;<br />
            &lt;/xsl:template&gt;      </code>    </p>
<p>The next thing we&#8217;ll need to do is modify out CEWP to contain the jQuery to handle the scrolling.  I will include all the script that is included in order to make our prototype function properly.  The relevant script is in red.  Note the easing function &#8211; for those that read my posts I&#8217;m sure you recognize that I did not come up with that on my own.  All those algorithms are from the <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing plugin </a>and you can simply copy and paste them in order to change the easing effect.</p>
<p><code>&lt;script src="/sprc/Resources%20%20jQuery/jquery-1.3.2.min.js"&gt;&lt;/script&gt;<br />
&lt;script src="/sprc/Resources%20%20jQuery/jquery.tools.min.js"&gt;&lt;/script&gt;<br />
&lt;script src="/sprc/Resources%20%20jQuery/jquery-ui-1.7.1.min.js"&gt;&lt;/script&gt;<br />
&lt;link rel="stylesheet" href="/sprc/Resources%20%20jQuery/jquery-ui-themes-1.7.1/excite-bike/jquery-ui.css"&gt;<br />
 &lt;script&gt;<br />
  $(document).ready(function(){<br />
    $("#accordion").accordion(<br />
{ autoheight: false}<br />
);<br />
 // initialize scrollable<br />
<span style="color: #ff6600;">$("div.scrollable").scrollable({        </span><br />
<span style="color: #ff6600;">vertical:true, s</span><span style="color: #ff6600;">ize: 1,</span><span style="color: #ff6600;">easing: 'custom', speed: 1000          </span><br />
<span style="color: #ff6600;"> </span><span style="color: #ff6600;">})</span><br />
 jQuery("#dialog").dialog({<br />
      bgiframe: true, autoOpen: false,  modal: true, show: 'slide'<br />
    });<br />
 $("#demo img[title]").tooltip('#demotip');<br />
   });<br />
 // custom easing called "custom"<br />
<span style="color: #ff6600;">$.easing.custom = function (x, t, b, c, d) {</span><br />
<span style="color: #ff6600;">                        if (t==0) return b;</span><br />
<span style="color: #ff6600;">                        if (t==d) return b+c;</span><br />
<span style="color: #ff6600;">                        if ((t/=d/2) &lt; 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;</span><br />
<span style="color: #ff6600;">                        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;</span><br />
<span style="color: #ff6600;">            }</span><br />
   function PopulateText(textToShow, title)<br />
  {<br />
            document.getElementById("dialog").innerHTML = textToShow;<br />
        document.getElementById("dialog").title = title;<br />
  }<br />
&lt;/script&gt;</code></p>
<p><strong>Scripting Resource Center</strong></p>
<p>Following Mark&#8217;s advice I created a Scripting Resource Center to centrally host all jQuery related files as well as a wiki for all things SharePoint.   I have download the latest versions of jQuery &#8211; 1.2.6 +, recent versions of jQuery UI,  jQuery Tools as well as all the jQuery UI themes:</p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture-2.png"><img class="alignnone size-full wp-image-452" title="New Picture (2)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture-2.png" alt="" width="624" height="485" /></a></p>
<p><strong>Changing Look and Feel</strong></p>
<p>jQuery themes make it extremely easy to change the look of your jQuery components.  See the screencast for the specific look but in a nutshell all you need to do is change the theme name in your CEWP.  I&#8217;m quite pleased with the fact that the theme that works for me is called excite-bike.  For some reason the name makes me happy.</p>
<p>&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;/sprc/Resources%20%20jQuery/jquery-ui-themes-1.7.1/<strong>excite-bike</strong>/jquery-ui.css&#8221;&gt;  to<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;/sprc/Resources%20%20jQuery/jquery-ui-themes-1.7.1/<strong>redmond</strong>/jquery-ui.css&#8221;&gt;</p>
<p><strong>Personalized View and Dynamic List Filtering</strong></p>
<p>I added a page where a user can view all blog posts along with their own comments.  This uses the Filter web parts that are part of MOSS Enterprise Edition.  The important thing to note here is that you need to set the Select Value to Provide to SharePoint profile value for current name and then select &#8220;Name&#8221; from the drop down.</p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/01/Filter1.png"><img class="alignnone size-large wp-image-456" title="Filter[1]" src="http://www.intelligenceamong.us/wp-content/uploads/2010/01/Filter1-1024x796.png" alt="" width="597" height="523" /></a></p>
<p>Adding dynamic filtering could not be easier thanks to <a href="http://instantlistfilter.codeplex.com/">Jaap Vossers solution</a>.  This requires jQuery 1.2.6 so I installed that into the Resource Center and then it&#8217;s just a matter of placing the script in a CEWP.  In my view this dramatically improves the user experience. </p>
<p><strong>Charting and Real-Time Data</strong></p>
<p>For the last piece of the puzzle I want to provide some charts on the home page that would show in (near) real time some of the activity on the blog.  For this I downloaded the ChartPart solution from CodePlex and begged my administrator to install it <img src='http://www.intelligenceamong.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />    It is incredibly easy to configure and it renders really slick looking charts. </p>
<p>Everything else was accomplished with a few custom lists and a 2 step workflow called Activity Tracker on the Posts list.</p>
<p>I created 2 lists &#8211; Comment Counter and Post Comment Counter. </p>
<p>Comment Counter contains 3 columns &#8211; Title, Comment Poster (person) and Comment Count (number).</p>
<p>Post Comment Counter contains 2 columns &#8211; Post Subject and Comment Count (number).</p>
<p>Below is a shot of the workflow in SPD</p>
<p><a href="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture-4.png"><img class="alignnone size-full wp-image-454" title="New Picture (4)" src="http://www.intelligenceamong.us/wp-content/uploads/2010/01/New-Picture-4.png" alt="" width="625" height="473" /></a></p>
<p>Both steps are essentially the same and the process goes like this:</p>
<ol>
<li>If the current user has a an entry already in the Comment Count list then get the current comment count, increment the count by 1 and then update their list item.</li>
<li>If the user has no item in the Comment Count list then create a new item for them with a Comment Count of 1.</li>
</ol>
<p>The second step is essentially the same except we are looking to see if an item with the same subject as the current post the user is commenting on exists.  If so increment by 1, otherwise create a new item for that Blog Post with a Comment Count of 1.</p>
<p>We can then create views and easily hook the charts up to those views.</p>
<p>And that is it.  Going through this process has been extremely educational for me as it relates to integrating  jQuery with SharePoint and I can say with certainty that our users are very impressed by the new pizazz we&#8217;re adding to their intranet.  It also made it clear how many resources there are available and what you can do when you combine them into a holistic solution.</p>
<p>Please feel free to send me any comments or questions.</p>
<img src="http://www.intelligenceamong.us/?ak_action=api_record_view&id=450&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.intelligenceamong.us/?feed=rss2&amp;p=450</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
