tag:blogger.com,1999:blog-47069239825758709152024-03-21T17:13:20.908-07:00All things SharePointCovering everything from C# .NET development, customization of master pages, jQuery integration, Silverlight, and SharePoint 2010 deployment.Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-4706923982575870915.post-89702804211350210552012-06-06T09:04:00.000-07:002012-06-06T09:05:08.865-07:00Debugging Custom SharePoint 2010 Timer JobsFor those of you who have seen posts on how to debug custom timer jobs, you have probably noticed that many of the solutions do not work, or only work part of the time. The foolproof, 100% method for getting an instance of the debugger running on your timer job is to add this line of code at the top of your <b>Execute</b> method:<br />
<br />
System.Diagnostics.Debugger.Launch();<br />
<br />
This will immediately pause the job and prompt you to launch a debug instance, which can be done in your open VS project. Once the debug instance is running, you can resume running the job.Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com2tag:blogger.com,1999:blog-4706923982575870915.post-46128538354799594212011-08-16T11:06:00.000-07:002011-08-16T11:15:12.540-07:00Cross-Site (Web) XsltListViewWebPartIt's been awhile since I've updated the blog, but just stumbled on something that may help anyone looking to display list information across multiple sites within a single site collection. Previously we handled this through jQuery, but I've found a much better way to display this information without the use of a CQWP, and the solution was lying directly under my nose the whole time.<br />
<br />
I was looking at creating a list view web part that would allow us to present data from one Web on another Web while maintaining the same look and functionality of the ListViewWebPart. I created a web part project in Visual Studio, and began hacking apart the XsltListViewWebPart class in Reflector (shh... don't tell), when I noticed a property in the XsltListViewToolPart class called "WebId". Why would WebId be a property in the XsltListViewWebPart you might ask? Very curious I thought...<br />
<br />
To begin, I created a new view on the list that I wanted to share, and exported the .webpart file from the XsltListView. To export the .webpart file, you simple click on Site Actions > Edit Page, and on the List View Web Part context menu click "Export" to save the file to your local machine. Web Part files are simply an XML representation of the properties of the web part, and can be imported back into the Web Parts library at the parent site for reuse throughout your Site Collection.<br />
<br />
<pre class="brush: js; toolbar: true;highlight: 44;"><webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="InitialAsyncDataFetch" type="bool">False</property>
<property name="ChromeType" type="chrometype">Default</property>
<property name="Title" type="string" />
<property name="Height" type="string" />
<property name="CacheXslStorage" type="bool">True</property>
<property name="ListDisplayName" type="string" null="true" />
<property name="AllowZoneChange" type="bool">True</property>
<property name="AllowEdit" type="bool">True</property>
<property name="XmlDefinitionLink" type="string" />
<property name="DataFields" type="string" />
<property name="Hidden" type="bool">False</property>
<property name="ListName" type="string">{B7B83EDB-714E-47A8-AF42-92A194B09169}</property>
<property name="NoDefaultStyle" type="string" />
<property name="AutoRefresh" type="bool">False</property>
<property name="ViewFlag" type="string">8388613</property>
<property name="Direction" type="direction">NotSet</property>
<property name="AutoRefreshInterval" type="int">60</property>
<property name="AllowConnect" type="bool">True</property>
<property name="Description" type="string" />
<property name="AllowClose" type="bool">True</property>
<property name="ShowWithSampleData" type="bool">False</property>
<property name="ParameterBindings" type="string">
&lt;ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/&gt;
&lt;ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/&gt;
&lt;ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/&gt;
&lt;ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/&gt;
&lt;ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" /&gt;
&lt;ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" /&gt;
&lt;ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" /&gt;
&lt;ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" /&gt;
&lt;ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /&gt;
&lt;ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /&gt;
</property>
<property name="Xsl" type="string" null="true" />
<property name="CacheXslTimeOut" type="int">86400</property>
<property name="WebId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">820a89d6-8509-4bc4-9d39-4fd91e420f7a</property>
<property name="ListUrl" type="string" null="true" />
<property name="DataSourceID" type="string" />
<property name="FireInitialRow" type="bool">True</property>
<property name="ManualRefresh" type="bool">False</property>
<property name="ViewFlags" type="Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Html, TabularView, Mobile</property>
<property name="ChromeState" type="chromestate">Normal</property>
<property name="AllowHide" type="bool">True</property>
<property name="PageSize" type="int">-1</property>
<property name="SampleData" type="string" null="true" />
<property name="BaseXsltHashKey" type="string" null="true" />
<property name="AsyncRefresh" type="bool">False</property>
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="ListId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">b7b83edb-714e-47a8-af42-92a194b09169</property>
<property name="DataSourceMode" type="Microsoft.SharePoint.WebControls.SPDataSourceMode, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">List</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="TitleUrl" type="string">/kb/Lists/Emerging Issues</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="DataSourcesString" type="string" />
<property name="GhostedXslLink" type="string">main.xsl</property>
<property name="PageType" type="Microsoft.SharePoint.PAGETYPE, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">PAGE_NORMALVIEW</property>
<property name="DisplayName" type="string">OnlineWPItems</property>
<property name="UseSQLDataSourcePaging" type="bool">True</property>
<property name="Width" type="string" />
<property name="ExportMode" type="exportmode">All</property>
<property name="XslLink" type="string" null="true" />
<property name="ViewContentTypeId" type="string">0x</property>
<property name="HelpUrl" type="string" />
<property name="XmlDefinition" type="string">&lt;View Name="{863AE444-CE71-4B03-A037-976A884DFA9B}" MobileView="TRUE" Type="HTML" DisplayName="OnlineWPItems" Url="/kb/Lists/Emerging Issues/OnlineWPItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png"&gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name="Modified" Ascending="FALSE"/&gt;&lt;/OrderBy&gt;&lt;Where&gt;&lt;And&gt;&lt;And&gt;&lt;Contains&gt;&lt;FieldRef Name="Intuit_x0020_Services"/&gt;&lt;Value Type="Text"&gt;Software (SaaS):Online Payroll&lt;/Value&gt;&lt;/Contains&gt;&lt;IsNotNull&gt;&lt;FieldRef Name="Issue_x0020_Status"/&gt;&lt;/IsNotNull&gt;&lt;/And&gt;&lt;Neq&gt;&lt;FieldRef Name="Issue_x0020_Status"/&gt;&lt;Value Type="Text"&gt;Updated&lt;/Value&gt;&lt;/Neq&gt;&lt;/And&gt;&lt;/Where&gt;&lt;GroupBy/&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name="Issue_x0020_Status"/&gt;&lt;FieldRef Name="LinkTitle"/&gt;&lt;/ViewFields&gt;&lt;RowLimit Paged="TRUE"&gt;5&lt;/RowLimit&gt;&lt;Aggregations Value="Off"/&gt;&lt;Toolbar Type="Standard"/&gt;&lt;/View&gt;</property>
<property name="Default" type="string" />
<property name="TitleIconImageUrl" type="string" />
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="SelectParameters" type="string" />
</properties>
</data>
</webPart>
</webParts>
</pre><br />
The highlighted line shows the WebId property in the exported web part file. If you open the file in a text editor or Visual Studio, you can modify the WebId before uploading the new file to your Web Parts Gallery. By default, the WebId is Guid.Empty() or 00000000-0000-0000-0000-000000000000.<br />
<br />
To get the WebId, fire up powershell on one of your sharepoint servers and use this snippet:<br />
<br />
<pre class="brush: js; toolbar: true;">$web = Get-SPWeb http://[url]
$web.Id
</pre><br />
Be sure to include the full path of the web, e.g. if the list is hosted under a subsite it would be http://sharepoint/listlocation.<br />
<br />
Now that you have your WebId, copy it from the powershell window and paste it into the WebPart file property "WebId" overwriting the default value. Save the file. <br />
<br />
<u><b>Uploading the Web Part File</b></u><br />
<ol><li><b>Navigate to the top-level site in your site collection</b></li>
<li><b>Click on Site Actions > Site Settings</b></li>
<li><b>Click on "Web Parts" under the "Galleries" section</b></li>
<li><b>Upload your .webpart file to the Web Part Gallery </b>(Name the file something that will easily be recognizable when adding the web part to your pages. I also tend to organize my web parts into groups, and in this case I've created a new Group called "Cross-site List View Web Parts")</li>
<li><b>Save your file properties.</b></li>
</ol><br />
At this point you should be at the "Web Part Gallery" items view. From here you can click on the title of your newly added web part to see how it will render on your pages. <br />
<br />
To add the web part to a page in SharePoint, simply edit your page and click the "Add Web Part" option, find the group you created in the "Add Web Part" menu, and click on you web part to add it to the page. Don't forget to save or Checkin your page. If you have publishing enabled, be sure to publish the page so that the changes are available to all users.<br />
<br />
Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com10tag:blogger.com,1999:blog-4706923982575870915.post-23057686870669800092011-04-12T12:00:00.000-07:002011-04-12T12:01:48.189-07:00Group Calendar - Default DisplaySo... as it always seems in my world, I get a lot of "That's great, but what about this?" questions. Getting the Group Calendar to display default resources was fine, but a new requirement to set the default display to month view popped up. Here's how you do it.<br />
<br />
Within the code I provided in my previous post, if you kept the code line-for-line and included the jQuery reference, insert this line at the bottom:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">MoveView('month', $(el).attr('ctxid'));</div><br />
If you chose a less sophisticated approach, you could use:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">MoveView('month', '[Context ID]'); </div><br />
This will automagically shift your Calendar view to the month view, still displaying your default resources. <br />
<br />
Here is the complete code reference:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><script type="text/javascript" src="/Style Library/lib/jQuery.min.js"></script></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"><script type="text/javascript"></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">var el = $(".ms-acal-rootdiv");</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">var xml = "\u003cEntities Append=\u0022True\u0022 Error=\u0022\u0022 DoEncodeErrorMessage=\u0022True\u0022 Separator=\u0022;\u0022 MaxHeight=\u00223\u0022\u003e\u003cEntity Key=\u0022All Computers\u0022 DisplayText=\u0022All Computers\u0022 IsResolved=\u0022True\u0022 Description=\u0022\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022 xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eResourceMembers\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e1;#Computer 01;#2;#Computer 02;#3;#Computer 03;#4;#Computer 04;#5;#Computer 05;#6;#Computer 06;#7;#Computer 07;#8;#Computer 08;#9;#Computer 09;#10;#Computer 10;#11;#Computer 11;#12;#Computer 12;#13;#Computer 13;#14;#Computer 14;#15;#Computer 15\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPResourceId\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e30\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003eResourceGroup\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u002fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches \u002f\u003e\u003c\u002fEntity\u003e\u003c\u002fEntities\u003e";</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, $(el).attr('ctxid')); </div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">sel.selectEntities(xml, true);</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">MoveView('month', $(el).attr('ctxid'));</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">}</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">ExecuteOrDelayUntilScriptLoaded(_setDefaultResources, "sp.ribbon.js");</div><div style="font-family: "Courier New",Courier,monospace;"></script></div>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com5tag:blogger.com,1999:blog-4706923982575870915.post-54513137939484949602011-03-29T15:50:00.000-07:002011-03-30T11:26:28.745-07:00Displaying Default Resources on the Group Calendar<b>[IMPORTANT NOTE] </b>It has been pointed out that some of the forum users who have tried this solution cannot get it to work. I forgot to mention that I'm using JQuery-1.5.1.min.js, which is why you see $() references in the solution. You could use substitute the JQuery variable "ID" for the actual ID of the Web Part Zone, e.g. "WPQ1", but I would suggest uploading the JQuery min file to your Style Library and using the following reference:<br />
<br />
<script src="/Style%20Library/JQuery-1.5.1.min.js" type="text/javascript"><br />
</script><br />
<br />
Sorry for the miscommunication.<br />
<br />
It's been awhile since I've posted any ground-breaking new discoveries, so I thought I would pass on a bit of info about the Group Calendar and displaying default groups. <b>Disclaimer:</b> this is still in beta, and not running on a production site yet.<br />
<br />
I've stumbled across a few blog posts about the group calendar, and the need to display a default set of resources on the calendar. The OOB functionality requires the user to select a resource/resource group before items show up on the calendar. Being the stubborn developer that I am, I decided that I would come up with a fix for this based on a specific requirement from one of our Business Units. This solution works for Resource Groups, but I'm sure it can be modified to easily display resources or people, depending on your requirements.<br />
<br />
Looking at the calendar in action, you will quickly realize that the calendar uses the picker dialog for selecting resources, and AJAX to render selected items on the calendar. So, how does one go about calling the necessary functions to populate the calendar? Magic! ;-)<br />
<br />
I started by viewing the source of the parent page to get an idea of what was actually taking place when the picker dialog closes. Here is the event you are looking for:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOrklQRTmzZBhNRNNif1aMY15ugCq_w-uVhvg0xtdEHw6XAeFRJpQfZH2AIi2-y7GSO7XPC5mRP3ckd6aKayejCtXl16GU5Y2JXRc9kjUH6pyckOEz1pAEThHy4kwMErMdDm5t1zgDxFU/s1600/Screen+shot+2011-03-29+at+3.19.58+PM.png" imageanchor="1"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOrklQRTmzZBhNRNNif1aMY15ugCq_w-uVhvg0xtdEHw6XAeFRJpQfZH2AIi2-y7GSO7XPC5mRP3ckd6aKayejCtXl16GU5Y2JXRc9kjUH6pyckOEz1pAEThHy4kwMErMdDm5t1zgDxFU/s640/Screen+shot+2011-03-29+at+3.19.58+PM.png" width="640" /></a></div><br />
Great! But how does this help you? You may notice that the dialog result is xml, and that setting the result requires a call to SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(type, id). After a bit of searching in the SP.UI.Calendar.debug.js file, I found some information around the ResourceSelector and retrieving the selector type. If you do a search of the source code in your view source window for "add_resource", you'll see that the "Add Resources" link attribute "evtid" is "add_resource". Searching through the SP.UI.Calendar.debug.js on "add_resource" yielded this handy bit of information:<br />
<br />
<div style="color: red; font-family: "Courier New",Courier,monospace;">$p0.$z('add_resource', Function.createDelegate(this, function ($p1_0) {<br />
__spPickerDialogFunc(1, this.$w_1, true);</div><span style="color: red; font-family: "Courier New",Courier,monospace;">}));</span><br />
<br />
This shows that the type is 1, and add = true. Once I had that information, I just needed to track down the XML data being passed from the picker dialog. That's where <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> comes in. If you aren't familiar with Fiddler, you should be. I won't go into too much detail, but will give you the gist below.<br />
<br />
First, I opened an instance of fiddler and launched IE, browsing to my home page (which contains my group calendar). I then clicked the "Add Resources" link, and added a Resource Group called "All Computers" and clicked "OK".<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxaqYMARGNUZPaGI_wvOZDtWmvJF6R7zsawEHyHKGHvaMHhSpHks3ggSXJb4uyvl7fzZt9UBTp1ooXHEvE5y9cXoa6ecwqsMza0GBclDACzgRI44ti44JVCUSdXZzYWRHz5RkQsPW9wf4/s1600/Screen+shot+2011-03-29+at+3.35.14+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="459" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxaqYMARGNUZPaGI_wvOZDtWmvJF6R7zsawEHyHKGHvaMHhSpHks3ggSXJb4uyvl7fzZt9UBTp1ooXHEvE5y9cXoa6ecwqsMza0GBclDACzgRI44ti44JVCUSdXZzYWRHz5RkQsPW9wf4/s640/Screen+shot+2011-03-29+at+3.35.14+PM.png" width="640" /></a></div>You'll see below that the events now display for each resource in the calendar. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbm77PHiXxFudhkKlKXKKXRW1PdgH-LDoa3tL_2W9PnyCT2nTbcqCmYK1whgkri1i7WvQPQkqGTkFgNLMQlIshYKwrg1z7MSL_zseXEP4sexd6clEtZYEYMV8HG61M2FLTGdEZiuaffqg/s1600/Screen+shot+2011-03-29+at+3.36.46+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="418" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbm77PHiXxFudhkKlKXKKXRW1PdgH-LDoa3tL_2W9PnyCT2nTbcqCmYK1whgkri1i7WvQPQkqGTkFgNLMQlIshYKwrg1z7MSL_zseXEP4sexd6clEtZYEYMV8HG61M2FLTGdEZiuaffqg/s640/Screen+shot+2011-03-29+at+3.36.46+PM.png" width="640" /></a></div><br />
I then went into fiddler, and took a look at the final request from Picker.aspx, and began scanning the TextView for any information that might be helpful.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMhYB5bsxHdM4mkoeTYKGxFiUZu5tg5YYLimZ6fREX04_NMrR0iCIQ7nE2zA_MVga_6TmXjpiJcHb47tANPrhpqJdXGHo-lI9D4zNWNbxFwo0pJLTNQXrXKW9X88RxrNQZSKdGJkKKcwY/s1600/Screen+shot+2011-03-29+at+3.38.04+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="454" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMhYB5bsxHdM4mkoeTYKGxFiUZu5tg5YYLimZ6fREX04_NMrR0iCIQ7nE2zA_MVga_6TmXjpiJcHb47tANPrhpqJdXGHo-lI9D4zNWNbxFwo0pJLTNQXrXKW9X88RxrNQZSKdGJkKKcwY/s640/Screen+shot+2011-03-29+at+3.38.04+PM.png" width="640" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5G9oe5cp8EGYnoSJDysFttLW-iRlMrMH3qJE2QUFHltut5nEzckk1OOynhnIoaU8vLxjP0_x-nuhOnhEEZUKhxImmY0NlK1IDJ1W8n5AdYhjxLYFMOLSNR5y8wkLCmycD3kYP2Y6Xm68/s1600/Screen+shot+2011-03-29+at+3.38.46+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="414" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5G9oe5cp8EGYnoSJDysFttLW-iRlMrMH3qJE2QUFHltut5nEzckk1OOynhnIoaU8vLxjP0_x-nuhOnhEEZUKhxImmY0NlK1IDJ1W8n5AdYhjxLYFMOLSNR5y8wkLCmycD3kYP2Y6Xm68/s640/Screen+shot+2011-03-29+at+3.38.46+PM.png" width="640" /></a></div><br />
And there it is, in an ecma encoded string. The full XML return value from the dialog window. I copied the <b>ret</b> variable and began scripting a new function for the home page.<br />
<b> </b><br />
<b>NOTE: </b>If you don't already know this, you can build your javascript into an html or txt file and upload it to a document library for reference in a Content Editor Web Part. I've found that if you just paste the javascript directly into the Content Editor, SharePoint has a nasty habit of correcting it for you, which can really break your code. I typically put my text/html files into a folder called "ctrl" in the Style Library. That way, if I reuse the code on multiple pages, I can update one single file and call it a day.<br />
<b></b><br />
Here is my final script to populate the calendar:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"><script type="text/javascript" src="/Style Library/Jquery.min.js"></script></span><br />
<span style="font-size: x-small;"><script type="text/javascript"></span><br />
<span style="font-size: x-small;"><br />
function _setDefaultResources() {<br />
var el = $(".ms-acal-rootdiv");<br />
var xml = "\u003cEntities Append=\u0022True\u0022 Error=\u0022\u0022 DoEncodeErrorMessage=\u0022True\u0022 Separator=\u0022;\u0022 MaxHeight=\u00223\u0022\u003e\u003cEntity Key=\u0022All Computers\u0022 DisplayText=\u0022All Computers\u0022 IsResolved=\u0022True\u0022 Description=\u0022\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022 xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eResourceMembers\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e1;#Computer 01;#2;#Computer 02;#3;#Computer 03;#4;#Computer 04;#5;#Computer 05;#6;#Computer 06;#7;#Computer 07;#8;#Computer 08;#9;#Computer 09;#10;#Computer 10;#11;#Computer 11;#12;#Computer 12;#13;#Computer 13;#14;#Computer 14;#15;#Computer 15\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPResourceId\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e30\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003eResourceGroup\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u002fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches \u002f\u003e\u003c\u002fEntity\u003e\u003c\u002fEntities\u003e";<br />
<br />
<br />
var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, $(el).attr('ctxid'));<br />
sel.selectEntities(xml, true);<br />
}<br />
</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;">ExecuteOrDelayUntilScriptLoaded(_setDefaultResources, "sp.ribbon.js");</span><br />
<span style="font-size: x-small;"></script></span><br />
</div><br />
A few important items to note... if you have multiple calendars on a single page, you will need to find the id of the calendar you are populating. The ctxid is actually a dynamically populated id (via javascript) of the web part context, which in this case is WPQ2. Make sure that you are using the ExecuteOrDelayUntilScriptLoaded( function, "sp.ribbon.js") call. The context id of the web part is not assigned until sp.ribbon.js is fully loaded. Once you have all that, it will work like a charm.<br />
<br />
As always, if you have any questions, feel free to ping me. Hopefully, this will save you some time and make you look like a rockstar!Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com63tag:blogger.com,1999:blog-4706923982575870915.post-8256139037507321112011-02-10T11:49:00.000-08:002011-02-10T12:02:36.054-08:00SharePoint 2010 Search - Thesaurus FilesThis year is the year of search for us. We're looking at implementing fast, focusing on metadata and better tagging in our content, and improving the overall search experience for our users. With that in mind, I just wanted to touch on creating Thesaurus files in SharePoint 2010 Search, as I've found the content on Technet and MSDN to be a bit cryptic.<br />
<br />
<b><u>Modifying Thesaurus Files</u></b><br />
If you've been referencing Technet (<a href="http://technet.microsoft.com/en-us/library/dd361734.aspx">http://technet.microsoft.com/en-us/library/dd361734.aspx</a>), there is some pretty good information on how to create thesaurus files to improve your search. There are two main priniples in a thesaurus file: expansion sets and replacement sets.<br />
<br />
To create an expansion set, which essentially maps synonyms to a specific keyword, you simply need to add the following code to your thesasurus file:<br />
<br />
<expansion><br />
<sub>401k</sub><br />
<sub>401 k</sub><br />
<sub>401-k</sub><br />
</expansion><br />
<br />
An important item to note, parentheses are not acceptable in a thesaurus file. I found this out the hard way when attempting to add <sub>401(k)</sub>, which is the approved standard for 401(k). Luckily for us, the parentheses are ignored in the keyword, so 401(k) will still appear in the search results, even when the user keys in 401-k.<br />
<br />
To create a replacement set, the schema is similar:<br />
<br />
<expansion><br />
<pat>IE8</pat><br />
<pat>IE7</pat><br />
<sub>Internet Explorer</sub><br />
</expansion><br />
<br />
<br />
In this case, IE8 or IE7 would be replaced by Internet Explorer.<br />
<br />
While we don't have much use for replacement sets, expansion sets have proven extremely valuable. Instead of providing Best Bets links via the Search Keywords administration tool, we can populate our search results with all synonyms immediately, which reduces the need for multiple clicks to get a specific result.<br />
<br />
<b><u>Updating Thesaurus Files</u></b><br />
<b><u><br />
</u></b><br />
The update process is where I have found the least amount of information. Thesaurus files are stored in multiple locations on a SharePoint Server, and determining the correct location can be a real pain in the butt. We update our Thesaurus files in 2 locations in the /Program Files/Microsoft Office Servers/14.0/ folder.<br />
<br />
First, we update the thesaurus files here: \Program Files\Microsoft Office Servers\14.0\Data\Config. Updates to the thesaurus files here will ensure that any new Search Service Applications that you create will have the updated thesaurus definitions when they spin up.<br />
<br />
Second, we copy the thesaurus files to the: \Program Files\Microsoft Office Servers\14.0\Data\Applications\[GUID]\Config folder. The GUID will be the guid of your Search Service Application, which can be found using this bit of Powershell goodness: Get-SPServiceApplication. This powershell command will list all of your service applications and their corresponding IDs.<br />
<br />
Once the files are copied to this location, you'll need to restart the search service for the changes to take affect. You can do this from Administrative Tools > Services > SharePoint Server Search 14, or by running these commands:<br />
<br />
net stop osearch<br />
net start osearch<br />
<br />
Once the service is resarted, go to your search center and plug in one of the newly added expansion/replacement terms to see your results.<br />
<br />
It is important to note that if you're running search on multiple servers, you will need to perform these steps on each server running search. If you already have multiple search applications running, you will also need to copy your thesaurus files to each config directory under the GUID folder for each search service application.<br />
<br />
For safety sake, we also updated the tsneu.xml along with tsenu.xml. NEU is the language neutral thesaurus file, and ENU is the US English thesaurus file. Definitions for each language prefix can be found on technet.Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com1tag:blogger.com,1999:blog-4706923982575870915.post-88054350830306800832011-02-08T11:56:00.000-08:002011-02-08T12:03:18.413-08:00Setting Managed Metadata Fields via Javascript - UPDATEAs I mentioned in a previous post, Managed Metadata fields can be set using Javascript. I've actually found an easier method to retrieve and update the values via javascript that I wish to share quickly.<br />
<br />
Previously, I was retrieving the Managed Metadata Field Value in display format. I encountered an issue when attempting to use this value to update a form field on a modal popup however, due to multiple results in the Term Store being found for a single string. To remedy this, I found the hidden value for the Metadata Field including the GUID of the term. To do this, I used my handy Powershell script from my previous post, and located the field name for the Metadata Field. I then located the following XML for my field:<br />
<br />
<br />
<div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><<span style="color: #a31515;">Field</span> <span style="color: red;">Type</span>=<span style="color: black;">"</span>Note<span style="color: black;">"</span> <span style="color: red;">DisplayName</span>=<span style="color: black;">"</span>Role_1<span style="color: black;">"</span> <span style="color: red;">StaticName</span>=<span style="color: black;">"</span>RoleTaxHTField<span style="color: black;">"</span> <span style="color: red;">Name</span>=<span style="color: black;">"</span>RoleTaxHTField<span style="color: black;">"</span> <span style="color: red;">ID</span>=<span style="color: black;">"</span>{bbaf434e-cc7e-40b5-b43e-5605ee3c3543}<span style="color: black;">"</span> <span style="color: red;">ShowInViewForms</span>=<span style="color: black;">"</span>FALSE<span style="color: black;">"</span> <span style="color: red;">Required</span>=<span style="color: black;">"</span>FALSE<span style="color: black;">"</span> <span style="color: red;">Hidden</span>=<span style="color: black;">"</span>TRUE<span style="color: black;">"</span> <span style="color: red;">CanToggleHidden</span>=<span style="color: black;">"</span>TRUE<span style="color: black;">"</span> <span style="color: red;">SourceID</span>=<span style="color: black;">"</span>{d96d858a-03f7-4b0f-a73f-fc0ee68996cd}<span style="color: black;">"</span> <span style="color: red;">Customization</span>=<span style="color: black;">""</span> <span style="color: red;">ColName</span>=<span style="color: black;">"</span>ntext9<span style="color: black;">"</span> <span style="color: red;">RowOrdinal</span>=<span style="color: black;">"</span>0<span style="color: black;">"</span>/></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Field</span> <span style="color: red;">Type</span>=<span style="color: black;">"</span>TaxonomyFieldTypeMulti<span style="color: black;">"</span> <span style="color: red;">DisplayName</span>=<span style="color: black;">"</span>Role<span style="color: black;">"</span> <span style="color: red;">List</span>=<span style="color: black;">"</span>{aff9fc9f-40b8-4a89-aaa3-f5f566117446}<span style="color: black;">"</span> <span style="color: red;">WebId</span>=<span style="color: black;">"</span>d96d858a-03f7-4b0f-a73f-fc0ee68996cd<span style="color: black;">"</span> <span style="color: red;">ShowField</span>=<span style="color: black;">"</span>Term1033<span style="color: black;">"</span> <span style="color: red;">Mult</span>=<span style="color: black;">"</span>TRUE<span style="color: black;">"</span> <span style="color: red;">Sortable</span>=<span style="color: black;">"</span>FALSE<span style="color: black;">"</span> <span style="color: red;">Required</span>=<span style="color: black;">"</span>FALSE<span style="color: black;">"</span> <span style="color: red;">Group</span>=<span style="color: black;">"</span>Knowledge Base Columns<span style="color: black;">"</span> <span style="color: red;">ID</span>=<span style="color: black;">"</span>{5050205f-5771-40e1-b356-ec6c989147f1}<span style="color: black;">"</span> <span style="color: red;">SourceID</span>=<span style="color: black;">"</span>{d96d858a-03f7-4b0f-a73f-fc0ee68996cd}<span style="color: black;">"</span> <span style="color: red;">StaticName</span>=<span style="color: black;">"</span>Role<span style="color: black;">"</span> <span style="color: red;">Name</span>=<span style="color: black;">"</span>Role<span style="color: black;">"</span> <span style="color: red;">Version</span>=<span style="color: black;">"</span>4<span style="color: black;">"</span> <span style="color: red;">EnforceUniqueValues</span>=<span style="color: black;">"</span>FALSE<span style="color: black;">"</span> <span style="color: red;">Customization</span>=<span style="color: black;">""</span> <span style="color: red;">ColName</span>=<span style="color: black;">"</span>int8<span style="color: black;">"</span> <span style="color: red;">RowOrdinal</span>=<span style="color: black;">"</span>0<span style="color: black;">"</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Default</span>/></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> <</span>Customization<span style="color: blue;">></span></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> <</span>ArrayOfProperty<span style="color: blue;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">SspId</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q1</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q1:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">d6d8e56a-06c9-4c99-a5b0-1ea8b6eb747f</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">GroupId</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">TermSetId</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q2</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q2:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">50857e97-8bdf-4000-bf13-5b1ba34d745a</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">AnchorId</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q3</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q3:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">00000000-0000-0000-0000-000000000000</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">UserCreated</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q4:boolean<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">false</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">Open</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q5</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q5:boolean<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">false</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">TextField</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q6</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q6:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">{bbaf434e-cc7e-40b5-b43e-5605ee3c3543}</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">IsPathRendered</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q7</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q7:boolean<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">false</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">IsKeyword</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q8</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q8:boolean<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">false</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">TargetTemplate</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> <</span><span style="color: #a31515;">Name</span><span style="color: blue;">></span>CreateValuesInEditForm<span style="color: blue;"></span><span style="color: #a31515;">Name</span><span style="color: blue;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q9</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q9:boolean<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">false</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> <</span><span style="color: #a31515;">Name</span><span style="color: blue;">></span>FilterAssemblyStrongName<span style="color: blue;"></span><span style="color: #a31515;">Name</span><span style="color: blue;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q10</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q10:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">FilterClassName</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q11</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q11:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">Microsoft.SharePoint.Taxonomy.TaxonomyField</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Name</span>><span style="color: black;">FilterMethodName</span><span style="color: #a31515;">Name</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q12</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q12:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">GetFilteringHtml</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Property</span>></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> <</span><span style="color: #a31515;">Name</span><span style="color: blue;">></span>FilterJavascriptProperty<span style="color: blue;"></span><span style="color: #a31515;">Name</span><span style="color: blue;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <<span style="color: #a31515;">Value</span> <span style="color: red;">xmlns:q13</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema<span style="color: black;">"</span> <span style="color: red;">p4:type</span>=<span style="color: black;">"</span>q13:string<span style="color: black;">"</span> <span style="color: red;">xmlns:p4</span>=<span style="color: black;">"</span>http://www.w3.org/2001/XMLSchema-instance<span style="color: black;">"</span>><span style="color: black;">FilteringJavascript</span><span style="color: #a31515;">Value</span>></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Property</span>></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> </span>ArrayOfProperty<span style="color: blue;">></span></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"> </span>Customization<span style="color: blue;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span style="color: #a31515;">Field</span>></div><div><br />
</div><div>As you can see, there are 2 fields listed in the XML. The first field is the hidden value including the GUID of the term or terms, and the second field is the container/display field that is rendered as a string in Display Mode.</div><div><br />
</div><div>On my display form for the items that will be receiving feedback, I added a hidden field in the XSLT, and set the value to </div><div><br />
</div><div><span class="Apple-style-span" style="color: #a31515; font-family: Consolas; font-size: 10px;"><span style="color: blue;"><</span></span><span class="Apple-style-span" style="color: #a31515; font-family: Consolas; font-size: 10px;">xsl-value-of select="@RoleTaxHTField" /</span><span class="Apple-style-span" style="color: #a31515; font-family: Consolas; font-size: 10px;"><span style="color: blue;">></span></span></div><div><span class="Apple-style-span" style="color: #a31515; font-family: Consolas; font-size: 10px;"><span style="color: blue;"><br />
</span></span></div><div>When opening the dialog, the arguments passed include the value of this field. On my dialog I now set the following the hidden storage field of the Metadata Field to the value passed. Now when the user submits the feedback, the value is mapped to the correct term without any errors, and there is no need to run the javascript that forces the metadata field to update.</div><div><br />
</div><div><br />
</div><div><br />
</div><div><br />
</div>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com1tag:blogger.com,1999:blog-4706923982575870915.post-17877119289304527372011-02-07T12:00:00.000-08:002011-02-07T12:00:36.025-08:00Working with Lists and SchemasI thought I would put up a quick post about retrieving list schema definitions via powershell while at the SPTechCon 2011 in SF this week. I've been working on some new Metadata functionality with JQuery and the SPServices Library (<a href="http://spservices.codeplex.com/">http://spservices.codeplex.com/</a> courtesy of Marc D Anderson), and realized that it's a real pain in the a** working with Managed Metadata Columns in SharePoint.<br />
<br />
Here's a quick reference for grabbing the XML Schema of a list definition so you can get to internal field names, column definitions, and the Taxomony Ids required for interacting with the TaxonomyClientService.<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$site = Get-SPSite http://[Site Url]</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$web = $site.OpenWeb() - <b>note: leave the value blank for the top-level web, or specify "/web url" between the parentheses to retrieve a specific web</b></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$list = $web.Lists["List Name"]</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$list.SchemaXML | Out-File C:\Temp\schema.xml</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit;">Now you should have an xml file containing the schema of your list. Open the file in your XML editor of choice, and have a blast locating the attributes you need.</span><br />
<span class="Apple-style-span" style="font-family: inherit;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit;"><br />
</span>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com2tag:blogger.com,1999:blog-4706923982575870915.post-40197287522275824052011-01-18T13:15:00.000-08:002011-01-18T13:22:40.200-08:00Publishing HtmlEditor on a Custom Application PageAs promised, I thought I would give you a quick tutorial on how to add an HtmlEditor to a custom application page in SharePoint 2010.<br />
<br />
As a quick overview, we had a need for streamlining our content creation process. We use standard HTML blocks to perform custom XSLT transformation before posting the content to our customer facing website, and needed a structured method for storing and transforming the data. Initially, we used Reusable Content Blocks to store the base HTML, and then used some CSS to highlight the editable regions. Unfortunately, the process became very difficult to manage, and required us to train our content editors in html best practices, which was extremely inefficient.<br />
<br />
To streamline the process, we created a custom HTML editor and gave the users simple menus to click which would allow them to enter just the content which we would then wrap with our predefined content blocks. The menu's allow a user to click a specific block type, key in the content, and click the save button to view the preview article before saving. Here are a few screen captures to illustrate:<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/_6k2DnAIyEGA/TTX7HLXEy7I/AAAAAAAABPY/3lLL8geALAI/s1600/Editor-Menu.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="190" src="http://2.bp.blogspot.com/_6k2DnAIyEGA/TTX7HLXEy7I/AAAAAAAABPY/3lLL8geALAI/s400/Editor-Menu.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Content Editor Menus</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_6k2DnAIyEGA/TTX7HLXEy7I/AAAAAAAABPY/3lLL8geALAI/s1600/Editor-Menu.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a></div><a href="http://2.bp.blogspot.com/_6k2DnAIyEGA/TTX7HLXEy7I/AAAAAAAABPY/3lLL8geALAI/s1600/Editor-Menu.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/_6k2DnAIyEGA/TTX7GzK8yGI/AAAAAAAABPY/7HrvO8xnu6Q/s1600/Editor-Dialog.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="225" src="http://1.bp.blogspot.com/_6k2DnAIyEGA/TTX7GzK8yGI/AAAAAAAABPY/7HrvO8xnu6Q/s400/Editor-Dialog.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Content Editor Dialog</td></tr>
</tbody></table><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
As you can see in the above images, we created a menu to allow for editing and adding of content blocks. When an option is clicked, a Dialog Window opens containing 1 or 2 rich html editors depending on the block type. We chose to go with the standard Publishing HtmlEditor control because our users liked the ribbon options for easily formatting text and inserting links. I have seen other similar implementations that use the Telerik RadEditor or another third-party editor for adding HTML content.<br />
<br />
<b><u>The Nuts and Bolts</u></b><br />
<br />
<b><u></u></b>The HtmlEditor can be found in the Microsoft.SharePoint.Publishing.WebControls namespace, and is intended to work specifically with publishing pages. The class is sealed, so creating a new editor from the base class is impossible. After a little bit of tweaking though, it really wasn't difficult to get the editor working on our custom application page.<br />
<br />
I first created a new SharePoint Empty Project in VS 2010, and added a new Application Page to the /_layouts folder. I like to keep my custom pages organized, so I created a folder under Layouts called "Editor". To use the HtmlEditor, you will need to add references to the following DLL's in your project:<br />
<br />
Microsoft.SharePoint.Publishing.dll - located in \14\ISAPI\<br />
Microsoft.Web.CommanUI.dll - located in \14\ISAPI\<br />
<br />
I then modified opened my ApplicationPage.aspx file and made the following modifications:<br />
<br />
<br />
<div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="color: black;"><span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-size: x-small;"></span></span></span></div><div><span style="background-color: yellow; color: black;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white;">I removed the reference to the aspx.cs page, which is added by default, and changed the MasterPageFile to use v4.master instead of ~/masterurl/default.master. The reason for the different master page is that we have some heavy customization for our default branding, and I didn't want this to carry over to our application page.</span></div><div><span class="Apple-style-span" style="background-color: white;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white;">I then added the following references:</span></div><div><span class="Apple-style-span" style="background-color: white;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white;"></span><br />
<span class="Apple-style-span" style="background-color: white;"></span><br />
<span class="Apple-style-span" style="background-color: white;"><div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="color: black;"><span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-size: x-small;"></span></span></span></div><div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="color: black;"><span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-size: x-small;"></span></span></span></div><div><span style="background-color: yellow; color: black;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white;">These references ensure that you can add the HtmlEditor to the page, and that the Ribbon controls will load.</span></div><div><span class="Apple-style-span" style="background-color: white;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white;">Next, in the PlaceHolderMain section I added a reference to the editor:</span></div><div><span class="Apple-style-span" style="background-color: white;"><br />
</span></div><div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"><</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">Publishing</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">HtmlEditor</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">ID</span></span><span class="Apple-style-span" style="font-size: x-small;">="htmlEditor"</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">runat</span></span><span class="Apple-style-span" style="font-size: x-small;">="server"</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">/></span></div></div><div><br />
</div><div>By default, the reference to the editor was not added to the designer.cs file, so you will need to manually add it if you want to interact with it in your aspx.cs file. </div><div><br />
</div><div>In the aspx.cs file, you will need to add these two using statements:</div><div><br />
</div><div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">using</span></span><span class="Apple-style-span" style="font-size: x-small;"> Microsoft.SharePoint.Publishing;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">using</span></span><span class="Apple-style-span" style="font-size: x-small;"> Microsoft.SharePoint.Publishing.WebControls;</span></div></div><div><br />
</div><div>To fully configure the editor for use, you will need to override the OnInit() function. Here is the code I used:</div><div><br />
</div><div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"> <span class="Apple-style-span" style="font-size: x-small;">protected</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">override</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">void</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> OnInit(</span></span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">EventArgs</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> e)</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">SPRibbon</span></span><span class="Apple-style-span" style="font-size: x-small;"> ribbon = </span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">SPRibbon</span></span><span class="Apple-style-span" style="font-size: x-small;">.GetCurrent(</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">this</span></span><span class="Apple-style-span" style="font-size: x-small;">.Page);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (ribbon != </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">null</span></span><span class="Apple-style-span" style="font-size: x-small;">)</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> {</span></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> ribbon.TrimById(</span></span><span class="Apple-style-span" style="font-size: x-small;">"Ribbon.EditingTools.CPEditTab.Layout"</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">);</span></span></div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> ribbon.TrimById(</span></span><span class="Apple-style-span" style="font-size: x-small;">"Ribbon.EditingTools.CPEditTab.EditAndCheckout"</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">);</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> htmlEditor.Field = </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">new</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">RichHtmlField</span></span><span class="Apple-style-span" style="font-size: x-small;">();</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> htmlEditor.Field.ControlMode = </span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">SPControlMode</span></span><span class="Apple-style-span" style="font-size: x-small;">.Edit;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> htmlEditor.Field.EnableViewState = </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">true</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> htmlEditor.Field.AllowReusableContent = </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">false</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> htmlEditor.Field.MinimumEditHeight = </span><span style="color: #a31515;"><span class="Apple-style-span" style="font-size: x-small;">"200px"</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">this</span></span><span class="Apple-style-span" style="font-size: x-small;">.Form.Controls.Add(htmlEditor.Field);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> btnSave.Click += </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">new</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">EventHandler</span></span><span class="Apple-style-span" style="font-size: x-small;">(btnSave_Click);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">base</span></span><span class="Apple-style-span" style="font-size: x-small;">.OnInit(e);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div></div><div><br />
</div><div>As you can see, I also trim the Wiki controls from the Ribbon. I don't have a need for the Layout and Check out functions. I then create a new RichHtmlField() which stores the contents of the HtmlEditor. Notice that I set the field ControlMode to edit, and modify a few additional parameters to hide options from the ribbon. The final step is to add the RichHtmlField control to the page. Adding the field to the page causes the page to render the associated Ribbon Contextual Tabs. Without it, you would only see a text area for entering content, but the Ribbon would never display.</div><div><br />
</div><div>To get the rest of the editor wired up required some javascript to handle the population of the editor control, and a few hidden fields for storing parameters from the parent page such as editor type and control id. We have up to 8 editable sections for a standard article, so the id of the parent content area was necessary to maintain the position of our content blocks. I also perform an initial post back of the page via javascript in order to validate the variables and throw an error message is one of the required values is missing. </div><div><br />
</div><div>To post the content back to the parent page, I use a button click event, and the following code to write the information back to the parent:</div><div><br />
</div><div><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span></span><br />
<span class="Apple-style-span" style="color: blue;"><div style="color: #a31515; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">string</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> close = </span></span><span class="Apple-style-span" style="font-size: x-small;">"<script src="\"/_layouts/jquery/jquery-1.4.2.min.js\"" type="\"text/javascript\""><br />
</script></span></div><div id="\"content\""><br />
"<span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> + Html + </span></span><span class="Apple-style-span" style="font-size: x-small;">"</span></div><br />
<script type="\"text/javascript\""><br />
var obj = new Object(); obj.content = $('#content').html(); obj.id = "</span><span style="color: #000000"><span class="Apple-style-span" style="font-size: small;"> + hdControlId.Value + </span></span><span class="Apple-style-span" style="font-size: small;">"; window.frameElement.commonModalDialogClose(obj, 1);<br />
</script>"<span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">;</span></span><br />
<div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> Context.Response.Write(close);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> Context.Response.Flush();</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> Context.Response.End();</span></div><div><br />
</div></span></div></div><div><br />
</div><div>This essentially clears the context of the page and returns a modalDialogClose() command with my returned values.</div><div><br />
</div><div><b><u>Conclusion</u></b></div><div><b><u><br />
</u></b></div><div>Hopefully this post will save you some time in trying to get the SharePoint HTML Editor to display on an application page. If you have any questions, feel free to drop me a line.</div><div><br />
</div><div><br />
</div></span></div>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com11tag:blogger.com,1999:blog-4706923982575870915.post-66437388071706791672011-01-14T13:33:00.000-08:002011-01-14T13:33:27.422-08:00Javascript Auto-Populate Complex FieldsIt's been awhile since my last post, but I've been hard at work rolling out new functionality to our portal. Recently, I've been creating several dialog actions in SharePoint 2010 to enable users to perform various functions. The new SharePoint dialog framework is a fantastic addition to the product, but you may hit a few road blocks when trying to perform tasks that should be fairly straight forward, like pre-populating a dialog with parameters from a parent window. Hopefully this post will help you stay sane.<br />
<b><u><br />
</u></b><br />
One of the primary features of our portal is that it acts as a Knowledge Base for our Customer Care Agents. We are constantly striving to keep our content up-to-date, but with over 4000 knowledge base articles, it takes more than just 1 or 2 sets of eyes to keep that content updated. In an attempt to streamline the update process, we decided to add a feedback mechanism to allow users to submit suggestions or requests. The best method for storing and reporting on this information, in my opinion, was to create a custom list to store requests. Using a SharePoint list allows us to easily track requests, maintain an SLA for updating content, and generating notifications and tasks based on these items.<br />
<br />
In v1 of the content feedback system left much to be desired. We only captured a simple url, and submitting feedback used an ajax and custom modal form to push the data to the list. Unfortunately, we were only capturing the url, which didn't offer us the ability to categorize and assign the feedback.<br />
<br />
In v2 we wanted to use a more out-of-the-box approach, and auto-populate various fields to allow us to assign the request to a specific content owner or group based on Taxonomy fields and User Fields on the parent knowledge base article. Easy, right?<br />
<br />
Unfortunately, many of the SharePoint JS library are undocumented. The Client OM offers some nice functionality, but in regards to modifying any of the advanced field types (Taxonomy Field, Rich Text Editor, User Field), there just isn't much out there. Yours truly decided that "no mountain is too high" and tackled pre-populating these field types anyway. After hours of sifting through thousands of lines of js, here are my findings. Hopefully they save you more time than it took me to discover them.<br />
<br />
<b><u>Taxonomy Field Values - how to set them via javascript</u></b><br />
<b><u><br />
</u></b><br />
The Taxonomy Field proved to be the most difficult to auto-populate via javascript. The Taxonomy Field allows a user to paste values into the editable region of the field, but a web service call is required to validate the terms and populate the Taxonomy Field hidden storage with the correct Term Label and Guid.<br />
<br />
I first needed to locate the script that loads the Taxonomy Field Control. The script can be found in the /14/TEMPLATE/LAYOUTS/ folder, and is called ScriptForWebTaggingUI.js. Step 1 complete, and the rest is butter, right? Unfortunately, ScriptForWebTaggingUI.js is minified, and there isn't a nice clean debug.js file to accompany it. Time to start digging. After a few painstaking hours, I stumbled across the appropriate method for updating the Taxonomy Field after populating the values.<br />
<br />
Here are the steps I took<br />
<br />
1. Created a hidden field on the parent display form using the following code:<br />
<br />
<br />
<div style="color: #2b91af; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"><</span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:element</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">name</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">=</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">input</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div style="color: #2b91af; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> <</span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">name</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">=</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">type</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">hidden</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div style="color: #2b91af; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> <</span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">name</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">=</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">id</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">hdArticleServices</span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> <</span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">name</span></span><span class="Apple-style-span" style="font-size: x-small;">=</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span class="Apple-style-span" style="font-size: x-small;">value</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span class="Apple-style-span" style="font-size: x-small;">></span></div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> <</span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">xsl:value-of</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">select</span></span><span class="Apple-style-span" style="font-size: x-small;">=</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span class="Apple-style-span" style="font-size: x-small;">@Services</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">"</span></span><span class="Apple-style-span" style="font-size: x-small;">/></span></div><div style="color: #2b91af; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">xsl:attribute</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div style="color: #2b91af; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"><span style="color: blue;"></span></span><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span><span style="color: #2b91af;"><span class="Apple-style-span" style="font-size: x-small;">xsl:element</span></span><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div><br />
</div><div>2. Next I the function to open the list form for my feedback list, and put a button on the form to call the function:</div><div><br />
</div><div><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"><</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">script</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">type</span></span><span class="Apple-style-span" style="font-size: x-small;">="text/javascript"></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> OpenArticleFeedbackDialog() {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> options = SP.UI.$create_DialogOptions();</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> options.url = </span></span><span class="Apple-style-span" style="font-size: x-small;">"/AboutC3/Lists/Article Feedback/NewForm_User.aspx"</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">;</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> options.title = </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"Submit Article Feedback"</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> options.width = 630;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> options.height = 500;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> options.args = {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> title: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleTitle'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> category: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleSupportCategory'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> services: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleServices'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> attached: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleAttachedServices'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> owner: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleOwner'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> backup: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleOwnerBackup'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> id: $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'#hdArticleId'</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> url: location.href</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> };</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> options.dialogReturnValueCallback = Function.createDelegate(</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">null</span></span><span class="Apple-style-span" style="font-size: x-small;">, CloseArticleFeedbackDialogCallback);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> SP.UI.ModalDialog.showModalDialog(options);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> CloseArticleFeedbackDialogCallback(result, target) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (result) {</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> alert(</span></span><span class="Apple-style-span" style="font-size: x-small;">"Thank you for your feedback."</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">);</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span></span><span class="Apple-style-span" style="font-size: x-small;">script</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;">As you can see, it's a standard showModalDialog call, but notice the options.args object. I'm using jQuery to grab the hidden field values and send them to the child window. </span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;">3. Next, I created a function on the newform.aspx file to grab the variables and populate the fields on the form. I added this function to the "PlaceHolderAdditionalPageHead" place holder on the newform.aspx page.</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div></div><div><span class="Apple-style-span" style="color: blue;"><div style="color: blue; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"><</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">script</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span style="color: red;"><span class="Apple-style-span" style="font-size: x-small;">type</span></span><span class="Apple-style-span" style="font-size: x-small;">="text/javascript"></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _setArticleValues() {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> args = SP.UI.ModalDialog.get_childDialog().get_args();</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $.each(args, </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> (i, n) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">switch</span></span><span class="Apple-style-span" style="font-size: x-small;"> (i) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"title"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"input[title='Feedback Title']"</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(n);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"input[title='Title']"</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(n);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"category"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> c = _parseTaxValue(n);</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff131_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).html(_parseTaxValue(n));</span></span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> _setTaxFieldValues(</span></span><span class="Apple-style-span" style="font-size: x-small;">'ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff131_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">);</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"services"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff141_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).html(_parseTaxValue(n));</span></span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> _setTaxFieldValues(</span></span><span class="Apple-style-span" style="font-size: x-small;">'ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff141_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">);</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"attached"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff151_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).html(_parseTaxValue(n));</span></span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> _setTaxFieldValues(</span></span><span class="Apple-style-span" style="font-size: x-small;">'ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff151_ctl00_ctl02editableRegion'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">); </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">;</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"owner"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff161_ctl00_ctl00_UserField_upLevelDiv'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).html(_parseUserValue(n));</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"backup"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff171_ctl00_ctl00_UserField_upLevelDiv'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).val(_parseUserValue(n));</span></span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"id"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"input[title='Content Id']"</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(n);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">case</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"url"</span></span><span class="Apple-style-span" style="font-size: x-small;">:</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"input[title='Feedback URL']"</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(_parseUrlValue(n));</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> $(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"input[title='Description']"</span></span><span class="Apple-style-span" style="font-size: x-small;">).val(_parseUrlValue(n));</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">break</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> });</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _setTaxFieldValues(id) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> obj = </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">new</span></span><span class="Apple-style-span" style="font-size: x-small;"> Microsoft.SharePoint.Taxonomy.ControlObject(document.getElementById(id).parentNode.parentNode.parentNode);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> obj.validateOnTextChangedDontTouchDom();</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _parseUserValue(user) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> $h = $(user),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">img = $h.find(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"img.ms-imnImg"</span></span><span class="Apple-style-span" style="font-size: x-small;">),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">output = </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">""</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (img) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> output = img.attr(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'sip'</span></span><span class="Apple-style-span" style="font-size: x-small;">);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">return</span></span><span class="Apple-style-span" style="font-size: x-small;"> output;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _parseTaxValue(input) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> s = input.split(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">";"</span></span><span class="Apple-style-span" style="font-size: x-small;">),</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">output = </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">""</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (s.length > 0) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">for</span></span><span class="Apple-style-span" style="font-size: x-small;"> (</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> i = 0; i < s.length; i++) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> t = s[i].split(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">":"</span></span><span class="Apple-style-span" style="font-size: x-small;">);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> output += t[t.length - 1].replace(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'&'</span></span><span class="Apple-style-span" style="font-size: x-small;">, </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'&'</span></span><span class="Apple-style-span" style="font-size: x-small;">) + </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">";"</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">return</span></span><span class="Apple-style-span" style="font-size: x-small;"> output;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _parseUrlValue(input) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> output = </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">""</span></span><span class="Apple-style-span" style="font-size: x-small;">,</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">s = input.split(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"&"</span></span><span class="Apple-style-span" style="font-size: x-small;">);</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (s.length > 0) {</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> output = s[0];</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">return</span></span><span class="Apple-style-span" style="font-size: x-small;"> output;</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 11.0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-style-span" style="font-size: x-small;"> ExecuteOrDelayUntilScriptLoaded(_setArticleValues, </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"scriptforwebtaggingui.js"</span></span><span class="Apple-style-span" style="font-size: x-small;">)</span></div><div style="color: maroon; font: 9.5px Consolas; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"></span></span><span class="Apple-style-span" style="font-size: x-small;">script</span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">></span></span></div><div><span style="color: blue;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;">As you can see, I'm performing quite a few functions to normalize the data which I will get into shortly. </span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;">The primary script is called _setArticleValues, and I use the SharePoint ExecuteOrDelayUntilScriptLoaded function to wait for the taxonomy field js to load. ExecuteOrDelayUntilScriptLoaded is an extremely valuable function when attempting to update complex field values from javascript because in many cases the field controls don't exist until the initial script is complete.</span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;">4. I first added the fields to the form, and did a simple html source view to grab the dynamic id's of the controls. The next step was to grab the html of the taxonomy field by writing the js generated html to a div tag on the form. This is where I discovered that the editable region of the Taxonomy Field is just the ID of the parent div + "editableRegion". Setting the HTML of the editable region is easy enough using jQuery, but unlike the Rich Text Editor, the Taxonomy Field doesn't post it's editable region contents to a hidden storage field before submitting the form (I will go into the RTE functionality in depth next). This is where I got stuck and decided to torture myself by sifting through SharePoint JS, and how I discovered this function:</span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="color: blue; font-family: Consolas; font-size: x-small;">validateOnTextChangedDontTouchDom();</span></span></div><div><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="color: blue; font-family: Consolas; font-size: x-small;"><br />
</span></span></div><div><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: black;">Unfortunately, this is part of the taxonomy control object, so you have to create an object before calling this function like so:</span></span></div><div><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: black;"><br />
</span></span></div><div><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="color: blue; font-family: Times;"><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> obj = </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">new</span></span><span class="Apple-style-span" style="font-size: x-small;"> Microsoft.SharePoint.Taxonomy.ControlObject(document.getElementById(id).parentNode.parentNode.parentNode);</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"> obj.validateOnTextChangedDontTouchDom();</span></div></span></span></span></div><div><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="color: black;"><br />
</span></span></div><div><span class="Apple-style-span" style="color: black;">This was the magic function to fix all of my pain. Once I ran this function, the taxonomy field values were automatically saved to the list item, and peace was restored to the galaxy. I can go into much more detail, but would rather get to the next field type.</span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;"><b><u>Rich Text Editor - Setting Field Values</u></b></span></div><div><span class="Apple-style-span" style="color: black;"><b><u><br />
</u></b></span></div><div><span class="Apple-style-span" style="color: black;">The above code doesn't really demonstrate how to pre-populate a rich text field, but another project of mine required a modal dialog html editor. Painful yes, but quite rewarding once it was complete. I will go into the details of creating an application page with the Microsoft.SharePoint.Publishing.WebControls.HtmlEditor in my next blog post, but for now I will show you how to auto-populate it with html.</span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;">1. Much like the Taxonomy Field, you need to find the ID of the control. In an application page, this can be done dynamically using the </span><span class="Apple-style-span" style="color: #cc0000;"> </span><span class="Apple-style-span" style="color: black;">reference, but in a list form you will have to grab the id from the rendered source. </span></div><div><span class="Apple-style-span" style="color: black;"><br />
</span></div><div><span class="Apple-style-span" style="color: black;">2. Once you have the ID, it's really a piece of cake to set the field value using jQuery or Javascript. This is the code I used for my application page:</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: black; font-family: Times;"><br />
</span></span></div><div><span class="Apple-style-span" style="color: black;"><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">$('#_hiddenDisplay').val(n);</span></span></div></span></div></span></div><br />
<br />
<u><br />
</u><br />
As you can see, the _hiddenDisplay field is the only field you need to set. Once this field is set, the contents are rendered accordingly. One item to note, when passing the argument to your child dialog, do not use the SP.Utilities.HttpUtility.htmlEncode function, as there is no decode function in the js.<br />
<br />
<b><u>User Field Values</u></b><br />
<b><u><br />
</u></b><br />
The SharePoint user field is almost identical to the Rich Text Editor field, but requires a little bit of finessing to get the correct value. When an data form web part renders the xsl version of the User Field, quite a bit of html is injected to display the hyperlink and user presence image. That's where this function comes in:<br />
<br />
<br />
<div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Times; font-size: small;"></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">function</span></span><span class="Apple-style-span" style="font-size: x-small;"> _parseUserValue(user) {</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">var</span></span><span class="Apple-style-span" style="font-size: x-small;"> $h = $(user),</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">img = $h.find(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">"img.ms-imnImg"</span></span><span class="Apple-style-span" style="font-size: x-small;">),</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-size: x-small;"> </span></span><span class="Apple-style-span" style="font-size: x-small;">output = </span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">""</span></span><span class="Apple-style-span" style="font-size: x-small;">;</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 11px;"><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;"> if</span></span><span class="Apple-style-span" style="font-size: x-small;"> (img) {</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"> output = img.attr(</span><span style="color: maroon;"><span class="Apple-style-span" style="font-size: x-small;">'sip'</span></span><span class="Apple-style-span" style="font-size: x-small;">);</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"> }</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 11px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-size: x-small;">return</span></span><span class="Apple-style-span" style="font-size: x-small;"> output;</span><span class="Apple-style-span" style="font-size: x-small;">}</span></div><br />
<div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="color: blue; font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;">As you can see, I simply convert the user field value to a jQuery object, and then run some simple html functions against it to grab the appropriate attribute that holds the email address of the user. I then set the User Field editable region with the email address value like so:</span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="color: maroon; font-family: Consolas; font-size: 10px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">$(</span></span><span class="Apple-style-span" style="font-size: x-small;">'#ctl00_ctl21_g_09d208ae_a4f5_4702_a96a_c661d67d2c11_ff161_ctl00_ctl00_UserField_upLevelDiv'</span><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;">).html(_parseUserValue(n));</span></span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="color: maroon; font-family: Consolas; font-size: 10px;"><span style="color: black;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;">Fairly self-explanatory, but you still have to determine the ID of the rendered User Field, and the appropriate div where the editable region is located.</span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><u><b>Conclusion</b></u></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><u><b><br />
</b></u></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;">Auto-populating complex field types via javascript can be a real bitch. Determining what field types you are populating is the first step; you then need to determine what order the SharePoint scripts are loaded so you can execute your functions after the final script control has been loaded on the page. I hope this post helps save you some time, and keeps you sane. As always, feel free to drop me a note if this post helped, or if you have any additional questions. And please excuse the poor grammar and sentence structure; I spent most of last night working on this, and wanted to get it up here before I forgot my steps.</span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: maroon;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></span></span></div><div style="font: normal normal normal 9.5px/normal Consolas; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><br />
<u><br />
</u><br />
<u><br />
</u><br />
<u><br />
</u><br />
<u><br />
</u><br />
<u><br />
</u><br />
<u><br />
</u>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com5tag:blogger.com,1999:blog-4706923982575870915.post-27181769853677109702010-06-11T08:58:00.000-07:002011-10-10T09:11:35.453-07:00Branding web parts in SharePoint 2010<span class="Apple-style-span" style="font-size: small;">Month 1.5 of the development phase of our new SharePoint 2010 deployment, and I finally get to spend some time on the UI. Based on our design, each web part with a chrome would need to wrapped with rounded corners and some gradient images for the header and the footer. You might say that's impossible, but I've got news.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Here is the initial design of our branded web parts, taken directly from the wireframes our designers created:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUP5IUB8VXdq6MfQhsUD1CCmvN8YpITyzfUBrtHh32uxAcSveFOaDSEjN11X5RH0krg0PQajHj3-gcr9LCx3ETtTmogr7FJaQ76vbAZLDjj7Ovk1cQr8j6FnJCR6ShXqPSjet0MCtbppI/s1600/Picture+11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="275" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUP5IUB8VXdq6MfQhsUD1CCmvN8YpITyzfUBrtHh32uxAcSveFOaDSEjN11X5RH0krg0PQajHj3-gcr9LCx3ETtTmogr7FJaQ76vbAZLDjj7Ovk1cQr8j6FnJCR6ShXqPSjet0MCtbppI/s400/Picture+11.png" width="400" /></a></div><span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">As you can see, everything looks pretty, but in SharePoint 2003 this would have been nearly impossible. In 2007, I had a similar request, but it only involved branding the web part headers, which was easily achievable using CSS and images. In 2010, you also have the same control using CSS, but adding a border and footer required a bit more than CSS could do. This is where jQuery comes in.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Intitially, the wep part header is easy to find and brand. If you open view source on a web part page and search for "ms-WPHeader" you'll see the web part header table row. This row contains 5 columns, and using the first-child and last-child selectors would allow you to easily add rounded edges to the corners, while filling the remaining columns with the backround of the header. You could also modify font size, weight, and style using css this way. Great! But what about the footer and content border?</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Before I begin, I have to throw a shout out to jQuery. Without it, none of this would be possible without significant hours of development in C# to write wrappers for all of your web parts.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">I'll start with the header because CSS and cross-browser techniques can be very tedious to say the least. I wanted to also make sure that the branding was turned off while the user was in edit mode, to ensure that edit mode wasn't bogged down.First things first though, make sure you go out and download the jQuery library here: <a href="http://jquery.com/">http://jquery.com/</a>. I like to install jQuery in the SharePoint Hive C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\Layouts\jquery\jquery-1.4.2.min.js. From here, you can reference the library on your Master Page like so:</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><script type="text/javascript" src="/_layouts/jQuery/jquery-1.4.2.min.js"></span><br />
<span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </script></span></span><br />
<span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"></span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span></span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Now that jQuery is installed and registered on the page, the fun begins. I begin with this call:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(document).ready(function () { </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">This allows me to bind event handlers, and call additional jQuery functions once the page has loaded.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Next I find the web part header:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$("tr.ms-WPHeader").each(function(){</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">This part is important. Applying branding to the children of a web part header requires that you traverse each header individually.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Next I traverse the children ("td") tags in the header, and apply an additional css class to handle the header branding. This allows me to keep the stock css intact, and to maintain a much smaller file for branding and master page customizations. It also ensures that during the edit process, the stock web part classes will be applied.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).children("td").each(function(index) {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">if(index == 0) {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-toplt");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else if(index >= 1 && index <= 3){</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-top");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-toprt");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">}</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">I'm sure I could have done this without looping, but the index of the children elements never changes, and I was in a hurry!</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Now that the header is branded, you will notice that when you render the page, the web part context menu column will be off by a pixel. To fix this, you have to remove the border on the column like so:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(".ms-WPHeaderTdMenu").css('border', '0').css('padding', 0);</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">And now it's time to move on to the web part content. You will notice in the page source that the content class is "ms-wpContentDivSpace". Now that you have the class, it's easy to find these div's and brand them accordingly:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$("div.ms-wpContentDivSpace").each( function () {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).wrap('<div class="c3-wp-midlt" />');</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).wrap('<div class="c3-wp-midrt" />');</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).after('<div class="c3-wp-bot"><img src="/Style Library/Images/intuit/c3-wp-botlt.gif" class="c3-wp-botlt" /> <img src="/Style Library/Images/intuit/c3-wp-botrt.gif" class="c3-wp-botrt" /></div>');</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">As you can see, I've wrapped the content div with an lt and rt border using jQuery .wrap(). I then dropped in the footer using the jQuery .after() function and some simple html.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">But how do you ensure that branding is turned off in edit mode? A simple if statement:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">if($('#MSOLayout_InDesignMode').val() || $('#MSOSPWebPartManager_DisplayModeName').val() == "Edit") { </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">}</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">The final code looks like this:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(document).ready(function () {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">if($('#MSOLayout_InDesignMode').val() || $('#MSOSPWebPartManager_DisplayModeName').val() == "Edit") {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">// I have some addtional jQuery here that I will cover in a later post</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">// Brand the web parts</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$("tr.ms-WPHeader").each(function(){</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).children("td").each(function(index) {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">if(index == 0) {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-toplt");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else if(index >= 1 && index <= 3){</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-top");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">} else {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).addClass("c3-wp-toprt");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">}</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">// fix the border issue in the web part menu</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(".ms-WPHeaderTdMenu").css('border', '0').css('padding', 0);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$("div.ms-wpContentDivSpace").each( function () {</span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).wrap('<div class="c3-wp-midlt" />');</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).wrap('<div class="c3-wp-midrt" />');</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$(this).after('<div class="c3-wp-bot"><img src="/Style Library/Images/intuit/c3-wp-botlt.gif" class="c3-wp-botlt" /> <img src="/Style Library/Images/intuit/c3-wp-botrt.gif" class="c3-wp-botrt" /></div>');</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">}</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">});</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">And the CSS looks like this:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-toplt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> max-width: 15px;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-image: url('/Style Library/Images/layout.gif');</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-repeat: no-repeat;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-position: left top; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-toprt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> min-width: 20px;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-image: url('/Style Library/Images/layout.gif');</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-repeat: no-repeat;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-position: -930px 0; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-top {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-image: url('/Style Library/Images/layout.gif');</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-repeat: repeat-x;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-position: -20px 0; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-bot {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> float: left;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-image: url('/Style Library/Images/layout.gif');</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-repeat: repeat-x;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-position: -20px -82px;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> width: 100%;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> min-height: 20px; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-botlt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> float: left; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-botrt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> float: right; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-midlt, .c3-wp-midrt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background: url('/Style Library/Images/c3-mid-border.gif') repeat-y; }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">.c3-wp-midrt {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"> background-position: right; }</span><br />
<span class="Apple-style-span" style="font-size: small;"> </span><br />
<span class="Apple-style-span" style="font-size: small;">If it isn't clear in the CSS, I'm using sprites for most of my borders and branding, which is why you will see odd background-position tags. You can slice the images up if needed, but it was just as easy for us to use sprites to achieve the same functionality. I did slice the bottom image up to account for a single div to store the left and right corner images, while cascading the backround gradient from the sprite.</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;">Here is an example of the branded web part in SharePoint:</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaiJer8ApfOIYaCbReuO5tAwC9B9PVmc1UyU19e15kr6GrlhPv-X5-NYTuAOKxXcJizJVrvXWduxo8aq-aYESP863yp5X5Yv-jxJR9c8Z_hykM4mPo27uGN0zX_DY4jjrwoVWbinr14jo/s1600/Picture+13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaiJer8ApfOIYaCbReuO5tAwC9B9PVmc1UyU19e15kr6GrlhPv-X5-NYTuAOKxXcJizJVrvXWduxo8aq-aYESP863yp5X5Yv-jxJR9c8Z_hykM4mPo27uGN0zX_DY4jjrwoVWbinr14jo/s320/Picture+13.png" /></a></div><span class="Apple-style-span" style="font-size: small;"><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;"><a href="http://www.zmsvc.com/assets/wp-branding.zip">Source Code</a><br />
</span><br />
<span class="Apple-style-span" style="font-size: small;"><br />
</span>Anonymoushttp://www.blogger.com/profile/12899304226010520103noreply@blogger.com26