Re: displaying an uploaded swf
Re: displaying an uploaded swf
- Subject: Re: displaying an uploaded swf
- From: Theodore Petrosky <email@hidden>
- Date: Thu, 06 Nov 2014 22:23:51 -0500
Paul,
Thank you, Thank you! the perfect push in the right direction. here’s my solution.
at the bottom of this page:
http://jenkins.wocommunity.org/job/Wonder/javadoc/er/attachment/package-summary.html
there is information about custom viewers. so I added to my properties file:
er.attachment.mimeType.application/x-Shockwave-Flash.viewer=com.eltek.components.TPSWFDefaultViewer
Then I created a new component in my app TPSWFDefaultViewer. HTML:
<webobject name = "SWFContainer"><webobject name = "params"/></webobject>
WOD:
SWFContainer: WOGenericContainer {
elementName="object";
type="application/x-shockwave-flash";
data=attachmentUrl;
}
params : WOGenericElement {
elementName = "param";
name = "movie";
value = attachment.fileName;
}
public String attachmentUrl() {
WOContext context = context();
ERAttachment attachment = attachment();
return ERAttachmentProcessor.processorForType(attachment).attachmentUrl(attachment, context.request(), context);
}
I then added two rules to create a link on the ListInsertions page:
100 : (pageConfiguration = 'ListInsertion' and propertyKey = 'theSWF') => componentName = "D2WCustomComponent" [com.webobjects.directtoweb.Assignment]
100 : (pageConfiguration = 'ListInsertion' and propertyKey = 'theSWF') => customComponentName = "DisplaySWFComponent" [com.webobjects.directtoweb.Assignment]
when you click the link, you get a dummy page with the swf embedded in the midst of a fictitious newspaper’s home page.
The end result HTML:
<object _componentname="com.eltek.components.TPSWFDefaultViewer" type="application/x-shockwave-flash" data="/cgi-bin/WebObjects/ASClientApproval.woa/attachments/id/1/1.swf"><param name="movie" value="1.swf" id="theSWF"></object>
BTW, This project is to allow my vendor, to upload swf ads, then my client will log in and be able to see an example page with the swf embedded with text and other ads.
I don’t know what I would do without WO.
Thanks again for the push.
Ted
On Nov 6, 2014, at 6:34 PM, Paul Hoadley <email@hidden> wrote:
> Hi Ted,
>
> On 7 Nov 2014, at 5:22 am, Theodore Petrosky <email@hidden> wrote:
>
>> I am trying to use this:
>>
>> <object type="application/x-shockwave-flash"
>> data="your-flash-file.swf" width="0" height="0">
>> <param name="movie" value="your-flash-file.swf" />
>> <param name="quality" value="high"/>
>> </object>
>>
>> I was thinking I could adjust the data and value to be WOStrings. I am passing the attachment to my page and I wanted to access the attachment in the data element like
>>
>> data=<wo:WOString value = "$attachData"/ >
>>
>> where attachData:
>>
>> public String attachData() {
>> String returnString = theAttachment().toString();
>> return returnString;
>> }
>>
>> which returns in the HTML:
>>
>> <object type="application/x-shockwave-flash" data="<er.attachment.model.ERFileAttachment" pk:"1">="" width="100" height="100">
>> <param name="movie" value="<er.attachment.model.ERFileAttachment" pk:"1">="" <param="">
>> </object>
>
> I’m not sure I can solve your larger problem, but if you’re trying to set attribute values in the rendered HTML, the best approach is to use WOGenericContainer or WOGenericElement. For example:
>
> <wo:WOGenericContainer elementName=“object” type=“application/x-shockwave-flash” data=“$attachData” …>
> <wo:WOGenericElement elementName=“param” name=“movie” value=“$filename” />
> …
> </wo:WOGenericContainer>
>
> You would then need a method attachData() to return the value for the ‘data' attribute, and filename() to return the value for the ‘value' attribute. These are obviously just examples—I’m otherwise not sure how to achieve what you want, though calling toString() on ERAttachment can’t be right, can it?
>
>
> --
> Paul Hoadley
> http://logicsquad.net/
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden