<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper"><channel><title>Istern - Blog</title><link>http://www.istern.dk</link><pubDate></pubDate><generator>umbraco</generator><description></description><language>en</language><item><title>THIS Blog is moving</title><link>http://www.istern.dk/blog/2011/5/15/this-blog-is-moving.aspx</link><pubDate>Sun, 15 May 2011 20:04:21 GMT</pubDate><guid>http://www.istern.dk/blog/2011/5/15/this-blog-is-moving.aspx</guid><content:encoded><![CDATA[ 
<p>This blog is strting to migrate over to Wordpress and can be
found on <a href="http://blog.istern.dk"
title="Istern blog">blog.istern.dk</a>,</p>

<p>The migration is a working process and i hope it will finished
in a couple of days. This blog</p>

<p>will stay open for some time but no new post will posted
here.</p>

<p>&nbsp;</p>

<p>Looking forward to see all my subscribers on my new blog.</p>

<p>&nbsp;</p>

<p>-Thomas</p>
]]></content:encoded></item><item><title>CMS Friendly URL With MVC (Simple)</title><link>http://www.istern.dk/blog/2011/5/4/cms-friendly-url-with-mvc-(simple).aspx</link><pubDate>Wed, 04 May 2011 12:01:45 GMT</pubDate><guid>http://www.istern.dk/blog/2011/5/4/cms-friendly-url-with-mvc-(simple).aspx</guid><content:encoded><![CDATA[ 
<p>I currently working on HUGE MVC project for a customer through
Pentia. They are rebuilding their entire website from .Net webforms
to MVC 3 with Razer.</p>

<p>So one of the first task was to build som simpel functionality
tha could resolve their url delivered from the underlying
CMS.Instead of register specific routes for the different pagetypes
in the CMS</p>

<p>I came up with this solution shown in this blogpost.</p>

<p>To begin with I registered a new "CMS route in global.asax". All
URL shoul hit this route, ofcourse you could make other routes
before this.</p>

<pre class="brush:c#;">
 //RouteMap for CMS content
 routes.MapRoute("CMSRoute", "{*url*}").RouteHandler = new CmsRouteHandler();
</pre>

<p>&nbsp;</p>

<p>Now to the simple CmsRouteHandler implementation it simply calls
the CmsHttpHandler a relying on the handler to find a correct
controller to desplaying the current request.</p>

<pre class="brush:c#;">
  
public class CmsRouteHandler : IRouteHandler
{
    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
      return new CmsHttpHandler(requestContext);
    }
}
</pre>

<pre class="brush:c#;">
<br />
Now the CMSHttpHandle which for this blogpost is simplyfied to always returning the<br />
frontpage. This should offcourse by matching the url to a page i DB and displaying the<br />
and resolve it to the correct controller<br />
public class CmsHttpHandler : IHttpHandler
    {
        private RequestContext RequestContext { get; set; }
        private IControllerFactory ControllerFactory { get; set; }
        private IController Controller { get; set; }

        public CmsHttpHandler(RequestContext requestContext)
        {
            RequestContext = requestContext;
        }

        public void ProcessRequest(HttpContext context)
        {
            HttpContext = context;
            InstantiateControllerFactory();
            InstantiateController();
            SetupRequestContext();
            Controller.Execute(RequestContext);
        }

        private HttpContext HttpContext { get; set; }

        private void InstantiateControllerFactory()
        {
            ControllerFactory = ControllerBuilder.Current.GetControllerFactory(); 
        }

        private void InstantiateController()
        {
            Controller = ControllerFactory.CreateController(RequestContext, Pagetype);
        }

        private void SetupRequestContext()
        {
            RequestContext.RouteData.Values.Add("controller", Pagetype);
            //Always render Index action, all pagetype controllers must implement Index action
            RequestContext.RouteData.Values.Add("action", "Index");

            AppendQueryStrings();
        }

        private void AppendQueryStrings()
        {
            foreach (string name in HttpContext.Request.QueryString)
                RequestContext.RouteData.Values.Add(name, HttpContext.Request.QueryString[name]);
        }

        private static string ResolvePagetypeFromUrl()
        {
           
            
            //Should return apgetype from db/URL
            return Pagetype
        
             
        }

        private string _pageType;
        private string Pagetype
        {
            get
            {
                  //Resolve pagetype from DB fx
                  //For now we will just return the frontpage
                  /return string should match controller name
                  return "frontpage";
            }
        }

        public bool IsReusable
        {
            get
            {
                throw new NotImplementedException();
            }
        }
    }
</pre>

<p>Hope you find it usefull..</p>
]]></content:encoded></item><item><title>Interface Templates</title><link>http://www.istern.dk/blog/2010/12/14/interface-templates.aspx</link><pubDate>Tue, 14 Dec 2010 08:44:57 GMT</pubDate><guid>http://www.istern.dk/blog/2010/12/14/interface-templates.aspx</guid><content:encoded><![CDATA[ 
<p>For this post I will look into a simple technique for building
easy to extend or reuse features in Sitecore solutions. This simple
architectural concept will, for the rest of this blog post, be
refereed to as an Interface template. This idea comes from my work
in <a href="http://pentia.dk" target="_blank"
title="Pentia">Pentia</a>, where we build website that should be
easy to maintain and reuse or extend implemented features. Some of
you, that where at Dreamcore 2010, might have been so lucky, that
they saw my brilliant colleague Thomas Eldblom in cooperation with
Dan Algrove from Hedgehog development, in a session on how to build
maintainable Sitecore solutions. You can read more great thoughts
from Thomas at his blog <a href="http://mcore.wordpress.com/"
target="_blank" title="Mcore">Molten Core</a>. Some of the key
points from this session and my daily work with Thomas is the base
for the blog post, and I will not take any credit for being the
inventor for the interface template concept. I've just used it a
lot recently to make it easier for new templates/pagetypes to reuse
implemented code features, and thought I would make for a good
post.</p>

<p>&nbsp;</p>

<p>We all know that code degrades as time goes by, and that the
more "quick fixes - Hey it works don't change it" where used during
implementation the faster the code degrades, and oh yes even the
best code will degrade over time, but maybe not on a quite as steep
slope.</p>

<p>&nbsp;</p>

