<?xml-stylesheet type="text/xsl" href="/rss.xsl" media="screen"?><rss version="2.0"><channel><title>softlogger Latest Articles ::Community-Server</title><link>http://softlogger.com</link><description>softlogger Latest Articles ::Community-Server</description><ttl>180</ttl><item><title>Cleanup The Crap That Windows Live Writer Injects With This HttpModule</title><link>http://softlogger.com/7336/Community-Server/cleanup-the-crap-that-windows-live-writer-injects-with-this-httpmodule.aspx</link><description>&lt;p&gt;First, let me start off with some praise. I really really like &lt;a title="WLW Team Blog" href="http://windowslivewriter.spaces.live.com/"&gt;Windows Live Writer&lt;/a&gt;. I’ve praised it many times on my blog. However, there is one thing that really annoys me about WLW, &lt;strong&gt;it’s utter disregard for web standards and the fact that injects crap I don’t want or need into my content&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Of particular annoyance is the way that WLW adds attributes that are not XHTML compliant. For example, when you use the &lt;em&gt;Insert Tags&lt;/em&gt; feature, it creates a div that looks something like:&lt;/p&gt;
&lt;div class="dropshadow code"&gt;
&lt;div class="innerbox"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="wlWriterEditableSmartContent"&lt;/span&gt; 
  &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="guid1:guid2"&lt;/span&gt; 
  &lt;span class="attr"&gt;contenteditable&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; 
  &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="padding-right: 0px; display: inline; padding-left: 0px; 
  padding-bottom: 0px; margin: 0px; padding-top: 0px"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p class="clear"&gt;What’s the problem? Let me explain. &lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;First of all, the ID is a GUID that starts with a number. Unfortunately XHTML doesn’t allow the id of an element to start with a number. &lt;/li&gt;
    &lt;li&gt;The &lt;em&gt;contenteditable&lt;/em&gt; attribute is not recognized in XHTML. &lt;/li&gt;
    &lt;li&gt;The style tag is superfluous and unnecessary. At the very least, it should have been reduced to style="padding:0; display: inline;" &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The purpose of the special class and the &lt;em&gt;contenteditable&lt;/em&gt; attribute is to inform WLW that the html tag is editable. In the &lt;em&gt;Web Layout&lt;/em&gt; view (F11), you can see a hashed box around the tags like so.&lt;/p&gt;
&lt;p&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="92" alt="image" width="383" border="0" src="http://haacked.com/images/haacked_com/WindowsLiveWriter/CleanupAfterWindowsLiveWriterWithThisHtt_1348B/image_2.png" /&gt;&lt;/p&gt;
&lt;p&gt;Clicking on the box changes the right menu to let you enter tags.&lt;/p&gt;
&lt;p&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="247" alt="image" width="221" border="0" src="http://haacked.com/images/haacked_com/WindowsLiveWriter/CleanupAfterWindowsLiveWriterWithThisHtt_1348B/image1.png" /&gt; &lt;/p&gt;
&lt;p&gt;Because I actually care about web standards and being XHTML compliant and I’m totally anal, I’ve always gone in and manually changed the HTML after the fact.&lt;/p&gt;
&lt;p&gt;Today, out of pure laziness and getting fed up with this extra work I have to do, I decided to write an HttpModule to do this repetitive task for me via a Request Filter. A Request Filter modifies the incoming request.&lt;/p&gt;
&lt;p&gt;But to make things interesting, I made sure that the HttpModule makes the changes in an intelligent manner so that no information is lost. Rather than simply removing the cruft, I moved the cruft into the class attribute. Thus the HTML I showed above would be transformed into this:&lt;/p&gt;
&lt;div class="dropshadow code"&gt;
&lt;div class="innerbox"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="wlWriterEditableSmartContent id-guid1:guid2 
  contenteditable-false"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p class="clear"&gt;Notice that I simply removed the style tag because I don’t need it.&lt;/p&gt;
&lt;p&gt;I also created a Response Filter to modify the outgoing response when the client is Windows Live Writer. That allows the module to convert the above html back into the format that WLW expects. In that manner, I don’t break any WLW functionality.&lt;/p&gt;
&lt;h3&gt;Other Cool Cleanups&lt;/h3&gt;
&lt;p&gt;Since I was already writing this module, I decided to make it clean up a few other annoyances.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Replaces a single &amp;amp;nbsp; between two words with a space. So &lt;em&gt;this&amp;amp;nbsp;is&amp;amp;nbsp;cool&lt;/em&gt; gets converted to &lt;em&gt;this is cool&lt;/em&gt;. &lt;/li&gt;
    &lt;li&gt;Replaces &amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt; with an empty string. &lt;/li&gt;
    &lt;li&gt;Replaces an apostophre within a word with a typoghraphical single quote. So &lt;em&gt;you can’t say that&lt;/em&gt; becomes &lt;em&gt;you can&amp;amp;#8217;t&lt;/em&gt; say that. &lt;/li&gt;
    &lt;li&gt;Replaces &lt;em&gt;atomicselection="true"&lt;/em&gt;with an empty string. I don’t re-insert this attribute back into the content yet, as I’m not sure if it is even necessary. &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Try it out!&lt;/h3&gt;
&lt;p&gt;This module should work with any ASP.NET blog engine that uses the &lt;a title="RFC: MetaWeblog API" href="http://www.xmlrpc.com/metaWeblogApi"&gt;MetaWeblog API&lt;/a&gt;. It only responds to requests made by Windows Live Writer, so it shouldn’t interfere with anything else you may use to post to your blog. &lt;/p&gt;
&lt;p&gt;To use it is as easy as dropping the assembly in the bin directory and modifying your &lt;em&gt;web.config&lt;/em&gt; to add the following to the httpModules section:&lt;/p&gt;
&lt;div class="dropshadow code"&gt;
&lt;div class="innerbox"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;httpModules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="HtmlScrubber.WLWCleanupModule, HtmlScrubber"&lt;/span&gt; 
    &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="HtmlScrubber"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;httpModules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p class="clear"&gt;I’m also including the source code and unit tests, so feel free to give it a try. Please understand that this is something I hacked together in a day, so it may be a bit rough around the edges and I give no warranty. Having saidthat, I’m pretty confident it won’t screw up your HTML.&lt;/p&gt;
