Gabe Sumner

Gabe Sumner

The RSS Feed URL cannot be found!
The remote server returned an error: (400) Bad Request.

Back to all posts

Sitefinity "Document" Control

Long-time readers of this blog might recall that I have been fairly vocal in my belief that Sitefinity should have a better solution for document & file management.  Long-time readers of this blog might also note that they do not, in fact, exist and swiftly disappear in a poof of self-unrealization. (Yes, a similar line exists in Hitchhiker's Guide to the Galaxy.  It was funny then and it's funny now!  Leave me alone.)

For everyone else, you can read my insightful diatribes on this subject:

Here, Here, and Here

The Problem

I have a Corporate Intranet that I'm redesigning with Sitefinity that is jam packed with PDFs, Word documents, PowerPoint presentations, Excel files, etc.   We're talking hundreds & hundreds of documents.  I want these documents to be managed by normal users.  Based on past experience I believe strongly that normal users are incapable of dealing with file management.  Which means giving users a folder to upload stuff into and then trusting them to set their links correctly will end very poorly.

I also want the documents to be organized within the native Sitefinity "Site Map".  This Site Map is elegant and makes the organization of the web site self evident.  Which means I don't want to create a Sitefinity module.  Doing this would separate the organization of these documents from the native Site Map.

The Solution

I wrote in a previous article how I would like to be able to use custom Sitefinity "Page Types" to solve this problem.  This may or may not be something Telerik makes available someday.  For now, I needed to solve this problem with the framework currently available to me.

I created a new Sitefinity control called "Document".  You can drag & drop this control onto any Sitefinity page.  Once placed, you can click Edit and be presented with a Custom Control Designer.  This Control Designer will let you upload a file.  This file could be anything (a PDF, a Word document, an Excel file, a JPEG, etc).

Once uploaded the Control Designer handles saving the file to the web site and creates a unique file name.  The file name & file location get saved as properties of the "Document" control.

As long as you are in "Page Edit" mode this Document control doesn't really do anything except give you a chance to upload a file.  If you access the page for real, however, the control swings into action and redirects to the uploaded file.

Check out this link to see this Document control in action.

Before you click, hover your mouse over the link and look at the URL.  That is an actual Sitefinity page.  Once you click the page the Document control will do a Response.Redirect() to the actual document file.

In the end, I suppose you could say "All this for a redirect?".  To which I would reply "Yeah, all of this for a redirect".  It works better than you might imagine. 

This control lets users upload documents without doing any file management.  The control also lets the documents be organized within the native Sitefinity "Site Map".  You can even make use of the "History" feature of Sitefinity with this control.  Old files never get removed, rather newer files just get a new file name and a new reference.  I even altered my "Links" control so that pages with a "Document" control open in a new window.

The unique file names are based on system ticks.  I'm also storing files in subdirectories so that the file index doesn't become too large.

How to Download

I have added this control to the GoonDocks Sitefinity Controls.

Facebook DZone It! Digg It! StumbleUpon Technorati Del.icio.us NewsVine Reddit Blinklist Furl it!

Comments  5

  • Ben 11 Jan, 02:26 PM

    Interesting idea. I Iike the idea of having using CMS pages for each document to maintain history. So do intranet users login to the CMS then create a new page and edit the page to upload a file using the control? Also, how did you hanlde the documents already in the system? Are you manually creating pages for the launch of the intranet.


  • Gabe Sumner 11 Jan, 03:00 PM

    Not all the Intranet users would be able to create or alter pages (or documents). But anyone with "Editor" privileges would indeed log into the CMS. From there they would need to create a new Sitefinity page (just like normal). Once the page is created they would need to drag & drop a "Document" control onto their page to make their page into a "document".

    Regarding documents already in the system; I believe you're talking about the existing Intranet and how I am going to port all of that to Sitefinity. To be honest, I have no idea. I'm still prototyping this project and haven't yet looked into transitioning existing data.

    Thanks for the comment!


  • dw 21 Jan, 12:08 AM

    f


  • dw 21 Jan, 12:09 AM

    f


  • hotel buchen tuerkei 29 Jan, 07:07 AM

    Demonstrate Review,much fine settlement warn towards use category activity substantial beyond heavy particular release appeal weak even agency shoulder instrument shot cabinet hot kind feel laugh size arrangement sit start distance claim wonder context wonderful may would long towards spring entitle promise connect material mass step client face community trip choice up believe miss home display proportion significance previous subject properly welfare proportion wild sign achievement find balance good instance absence life paper most other leaf before card represent past absolutely lack northern sex confirm road try target meanwhile start


Post a comment!


HostMySite.com   website uptime