<p>We have all tried to write simple parts of a website, but even
the simple parts may lead to complicated code. Let's take an simple
example as a Menu or Breadcrumb path. Most websites have some sorts
of navigation and likewise have breadcrumbs. So to start with the
Customer have a simple website where the breadcrumb starts at the
current item and works it's way up the content tree to the root of
the site i.e. at the front page. It would be an fairly easy task to
implement code that can build this sort of breadcrumb path. This
could be done either in an simple xslt or maybe by implementing
some sort of breadcrumb provider in c# class.We will traverse every
ancestor until the following condition is meet. This could for
example be done using a Sitecore query a look something like
this.<br />
 Note only pseudo code will be used in this post.</p>

<p>&nbsp;</p>

<p><em>ancestor-or-self::item[@tid = 'frontpage']</em></p>

<p><em><br />
</em></p>

<p>This will work great and is a simple and acceptable solution. So
what is the problem ? After an year your customer returns with an
wish that they want functionality restart the navigation
"breadcrumb" for some node in content tree, this could be anywhere.
So the root item ie the first link in the breadcrumbs path is no
longer the front page but could potentially be any node.<br />
 The question now is, how do you determine where the root of the
breadcrumbs path is? You can no longer settle for a simple test
against the "frontpage"-template or could we ? A simple way would
either be to make an new front page at the given point in the
content tree, but it seems stupid that the customer will have to
use a front page for this task and might be confusing as well. So
okay no problem we will just make an new template, or choose a page
type and add the template to the query condition and it might look
something like this.</p>

<p>&nbsp;</p>

<p><em><br />
 ancestor-or-self;;item[@tid = 'frontpage' or @tid =
'subfrontpage']</em></p>

<p><em><br />
</em></p>

<p>Great it works and was pretty simple too, but now we started on
the slippery slope.The key point to notice here is that for this to
work we had to make changes to the code.<br />
 What will happen the next time the customer returns with a wish to
reset the navigation for the all ready existing document template
or any template for that matter. And even more the document
template should have a check box that enables the reset features.
No problem we simply add the check box to the document template and
extend the select query.</p>

<p>&nbsp;</p>

<p><em>ancestor-or-self::item[@tid = 'frontpage' or @tid =
'subfrontpage' or (@tid = 'document' and resetmenuField = '1'
)]</em></p>

<p><em><br />
</em></p>

<p>Wow it worked but now the query is becoming quite complex and
keep in mind this is an simple example. And soon the customer will
be back with a note that the shoppingItemTemplate needs to reset
the breadcrumbs as well and with the same condition as the document
template. As the years go bye the query is becoming more and more
unreadable.</p>

<p>&nbsp;</p>

<p>But how can we avoid this slippery slope ?<br />
 We could build a new template and let it inherit from the
"frontpage"-template, new template will then have the same fields
as the front page. This might lead to a more confused customer
because a simple document template will have the same field as
front page without using them.</p>

<p>So now we will have a look at an interface template. This could
be a simple template with or without fields. The sole purpose of
the this interface template, is to define "some
functionality"<br />
 for another templates that inherits from it. Lets revisit our
example with the breadcrumbs.<br />
 First we define this template without any fields lets call it
_isMenuRoot. And let the frontpage template inherit from this. Now
we can write the first query as this.</p>

<p>&nbsp;</p>

<p><em>ancestor-or-self::item[ is derived from template
_isMenuRoot]</em></p>

<p><em><br />
</em></p>

<p>The query will return the front page as the menu root just as we
wanted. Perfect now the beauty of the simple template comes into
play. Now the customer wants a simple sub front page that can reset
the breadcrumbs. This should be a fairly easy task. Build your
normal sub front page a let it inherit from the _isMenuRoot
template now look at the query</p>

<p><br />
 ancestor-or-self::item[ is derived from template _isMenuRoot]</p>

<p>Wow it's the same and we didn't have to change anything in the
code, great!<br />
 Now let's extend the template so it has a simple checkbox field
that allows back end users to enable/disable the reset
functionality. This is done simply by extending the _isMenuRoot
Template with an checkbox field. Of course this demands for a
simple change to the code, so we change the query accordingly so it
reads.</p>

<p><br />
 <em>item[ is derived from template _menuRoot and reset menu =
1]</em></p>

<p><br />
 Of course this will force back end users to actively
enable/disable this feature for existing items. But this can be
done fairly easy on templates that inherit from the interface
template. For example, you might want the front page to always have
this feature enabled, and as default disabled for a document page
or alike. You can achieve this but setting the checkbox value in
standard values for all the templates the inherits from our
_isMenuRoot interface template. Thank you sitecore for standard
values. So without changing any code, future templates can nowgain
access to this Menu root functionality by inheriting from our
_isMenuRoot template.</p>

<p>&nbsp;</p>

<p>The above helped me on project i recently worked on where I had
an if statements that had to test for 8 different templates.
Everytime someone came to develop new templates/page types they had
to go in and actively add another clause to the if statement, if
they wanted to acces the code features provided after in if
statement. This were change by the use of an interface template so
the if statement checked for an interface template instead of 8
different templates .And of course all the template previously in
the if statement, now simply had to inherit from the newly created
interface template. New templates/pages, that want to reuse the
same functionality, simply had to inherit from the interface
template,without the need for changing any code at all.</p>

<p>&nbsp;</p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>Google Chart Tools</title><link>http://www.istern.dk/blog/2010/11/25/google-chart-tools.aspx</link><pubDate>Thu, 25 Nov 2010 10:11:27 GMT</pubDate><guid>http://www.istern.dk/blog/2010/11/25/google-chart-tools.aspx</guid><content:encoded><![CDATA[ 
<p>No i haven't forgotten about my blog, and yes it's been a while
since my last post. So i'm sorry for not answering questions
quickly.<br />
 So in this post I will have a look at the chart tools google
provides, you can read more about here <a
href="http://code.google.com/apis/chart/"
target="_blank">http://code.google.com/apis/chart/&nbsp;</a>
&nbsp;.</p>

<p>In <a href="http://www.pentia.dk"
target="_blank">Pentia</a>&nbsp;we have a different tools for
monitoring different parameters and i thought i could be fun to
have some graphical reprensentation of this, and luckely one of
colleagues told me about the chart tools at google. So in this post
we have a quick look at this service from google. I will only do
the simple piechart but it is possible to build more complex
chart.</p>

<p>So since I want different input to the chart tools I will first
build a simple interface, and do and simple demo
implementation.</p>

<pre class="brush:c#">
  interface IChartItem
  {
    string Label { get; }
    string Size { get; }
  }
</pre>

<p>&nbsp;</p>

<p>and now to the simple implementation</p>

<p>&nbsp;</p>