&lt;p class="clear"&gt;I have plans to add other features and cleanups in the future. For example, it wouldn’t be hard to add a configuration section that allows one to specify other regular expressions and replacement patterns to apply.&lt;/p&gt;
&lt;p&gt;If you have any "cleanups" I should include, please let me know. If you’re reading this post, then you know the module worked.&lt;/p&gt;
&lt;p&gt;[&lt;a title="Download Binaries" href="http://haacked.com/code/Haacked-Html-Scrubber.zip"&gt;Download Binaries&lt;/a&gt;] [&lt;a title="Html Scrubber Source Code" href="http://haacked.com/code/Haacked-HtmlScrubber-SOURCE.zip"&gt;Download Source&lt;/a&gt;]&lt;/p&gt;
&lt;p&gt;I thought about adding this to CodePlex, but I’m hoping that the next version of Windows Live Writer makes this module irrelevant. I’m not holding my breath on that one though.&lt;/p&gt;
&lt;div class="wlWriterSmartContent id-0767317B-992E-4b12-91E0-4F059A8CECA8:9baaff97-6538-48ee-8b4d-7e91cc9f25c3 contenteditable-false"&gt;Technorati tags: &lt;a rel="tag" href="http://technorati.com/tags/WLW"&gt;WLW&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Windows%20Live%20Writer"&gt;Windows Live Writer&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/ASP.NET"&gt;ASP.NET&lt;/a&gt;&lt;/div&gt;&lt;img src="http://haacked.com/aggbug/18374.aspx" width="1" height="1" /&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=7336"&gt;</description><author>youve been HAACKED</author><pubDate>2007-07-30T00:00:00</pubDate><category>Community Server</category></item><item><title>Create an Archive Page for Community Server Blogs</title><link>http://softlogger.com/7155/Community-Server/create-an-archive-page-for-community-server-blogs.aspx</link><description>&lt;p&gt;In my new EliteCircle theme, I moved my monthly archive from sidebar to a &lt;a href="http://nayyeri.net/archive.aspx"&gt;separate page&lt;/a&gt; because as long as my blog is getting older, it's getting longer and can't fit into sidebar easily.&lt;/p&gt; &lt;p&gt;Creating an archive page for Community Server blogs is very easy but it's not included by default.&amp;nbsp; All you need to do is adding a new Archive.aspx page to your blog theme folder with appropriate content.&lt;/p&gt; &lt;p&gt;First step is to create an empty Archive.aspx file.&amp;nbsp; Second step is adding your blog master page to this page&amp;nbsp;to keep consistency.&amp;nbsp; Also you need to add some references&amp;nbsp;to this page and set its title.&lt;/p&gt; &lt;p&gt;Rather than doing above steps manually, I can recommend you to choose one of other&amp;nbsp;pages from your blog theme, remove its content and keep its headers and references.&amp;nbsp; For example, this is the page header, references and Page_Load method for my EliteCircle archive page:&lt;/p&gt; &lt;p&gt;&lt;em&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" EnableViewState="False" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MasterPageFile="~/Themes/Blogs/elitecircle/theme.Master"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits="CommunityServer.Blogs.Controls.CSBlogThemePage" %&amp;gt;&lt;br&gt;&amp;lt;%@ Import Namespace="CommunityServer.Components" %&amp;gt;&lt;br&gt;&amp;lt;%@ Import Namespace="CommunityServer.Blogs.Components" %&amp;gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&amp;lt;script runat="Server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Page_Load(object sender, EventArgs e)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetTitle("Archive");&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;lt;/script&amp;gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;Probably you know&amp;nbsp;what the last step&amp;nbsp;is!&amp;nbsp; Yes, you put an &lt;em&gt;ArchiveDataItemList&lt;/em&gt; Chameleon control inside your page &lt;em&gt;ContentPlaceHolder&lt;/em&gt; to show archive items.&lt;/p&gt; &lt;p&gt;&lt;em&gt;&amp;lt;asp:Content ContentPlaceHolderID="Main" runat="Server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CSBlog:ArchiveDataItemList ID="ArchiveDataItemList1" runat="Server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LeaderTemplate&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h1&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Archive&amp;lt;/h1&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/LeaderTemplate&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/CSBlog:ArchiveDataItemList&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br&gt;&amp;lt;/asp:Content&amp;gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;And now, you have an archive page!&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=72485" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=7155"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-05-17T00:00:00</pubDate><category>Community Server</category></item><item><title>Community Server MVPs Cinnabar CSModule Package</title><link>http://softlogger.com/7157/Community-Server/community-server-mvps-cinnabar-csmodule-package.aspx</link><description>&lt;p&gt;Finally I announced &lt;a href="http://csmvps.com/blogs/news/archive/2007/05/13/community-server-mvps-cinnabar-csmodule-package.aspx"&gt;Cinnabar CSModules Package&lt;/a&gt; a few minutes ago.&lt;/p&gt; &lt;p&gt;Cinnabar is written and tested for Community Server 2007 and&amp;nbsp;doesn't come with many new &lt;abbr title="Community Server Modules"&gt;CSModules&lt;/abbr&gt;.&amp;nbsp; It contains some bug fixes and feature improvements for old CSModules as well as a new CSModule that&amp;nbsp;&lt;a href="http://intensivedesign.co.uk/blogs/gary/default.aspx" rel="friend"&gt;Gary&lt;/a&gt; and I have written and is named LinkManager.&amp;nbsp; LinkManager lets you add custom attributes to all links in a site.&amp;nbsp; It's completely configurable for internal and external links and specific applications.&amp;nbsp; Using LinkManager, you can add rel="nofollow" or target="_new" attributes to all your external links, for example.&lt;/p&gt; &lt;p&gt;There is another change in our package.&amp;nbsp; In this new version we use configuration overriding options in Community Server 2007 and replaced our old communityserver.config files with communityserver_override.config.&lt;/p&gt; &lt;p&gt;For your information (if you don't know about it yet): this is the third version of our CSModules package after &lt;a href="http://csmvps.com/blogs/news/archive/2006/08/14/Community-Server-MVP_2700_s-Alabaster-CSModule-Package.aspx"&gt;Alabaster&lt;/a&gt; and &lt;a href="http://csmvps.com/blogs/news/archive/2006/12/04/community-server-mvp-s-beryl-csmodule-package.aspx"&gt;Beryl&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;You can download and install &lt;a href="http://csmvps.com/files/folders/csmodules/entry3479.aspx"&gt;Cinnabar&lt;/a&gt; right now.&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=72096" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=7157"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-05-13T00:00:00</pubDate><category>Community Server</category></item><item><title>Elite Circle Theme for Community Server 2007</title><link>http://softlogger.com/7057/Community-Server/elite-circle-theme-for-community-server-2007.aspx</link><description>&lt;p&gt;As I had planned and a few friends have asked for my new Elite Circle&amp;nbsp;theme code, I published it as a public download for all users.&lt;/p&gt; &lt;p&gt;My original theme required some teaks to be ready for public usage such as adding site navigation menu and a few minor changes for blog authors.&amp;nbsp; Now it's ready for public download and I hope that you enjoy it.&amp;nbsp; Elite Circle is originally designed under Creative Commons Attribution 2.5 license and I haven't put any special license on it.&amp;nbsp; You can also remove my name and link from the footer but must keep the link to original designer.&lt;/p&gt; &lt;p&gt;I'm not a professional designer and don't want to support this template forever but if you think there is any major change that should be applied, please leave a comment or contact me directly.&amp;nbsp; I'll try to apply those changes.&lt;/p&gt; &lt;p&gt;You can download Elite Circle 1.0 theme for Community Server 2007 from &lt;a href="http://nayyeri.net/misc/keyvan/Downloads/EliteCircle/EliteCircle.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=70565" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=7057"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-04-29T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: Forums</title><link>http://softlogger.com/6901/Community-Server/cs-dev-guide-forums.aspx</link><description>&lt;p&gt;Forum is the most powerful application in Community Server.&amp;nbsp; I think blogs and forums are most commonly used applications in&amp;nbsp;Community Server.&lt;/p&gt; &lt;p&gt;In new series of my CS Dev Guide posts I want to talk about forums and some related topics about them.&amp;nbsp; This first post is dedicated to forum itself and how to get, add, delete or update a forum.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CommunityServer.Discussions.Components.Forum&lt;/em&gt; is the main class to represent a forum.&amp;nbsp; It's derived from &lt;em&gt;CommunityServer.Component.Section&lt;/em&gt; base class and extends its properties to fit into forum application needs.&amp;nbsp; As always &lt;em&gt;CommunityServer.Discussions.Components.Forums&lt;/em&gt; is the method factory to provide some static methods that help you to get, add, delete or update Forum objects.&lt;/p&gt; &lt;p&gt;Most of the added properties to &lt;em&gt;Section&lt;/em&gt; base class in &lt;em&gt;Forum&lt;/em&gt; subclass are ReadOnly and implement some functionality for forum application but core functionality is similar to &lt;em&gt;Section&lt;/em&gt; base class.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CommunityServer.Discussions.Components.Forums&lt;/em&gt; is an important namespace here because it does the job around Forum class.&amp;nbsp; So I list its methods with a description about their usage:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Add: Gets a &lt;em&gt;Forum&lt;/em&gt; object and adds it to system.  &lt;li&gt;Delete: Gets a &lt;em&gt;Forum&lt;/em&gt; object and deleted it from system.  &lt;li&gt;Filter: Gets a list of Sections and a &lt;em&gt;ForumSectionQuery&lt;/em&gt; and an integer value (by ref) then filters passed sections based on query and updated integer value of total number of filtered sections.&amp;nbsp; This function returns a list of filtered sections.&amp;nbsp; &lt;em&gt;ForumSectionQuery&lt;/em&gt; is a query object similar to &lt;em&gt;BlogThreadQuery&lt;/em&gt; or &lt;em&gt;GalleryThreadQuery&lt;/em&gt; that helps you to&amp;nbsp;write queries for Forum objects.  &lt;li&gt;FilterForumsByAccessControl: Gets a list of Sections and Permission object and returns a new list of Sections that is a filtered list of passed sections that have same permissions as what is passed to this function.  &lt;li&gt;GetDeleteForum: Returns an instance of Forum object for Deleted Posts forum.&amp;nbsp; You know this is a default and required forum in Community Server.  &lt;li&gt;GetForum: Has two overloads and returns an instance of &lt;em&gt;Forum&lt;/em&gt; object for passed ForumID value.  &lt;li&gt;GetForumByPostID: Has three overloads and returns an instance of &lt;em&gt;Forum&lt;/em&gt; object for the PostID that is passed to it.&amp;nbsp; This method returns a &lt;em&gt;Forum&lt;/em&gt; object where the post whose PostID is passed to function is located there.  &lt;li&gt;GetForums: Has two overloads and returns a list of Sections (forums) in forum application.  &lt;li&gt;GetForumsByForumGroupID: Has four overloads and gets group ID and returns a list of sections (forums) for that group.  &lt;li&gt;GetReportedForum: Returns an instance of Forum object for Reported Posts forum.&amp;nbsp; This is a required default forum in Community Server.  &lt;li&gt;GetSpecialForums: Gets a &lt;em&gt;ForumType&lt;/em&gt; enumeration value as parameter and returns a list of Sections (forums) for that specific forum.&amp;nbsp; There are some special forum types such as FAQ, KB, Reporting and ...  &lt;li&gt;GetTopMostParentSection: You know that forums can be organized in hierarchy manner.&amp;nbsp; This function gets a section ID and returns an instance of &lt;em&gt;Section&lt;/em&gt; object for top most section for that section.  &lt;li&gt;MarkAllForumsRead: Gets a UserID, a GroupID and a ForumID and marks all forum posts as read for that user.  &lt;li&gt;Update: Gets a &lt;em&gt;Forum&lt;/em&gt; object and updates its values in database.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Having these said, let's check out some examples.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CreateNewForum()&lt;/em&gt; is a method that checks to see if current application is forum then creates a new instance of &lt;em&gt;Forum&lt;/em&gt; object and sets some properties for it then adds this new forum to current forum group in application by calling &lt;em&gt;Forums.Add()&lt;/em&gt; method.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; CreateNewForum()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (context.ApplicationType == &lt;span style="color: teal"&gt;ApplicationType&lt;/span&gt;.Forum)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;Forum&lt;/span&gt; forum = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;Forum&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.ApplicationKey = &lt;span style="color: maroon"&gt;"myForum"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.DateCreated = &lt;span style="color: teal"&gt;DateTime&lt;/span&gt;.Now;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.Name = &lt;span style="color: maroon"&gt;"Test Forum"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.Description = &lt;span style="color: maroon"&gt;"A Test Forum"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.SettingsID = context.SettingsID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; forum.GroupID = context.GroupID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;Forums&lt;/span&gt;.Add(forum);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;em&gt;GetFAQForumsCount()&lt;/em&gt; is a function that returns integer value of total numbers of FAQ forums.&amp;nbsp; It uses &lt;em&gt;Forums.GetSpecialForums()&lt;/em&gt; function to get a list of FAQ forums then returns their count.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; GetFAQForumsCount()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: teal"&gt;Section&lt;/span&gt;&amp;gt; sections = &lt;span style="color: teal"&gt;Forums&lt;/span&gt;.GetSpecialForums(&lt;span style="color: teal"&gt;ForumType&lt;/span&gt;.FAQ);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; sections.Count;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;em&gt;FilterForumsInCurrentGroup()&lt;/em&gt; is a function that returns a list of Sections for all normal forums in current forum group.&amp;nbsp; It gets a list of all Sections in current group by calling &lt;em&gt;Forums.GetForumsByForumGroupID()&lt;/em&gt; and filters all forums using a &lt;em&gt;ForumSectionQuery&lt;/em&gt; and &lt;em&gt;Forums.Filter()&lt;/em&gt; method.&amp;nbsp; It finally returns a list of filtered Sections.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: teal"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: teal"&gt;Section&lt;/span&gt;&amp;gt; FilterForumsInCurrentGroup()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: teal"&gt;Section&lt;/span&gt;&amp;gt; sections = &lt;span style="color: teal"&gt;Forums&lt;/span&gt;.GetForumsByForumGroupID(context.GroupID);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;ForumSectionQuery&lt;/span&gt; sectionQuery = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;ForumSectionQuery&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeDeletedForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeFAQForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeKBForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeLinkForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeNewsletterForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.IncludeReportingForums = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.SortBy = &lt;span style="color: teal"&gt;SectionSortBy&lt;/span&gt;.LastPost;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.SortOrder = &lt;span style="color: teal"&gt;SortOrder&lt;/span&gt;.Descending;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.PageSize = sections.Count;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sectionQuery.PageIndex = 0;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;int&lt;/span&gt; totalCount = 0;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: teal"&gt;Section&lt;/span&gt;&amp;gt; filteredSections = &lt;span style="color: teal"&gt;Forums&lt;/span&gt;.Filter&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; (sections, &lt;span style="color: blue"&gt;null&lt;/span&gt;, totalCount);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; filteredSections;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Now playing:&lt;/strong&gt; Eric Clapton - One Day&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=65778" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6901"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-03-27T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: GalleryPost</title><link>http://softlogger.com/6811/Community-Server/cs-dev-guide-gallerypost.aspx</link><description>&lt;p&gt;Like &lt;a href="http://nayyeri.net/archive/2006/06/07/CS-Dev-Guide_3A00_-Add_2C00_-Delete-or-Update-blog-posts.aspx"&gt;CommunityServer.Blogs.Components.WeblogPost&lt;/a&gt;, CommunityServer.Galleries.Components.GalleryPost is a class specifically designed for working with photo gallery posts in Community Server APIs.&lt;/p&gt; &lt;p&gt;This class is the main class to work with gallery posts in Community Server APIs.&amp;nbsp; As you can probably remember &lt;em&gt;WeblogPost&lt;/em&gt; is used for blog operations and was derived&amp;nbsp;from &lt;em&gt;CommunityServer.Components.Post&lt;/em&gt; but Post class couldn't be used for some operations.&amp;nbsp; Same is true for &lt;em&gt;GalleryPost&lt;/em&gt;.&amp;nbsp; It means it's derived from &lt;em&gt;Post&lt;/em&gt; base class and you need to use it to add or edit a gallery post.&lt;/p&gt; &lt;p&gt;&lt;em&gt;GalleryPost&lt;/em&gt; is similar to &lt;em&gt;WeblogPost&lt;/em&gt; in its usage for galleries and provides several properties.&amp;nbsp; I don't list its properties to bother you but it provides some properties to work with post configurations, image, thumbnails, image title and description and other related settings for a gallery post.&lt;/p&gt; &lt;p&gt;As I stated in my post about &lt;a href="http://nayyeri.net/archive/2006/06/29/CS-Dev-Guide_3A00_-Post-Attachments.aspx"&gt;Post Attachments&lt;/a&gt; gallery photos are saved as post attachment in Community Server so you can store an image by creating a post attachment for it and associate this attachment with your GalleryPost.&lt;/p&gt; &lt;p&gt;As always (in Community Server) there is a method factory to work with &lt;em&gt;GalleryPosts&lt;/em&gt; and get, add, delete or update them in &lt;em&gt;CommunityServer.Galleries.Components.GalleryPosts&lt;/em&gt;.&amp;nbsp; There you can find other static methods for example to add a new image as post attachment.&lt;/p&gt; &lt;p&gt;Like BlogThreadQuery object you can use GalleryThreadQuery to write queries and fetch specific gallery post objects uisng some functions that are provided in GalleryPosts factory (you'll see an example).&lt;/p&gt; &lt;p&gt;Below are some examples that show you most things that you need to work with &lt;em&gt;GalleryPost&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;&lt;em&gt;AddNewPhoto()&lt;/em&gt; is a method that gets string value of a path for an image and its width and height then creates a post attachment based on this file and associates this file with a new &lt;em&gt;GalleryPost&lt;/em&gt; image.&amp;nbsp; There are some properties that must be set for &lt;em&gt;PostAttachment&lt;/em&gt; and &lt;em&gt;GalleryPost&lt;/em&gt; objects.&amp;nbsp; At the end &lt;em&gt;GalleryPosts.CreatePicture()&lt;/em&gt;&amp;nbsp;stores my attachment and associates it with my &lt;em&gt;GalleryPost&lt;/em&gt; and&amp;nbsp;&lt;em&gt;GalleryPosts.Add()&lt;/em&gt; method stores&amp;nbsp;this &lt;em&gt;GalleryPost&lt;/em&gt;.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; AddNewPhoto(&lt;span style="color: blue"&gt;string&lt;/span&gt; path, &lt;span style="color: blue"&gt;int&lt;/span&gt; width, &lt;span style="color: blue"&gt;int&lt;/span&gt; height)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;PostAttachment&lt;/span&gt; attachment = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;PostAttachment&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;byte&lt;/span&gt;[] content = &lt;span style="color: teal"&gt;File&lt;/span&gt;.ReadAllBytes(path);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.Content = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;MemoryStream&lt;/span&gt;(content);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.Length = content.Length;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.ContentType = &lt;span style="color: maroon"&gt;"image/jpeg"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.DateCreated = &lt;span style="color: teal"&gt;DateTime&lt;/span&gt;.Now;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.FileName = &lt;span style="color: teal"&gt;Path&lt;/span&gt;.GetFileName(path);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.IsRemote = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.Width = width;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.Height = height;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPost&lt;/span&gt; galleryPost = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;GalleryPost&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.Name = &lt;span style="color: maroon"&gt;"Sample Photo"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.Body = &lt;span style="color: maroon"&gt;"&amp;lt;p&amp;gt;This is a sample photo!&amp;lt;/p&amp;gt;"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.UserID = context.UserID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.PostStatus = &lt;span style="color: teal"&gt;PostStatus&lt;/span&gt;.Approved;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.PostDate = &lt;span style="color: teal"&gt;DateTime&lt;/span&gt;.Now;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.Attachment = attachment;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.SectionID = context.SectionID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.CreatePicture(context.SectionID,&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost, attachment, &lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.Add(galleryPost, context.User);&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;em&gt;UpdatePhoto()&lt;/em&gt; is another method that updates current photo item and changes its&amp;nbsp;name then stores this change by calling &lt;em&gt;GalleryPosts.UpdatePicture()&lt;/em&gt; method.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; UpdatePhoto()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPost&lt;/span&gt; galleryPost = &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.GetPicture(context.PostID);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (galleryPost != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; galleryPost.Name = &lt;span style="color: maroon"&gt;"Updated Title"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.UpdatePicture(galleryPost);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;GetMostPopularID() function returns the PostID for the post with most views from latest 20 published photos.&amp;nbsp;&amp;nbsp; It uses GalleryThreadQuery and GetPictures() function to fetch data.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; GetMostPopularIDi()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryThreadQuery&lt;/span&gt; query = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: teal"&gt;GalleryThreadQuery&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.SectionID = context.SectionID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.SortBy = &lt;span style="color: teal"&gt;GalleryThreadSortBy&lt;/span&gt;.PictureDate;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.SortOrder = &lt;span style="color: teal"&gt;SortOrder&lt;/span&gt;.Descending;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.PageSize = 20;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.PageIndex = 0;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.OnlyApproved = &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;int&lt;/span&gt; maxView = 0;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;int&lt;/span&gt; postID = 0;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;ThreadSet&lt;/span&gt; set = &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.GetPictures(query);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: teal"&gt;Post&lt;/span&gt; post &lt;span style="color: blue"&gt;in&lt;/span&gt; set.Threads)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;GalleryPost&lt;/span&gt; galleryPost = &lt;span style="color: teal"&gt;GalleryPosts&lt;/span&gt;.GetPicture(post.PostID);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (galleryPost.Views &amp;gt; maxView)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; maxView = galleryPost.Views;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; postID = galleryPost.PostID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; postID;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Now playing:&lt;/strong&gt; Pink Floyd - A Great Day For Freedom&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=62697" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6811"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-03-16T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: Galleries</title><link>http://softlogger.com/6655/Community-Server/cs-dev-guide-galleries.aspx</link><description>&lt;p&gt;A&amp;nbsp;long time after discussing weblog application in my CS Dev Guide, now I want to talk about gallery as another main application in Community Server in this post and a few upcoming posts.&lt;/p&gt; &lt;p&gt;First thing that should be discussed is working with gallery itself and how to get, add, delete or&amp;nbsp;update a gallery.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CommunityServer.Galleries.Components.Gallery&lt;/em&gt; is a code representation class for a gallery in Community Server APIs.&amp;nbsp; &lt;em&gt;CommunityServer.Galleries.Galleries&lt;/em&gt; is a method factory that provides static methods to get, add, delete or&amp;nbsp;update galleries.&amp;nbsp;&lt;/p&gt; &lt;p&gt;Unlike my early CS Dev Guide posts I don't want to list all properties and methods&amp;nbsp;for &lt;em&gt;Gallery&lt;/em&gt; class because they're easy to understand.&amp;nbsp; Most of the properties for this object specify some settings for a gallery like image size, thumbnail size, default theme and ... but one point should be mentioned here about&amp;nbsp;return types for some of its methods.&lt;/p&gt; &lt;p&gt;In order to&amp;nbsp;work easier with some settings for gallery&amp;nbsp;and its photos, &lt;em&gt;Gallery&lt;/em&gt; class provides some methods to return&amp;nbsp;some&amp;nbsp;specific settings as a special type.&amp;nbsp; &lt;em&gt;GalleryImageSettings&lt;/em&gt; is a simple class that represents some settings for photos and it's the return type for some of &lt;em&gt;Gallery&lt;/em&gt; methods like&amp;nbsp;&lt;em&gt;GetMaxSettings()&lt;/em&gt;, &lt;em&gt;GetPictureDetailsSettings()&lt;/em&gt;, &lt;em&gt;GetSecondaryThumbnailSettings()&lt;/em&gt;, &lt;em&gt;GetSlideshowSettings()&lt;/em&gt; and&amp;nbsp;&lt;em&gt;GetThumbnailSettings()&lt;/em&gt;.&amp;nbsp; Actually these methods are&amp;nbsp;grouping some settings to return them as a single type.&amp;nbsp; &lt;em&gt;GalleryImageSettings&lt;/em&gt; is a simple class with different constructors (as shortcuts for its properties) and a few properties that specify some settings about photos like&amp;nbsp;size, type, brightness, quality and ...&lt;/p&gt; &lt;p&gt;Having this said ..., there isn't any important point to mention about &lt;em&gt;Gallery&lt;/em&gt; itself.&amp;nbsp; &lt;em&gt;CommunityServer.Galleries.Galleries&lt;/em&gt; namespace is familiar to you and it works like &lt;em&gt;CommunityServer.Blogs.Components.Weblogs&lt;/em&gt; namespace for weblog application.&amp;nbsp; Several static methods with different overloads let you to get, add, delete or update a &lt;em&gt;Gallery&lt;/em&gt; object as well as checking for gallery existence, getting a gallery group or gallery groups and restarting the gallery cache.&lt;/p&gt; &lt;p&gt;At this point we can&amp;nbsp;discover a few examples.&lt;/p&gt; &lt;p&gt;&lt;em&gt;GetCurrentGalleryName()&lt;/em&gt; is a function that wants to return the name of current gallery (if it exists).&amp;nbsp; Using &lt;em&gt;Exists()&lt;/em&gt; function&amp;nbsp;I can check to see if a gallery with same&amp;nbsp;ApplicationKey as current ApplicationKey exists or not.&amp;nbsp; If yes then I create an instance of &lt;em&gt;Gallery&lt;/em&gt; object and set it to what &lt;em&gt;GetGallery()&lt;/em&gt; method returns and finally&amp;nbsp;return the name of gallery.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; GetCurrentGalleryName()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.Exists(context.ApplicationKey))&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;Gallery&lt;/span&gt; gallery = &lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.GetGallery(context.ApplicationKey);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; gallery.Name;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;em&gt;TotalGalleries()&lt;/em&gt; is a simple integer function that returns the total number of photo galleries in an application by calling &lt;em&gt;GetGalleries()&lt;/em&gt; function.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; TotalGalleries()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: teal"&gt;Section&lt;/span&gt;&amp;gt; galleries = &lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.GetGalleries();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; galleries.Count;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;In the last example &lt;em&gt;UpdateThumbnailSize()&lt;/em&gt; method gets two integer values as new width and height to update current gallery settings and change the width and height of thumbnails for it.&amp;nbsp; After checking for gallery existence with &lt;em&gt;Exists()&lt;/em&gt; function, I create a gallery object based on current ApplicationKey and set new width and height for its thumbnails and finally call &lt;em&gt;Update()&lt;/em&gt; method to save my changes.&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; UpdateThumbnailSize(&lt;span style="color: blue"&gt;int&lt;/span&gt; Width, &lt;span style="color: blue"&gt;int&lt;/span&gt; Height)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;CSContext&lt;/span&gt; context = &lt;span style="color: teal"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.Exists(context.ApplicationKey))&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;Gallery&lt;/span&gt; gallery = &lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.GetGallery(context.ApplicationKey);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; gallery.ThumbnailX = Width;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; gallery.ThumbnailY = Height;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: teal"&gt;Galleries&lt;/span&gt;.Update(gallery);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Now playing:&lt;/strong&gt; Richard Clayderman - Love Me Tender&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=57774" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6655"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-03-01T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: What's New in Community Server 2007 API</title><link>http://softlogger.com/6622/Community-Server/cs-dev-guide-what-s-new-in-community-server-2007-api.aspx</link><description>&lt;p&gt;Last&amp;nbsp;week Telligent released Community Server 2007 Beta 1 publicly to let users enjoy the power of this great platform.&amp;nbsp; As you may know this new version is a milestone and comes with major enhancement in comparison with its preceding versions.&amp;nbsp; In addition to some changes that users can feel in user interface there are some other changes in codes and APIs that developers should concern about them.&lt;/p&gt; &lt;p&gt;In this short post I want to take a brief look at major changes in Community Server APIs based on what I could find in this short while after release.&amp;nbsp; After this my CS Dev Guide posts will apply new APIs for Community Server 2007.&lt;/p&gt; &lt;p&gt;A&amp;nbsp;major change for Community Server 2007 is it's designed specifically for ASP.NET 2.0 and doesn't support ASP.NET 1.1 anymore.&amp;nbsp; This restriction has helped team members to change APIs and improve their code and performance and add great features.&lt;/p&gt; &lt;p&gt;You already know that Community Server 2007 comes with new template engine named Chameleon so almost all codes for user interface are changed to make things easier to do.&amp;nbsp; But I haven't seen major changes in Control Panel side.&lt;/p&gt; &lt;p&gt;The second change is in membership provider.&amp;nbsp; New membership that is named Morpheous adds great features to preceding membership system.&amp;nbsp; the most important feature in Morpheous is the ability to share membership data between different sites easily.&amp;nbsp; I haven't seen major&amp;nbsp;additions or replacements in common public APIs that we were using and it seems most changes for membership&amp;nbsp;are behind the scenes (although I didn't spend more than 5 minutes on viewing membership APIs!).&lt;/p&gt; &lt;p&gt;Third major change is around emailing system where things are very different from the past.&amp;nbsp; Ken Robertson has done a great job on improving email system.&amp;nbsp; In new version it will be easier to customize emails and add new fields to them.&amp;nbsp; I'll try to cover new emailing system in one of my posts.&lt;/p&gt; &lt;p&gt;Using .NET 2.0, team members replaced many collection types in public APIs with generic types.&amp;nbsp; Previously you could see that ArrayList was the&amp;nbsp;main type for these public APIs but in&amp;nbsp;Calypso it's replaced with List&amp;lt;&amp;gt; generic type.&amp;nbsp; As usually we use some properties that are shared between ArrayList and List&amp;lt;&amp;gt; we shouldn't expect&amp;nbsp;many broken codes and probably a recompilation solves most of errors and some simple changes in code can solve other errors.&amp;nbsp; For example two replacements were enough to update my &lt;a href="http://nayyeri.net/archive/2007/02/21/community-server-2007-blogml-converter-beta.aspx"&gt;BlogML converter&lt;/a&gt; to work with Community Server 2007.&lt;/p&gt; &lt;p&gt;On the other hand I saw some minor additions to methods and properties for some classes that I will cover in my future posts.&lt;/p&gt; &lt;p&gt;These were all main changes that a developer should be aware to use Community Server 2007.&amp;nbsp; I try&amp;nbsp;to cover these changes in more details and write about any other change that I could find in some posts.&amp;nbsp; Before doing this, I want to go back and forth and discover photo gallery and forum APIs in general.&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=56609" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6622"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-02-23T00:00:00</pubDate><category>Community Server</category></item><item><title>Create a Blogroll from OPML Files</title><link>http://softlogger.com/6538/Community-Server/create-a-blogroll-from-opml-files.aspx</link><description>&lt;P&gt;One of things that I wanted to add to new version of Nayyeri.NET was a blogroll.&amp;nbsp; Community Server supports blogrolls out of the box but they're not easy to manage.&amp;nbsp; Probably you can remember that I had written an &lt;A href="http://nayyeri.net/archive/2006/03/31/Final-versions-of-two-new-Add_2D00_ons-for-CS-2.0.aspx" mce_href="http://nayyeri.net/archive/2006/03/31/Final-versions-of-two-new-Add_2D00_ons-for-CS-2.0.aspx"&gt;OPML to Blogroll converter control for Community Server 2.0&lt;/A&gt; but in fact it wasn't fast for large numbers of links.&amp;nbsp; &lt;A href="http://dbvt.com/blog/" rel=friend mce_href="http://dbvt.com/blog/"&gt;Dave&lt;/A&gt; had modified my control with a SQL server to avoid many iterations in APIs and had replaced them with direct SQL statements but finally he left that control like me.&lt;/P&gt;
&lt;P&gt;For new version I was looking for an easier way to apply this with Community Server APIs but nope, result wasn't good!&amp;nbsp; Finally I switched to&amp;nbsp;another solution that I was going to implement from the first day!&lt;/P&gt;
&lt;P&gt;As I wanted an easier way to manage links I decided to avoid any .NET code and write a better transform to convert my OPML file to blogroll on fly.&amp;nbsp; The result was absolutely better than what I had with my Community Server control.&amp;nbsp; I wrote an XSL Transform to generate final HTML from OPML and used ASP.NET XML server control to automate this conversion and put this control in a user control and cached it on local server to improve the performance.&amp;nbsp; So you can guess, result was great!&amp;nbsp; But after finding this solution I belief that there are many links that make my sidebar heavy and ignored this blogroll from the base!&lt;/P&gt;
&lt;P&gt;However, it may be helpful for some users because I saw that some guys were asking for an easier solution to manage their blogrolls in Community Server.&lt;/P&gt;
&lt;P&gt;Here is the XSL Transform that I used to convert OPML to HTML:&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: courier new"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;xml&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;version&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;1.0&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;encoding&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;UTF-8&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;?&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:stylesheet&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;xmlns:xsl&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;http://www.w3.org/1999/XSL/Transform&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;xmlns:dc&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;http://purl.org/dc/elements/1.1/&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;version&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;1.0&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:output&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;method&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;xml&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;indent&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;yes&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:template&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;match&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;opml&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;http://www.w3.org/1999/xhtml&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;lang&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;en&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;xml:lang&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;en&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;style&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a:link, a:active, a:visited, a:hover {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; color: #ce0000;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text-decoration: none;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;style&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;http://www.w3.org/1999/xhtml&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Blogroll&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:for-each&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/opml/body/outline&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h4&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:choose&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:when&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;test&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@title&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:value-of&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@title&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:when&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:otherwise&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:value-of&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@text&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:otherwise&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:choose&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;h4&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:for-each&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;./outline&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;ItemListItem&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:attribute&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;href&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:choose&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:when&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;test&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@htmlUrl&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:value-of&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@htmlUrl&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:when&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:otherwise&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:value-of&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@xmlUrl&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:otherwise&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:choose&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:attribute&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:value-of&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;select&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;@text&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;a&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;li&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:for-each&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;ul&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:for-each&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:template&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;xsl:stylesheet&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Then I used an XML server control and set its DocumentSource property to my OPML file address and TransformSource to the address of this XSL file.&amp;nbsp; You can see&amp;nbsp;a sample output below.&lt;/P&gt;
&lt;P&gt;&lt;IMG height=458 src="http://nayyeri.net/misc/CreateaBlogrollfromYourOPMLFiles_124AE/OPMLBlogroll12.jpg" width=260 mce_src="http://nayyeri.net/misc/CreateaBlogrollfromYourOPMLFiles_124AE/OPMLBlogroll12.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;I attached XSL transform file to this post.&lt;/STRIKE&gt;&amp;nbsp; There is a bug in Community Server 2007 Beta 1 blog attachments so I couldn't upload my file.&lt;/P&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=55351" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6538"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-02-17T00:00:00</pubDate><category>Community Server</category></item><item><title>Mollio Template on Nayyeri.NET</title><link>http://softlogger.com/6446/Community-Server/mollio-template-on-nayyeri-net.aspx</link><description>&lt;p&gt;I didn't want to make this public before deploying to my site but as &lt;a href="http://scottwater.com/blog/" rel="acquaintance"&gt;Scott&lt;/a&gt; has written about some &lt;a href="http://scottwater.com/blog/archive/free-web-templates/"&gt;free web templates&lt;/a&gt; and&amp;nbsp;listed&amp;nbsp;Mollio so cat is out the bag!&lt;/p&gt; &lt;p&gt;Recently I was working on a new template for my site to apply it here after first public Beta release of Community Server 2007.&amp;nbsp; You know I'm not a professional designer so I had to choose a good open source&amp;nbsp;template that fits to my site.&amp;nbsp;&amp;nbsp;Main drawback of all my previous themes&amp;nbsp;was the&amp;nbsp;difference between&amp;nbsp;my blog and&amp;nbsp;other parts&amp;nbsp;of site so this time I came up with the idea to work on a new&amp;nbsp;template for whole site based on my site requirements.&lt;/p&gt; &lt;p&gt;Some months ago (last year?!)&amp;nbsp;Scott had used a very&amp;nbsp;beautiful template on his site for a few weeks.&amp;nbsp; That template was &lt;a href="http://www.mollio.org/"&gt;Mollio&lt;/a&gt;, an open source template that is designed in several types but with one single CSS file (some readers may know it).&amp;nbsp; After checking different type I decided to use Type F because it lets me to put all my content in sidebars and content wrapper&amp;nbsp;easily.&amp;nbsp; Mollio is a template with great details that make it beautiful.&lt;/p&gt; &lt;p&gt;Using this&amp;nbsp;template needed some changes in default CSS.&amp;nbsp;&amp;nbsp;I&amp;nbsp;had to add some CSS codes for links, tags, titles and ...&amp;nbsp; However, I had to spend much time to change CSS and add new styles.&lt;/p&gt; &lt;p&gt;Finally I could do it and new template is almost ready (at least for blog).&amp;nbsp;&amp;nbsp;Fortunately it wasn't so hard to apply this modified&amp;nbsp;template to site master file and it could give me a good result so I'm very close to finishing this&amp;nbsp;template for whole&amp;nbsp;site as well.&lt;/p&gt; &lt;p&gt;The interesting point that I want to share with you is about Chameleon (new theme engine in Community Server 2007).&amp;nbsp; &lt;a href="http://getben.com/" rel="acquaintance"&gt;Ben&lt;/a&gt; has done a great job on writing this new engine and I could import things easily (as Scott has said and I wrote in previous paragraphs, importing the Mollio was a little complicated though).&lt;/p&gt; &lt;p&gt;Here are some snapshots of my new template (coming soon).&amp;nbsp; On production it will be better with more data.&amp;nbsp; It needs some tweaking though but I want to wait until&amp;nbsp;last pre-Beta release to apply changes.&lt;/p&gt; &lt;p&gt;&lt;a href="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET13.jpg"&gt;&lt;img height="303" alt="Nayyeri.NET" src="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET1_thumb1.jpg" width="400" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET23.jpg"&gt;&lt;img height="301" alt="Nayyeri.NET" src="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET2_thumb1.jpg" width="400" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET33.jpg"&gt;&lt;img height="303" alt="Nayyeri.NET" src="http://nayyeri.net/misc/MollioThemeonNayyeri.NET_8E71/NayyeriNET3_thumb1.jpg" width="400" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;At the end, as Scott has asked for more open source templates, I'd like to add&amp;nbsp;&lt;a href="http://www.templateworld.com/free_templates.html"&gt;Template World&lt;/a&gt;&amp;nbsp;as&amp;nbsp;a site with excellent free templates.&lt;/p&gt; &lt;p&gt;Stay tuned, Community Server 2007 is coming!&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=45760" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6446"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-02-07T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: Referrals</title><link>http://softlogger.com/6447/Community-Server/cs-dev-guide-referrals.aspx</link><description>&lt;p&gt;A&amp;nbsp;while back I was working on a custom control to deploy it to my blog but didn't finish it.&amp;nbsp; Today I worked on it again and may add it to this blog after installing first Beta version of Community Server 2007.&amp;nbsp; This control is about referrals.&lt;/p&gt; &lt;p&gt;What is a referral?&amp;nbsp; Yes, you know!&amp;nbsp; So I can jump into describing available APIs to work with referrals in Community Server.&lt;/p&gt; &lt;p&gt;CommunityServer.Components.Referral and CommunityServer.Components.ReferralSet classes and CommunityServer.Components.Referrals factory have the main role in working with referrals.&lt;/p&gt; &lt;p&gt;there is also a CSJob to store referral data on a regular basis.&amp;nbsp; This means that referral information won't be stored immediately and it takes time to store them by a CSJob (ReferralsJob).&lt;/p&gt; &lt;p&gt;In database there are two tables named cs_Referrals and cs_Urls that are used to store referral URLs in conjunction with cs_Posts table.&amp;nbsp; cs_Referral has a relationship with cs_Urls and cs_Posts.&amp;nbsp; URL of referral is stored in cs_Urls and other information about it are stored in cs_Referrals.&lt;/p&gt; &lt;p&gt;Referral is a class with following properties and no method:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Hits: Integer value of the number of hits from the referral.  &lt;li&gt;LastDate: DateTime value of when the last hit is come to site from referral.  &lt;li&gt;PostID: Integer value of post identifier that this referral belongs to it.  &lt;li&gt;ReferralID: An integer value as identifier of referral.  &lt;li&gt;SectionID: Integer value of section identifier where this referral and its corresponding post are located.  &lt;li&gt;SettingsID: Integer value of SettingsID for current application.  &lt;li&gt;Title: A string value as the title of URL.&amp;nbsp; Normally it's equal to URL.  &lt;li&gt;Url: String value of referral's URL.  &lt;li&gt;UrlID: Integer value of URL's identifier.  &lt;li&gt;ViewPostUrl: A URL to quickly view the post.&amp;nbsp; You can find these URLs when you're viewing referrals page in blog.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;ReferralSet is another class with four properties that are listed below.&amp;nbsp; It's actually a container to keep a list of Referral objects.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;PageIndex: Integer value of page index number (starts from 0).  &lt;li&gt;PageSize: Integer value of page size.  &lt;li&gt;Referrals: An ArrayList of Referral objects.  &lt;li&gt;TotalRecords: Integer value of total number of referral objects in ReferralSet.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Referrals is a method factory that helps you to work with referrals.&amp;nbsp; It's like a queue that keeps&amp;nbsp;tracked data for&amp;nbsp;referrals.&amp;nbsp; Some of its methods are important for default Community Server implementation (to add referrals to queue and other operations)&amp;nbsp;so they're not very common in custom developments&amp;nbsp;and I&amp;nbsp;give a short description about&amp;nbsp;one common methods.&lt;/p&gt; &lt;p&gt;GetReferrals()&amp;nbsp;gets a Referral object and two integer values as page size and page index and returns a ReferralSet for the post.&amp;nbsp; Post is specified via its PostID in incoming Referral object.&amp;nbsp; Therefore you can use this method to get a list of referrals for a post.&lt;/p&gt; &lt;p&gt;In below code I want to get a list of referrals for the post that is being viewed by user to show it somewhere so GetFilteredReferrals() function doesn't get any parameter but returns an ArrayList of referrals.&amp;nbsp; It tries to filter referrals and exclude referrals from some search engines.&amp;nbsp; By default Community Server provides some APIs to filter incoming referrals before storing them into database&amp;nbsp;but as it stores&amp;nbsp;all referrals from search engines and doesn't apply any filter to them,&amp;nbsp;I should filter them here.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:teal;"&gt;ArrayList&lt;/span&gt; GetFilteredReferrals()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;CSContext&lt;/span&gt; context = &lt;span style="color:teal;"&gt;CSContext&lt;/span&gt;.Current;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;ArrayList&lt;/span&gt; results = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;ArrayList&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;Referral&lt;/span&gt; r = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Referral&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.PostID = context.PostID;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.SectionID = context.SectionID;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; r.SettingsID = context.SettingsID;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;ReferralSet&lt;/span&gt; referralSet = &lt;span style="color:teal;"&gt;Referrals&lt;/span&gt;.GetReferrals(&lt;span style="color:teal;"&gt;Referrals&lt;/span&gt;, 100, 0);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:teal;"&gt;Referral&lt;/span&gt; referral &lt;span style="color:blue;"&gt;in&lt;/span&gt; referralSet)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;if&lt;/span&gt; (!(referral.Url.Contains(&lt;span style="color:maroon;"&gt;"search."&lt;/span&gt;) || referral.Url.Contains(&lt;span style="color:maroon;"&gt;"google."&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; || referral.Url.Contains(&lt;span style="color:maroon;"&gt;"search.yahoo"&lt;/span&gt;) || referral.Url.Contains(&lt;span style="color:maroon;"&gt;"search.live.com"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; || referral.Url.Contains(&lt;span style="color:maroon;"&gt;"technoarti.com"&lt;/span&gt;)))&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; results.Add(referral);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; results;&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Now playing:&lt;/strong&gt; Eminem - Lose Yourself&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=45467" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6447"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-02-06T00:00:00</pubDate><category>Community Server</category></item><item><title>How Do I Add Live Comment Preview to my Subtext Blog Comments</title><link>http://softlogger.com/6399/Community-Server/how-do-i-add-live-comment-preview-to-my-subtext-blog-comments.aspx</link><description>If you even wondered how certain subtext blogs are showing a preview pane when you are writing a comment on a blog post, here is how you can implement that feature on your very own subtext blog.
&lt;ul&gt;
    &lt;li&gt;Open the &lt;strong&gt;Skins.config&lt;/strong&gt; file located in the Admin folder of your subtext installation in Visual Studio or in a Text editor.&lt;/li&gt;
    &lt;li&gt;Locate the &lt;strong&gt;SkinTemplate&lt;/strong&gt; section for your blog skin. In this example, I am using a blog skin called &lt;strong&gt;gray&lt;/strong&gt;.&lt;/li&gt;
    &lt;li&gt;If there is a &lt;strong&gt;Scripts&lt;/strong&gt; section already, then just add line &lt;strong&gt;3&lt;/strong&gt;. Otherwise, add lines &lt;strong&gt;2, 3&lt;/strong&gt; and &lt;strong&gt;4&lt;/strong&gt;. Be careful with case sensitivity.&lt;br /&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SkinTemplate&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;="gray"&lt;/span&gt; &lt;span class="attr"&gt;TemplateFolder&lt;/span&gt;&lt;span class="kwrd"&gt;="gray"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Scripts&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;            &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Script&lt;/span&gt; &lt;span class="attr"&gt;Src&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Scripts/LiveCommentPreview.js"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Scripts&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Styles&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Style&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="~/skins/_System/csharp.css"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Style&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="~/skins/_System/commonstyle.css"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Style&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="~/skins/_System/commonlayout.css"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Style&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="~/scripts/lightbox.css"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Style&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="print.css"&lt;/span&gt; &lt;span class="attr"&gt;media&lt;/span&gt;&lt;span class="kwrd"&gt;="print"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Styles&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;SkinTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt; Save and close the &lt;strong&gt;Skins.config&lt;/strong&gt; file.&lt;/li&gt;
    &lt;li&gt;Now open the &lt;strong&gt;PostComment.ascx&lt;/strong&gt; file under the controls folder for the skin in Visual Studio or in a Text editor. In my example, it will be under &lt;strong&gt;\Skins\gray\Controls&lt;/strong&gt;&lt;/li&gt;
    &lt;li&gt;Scroll down to the bottom of the page, and paste the following line of code at the location you want to display the &lt;strong&gt;Live Preview&lt;/strong&gt;.&lt;br /&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="comment livepreview"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;br /&gt;
