Tuesday 24 March 2009

Using <p> instead of <br/> in FCK

Out of the box, Kentico is configured to use line-breaks instead of paragraphs in the FCKeditor. It's a simple thing to change. Find the fckconfig.js file and change this:

FCKConfig.EnterMode = 'br' ;  // p | div | br
FCKConfig.ShiftEnterMode = 'p' ; // p | div | br

to this:

FCKConfig.EnterMode = 'p' ;  // p | div | br
FCKConfig.ShiftEnterMode = 'br' ; // p | div | br

Tuesday 17 March 2009

Secure Document Access for Axis

One of our customers, Axis Corporate Solutions, provide an innovative (well innovative for an accountancy firm) function on their website. They allow their customers to login to the site and access all of the documents that have been created for them.

So each customer has their own login and their own private area within the website where they can view these documents.

This presented us with our first Kentico challenge. Here's what we did:

  1. Add a login form to the Master page. This was set to redirect to Login.aspx when a customer successfully logs in.
  2. In the Page_Load event for the login page we firstly check the ViewMode. We only want the redirection to happen on the live site otherwise we wouldn't be able to administer the login page.
  3. Then we get the current user context and find out if they are an editor. If they're an editor we send them off to the customer index page where they can choose who they want to have a look at.
  4. If they're not an editor then they're a customer. What we do for them is to check all of the documents in the Customer branch of the sitemap and see if they have read access. If we find one that has read access then we redirect them to it.

We like this approach because we don't need to add anything to the database to tie customers to their sections of the website. The code is below

  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      // Send the user off in the right direction if we're
      // in LiveSite mode.  Don't want to do this in edit mode.
      //
      if (CMSContext.ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite)
      {
        CurrentUserInfo user = CMSContext.CurrentUser;

        if (user.IsEditor)
          Response.Redirect("~/Customers.aspx");
        else
        {
          // It's a customer, check permissions on all sub-pages of "/Customer"
          //
          DataSet ds = TreeHelper.SelectNodes("/Customers/%", false, "Axis.Customer");

          foreach (DataRow dr in ds.Tables[0].Rows)
          {
            int docId = (int) dr["DocumentID"];
            CMS.TreeEngine.TreeNode node = TreeHelper.SelectSingleDocument(docId);

            if (CMS.TreeEngine.AuthorizationResultEnum.Allowed ==
                  user.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read))
            {
              // User has access to this page - send them there...
              //
              Response.Redirect(CMSContext.GetUrl(node.NodeAliasPath));
            }
          }
        }
      }
    }

Monday 16 March 2009

Why a CMS?

Just about every professional website is built on top of a Content Management System. Certainly when we go to see prospective customers it is their expectation that they will have full control over the content of their websites once it has been delivered. In reality only a fraction of them actually update their content, but they do expect to be able to do it!

For six years now we've been building websites on our own content management system Wirenet. Wirenet is built using classic ASP and uses a Microsoft SQL Server database. It's done us proud and has delivered billions of web pages since its launch with the Linder Myers website back in 2002.

However, all good things must come to an end and Wirenet is no exception. In the last couple of years we've been seeing a significant increase our clients' expectations of the web. Many want advanced functionality and more and more are moving to ecommerce. We found that building this functionality was a lot easier with a more up to date platform, ASP.NET. However, making the two technologies, Wirenet and .NET work together was a bit yukky (technical term that!).

So our plan was to rewrite Wirenet with ASP.NET. The problem was finding the time! After a year of not doing it we decided to have a look for other web platforms we could use instead. We had a go with many CMSs but narrowed down our shortlist to DotNetNuke and Kentico.

More details on how we chose Kentico next time

About This Blog

This blog is all about my/our experiences with the Kentico CMS. When I say "our" I mean Silkmoth. If you don't know what I mean when I say CMS then you're in the wrong place.

About Me

My photo
I'm most often described as a Grumpy Old Bugger.

Followers