<pre class="brush:c#">
public class Demo : IChartItem
  {
    public Demo(string label,string size)
    {
      Label = label;
      Size = size;
    }<br />

    public string Label
    {<br />
      get; private set;
    }

    public string Size
    {
      get;
      private set;
    }
  }
</pre>

<p>&nbsp;</p>

<p>Now to the glue that combines or more build the url for image
that hold our chart.</p>

<pre class="brush:c#">
 protected void Page_Load(object sender, EventArgs e)
    {
      DataBind();
    }

    protected string ChartSource
    {
      get
      {
        return BuildGoogleChartUrl();
      }
    }

    private string BuildGoogleChartUrl()
    {
      string prefix = "http://chart.apis.google.com/chart?cht=p3&amp;chs=500x300";
      string chd = "&amp;chd=t:";
      foreach (IChartItem chartItem in ChartItems)
      {
        chd = String.Format("{0}{1},", chd, chartItem.Size);
      }
      chd = chd.TrimEnd(',');
      string chl = "&amp;chl=";
      foreach (IChartItem chartItem in ChartItems)
      {
        chl = String.Format("{0}{1}|", chl, chartItem.Label);
      }
      chl = chl.TrimEnd('|');
      return String.Format("{0}{1}{2}", prefix, chd,chl);
    }

    private IEnumerable _chartItems;
    private IEnumerable ChartItems
    {
      get
      {
        if (_chartItems == null)
          _chartItems = InstantiateChartItems();
        return _chartItems;<br />
      }
    }

    private IEnumerable InstantiateChartItems()
    {
      List list = new List();
      list.Add(new Demo("20","20"));
      list.Add(new Demo("4", "40"));
      list.Add(new Demo("50", "50"));
      list.Add(new Demo("10", "10"));
      return list;
    }
</pre>

<p>&nbsp;</p>

<p>And now we can use the url generated as a source for img-tag as
this&nbsp;&lt;img src="&lt;%# ChartSource %&gt;" /&gt;</p>

<p>&nbsp;</p>

<p>and here is the result</p>

<p>&nbsp;</p>

<p><img src="/media/3740/ss_300x166.jpg"  width="300"  height="166" alt="piecahrtexample"/></p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>Chiliplanter på chillicious.dk</title><link>http://www.istern.dk/blog/2010/8/18/chiliplanter-paa-chilliciousdk.aspx</link><pubDate>Wed, 18 Aug 2010 14:49:30 GMT</pubDate><guid>http://www.istern.dk/blog/2010/8/18/chiliplanter-paa-chilliciousdk.aspx</guid><content:encoded><![CDATA[ 
<p>Lidt reklame !!!!!</p>

<p>S&aring; har jeg endelig f&aring;et nogle fine chiliplanter som
s&aelig;lges p&aring; mit lille hobbyprojekt</p>

<p>chillicious.dk her er et l<a
href="http://chillicious.dk/chiliplanter.aspx"
title="chiliplanter">link hvo i kan se dem fine chiliplanter</a>
desv&aelig;rre er der kun ganske f&aring; tilbage s&aring; man skal
skynde sig lidt hvis man &oslash;nsker at f&aring; fat i en af de
fine sager.</p>

<p>Men tjek dem ud.</p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>What will make users comment blogposts ?</title><link>http://www.istern.dk/blog/2010/6/15/what-will-make-users-comment-blogposts-.aspx</link><pubDate>Tue, 15 Jun 2010 21:56:35 GMT</pubDate><guid>http://www.istern.dk/blog/2010/6/15/what-will-make-users-comment-blogposts-.aspx</guid><content:encoded><![CDATA[ 
<p style="margin-bottom: 0cm;">&nbsp;</p>

I have had this blog for sometime now, and i can see more and more
people have started read my posts, But not many or more correct not
any, are <span>writing</span> <span>comments</span> to my posts.
That made me think either I'm <span>writing</span> easy to read and
understand and self <span>explaining</span> <span>posts, but i
seriously doubt that, or the post are so bad and not worth
commenting, I hope this is not the case.</span> 

<p style="margin-bottom: 0cm;"><span>So what could I do to improve
my blog, and why don't my</span> <span>visitors</span>
<span>add</span> <span>comments</span><span>. So my question is
what will make you write comments for blogposts in the future
?</span></p>

<p style="margin-bottom: 0cm;"><span>With out any</span>
<span>comments</span> <span>or feedback it is hard to improve the
posts and this blog overall.</span></p>

<p style="margin-bottom: 0cm;"><span>With comments each post
becomes more interactive and hopefully can help even more
people.</span></p>

<p style="margin-bottom: 0cm;"><span>So let me know if you have any
specific themes or question you would like me to blog about, or how
to improve the posts so you will and commets.</span></p>

<br />
<br />
]]></content:encoded></item><item><title>Usersessions in sitecore (logout users from backend)</title><link>http://www.istern.dk/blog/2010/6/7/usersessions-in-sitecore-(logout-users-from-backend).aspx</link><pubDate>Mon, 07 Jun 2010 10:42:52 GMT</pubDate><guid>http://www.istern.dk/blog/2010/6/7/usersessions-in-sitecore-(logout-users-from-backend).aspx</guid><content:encoded><![CDATA[ 
<p>&nbsp;</p>

<p>The number of usersession that is possible to have open in
sitecore depend onj the licens, which is fair enough. But the task
for an administrator to end hanging usersession seems somewhat
headless. The administrator have to logout, to get a list of active
user sessions, and then choose to end hanging or not used sessions.
This might be fine in minor solutions but I think this might pose a
problem in solutions where a user with the "Is Adminstrator" flag
is set to true can be hard to find. He might be working in
different office or just generally be hard to get a hold of. It
doesn't require you have the "Is administrator" flag to end session
but it is required to get the list of active sessions. You don't
even have to be logged in to sitecore to end active session, if
presented with the option to end active session anonymous users
could do so. My idea is to help local administrators with
functionality to end session with out leaving the backend, or
having to log out or anything like that. Since sitecore is one big
tool box I will build it as shortcut in the tray of sitecore.<br />
 Okay so we start, all our work is done in the core database and it
only contains minimal coding. We start with making the tray icon.
In the core database we go to content/applications/Desktop/tray and
add a item I will call it UserSessions the Data section of the item
find the click attribute and add the command name, this will also
have to go in the command file we get back to that. I also and icon
for the tray I have choosen the standard user icon.</p>

<p><br />
 <img src="/media/3613/ss1_405x273.jpg"  width="405"  height="273" alt="userhelper1"/></p>

