 |
|
|
Webparts that are made for WSS 3.0/MOSS 2007 should derive from the System.Web.UI.WebControls.WebParts.WebPart class.
WSS 3.0 only includes the Web Part class Microsoft.SharePoint.WebPartPages.WebPart for backwards compatibility purposes, and this should be used only when migrating existing code from WSS 2.0.
I have taken the liberty to rewrite the webpart to work with the right WebPart class.
using System; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.ComponentModel;
namespace FlashWebPart { public class FlashWebPart : WebPart {
private int flashWidth; private int flashHeight; private string flashUrl;
[Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("Width"), WebDescription("Width of the flash"), Category("Configuration")] public int FlashWidth { get { return flashWidth; } set { flashWidth = value; } }
[Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("Height"), WebDescription("Height of the flash"), Category("Configuration")] public int FlashHeight { get { return flashHeight; } set { flashHeight = value; } }
[Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("URL"), WebDescription("Url of the flash file"), Category("Configuration")] public string FlashUrl { get { return flashUrl; } set { flashUrl = value; } }
protected override void Render(HtmlTextWriter writer) { if (!String.IsNullOrEmpty(FlashUrl)) { string outHTML = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,12,36\" " + "WIDTH=" + flashWidth + " HEIGHT=" + flashHeight + "> " + "<PARAM NAME=movie VALUE=\"" + flashUrl + "\"> " + "<PARAM NAME=WMODE VALUE=\"Transparent\">" + "<PARAM NAME=quality VALUE=high> " + "<EMBED src=\"" + flashUrl + "\" quality=high wmode=\"transparent\" WIDTH=\"" + flashWidth + "\" HEIGHT=\"" + flashHeight + "\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></EMBED> " + "</OBJECT>"; writer.Write(outHTML); } else { writer.Write("Modify Webpart to add content URL"); } } } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I am new to Sharepoint and can't get a very simple embed statement to work. I am attempting to prototype using a web content web part. I have a swf that I pass paramters to in this fashion:
<embed src="http://whatever/jim/SWF/Gallery.swf?Path='http://whatever/jim/SWF/images.xml'" width="400" height="400" />
If I hard code the location of the xml file into the swf and don't use the Query string as below it works fine:
<embed src="http://whatever/jim/SWF/Gallery.swf" width="400" height="400" >
As soon as I add the query string to pass the path of the xml file the swf loads and doesn't find the xml file.
I've verified that my embed statement is correct by using it inside a standard html file on the share point server. The issue is once I'm inside the web content web part.
Any help on this would be appreciated.
Thanks, Jim
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Dear Mahdi this is great and thank you for that, do you have any idea about adding this web part functionality to the CQWP or to the RichHtmlEditor of the page layout? i think it will be great best regards
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
This looks like something that would be VERY useful, but unfortunately we're running WSS v3.0 (not MOSS).
Any ideas on running this or an alternative in WSS v3?
Thanks!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
the same code is working for WSS 3.0, just replace XML in "*.webpart" file as described in the second comment reply
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
When I try to deploy this code in visual studio 2005, this message is shown : "Error'FlashWebPart.FlashWebPart' does not contain a definition for 'ExportMode..."
But when I change the inheritance Microsoft.SharePoint.WebPartPages.WebPart to System.Web.UI.WebControls.WebParts.WebPart the code runs. Why is it happenning?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Quote "I don't recommend this approach for many reasons"
Could you please give more arguments than editing HTML....
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Is there a reason why you specified Port 80 for the Site Collection?
I've noticed that my Flash SWF never seems to load. Is there a special document library type or list type you need to store the SWF content in?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi tonyjo
I've specified Port 80 because this is my working environment, and never tried it using another port, you can store your flash file in a document library, just you need to set the right URL to this flash in URL property.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hello Mahdi,
I used your code for creating the webpart and after deploying the webpart appears at the sharepointservices butI can not get in the swf-url. I miss the category 'flashInfo' like shown in your screenshoot. What is my mistake? Thanks a lot.
|
| Sign In·View Thread·PermaLink | 1.33/5 (2 votes) |
|
|
|
 |
|
|
Dear Gertrud2,
I hope you are doing well, be sure that you've inherited the right class as the following:
[Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")] [XmlRoot(Namespace = "FlashWebPart")] public class FlashWebPart : Microsoft.SharePoint.WebPartPages.WebPart
because the above class is not the default class when you create new web part project.
by the way, some people told me that sharepoint refused XML of the ".webpart" file when they defined the XMLRoot Namespace, to solve this problem also; locate the ".webpart" file in the following path:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\FlashWebPart_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and replace the XML according to the following template:
<?xml version="1.0"?> <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"> <Assembly>AssemblyName(with no .dll extension), Version=VersionNumber, Culture=Culture, PublicKeyToken=PublicKeyToken</Assembly> <TypeName>WebPartNamespace.WebPartClassName</TypeName> <Title>DefaultWebPartTitle</Title> <Description>WebPartDescription</Description> </WebPart>
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Dear Mahdi,
Asalam,
If i build the Solution i got created two xml file in
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\FlashWebPart_xxxx
folder that is elementManifest.xml and feature.xml,
In which file can i place your code. could you explain me detail.
Without [XmlRoot(Namespace = "FlashWebPart")] its deployed successfully but i can't able to get "Flash Info" in webpart property.
Waiting for your reply soon thanks
jerald
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Dear Jerald,
you should replace the template of the ".webpart" file,(i.e: FlashWebPart.webpart)
unfortunately, due to unknown reasons you won't get any new property viewable without [XmlRoot(Namespace = "FlashWebPart")], but I think this problem will be fixed later.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
 |