5,530,111 members and growing! (14,837 online)
Email Password   helpLost your password?
Enterprise Systems » SharePoint Server » Custom Controls     Intermediate License: The Code Project Open License (CPOL)

Flash Movie Field for WSS 3.0

By Stephen Huen

Custom Flash Movie Field for WSS 3.0 to render Flash movies.
C# (C# 1.0, C# 2.0, C# 3.0, C#), ASP.NET, Dev

Posted: 26 Apr 2008
Updated: 15 Aug 2008
Views: 10,822
Bookmarked: 26 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
7 votes for this Article.
Popularity: 3.38 Rating: 4.00 out of 5
2 votes, 28.6%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
1 vote, 14.3%
4
4 votes, 57.1%
5
Figure 1
Figure 1
Figure 2
Figure 2

Introduction

Flash Movie Field is a custom WSS field to render Flash movies and YouTube videos. It uses the excellent swfobject to render the HTML and JavaScript for maximum browser compatibility. In edit mode, authors specify the URL, Width, and Height of the Flash movie. Optional parameters can be added easily by modifying the attached source code.

Description

The Flash Movie Field is based on a new Field Type SPFieldFlashMovie. It has the following properties or column values:

  • Url - URL to Flash (.swf) movie or YouTube video, e.g. /media/map.swf, http://www.youtube.com/v/dMH0bHeiRNg&hl=en&fs=1.
  • Width - Width of Flash movie or YouTube video in pixels. For YouTube video, width includes embedded player.
  • Height - Height of Flash movie or YouTube video in pixels. For YouTube video, height includes embedded player.

Rendering is provided by a custom Field Control FlashMovieField with an associating Rendering Template QuestechFlashMovieFieldTemplate. All UI strings are localized and stored in resource files. The resource files are split into three files, one for the project level, one for the web application level, and one for the WSS level.

  • \SharePoint\ClientScripts\swfobject.js
    Support JavaScript file for swfobject. Set as Embedded Resource.
  • \SharePoint\Fields\SPFieldFlashMovie.cs
    Field Type for custom Flash Movie field. Inherits from SPFieldMultiColumn.
  • \SharePoint\Fields\SPFieldFlashMovieValue.cs
    A class of column values for SPFieldFlashMovie. Inherits from SPFieldMultiColumnValue.
  • \SharePoint\Receivers\AppGlobalResourcesFeatureReceiver.cs
    Feature receiver that copies all resource files with the name starting Questech* in ..\12\CONFIG\Resources\ to ..\wss\VirtualDirectories\[port]\App_GlobalResources\ upon feature activation.
  • \SharePoint\Resources\Resources.resx
    Project resource file for localized UI strings.
  • \SharePoint\RootFiles\CONFIG\Resources\QuestechSharePoint.resx
    Application run-time resource file for localized UI strings. This sets the label strings for properties Url, Width, and Height during authoring. Deploys to ..\12\CONFIG\Resources\. Copies to ..\wss\VirtualDirectories\[port]\App_GlobalResources\ by the feature QuestechAppGlobalResources.
  • \SharePoint\RootFiles\Resources\QuestechCoreSharePoint.resx
    WSS provisioning resource file for localized UI strings. This sets the display name for the custom field. Deploys to ..\12\Resources\.
  • \SharePoint\RootFiles\TEMPLATE\CONTROLTEMPLATES\QuestechFlashMovieFieldTemplate.ascx
    Form edit view of FlashMovieField with RenderingTemplate control.
  • \SharePoint\RootFiles\TEMPLATE\XML\fldtypes_SPFieldFlashMovie.xml
    Field Type Definition for Field Type SPFieldFlashMovie.
  • \SharePoint\WebControls\FlashMovieField.cs
    Field Control for SPFieldFlashMovie. Uses swfobject 2.1 to render Flash movies and YouTube videos.
  • \SharePoint\Utility.cs
    Utility file for common methods and properties.

Two features are required for the deployment: QuestechAppGlobalResources and QuestechColumns. QuestechAppGlobalResources is responsible for copying web application resource files to the appropriate directory under the web application root. This is only required for existing web applications, not for new ones. QuestechColumns is responsible for deploying the custom Field Type Definition in fldtypes_SPFieldFlashMovie.xml.

