Products and Services
Graffiti CMS
Learn more about our simple content publishing platform.
Harvest Reporting Server
Get business intelligence tools for measuring online behavior.
Professional Services
Consulting, creative, and Web services from the people who know Community Server best.
Solutions
Telligent
Learn more about our team at Telligent.com.
 

Registering Custom File Viewers

Community Server registers all file viewers in the <FileViewers> region of the communityserver.config file. Each file viewer requires an <add /> node, which supports three attributes: type, extensions, and urlPattern.

 

The following image file viewer example shows all three supported attributes:

<add
  type="CommunityServer.Components.ImageFileViewer, CommunityServer.Components"
  extensions="gif;jpg;jpeg;bmp;png"
  urlPattern="^[^\?]*?\.(?:gif|jpg|jpeg|bmp|png)(?:\?.*)?$"
  />

type

The type attribute identifies the class implementing the IFileViewer interface that should be registered.  In the example above case, the interface is the CommunityServer.Components.ImageFileViewer class in the CommunityServer.Components assembly. 

extensions

The extensions attribute identifies the semi-colon-separated list of file extensions that are supported by this viewer. These extensions are matched only to local files (those stored in the Centralized File System in Community Server 2008) and will not match to remote attachments or external URLs.

urlPattern

The urlPattern identifies a regular expression that matches URLs the file viewer can support. In the example above, the ImageFileViewer can render URLs that identify an image file extension.

Related Topics