<p><br />
 Now with the tray icon shortcut in place you should be able to see
it in th start bar just save the item and hit F5</p>

<p>&nbsp;</p>

<p><img src="/media/3618/ss2.jpg" width="313" height="60" alt="userhelper2"/></p>

<p>Now we will add the command to the App_Config/Commands.config
add the following line</p>

<p>&lt;command name="Tray:UserSessionViewer"
type="UserHelper.UserhelperTrayCommand,UserHelper" /&gt;</p>

<p><br />
 I will add this little user feature helper as an application so we
need to add an application and layout for the application in the
core database. We start with adding the layout "core database" go
to sitecore/layout/applications and add a new layout in the data
section in path write the physical path to layout you will create
in the next step.</p>

<p>&nbsp;</p>

<p><img src="/media/3623/ss3_442x200.jpg"  width="442"  height="200" alt="suerhelper3"/></p>

<p><br />
 Next we will add the application again this is done in the core
database go to sitecore/content/Applications/ and add a new
application pull on the the layout we just created make sure you
can see it in the layout section for the item. Also note the Id for
your application, we will have to use it in the code part.</p>

<p><br />
 <img src="/media/3628/ss4_469x401.jpg"  width="469"  height="401" alt="userhelper4"/></p>

<p><br />
 Okay now we are done with the configuration in sitecore now to
code part.<br />
 First we will start we the Tray click command which is pretty
simple note that is hardcode the id for our application and the
database I getting the item from.</p>

<p>&nbsp;</p>

<p>Now we have something that handle the click on the Tray command
no we will code the popup or application window. First the frontend
code for the application. The frontend code shows when the user
session started and when the last request was made info need to
take into account which user sessions you should end</p>

<pre class="brush: xml">
&lt;div class="taskInfoWindow"&gt;
  &lt;div class="SystemTime&gt;
  &lt;span class="Literal"&gt;System Time&lt;/span&gt;
  &lt;span class="Time"&gt;&lt;%# SystemTime %&gt;&lt;/span&gt;
  &lt;/div&gt;
    &lt;div class="tasks"&gt;
      &lt;asp:Repeater ID="taskRepeater" runat="server" DataSource="&lt;%# ScheduleItems %&gt;"
        OnItemCommand="taskRepeater_ItemCommand"&gt;
        &lt;HeaderTemplate&gt;
          &lt;table&gt;
            &lt;thead&gt;
              &lt;tr class="informationHeader"&gt;
                &lt;td class="Icon"&gt;
                  *
                &lt;/td&gt;
                &lt;td class="Literal"&gt;
                  Task name
                &lt;/td&gt;
                &lt;td class="Literal"&gt;
                  Is Due
                &lt;/td&gt;
                &lt;td class="Time"&gt;
                  Last run
                &lt;/td&gt;
                &lt;td class="Time"&gt;
                  Next run
                &lt;/td&gt;
                &lt;td class="Button"&gt;
                  Execute Task
                &lt;/td&gt;
              &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
        &lt;/HeaderTemplate&gt;
        &lt;ItemTemplate&gt;
          &lt;tr class="scheduledItem &lt;%# Container.ItemIndex == 0 || Container.ItemIndex % 2 == 0 ? "even" : "odd"   %&gt;"&gt;
            &lt;td class="Icon"&gt;
              &lt;img src="/sitecore/shell/Themes/Standard/&lt;%#((ScheduleItem)Container.DataItem).Icon%&gt;"
                alt="&lt;%# ((ScheduleItem)Container.DataItem).DisplayName %&gt;" /&gt;
            &lt;/td&gt;
            &lt;td class="Literal"&gt;
              &lt;%# ((ScheduleItem)Container.DataItem).DisplayName%&gt;
            &lt;/td&gt;
            &lt;td class="Literal"&gt;
              &lt;%# ((ScheduleItem)Container.DataItem).IsDue%&gt;
            &lt;/td&gt;
            &lt;td class="Time"&gt;
              &lt;%# ((ScheduleItem)Container.DataItem).LastRun.ToString("HH:mm dd/MM-yyyy")%&gt;
            &lt;/td&gt;
            &lt;td class="Time"&gt;
              &lt;%# ((ScheduleItem)Container.DataItem).NextRun.ToString("HH:mm dd/MM-yyyy")%&gt;
            &lt;/td&gt;
            &lt;td class="Button"&gt;
              &lt;asp:LinkButton ID="LinkButton1" Text="Execute" CssClass="SortButton" runat="server"
                CommandName="Execute" CommandArgument="&lt;%# ((ScheduleItem)Container.DataItem).ID %&gt;" /&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/tbody&gt;
        &lt;/ItemTemplate&gt;
        &lt;FooterTemplate&gt;
          &lt;/tbody&gt; &lt;/table&gt;
        &lt;/FooterTemplate&gt;
      &lt;/asp:Repeater&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</pre>

<p>Now to the code behind, I am only using standard sitecore
functionality nothing fancy here other then the click event for the
repeater that end the selected user session.</p>

<pre class="brush: c#">
using Sitecore.Data;
using Sitecore.Security.Accounts;
using Sitecore.Web.Authentication;

namespace Userhelper.Presentation
{
  public partial class UserSessionsView : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      DataBind();
    }

    public IEnumerable UserSessions
    {
      get
      {
        return DomainAccessGuard.Sessions;
      }
    }


    protected void userRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
      string id = e.CommandArgument.ToString();
      switch (e.CommandName)
      {
        case "Execute":
          EndSession(id);
          break;
      }
    }

    private void EndSession(string sessionID)
    {
      DomainAccessGuard.Kick(sessionID);
    }

  }
}

</pre>

<p><br />
 This is how I looks when we done</p>

<p><img src="/media/3633/sslast_458x80.jpg"  width="458"  height="80" alt="userhelperlast"/></p>

<p>The styling part is left for you. With this little userhelper
you can set security on the tray icon so local administrator can
see the tray icon and all other users have denied read access so
only users with elevate security settings can end user
sessions.</p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>A personal project</title><link>http://www.istern.dk/blog/2010/6/4/a-personal-project.aspx</link><pubDate>Fri, 04 Jun 2010 20:54:38 GMT</pubDate><guid>http://www.istern.dk/blog/2010/6/4/a-personal-project.aspx</guid><content:encoded><![CDATA[ 
<p>I haven't been writting any post for a while, because i've
started a new minor business project.&nbsp; It is more a hobby
business project, selling chiliseed and everything related to
growing chilli's the shop is not open yet but you can check out
here is a link <a href="http://chillicious.dk"
title="Chillicious.dk">Chillicious.dk</a>. The project base is
stilling missing some items, but i'm currently building some
business relations with partnes abroad. So more items will come in
the near future. SO go have a look, and hopefully you will buy a
lot of stuff..</p>