Installation

The sample Visual Studio 2005 SP1 solution includes all the support files you need to build and deploy the custom field, minus strong name key files (*.snk). (The supplied Visual Studio 2005 solution contains Web Application projects supported only by SP1 or after.) It contains three projects: Deployment, Features, and SharePoint. The SharePoint project contains source code for the custom field. The Features project contains features to support the deployment. The Deployment project contains a pre-build script to aggregate all the files needed for deployment. It contains a Solution directory where a WSP file is generated and deployed by a post-build script.

This structure of Visual Studio solution and projects is designed to be scalable to full blown MOSS/WSS development and deployment. You could add additional projects like SharePoint.Publishing for MOSS Publishing development. Within your SharePoint or SharePoint.Publishing projects, you could have custom components like user controls, web controls, web parts etc.

To deploy the custom field, follow the procedures below:

  1. Using stsadm, install the solution file QuestechSolution.wsp in \Deployments\Solution\
  2. stsadm -o addsolution -filename QuestechSolution.wsp
  3. Open SharePoint 3.0 Central Administration, go to Operations/Global Configuration/Solution Management. Deploy QuestechSolution.wsp to select web application(s).
  4. In SharePoint 3.0 Central Administration, go to Application Management/Manage Web application features. Select the web application(s) where the solution is deployed. Activate the feature Questech Systems Application Global Resources.
  5. Go to the top site in the selected web application(s). Activate the Site Collection feature Questech Systems Custom Columns.

The custom Flash Movie Field should now be ready for use. You can go to the Site Columns gallery to verify. To use the custom field in your MOSS page layout, you would first need to add the custom site column to a content type by going to the Site content types gallery. In the gallery listing, select a content type and click Add from existing site columns.

In your page layout ASPX file, modify the code as follows:

...
<%@ Register Tagprefix="QuestechWebControls" 
    Namespace="QuestechSystems.SharePoint.WebControls"
    Assembly="QuestechSystems.SharePoint, Version=1.0.0.0, 
    Culture=neutral, PublicKeyToken=f1874fca2a9b1c17" %>

...
...
<QuestechWebControls:FlashMovieField FieldName="FlashMovieFile" runat="server" />
...

References

  1. Create custom field type in WSS V3 - Jim Yang
  2. SharePoint Resources, Types, Use and Deployment - Mikhail Dikov
  3. swfobject
  4. Features for SharePoint - MSDN Magazine
  5. SharePoint 2007 Features “ Creating Site Columns and Content types - Share This Point
  6. Solution Deployment with SharePoint 2007 - MSDN Magazine

History

  • V1.1 - 2008.08.12
    • Added support of YouTube videos.
    • Modified form view layout.
    • Upgraded swfobject to V2.1
  • V1.0 - 2008.04.26 - Base.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Stephen Huen



Occupation: Web Developer
Company: Questech Systems
Location: Canada Canada

Other popular SharePoint Server articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 13 of 13 (Total in Forum: 13) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralError when select the Flash Movie Filed button in WSS 3.0memberoconnortj4:12 18 Sep '08  
GeneralRe: Error when select the Flash Movie Filed button in WSS 3.0memberStephen Huen19:33 20 Sep '08  
QuestionModify what?memberroryschmitz7:37 15 Jul '08  
AnswerRe: Modify what?memberStephen Huen12:12 16 Jul '08  
GeneralRe: Modify what?memberCurtisG7:16 19 Aug '08  
GeneralRe: Modify what?memberStephen Huen9:35 27 Aug '08  
QuestionIt couldn't open in vs2005membervinoinfozone19:47 18 Jun '08  
AnswerRe: It couldn't open in vs2005memberStephen Huen15:18 23 Jun '08  
GeneralFile not found error messagememberCheGueVerra13:21 6 Jun '08  
GeneralCould I get some more details...memberCurtisG11:15 4 Jun '08  
GeneralDo I have to use MOSSmembervincemus6:57 4 May '08  
GeneralRe: Do I have to use MOSSmemberStephen Huen7:13 4 May '08  
GeneralRe: Do I have to use MOSSmembervincemus7:42 4 May '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 Aug 2008
Editor: Sean Ewington
Copyright 2008 by Stephen Huen
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project