Depending on how the rest of your comment page is laid out, so as to not break the page rendering on the browser, you may need to enclose this DIV tag in a table row or something else as follows.&lt;br /&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;tr&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;td&lt;/span&gt; &lt;span class="attr"&gt;colSpan&lt;/span&gt;&lt;span class="kwrd"&gt;="3"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Live Preview&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="comment livepreview"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;td&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;tr&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt; Next, browse to one of your posts, and click the link to for the comments/feedback.&lt;/li&gt;
    &lt;li&gt;Start typing a comment, and you should see the comment in realtime in the Live preview pane.&lt;br /&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Troubleshooting the Live Preview Comments implementation.&lt;/h2&gt;
If you don't see the live preview, first ensure that the javascript has been included.
&lt;ul&gt;
    &lt;li&gt; Right click the blog post page, and click View Source.&lt;/li&gt;
    &lt;li&gt; Search for LiveCommentPreview.js.&lt;/li&gt;
    &lt;li&gt; Copy the full URL for LiveCommentPreview.js file and paste it in the address bar of a new browser window and press enter.&lt;/li&gt;
    &lt;li&gt; The LiveCommentPreview.js file should be opened.&lt;/li&gt;
    &lt;li&gt; If you get a file not found error, then look closely at the full path to LiveCommentPreview.js and correct it in the location in Skins.config file and try again.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://theshiva.us/technicalblog/aggbug/41.aspx" width="1" height="1" /&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6399"&gt;</description><author>Shiva @Compile blog                                                                                 </author><pubDate>2007-01-30T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: Time Zone</title><link>http://softlogger.com/6397/Community-Server/cs-dev-guide-time-zone.aspx</link><description>&lt;p&gt;For many people around the world &lt;a href="http://en.wikipedia.org/wiki/Time_zone"&gt;time zone&lt;/a&gt; doesn't matter at all.&amp;nbsp; For some people it's important for their jobs and business but for developers it's just a pain!&amp;nbsp; I can remember many situations that I've gotten in trouble with time zones myself.&amp;nbsp; Two times (before release of Community Server 2.0 and launching &lt;a href="http://blogmailr.com/"&gt;BlogMailr&lt;/a&gt;) I had some conversations with &lt;a href="http://qgyen.net/" rel="acquaintance"&gt;Ken&lt;/a&gt; about them and it's still a big problem for software developers.&amp;nbsp; Many users ask about the lack of their local time zone in Community Server and hopefully they can get&amp;nbsp;their answer in all details after reading this post.&amp;nbsp; I see some posts with my eyes where some users thought that Telligent is encouraging racism and were asking for their time zones to be included in list.&lt;/p&gt; &lt;p&gt;In this CS Dev Guide post I want to talk about time zones in Community Server APIs but before that I'll give short introduction to some concepts that you will see.&amp;nbsp; I'm sure you know all details about time zone in general but we needs some details to be able to calculate local and universal time and convert them to each other in programming.&lt;/p&gt; &lt;h3&gt;Background&lt;/h3&gt; &lt;p&gt;A time zone is an area that gets a specific time based on its distance from Greenwich in England.&amp;nbsp; Greenwich time is also known as UTC for you.&amp;nbsp; Each area in our world gets a local time based on its distance.&amp;nbsp; For example +1:00 hour, +2:00 hours, -6:00 hours and so on.&amp;nbsp; Greenwich is a source for calculations so we'll be able to have different times wherever we live and&amp;nbsp;find others times using some basic mathematic calculations.&lt;/p&gt; &lt;p&gt;Ok, stop, this is very simple,&amp;nbsp;what's the problem?&amp;nbsp; The trouble is with something known as &lt;a href="http://en.wikipedia.org/wiki/Daylight_saving"&gt;daylight saving time&lt;/a&gt;.&amp;nbsp; In many countries governments change their local time on specific dates and add or subtract one hour from their local time.&amp;nbsp; There are economic benefits in doing this thing.&amp;nbsp; But as there isn't any standard for daylight savings then each government has its own rules for daylight savings.&amp;nbsp; And also in some modern countries some bright persons (who love tomato) suddenly decide to avoid&amp;nbsp;doing this&amp;nbsp;(got it?!!).&amp;nbsp; However, difference comes from daylight saving and I haven't seen a good solution for it except using a webservice.&lt;/p&gt; &lt;h3&gt;Time Zones in Community Server&lt;/h3&gt; &lt;p&gt;Let's follow this story&amp;nbsp;in Community Server ...&lt;/p&gt; &lt;p&gt;In Community Server we have a list of pre-defined&amp;nbsp;time zones but this list doesn't include all zones.&amp;nbsp; It only contains time zones with integer values so for example you have a time zone for +4:00 but don't have a time zone for +4:30.&amp;nbsp; It's possible to add any new time zone to this list but as you'll see later, restriction for time zone values won't be solved unless the team changes the core code.&amp;nbsp; For each time zone we have some information that helps us to calculate local and universal time and convert a DateTime value from one time zone to another.&amp;nbsp; Community Server stores these information both for normal and daylight times to be able to do its calculations easier.&amp;nbsp; It stores a name for each time zone for both cases as well as a bias for each case.&amp;nbsp; There is also a general name for each time zone.&lt;/p&gt; &lt;p&gt;Alright, let's get in more technical details.&lt;/p&gt; &lt;p&gt;Three classes and one enumeration in &lt;em&gt;CommunityServer.Components&lt;/em&gt; play all roles about managing time zones in Community Server:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;em&gt;TimeZoneArea&lt;/em&gt; is an enumeration of all available time zones in Community Server.&amp;nbsp; It's used in other classes.  &lt;li&gt;&lt;em&gt;TimeZoneInternational&lt;/em&gt; is a class to represent a time zone in Community Server APIs.  &lt;li&gt;&lt;em&gt;TimeZoneInternationalCollection&lt;/em&gt; is&amp;nbsp;a collection class to keep the list of available time zones in Community Server.  &lt;li&gt;&lt;em&gt;TimeZoneInternationalManager&lt;/em&gt; is another class that helps you to work with time zones.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;You know that in Community Server most (or all?!) DateTime values will be shown to ends users based on the time zone that they have chosen in their profiles.&amp;nbsp; Community Server also gets the time zone for server to do its calculations.&amp;nbsp; Therefore above classes are very important for the power of Community Server in DateTime calculations.&lt;/p&gt; &lt;h3&gt;TimeZoneArea&lt;/h3&gt; &lt;p&gt;This enumeration simply lists all available time zone areas in Community Server to help to work with them easier.&lt;/p&gt; &lt;h3&gt;TimeZoneInternational&lt;/h3&gt; &lt;p&gt;This class is derived from System.TimeZone class in .NET Framework and does the main job around time zones.&amp;nbsp; Community Server hasn't added many new things to .NET TimeZone object but I'll describe its properties and methods anyway.&amp;nbsp; It has six properties (regarding what I wrote in background):&lt;/p&gt; &lt;ul&gt; &lt;li&gt;DaylightBias: An integer value of bias for&amp;nbsp;daylight time.&amp;nbsp;  &lt;li&gt;DaylightName: String value of time zone name for daylight time.  &lt;li&gt;DisplayName: String value of time zone name.&amp;nbsp; This is what end users see as the name of time zone.  &lt;li&gt;StandardBias: An integer value of bias for&amp;nbsp;standard&amp;nbsp;time.  &lt;li&gt;StandardName: String value of time zone name for standard time.  &lt;li&gt;TimeZoneArea: A corresponding &lt;em&gt;TimeZoneArea&lt;/em&gt; enumeration value.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;You see that &lt;em&gt;DaylighBias&lt;/em&gt; and &lt;em&gt;StandardBias&lt;/em&gt; are both integer properties so Community Server doesn't support any double values for time zones and this is the answer to a common question about Community Server.&amp;nbsp; I hope that we see good changes around time zones in Calypso.&lt;/p&gt; &lt;p&gt;It also has&amp;nbsp;five methods:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;GetDaylightChanges: Gets an integer as a year and returns a System.Globalization.DaylightTime object which represents the daylight changes for that year.&amp;nbsp; DaylightTime provides three properties for daylight changes: start and end date of daylight saving changes and TimeSpan of changes.  &lt;li&gt;GetUtcOffset: Gets a DateTime value of local time (for current &lt;em&gt;TimeZoneInternational&lt;/em&gt; object) and returns a TimeSpan of difference between UTC time and local time.  &lt;li&gt;IsDaylightSavingTime: Get a DateTime value of local time and checks if it's time for daylight saving.  &lt;li&gt;ToLocalTime: It has two overloads and converts a DateTime value from UTC or other time zones to local time zone.  &lt;li&gt;ToUniversalTime: Gets a DateTime value based on local time and converts it to universal time.&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;TimeZoneInternationalCollection&lt;/h3&gt; &lt;p&gt;This class is actually a collection for &lt;em&gt;TimeZoneIntrernational&lt;/em&gt; objects so has some common methods and properties to work with collections.&amp;nbsp; You can add or remove a &lt;em&gt;TimeZoneInternational&lt;/em&gt; object to or from it or iterate through its items.&lt;/p&gt; &lt;h3&gt;TimeZoneInternationalManager&lt;/h3&gt; &lt;p&gt;This class is as simple as one property and one method.&amp;nbsp; TimeZones is a ReadOnly property that returns a &lt;em&gt;TimeZoneInternationalCollection&lt;/em&gt; of all available time zones in application.&amp;nbsp; &lt;em&gt;GetTimeZone()&lt;/em&gt; gets a &lt;em&gt;TimeZoneArea&lt;/em&gt; enumeration value and returns&amp;nbsp;its corresponding&amp;nbsp;&lt;em&gt;TimeZoneInternational&lt;/em&gt; object.&lt;/p&gt; &lt;h3&gt;Examples&lt;/h3&gt; &lt;p&gt;You know it's possible to write many good examples about time zones but I only write two examples to demonstrate some basic principles and you can find your thread to follow.&lt;/p&gt; &lt;p&gt;In &lt;em&gt;GetAllLocalTimes()&lt;/em&gt; method below I use &lt;em&gt;TimeZoneInternationalManager&lt;/em&gt; to get a &lt;em&gt;TimeZoneInternationalCollection&lt;/em&gt; of all available &lt;em&gt;TimeZoneInternational&lt;/em&gt; objects then use server time to calculate current time in all these areas then return a&amp;nbsp;Hashtable of time zone names and DateTime value of current time for them.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:teal;"&gt;Hashtable&lt;/span&gt; GetAllLocalTimes()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;DateTime&lt;/span&gt; serverTime = &lt;span style="color:teal;"&gt;UserTime&lt;/span&gt;.CurrentServerTime;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;Hashtable&lt;/span&gt; results = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Hashtable&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;TimeZoneInternationalCollection&lt;/span&gt; zones =&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;TimeZoneInternationalManager&lt;/span&gt;.TimeZones;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:teal;"&gt;TimeZoneInternational&lt;/span&gt; zone &lt;span style="color:blue;"&gt;in&lt;/span&gt; zones)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; results.Add(zone.DisplayName, zone.ToLocalTime(serverTime));&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; results;&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;In &lt;em&gt;GetLocalTimeInWestAustralia()&lt;/em&gt; I use &lt;em&gt;TimeZoneInternationalManager&lt;/em&gt; to get a &lt;em&gt;TimeZoneInternational&lt;/em&gt; object for West Australia&amp;nbsp;then return a DateTime value of current local time there.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:teal;"&gt;DateTime&lt;/span&gt; GetLocalTimeInWestAustralia()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;DateTime&lt;/span&gt; serverTime = &lt;span style="color:teal;"&gt;UserTime&lt;/span&gt;.CurrentServerTime;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;TimeZoneInternational&lt;/span&gt; localZone = &lt;span style="color:teal;"&gt;TimeZoneInternationalManager&lt;/span&gt;.GetTimeZone&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;span style="color:teal;"&gt;TimeZoneArea&lt;/span&gt;.WestAustraliaStandardTime);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; localZone.ToLocalTime(serverTime);&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=37403" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6397"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-01-29T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: Content</title><link>http://softlogger.com/6286/Community-Server/cs-dev-guide-content.aspx</link><description>&lt;p&gt;One of many open doors to add your content and customize Community Server to use&amp;nbsp;this content is via &lt;em&gt;CommunityServer.Components.Content&lt;/em&gt; class.&amp;nbsp; This class (which is used to store and retrieve articles in default Community Server code) lets you to save your own content into database and&amp;nbsp;get it later.&lt;/p&gt; &lt;p&gt;On the other hand &lt;em&gt;CommunityServer.Components.Contents&lt;/em&gt; namespace is a factory that provides several static methods to help you on working with content.&lt;/p&gt; &lt;p&gt;Content class is simple.&amp;nbsp; Eight properties build it:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Body: String value of the body of content.  &lt;li&gt;Exists: ReadOnly Boolean value to check if that content exists.  &lt;li&gt;FormattedBody: String value of formatted body for a content.  &lt;li&gt;Hidden: Boolean value to hide a content from public view.  &lt;li&gt;ID: Integer identifier for content.  &lt;li&gt;LastModified: DateTime value of when a content is modified.  &lt;li&gt;Name: String value of a name for content.&amp;nbsp; It must be unique&amp;nbsp;and is another identifier for&amp;nbsp;&lt;em&gt;Content&lt;/em&gt; class.&amp;nbsp; This property has been used to implement articles with &lt;em&gt;Content&lt;/em&gt; class.  &lt;li&gt;Title: String value of title.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This&amp;nbsp;class comes with two constructors.&amp;nbsp; One of them is default constructor and second one is a shortcut to create an instance and set its properties.&amp;nbsp; There are also two other public functions for this class:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Copy: Simply returns a new instance (and copy) of current content object to use in other codes.  &lt;li&gt;RenderedBody: Gets a &lt;em&gt;CommunityServer.Components.PostTarget&lt;/em&gt; enumeration value and gives a new string based on the target.&amp;nbsp; You may be familiar with this enumeration from CSModules.&amp;nbsp; A post can be viewed in NNTP, email, feeds, web, ... and all these targets need different formatting for body.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;On the other side &lt;em&gt;Contents&lt;/em&gt; namespace provides some methods to work with &lt;em&gt;Content&lt;/em&gt; or its special implementation for&amp;nbsp;articles (I excluded some methods that I don't know what they do!):&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Add:&amp;nbsp;Gets a &lt;em&gt;Content&lt;/em&gt; object and stores it in database.  &lt;li&gt;ArticleUrl: Gets the name of article (&lt;em&gt;Content&lt;/em&gt; object) and returns string value of its Url.  &lt;li&gt;Delete: Gets a &lt;em&gt;Content&lt;/em&gt; object and deletes it.  &lt;li&gt;GetAllContent: Returns a list of all available &lt;em&gt;Content&lt;/em&gt; objects in an application.  &lt;li&gt;GetContent: It has two overloads and returns an instance of &lt;em&gt;Content&lt;/em&gt; object by getting its ID or name.  &lt;li&gt;StripBadChars: This method is completely independent from &lt;em&gt;Content&lt;/em&gt; class.&amp;nbsp; It strips all bad characters in a string and returns a new string value.  &lt;li&gt;Update: Gets a &lt;em&gt;Content&lt;/em&gt; object and stores its changes in database.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Like recent CS Dev Guide posts let's explore some examples.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CreateNewContent()&lt;/em&gt; method just creates an instance of &lt;em&gt;Content&lt;/em&gt; object, sets it properties,&amp;nbsp;and stores it.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;void&lt;/span&gt; CreateNewContent()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;Content&lt;/span&gt; content = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;Content&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; content.Title = &lt;span style="color:maroon;"&gt;"Introduction to Gholi!"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; content.Name = &lt;span style="color:maroon;"&gt;"Gholi"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; content.Hidden = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; content.Body = &lt;span style="color:maroon;"&gt;"Gholi is a great guy ..."&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;Contents&lt;/span&gt;.Add(content);&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;UpdateContentNames() method updates all content names and add the ID of content with an underline to beginning of name.&amp;nbsp; To do this it uses &lt;em&gt;GetAllContent()&lt;/em&gt; method then iterates through all available contents, changes their name and saves all changes by calling &lt;em&gt;Update()&lt;/em&gt; method.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;void&lt;/span&gt; UpdateAllContent()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;IList&lt;/span&gt; contents = &lt;span style="color:teal;"&gt;Contents&lt;/span&gt;.GetAllContent();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:teal;"&gt;Content&lt;/span&gt; content &lt;span style="color:blue;"&gt;in&lt;/span&gt; contents)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; content.Name = content.ID.ToString()&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; + &lt;span style="color:maroon;"&gt;"_"&lt;/span&gt; + content.Name;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;Contents&lt;/span&gt;.Update(content);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;+ I think there is an inconsistency in &lt;em&gt;Contents&lt;/em&gt; factory.&amp;nbsp; Some of these methods had to be available in better APIs.&amp;nbsp; For example &lt;em&gt;ArticleUrl()&lt;/em&gt; could be added to &lt;a href="http://nayyeri.net/archive/2006/08/02/CS-Dev-Guide_3A00_-Site-Urls.aspx"&gt;SiteUrls&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;+ A suggestion for future of &lt;em&gt;Content&lt;/em&gt; class: having extended properties can open more doors to developers.&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=31065" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6286"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-01-18T00:00:00</pubDate><category>Community Server</category></item><item><title>CS Dev Guide: SiteSettings</title><link>http://softlogger.com/6260/Community-Server/cs-dev-guide-sitesettings.aspx</link><description>&lt;p&gt;In addition to site&amp;nbsp;&lt;a href="http://nayyeri.net/archive/2006/09/08/CS-Dev-Guide_3A00_-Configuration.aspx"&gt;configurations&lt;/a&gt;, Community Server provides several settings for each site.&amp;nbsp; Most of these settings have default values and you can set them in Control Panel and web UI.&lt;/p&gt; &lt;p&gt;&lt;em&gt;CommunityServer.Components.SiteSettings&lt;/em&gt;&amp;nbsp;is a code representation of all site settings for a specific Community Server instance.&lt;/p&gt; &lt;p&gt;As you know, several Community Server instances can be installed in same database.&amp;nbsp; Here a property which is named &lt;em&gt;SettingsID&lt;/em&gt; comes handy and helps to distinguish each instance (there is also an &lt;em&gt;ApplicationName&lt;/em&gt; property to identify site settings).&amp;nbsp; A &lt;em&gt;SiteSettings&lt;/em&gt; object has a one to one&amp;nbsp;relationship with a &lt;em&gt;SettingsID&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;By understanding this important key you can start coding against site settings by using static methods in &lt;em&gt;CommunityServer.Components.SiteSettingsManager&lt;/em&gt; namespace and &lt;em&gt;CommunityServer.Components.SiteSettings lass&lt;/em&gt;.&amp;nbsp; &lt;em&gt;SiteSettings&lt;/em&gt; has tons of properties and their name suggests their application so I don't step into their details.&amp;nbsp; Based on your needs you can get or set these settings in your code.&lt;/p&gt; &lt;p&gt;But &lt;em&gt;SiteSettingsManager&lt;/em&gt; namespace helps you to get an instance of &lt;em&gt;SiteSettings&lt;/em&gt; object or save one.&amp;nbsp; Here is a brief description about its common methods:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;AllSiteSettings: Returns an ArrayList of &lt;em&gt;SiteSettings&lt;/em&gt; objects.&amp;nbsp; Each object in this list is for one of installed applications.  &lt;li&gt;GetActiveSiteSettings: Returns an instance of &lt;em&gt;SiteSettings&lt;/em&gt; object for current application.  &lt;li&gt;GetSettingIDs: Returns an array of integers which contains all SettingIDs for installed applications.  &lt;li&gt;GetSiteSettings: This method is provided with three different overloads.&amp;nbsp; They let you to get an instance of &lt;em&gt;SiteSettings&lt;/em&gt; object by passing a &lt;em&gt;SettingsID&lt;/em&gt; or &lt;em&gt;ApplicationName&lt;/em&gt;.  &lt;li&gt;Save: Stores data for an instance of &lt;em&gt;SiteSettings&lt;/em&gt; object which is passed to it.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Alright, seeing some examples completes this discussion.&lt;/p&gt; &lt;p&gt;Here &lt;em&gt;UpdateCompanyName()&lt;/em&gt; method updates the company name for current application&amp;nbsp;then&amp;nbsp;saves it.&amp;nbsp; In this code first I created a &lt;em&gt;SiteSettings&lt;/em&gt; object and set it to current application settings using &lt;em&gt;SiteSettingsManager.GetActiveSiteSettings()&lt;/em&gt;&amp;nbsp;then changed company name and used &lt;em&gt;SiteSettingsManager.Save()&lt;/em&gt; method to store my change.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;void&lt;/span&gt; UpdateCompanyName()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;SiteSettings&lt;/span&gt; settings = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:teal;"&gt;SiteSettings&lt;/span&gt;();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; settings = &lt;span style="color:teal;"&gt;SiteSettingsManager&lt;/span&gt;.GetActiveSiteSettings();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.CompanyName = &lt;span style="color:maroon;"&gt;"Telligent Systems"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;SiteSettingsManager&lt;/span&gt;.Save(settings);&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;In second example &lt;em&gt;UpdateAllCopyrights()&lt;/em&gt; method updates&amp;nbsp;copyright notices for all applications.&amp;nbsp; It gets an ArrayList of all &lt;em&gt;SiteSettings&lt;/em&gt; using &lt;em&gt;SiteSettingsManager.AllSiteSettings()&lt;/em&gt; then iterates through them and updates all copyright notices.&amp;nbsp; On each iteration it stores changes by calling &lt;em&gt;SiteSettingsManager.Save()&lt;/em&gt;.&lt;/p&gt; &lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt; &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;void&lt;/span&gt; UpdateAllCopyrights()&lt;/p&gt; &lt;p style="margin:0px;"&gt;{&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;ArrayList&lt;/span&gt; settingsList = &lt;span style="color:teal;"&gt;SiteSettingsManager&lt;/span&gt;.AllSiteSettings();&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:teal;"&gt;SiteSettings&lt;/span&gt; settings &lt;span style="color:blue;"&gt;in&lt;/span&gt; settingsList)&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; settings.Copyright = &lt;span style="color:blue;"&gt;string&lt;/span&gt;.Format&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;span style="color:maroon;"&gt;"Copyright © {0} - Licensed under"&lt;/span&gt; +&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:maroon;"&gt;"Creative Commons Attribution 2.5 License."&lt;/span&gt;, &lt;span style="color:teal;"&gt;DateTime&lt;/span&gt;.Now.Year.ToString());&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;SiteSettingsManager&lt;/span&gt;.Save(settings);&lt;/p&gt; &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin:0px;"&gt;}&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;Now playing:&lt;/strong&gt; Man On The Line - Chris De Burgh&lt;/p&gt;&lt;img src="http://nayyeri.net/aggbug.aspx?PostID=27826" width="1" height="1"&gt;&lt;img alt="via softlogger.com" src="http://softlogger.com/postview.aspx?ArticleID=6260"&gt;</description><author>Keyvan Nayyeri</author><pubDate>2007-01-11T00:00:00</pubDate><category>Community Server</category></item></channel></rss>