<p>This new hobby project doesn't mean that I will stop writing
post. I've allready have some ideas in the pipeline with code
allready made just waiting for me to have the time to write a post
about it.</p>
]]></content:encoded></item><item><title>System Alert in sitecore</title><link>http://www.istern.dk/blog/2010/4/27/system-alert-in-sitecore.aspx</link><pubDate>Tue, 27 Apr 2010 08:48:54 GMT</pubDate><guid>http://www.istern.dk/blog/2010/4/27/system-alert-in-sitecore.aspx</guid><content:encoded><![CDATA[ 
<p>When working with large Sitecore implementation and customers
that have a lot of editors maintaining the content of their
website, often makes updating the system becomes a hurdle. Because
editors may or may not work in on the same floor or even the same
building, so even if you have an contact person who's
responsibility is to notify editor about the downtime, it is
possible that one or more editors haven't heart about the downtime
and haven't save the what they where doing the second the system is
taken offline, a valuable work may have been lost.<br />
 So I thought what would be more smart the implementing a System
alert/ notifier system that alert the users about the forthcoming
downtime. This Alert could as in this example be a simple
javascript alert.<br />
 My solution is build around simple Javascript calling a webservice
which looks for alert placed inside sitecore and display them as a
simple javascript alert. Yes some may argue that I have some
hardcoded path string and what have we not, but it is left to you
to move these to fx. The web.config. Even more this solution I
maybe a little over the edge when looking at the implementation,
but I se so many usages for this so I went ALL-IN as implemented
with interface and using a provider model. The solution is build
and tested against a Sitecore 6.2, but nothing wrong with using on
other Sitecore versions.<br />
 But here goes first the javascript since Sitecore editors have
three different editors Page Edit, Content Editor and the Desktop.
So we need to include the javascript in three different files, and
because of the we need to ensure that the file is only loaded once
so logged into the Desktop and opening the content editor doesn't
give two warnings, hence the cookie check. Now to javascript, it's
all simple stuff.<br />
 The javascript should be include in these three files<br />
 Webedit:<br />
 sitecore\shell\Applications\WebEdit\WebEditRibbon.aspx<br />
 Content Editor:<br />
 sitecore\shell\Applications\Content Manager\Default.aspx<br />
 Desktop:<br />
 sitecore\shell\Applications\Startbar\Startbar.xml</p>

<pre class="brush: javascript">
/* Function for calling the webservice                             */
function callWebservice() {
  var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.open("GET", "/Components/SystemNotifier/AjaxWebservice/SystemNotifier.asmx/GetAlerts", false);
  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlhttp.send();

  if (xmlhttp.status == 200) {
    var str = xmlhttp.responseXml.getElementsByTagName("string").item(0).text;
    return str;
  }
}

/* function that Get system alerts */
/* update timer by calling the webservice    */
function GetSystemAlerts() {
  var alertString = callWebservice();
  if (alertString != "") {
     alert(alertString);
     //increase time to next call so we dont get same alert twice
     setTimeout("GetSystemAlerts()", 125000);
  }
  else {
    setTimeout("GetSystemAlerts()", 60000);
  } 
}

var cookieName = "SitecoreSystemNotifier";

function writeCookie() {
 document.cookie = cookieName;
}

function cookieExists()
{

 if (document.cookie.length &gt;0 )
 {
   var offset = document.cookie.indexOf(cookieName);
   if (offset != -1)
     return true;
   return false;
 }
 return false;
}


function init(){
 if(!cookieExists()){
  writeCookie();
  //SetTimeout in ms
  setTimeout("GetSystemAlerts()", 60000);
 }
}

init();
</pre>

<p>&nbsp;</p>

<p>Okay now that we have the javascript we need the webservice to
be called. It's fairly simple when using the Provider.</p>

<p>&nbsp;</p>

<pre class="brush: c#">
namespace SystemNotifier.AjaxWebservice
{
  /// 
  /// Summary description for SystemNotifier
  /// 
  [WebService(Namespace = "http://pentia.dk/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [System.ComponentModel.ToolboxItem(false)]
  // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
  [System.Web.Script.Services.ScriptService]
  public class SystemNotifier : WebService
  {

    [WebMethod]
    public string GetAlerts()
    {
      ISystemAlert alert = AlertProvider.NextAlert;
      if (alert != null)
        return alert.Text;
      return "";
    }

    private SystemAlertProvider _provider;
    private SystemAlertProvider AlertProvider
    {
      get
      {
        if (_provider == null)
          _provider = new SystemAlertProvider();
        return _provider;
      }
    }
    
  }
}
</pre>

<p>And now to the provider implementation</p>

<pre class="brush: c#">
 public class SystemAlertProvider
  {
    private IEnumerable _alerts;
    public IEnumerable Alerts
    {
      get {
      if(_alerts == null)
       _alerts = GetAlertsFromSitecore();
       return _alerts;
      }
    }

    private TimeSpan timespan = new TimeSpan(0, 1, 0);
    private IEnumerable GetAlertsFromSitecore()
    {
      ChildList childList = AlertRootItem.Children;
      foreach(Item child in childList)
      {
        ISystemAlert alertItem = new SystemAlert(child);
        if(alertItem.AlertTime &gt; DateTime.Now.Subtract(timespan))
          yield return alertItem;
      }
    }

    private const string sitecoreRootPath = "/sitecore/system/SystemAlertNotifier";
    private Item _rootItem;
    private Item AlertRootItem
    {
      get
      {
        if(_rootItem == null)
         _rootItem = Database.GetItem(sitecoreRootPath);
        return _rootItem;
      }
    }

    private const string _databaseName = "master";
    private Database Database
    {
      get
      {
        return Database.GetDatabase(_databaseName);
      }
    }
    public ISystemAlert NextAlert
    {
      get
      {
        if(Alerts.Count() &gt; 0)
          return Alerts.OrderBy(w =&gt; w.AlertTime).First();
        return null;
      }
    }
  }
</pre>

<p>And finally the Alert interface and implementation of the
same.</p>

<p>Inteface</p>

<pre class="brush: c#">
public interface ISystemAlert
  {
    DateTime AlertTime { get; }
    String Text { get; }
  }
</pre>

<p>Implementaion</p>

<pre class="brush: c#">
public class SystemAlert : ISystemAlert
  {
    public SystemAlert(Item item)
    {
      Item = item;
    }

    private Item Item
    {
      get;
      set;
    }

    private const string _alertTimeField = "SystemAlert_AlertTime";
    public DateTime AlertTime
    {
      get
      {

        DateField dateField = Item.Fields[_alertTimeField];
        return dateField.DateTime;
      }
    }

    private const string _textField = "SystemAlert_Text";
    public string Text
    {
      get { return Item[_textField]; }
    }
  }
</pre>

<p>Now we got all the code working so now we need to have someway
to get the info, let's use a sitecore item. So here is a snapshot
of the how my sitecore item looks.</p>

<p><img src="/media/3579/sysemalert2_500x130.jpg"  width="500"  height="130" alt="sys2"/></p>

<p>So this is pretty much everything you need to have a system
alert system up and running inside sitecore. Remember to edit
hardcode root path to system alert root folder.<br />
 You can download the project in the download section <a
href="/media/3552/systemnotifier.rar">link here.</a></p>

<p>And hope you can see the posiblities in this solution or
implementaion, you could scheduled downtown and have email alert,
downtime calendar and much much more hope you enjoy,</p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>Seamless integration of external photo gallery</title><link>http://www.istern.dk/blog/2010/3/12/seamless-integration-of-external-photo-gallery.aspx</link><pubDate>Fri, 12 Mar 2010 21:45:09 GMT</pubDate><guid>http://www.istern.dk/blog/2010/3/12/seamless-integration-of-external-photo-gallery.aspx</guid><content:encoded><![CDATA[ 
<p>In this post I will give one way, or my take on how-to integrate
an external photo gallery seamless in to your website. Some of the
advantage in doing this is you save room/space on your local
webhost, and the load on the serve if you have large photo/images
since these are not load in another thread on an external server.
Off course there are disadvantage as well the gallery provide have
to be online for this to work, and you have to maintain gallery
content and web content on two different websites. On the other
hand you if you choose one of the large providers flickr or picasa,
you get some great photo gallery functionality tagging of images
and galleries and more.</p>

<p>So i don't what to build the new Picasa or a like, so i will
only provide functionality for showing frontend relevant images and
associated information. In near future there will be a post on
how-to use this post to integrate into Umbraco.</p>

<p>For this post i have chosen to integrate up against Google's
Picasa so to start with you can go and download the google-gdata
API you can get it here</p>

<p>The documentation i used to for making this post and code can be
found here<br />
 The main idea for making this seamless is it could be easy to
switch gallery provider from picasa to whatever your favorite
web-photo gallery you use. Off course the difficulties you meet
depend on how well an interface the provider gives you, you could
end up in some tricky situations.</p>

<p><br />
 Okay let's get started. First of I've created the interfaces I've
so necessary for making a good web gallery. You are more than
welcome to give feedback if you think something are missing on one
these.</p>

<p>There exist three parts. A gallery which consists of one or more
photo albums. Next there off course a photo album which contain
some album information and one or more Images. Last off is the
image it self. So here are the three interfaces.</p>

<p>&nbsp;</p>

<pre class="brush:c#;">
 
public interface IGallery
  {
    String Name { get; }
    String Description { get; }
    int NumberOfAlbums { get; }
    IEnumerable Albums{get;}
    IGalleryAlbum GetAlbumFromId(string id);
  } 
</pre>

<pre class="brush:c#;">
 
public interface IGalleryAlbum
  {
    String Id { get; }
    String Name{ get; }
    String Description { get; }
    String Category { get; }
    IGalleryImage AlbumCoverImage { get; }
    uint NumberOfImages { get; }
    IEnumerable Images { get; }
  }
</pre>

<pre class="brush:c#;">
 
 public interface IGalleryImage
  {
    String Name { get; }
    String Url { get; }
    String Description { get; }
    String ThumbnailUrl { get; }
    Dictionary ExifData { get; }
  }
</pre>

<p><br />
 Again you are more than welcome to give feedback if you think
something is missing, keep in mind this is what I think is one a
good and simple image gallery should be able to provide of
information.<br />
 So now we have the interfaces in place lets go ahead an implement
them using the Picasa API.<br />
 This is a pretty simple task if keep a window open with the
documentation here is another link to the documentation<br />
 All I've used is the simple example provide at the documentation
page.<br />
 First of the gallery implementation this is simple</p>

<pre class="brush:c#;">
namespace PicasaGalleryModel
{
  public class PicasaGallery : IGallery
  {
    private PicasaService _service;
    private PicasaFeed _feed;


    private const string PICASA_SERVICE_NAME = "PicasaIGalleryModel";

    public PicasaGallery(string username)
    {
      Username = username;
    }

    public string Name
    {
      get
      {
        return Feed.Title.Text;
      }
    }

    public string Description
    {
      get { return ""; }
    }

    public int NumberOfAlbums
    {
      get { return Albums.Count(); }
    }

    public IEnumerable Albums
    {
      get
      {
        return InitializeGalleryAlbumFromPicasaFeed(); 
      }
    }

     public IGalleryAlbum GetAlbumFromId(string id)
     {
       return Albums.Where(g =&gt; g.Id == id).First();
     }

    private PicasaFeed Feed
    {
      get
      {
        if (_feed == null)
          _feed = RetrieveUserAlbumsFromPicasa();
        return _feed;
      }
    }

    private PicasaFeed RetrieveUserAlbumsFromPicasa()
    {
      AlbumQuery query = new AlbumQuery(PicasaQuery.CreatePicasaUri(Username));
      PicasaFeed feed = Service.Query(query);
      return feed;
    }

    private IEnumerable InitializeGalleryAlbumFromPicasaFeed()
    {
      foreach (PicasaEntry entry in Feed.Entries)
      {
        IGalleryAlbum album = new PicasaAlbum(entry,Service,Username);
        yield return album;
      }

    }

    private PicasaService Service
    {
      get
      {
        if(_service == null)
          _service = new PicasaService(PICASA_SERVICE_NAME);
        return _service;
      }
    }

    private void Logon()
    {
    }

    protected string Password
    {
      get;
      set;
    }

    protected string Username
    {
      get; set ;
    }
  }
}
</pre>

<p><br />
<br />
 DO note that the username is the logon name you use to logon to
picasa.<br />
 The implementation have some unused and unfinished function, when
I first the idea to this post it started as huge project where I
wanted security from picasa as well to be covered, in this
implementation.<br />
 Wow this class uses the IGalleryAlbum so let's move on to the
implantation of this.</p>

<pre class="brush:c#;">
namespace PicasaGalleryModel
{
  public class PicasaAlbum : IGalleryAlbum
  {
    private PicasaEntry _albumFeed;
    private PicasaFeed _imageFeed;
    private AlbumAccessor _ac;

    public PicasaAlbum(PicasaEntry feed,PicasaService service,string username)
    {
      AlbumFeed = feed;
      Service = service;
      Username = username;
    }

    public string Name
    {
      get { return AlbumAccessor.AlbumTitle; }
    }

    public string Description
    {
      get { return AlbumAccessor.AlbumSummary; }
    }

    public string Category
    {
      get { return "CAT-SET_STATIC"; }
    }

    public IGalleryImage AlbumCoverImage
    {
      get
      {
        PhotoQuery query = PhotoQueryFromUri(AlbumFeed.Id.AbsoluteUri);
        return BuildIGalleryImageFromPicasa(Service.Query(query)).First();
      }
    }

    private AlbumAccessor AlbumAccessor
    {
      get
      {
        if (_ac == null)
          _ac = new AlbumAccessor(AlbumFeed);
        return _ac;
      }
    }

    public uint NumberOfImages
    {
      get
      {
        
        return AlbumAccessor.NumPhotos;
      }
    }

    public IEnumerable Images
    {
      get 
      {
        return BuildIGalleryImageFromPicasa(ImageFeed);          
      }
    }

    private IEnumerable BuildIGalleryImageFromPicasa(PicasaFeed feed)
    {
      foreach (PicasaEntry entry in feed.Entries)
      {
        IGalleryImage image = new PicasaImage(entry);
        yield return image;
      }
    }

    public PicasaEntry AlbumFeed
    {
      get { return _albumFeed; }
      set { _albumFeed = value; }
    }

    public PicasaFeed ImageFeed
    {
      get
      {
        if(_imageFeed == null)
        {

          _imageFeed = Service.Query(PhotoQueryFromUri(PicasaImageUri()));
        }
        return _imageFeed;
      }
    }

    private string PicasaImageUri()
    {
      return PicasaQuery.CreatePicasaUri(Username, Id);;
    }

    private PhotoQuery PhotoQueryFromUri(string uri)
    {
      return new PhotoQuery(uri);
    }

    private PicasaService Service
    {
      get; set;
    }

    public String Id
    {
      get
      {
        return AlbumAccessor.Id;
      }
    }

    private string Username
    {
      get;
      set;
    }
  }
}

</pre>

<p><br />
<br />
 And now to the final part the Image implementation</p>

<pre class="brush:c#;">
namespace PicasaGalleryModel
{
  public class PicasaImage : IGalleryImage
  {

    private PhotoAccessor _photoAccessor;

    private Dictionary _exifData;

    public PicasaImage(PicasaEntry entry)
    {
      Entry = entry;
    }

    private PicasaEntry Entry
    {
      get;
      set;
    }

    public string Name
    {
      get
      {
        return PhotoAccessor.PhotoTitle;
      }
    }

    public string Url
    {
      get
      {
        return Entry.Media.Content.Attributes["url"].ToString();
      }
    }

    public string Description
    {
      get { return PhotoAccessor.PhotoSummary; }
    }

    public string ThumbnailUrl
    {
      get
      {
        return Entry.Media.Thumbnails[0].Attributes["url"].ToString();
      }
    }

    public Dictionary ExifData
    {
      get
      {
        if (_exifData == null)
          InitializeExifDataToDictionary();
        return _exifData;
      }
    }

    private void InitializeExifDataToDictionary()
    {
      _exifData = new Dictionary();
      _exifData.Add("Camera model", Entry.Exif.Model.Value);
      _exifData.Add("ISO", Entry.Exif.ISO.Value);
      _exifData.Add("Focal Length", Entry.Exif.FocalLength.Value);
      //_exifData.Add("Exposure", Entry.Exif.Exposure.Value);
      _exifData.Add("F Stop", Entry.Exif.FStop.Value);
      _exifData.Add("Flash", Entry.Exif.Flash.Value);
    }

    

    public PhotoAccessor PhotoAccessor
    {
      get
      {
        if(_photoAccessor == null)
          _photoAccessor = new PhotoAccessor(Entry);
        return _photoAccessor;
      }
    }

  }
}
</pre>

<p><br />
<br />
 Now with the model in place we can start to render out the
IGallery* stuff.<br />
 This is made so it should be easy to integrate into Umbraco hence
the MasterPage file.<br />
 The frontend stuff consist of the main gallery which loads in two
different controls depending on you are viewing a list of albums or
a list images in an album. The styling is left for you do, since
this is dependent on your website design. If you like a can In a
later post do this.<br />
 The main gallery<br />
<br />
 The .ascx page</p>

<p>&lt;%@ Page Language="C#" MasterPageFile="~/Gallery.master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Presentation._Default" %&gt;<br />
 &lt;%@ Import Namespace="Interfaces" %&gt;</p>

<p>&lt;asp:Content ID="head" ContentPlaceHolderID="head"
Runat="Server"&gt;<br />
 &lt;script type="text/javascript"
src="js/jquery.js"&gt;&lt;/script&gt;<br />
 &lt;script type="text/javascript"
src="js/jquery.lightbox-0.5.min.js"&gt;&lt;/script&gt;<br />
 &lt;script type="text/javascript"
src="js/InitLightbox.js"&gt;&lt;/script&gt;<br />
 &lt;link rel="stylesheet" type="text/css"
href="/CSS/jquery.lightbox-0.5.css" media="screen" /&gt;<br />
 &lt;/asp:Content&gt;<br />
<br />
 &lt;asp:Content ID="GalleryContent"
ContentPlaceHolderID="GalleryContent" Runat="Server"&gt;</p>

<p>&lt;div&gt;<br />
 My Gallery Test<br />
<br />
 &lt;asp:PlaceHolder ID="galleryContent" runat="server" /&gt;</p>

<p>&lt;/div&gt;<br />
 &lt;/asp:Content&gt;</p>

<p>&nbsp;</p>

<p><br />
 and the codepage</p>

<pre class="brush:c#;">
public partial class _Default : System.Web.UI.Page
  {
    private IGallery _gallery;
    public const string ALBUMID = "aid";

    protected void Page_Load(object sender, EventArgs e)
    {

      SetGalleryContent();
    }

   

    private void SetGalleryContent()
    {
      Control view;
      if (String.IsNullOrEmpty(AlbumId))
        view = LoadGalleryView;
      else
        view = LoadAlbumView;
      galleryContent.Controls.Add(view);
    }

    private IEnumerable GalleryAlbums
    {
      get
      {
        return Gallery.Albums;
      }
    }

    private Control LoadGalleryView
    {
      get
      {
        Control viewControl = LoadControl("~/GalleryView.ascx");
        GalleryView gallery = (GalleryView)viewControl;
        gallery.AlbumQueryString = ALBUMID;
        gallery.GalleryAlbums = GalleryAlbums;
        return viewControl;
      }
    }

    private Control LoadAlbumView
    {
      get
      {
        Control viewControl = LoadControl("~/AlbumView.ascx");
        AlbumView gallery = (AlbumView)viewControl;
        gallery.Images = CurrentAlbum.Images ;
        return viewControl;
      }
    }

    private IGalleryAlbum CurrentAlbum
    {
      get
      {
        return Gallery.GetAlbumFromId(AlbumId);
      }
    }
    private string AlbumId
    {
      get
      {
        return Request.QueryString[ALBUMID];
      }
    }

    private IGallery Gallery
    {
      get
      {
        if(_gallery == null)
          _gallery = new PicasaGallery("USERNAME_GOES_HERE");
        return _gallery;
      }
    }
  }
</pre>

<p><br />
 The List view of albums<br />
 Ascx page</p>

<p>&lt;%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="GalleryView.ascx.cs"
Inherits="Presentation.GalleryView" %&gt;<br />
 &lt;%@ Import Namespace="Interfaces"%&gt;</p>

<p>&lt;asp:Repeater runat="server" ID="AlbumeRepeater"
DataSource="&lt;%# GalleryAlbums %&gt;"&gt;<br />
 &lt;ItemTemplate&gt;<br />
 &lt;div class="AlbumCoverImage"&gt;<br />
 &lt;a href="&lt;%#
AlbumLink(((IGalleryAlbum)Container.DataItem).Id) %&gt;" &gt;<br />
 &lt;img src="&lt;%#
((IGalleryAlbum)Container.DataItem).AlbumCoverImage.ThumbnailUrl
%&gt;" alt="" /&gt;<br />
 &lt;/a&gt;<br />
 &lt;/div&gt;<br />
 &lt;div class="AlbumTitle"&gt;<br />
 &lt;a href="&lt;%#
AlbumLink(((IGalleryAlbum)Container.DataItem).Id) %&gt;" &gt;<br />
 &lt;%# ((IGalleryAlbum)Container.DataItem).Name %&gt;<br />
 &lt;/a&gt;<br />
 &lt;/div&gt;<br />
 &lt;div class="ImageCountInAlbum"&gt;<br />
 &lt;%# ((IGalleryAlbum)Container.DataItem).NumberOfImages
%&gt;<br />
 &lt;/div&gt;<br />
 &lt;div class="AlbumDescription"&gt;<br />
 &lt;%# ((IGalleryAlbum)Container.DataItem).Description%&gt;<br />
 &lt;/div&gt;<br />
<br />
 &lt;/ItemTemplate&gt;<br />
 &lt;/asp:Repeater&gt;</p>

<p>&nbsp;</p>

<p>Codepage</p>

<pre class="brush:c#;">
public partial class GalleryView : System.Web.UI.UserControl
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      AlbumeRepeater.DataBind();
    }

    public string AlbumLink(string albumId)
    {
      string url = String.Format("{0}{1}={2}", Request.RawUrl, AlbumQueryString, albumId);
      return url;
    }

    public string AlbumQueryString
    {
      get; set;
    }

    public IEnumerable GalleryAlbums
    {
      get;
      set;
    }

  }
</pre>

<p><br />
 And finally the list view of images in an album<br />
 Ascx page</p>

<p>&lt;%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="AlbumView.ascx.cs" Inherits="Presentation.AlbumView"
%&gt;<br />
 &lt;%@ Import Namespace="Interfaces"%&gt;<br />
 &lt;asp:Repeater ID="ImageRepeater" runat="server"
DataSource="&lt;%#Images %&gt;"&gt;<br />
 &lt;HeaderTemplate&gt;<br />
 &lt;ul id="Gallery"&gt;<br />
 &lt;/HeaderTemplate&gt;<br />
 &lt;ItemTemplate&gt;<br />
 &lt;li&gt;<br />
 &lt;a href="&lt;%# ((IGalleryImage)Container.DataItem).Url %&gt;"
class="lightbox" title="&lt;%#
ExifData((IGalleryImage)Container.DataItem)%&gt;"&gt;&lt;img
src="&lt;%# ((IGalleryImage)Container.DataItem).ThumbnailUrl %&gt;"
/&gt;&lt;/a&gt;<br />
<br />
 &lt;/li&gt;<br />
 &lt;/ItemTemplate&gt;<br />
 &lt;FooterTemplate&gt;<br />
 &lt;/ul&gt;<br />
 &lt;/FooterTemplate&gt;<br />
 &lt;/asp:Repeater&gt;</p>

<p>codefile</p>

<pre class="brush:c#;">
public partial class AlbumView : System.Web.UI.UserControl
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      ImageRepeater.DataBind();
    }

    public string ExifData(IGalleryImage image)
    {
      string exifData = "";
      foreach(string key in image.ExifData.Keys)
      {
        exifData += string.Format("{0} : {1}<br />
", key, image.ExifData[key]);
      }
      return exifData;
    }

    public IEnumerable Images
    {
      get;
      set;
    }
  }
</pre>

<p><br />
 The final part is using the jquery lightbox again you could switch
this to you own favorite gallery viewing service the lightbox for
jquery can be found here. I've extend this a bit so you can provide
a max image height and max image width, both are found in the
solution for this project.<br />
 And a service for my loyal readers, you can now download the
entire solution which contains all the above models
implementations, and all the other good stuff I've covered in this
post. Now you can get <a href="/media/3515/gallery.rar">HERE</a>,
Rememer to fill out your own Username</p>

<p>And now you can head over and see when this is integrated into
umbraco, i've done this for my site here is a like to my <a
href="/galleries.aspx" title="Galleries">gallery</a></p>

<p>&nbsp;</p>
]]></content:encoded></item></channel></rss>
