Should un-publishing a pdf that is used in a component on page cause the page to be unpublished? - tridion

We are handling PDF publishing by using a Dynamic Component Template associated with the PDF schema, then creating Binary Links where we need to link to the PDF.
We've found that un-publishing a PDF that is a component link inside a component used on a page is triggering the page to get unpublished.
I know we can control this behaviour by using a Custom Resolver, but is this the expected result?
Has this behaviour changed from Tridion 2009 to Tridion 2011?

BinaryLinks are meant to be used for "inline binary content", so typically things that are included by a src attribute.
<img src="..." />
<video width="320" height="240" controls="controls">
<source src="movie.mp4" type="video/mp4" />
<source src="movie.ogg" type="video/ogg" />
Your browser does not support the video tag.
</video>
For this inline binary content, the page will not display correctly without it. Knowing that, it is correct that the Page gets unpublished when you unpublish the MMC. So as far as I can tell this is indeed the expected behavior, which hasn't changed in a long time.
The mistake is in using an MMC for a PDF that you want to show as a hyperlink. For anything that you want to link to (so that turns into a <a href="...") you should be using a ComponentLink (or of course a PageLink of it is a Page).

The unpublishing of items that are used by a Binary Component was already there in 2009 (so much so, it's even one of the questions of the Tridion 2009 Business Analyst Exam).
I see a trend developing of people using Dynamic Component Presentations for their binaries, which bypasses all this side effect, but leaves you potentially with bad binary links on your pages.
If you go down the DCP route for binaries, make sure to use Dynamic Linking (pretty simple to create on the CM by using "tridion:type=binary" in your anchor markup).

Related

Preview PDF in ASP .NET without excuting PDF's embedded JS

I have a problem previewing a PDF, I use an iframe and when certain PDFs (which have embedded JS) show the print dialog automatically.
Code:
<iframe id="Iframepaso1" src="\pdf\test.pdf" runat="server" height="500" scrolling="AUTO" ></iframe>
The PDF has this line:
/Type /Action
/S /JavaScript
/JS (this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)
>>
<iframe> has an attribute called sandbox. By default it will:
block form submission
block script execution
disable APIs
prevent links from targeting other browsing contexts
prevent content from using plugins (through , , , or other)
prevent the content to navigate its top-level browsing context
block automatically triggered features (such as automatically playing a video or automatically focusing a form control)
You can remove specific restrictions by supplying special values to it.

How can i stop html5 audio from auto download

I am using this
<audio src="audio.mp3" />
Now that file is big and system automatically downloads it when someone loads the page.
is there any way that when someone press play , only then system downlaods. Because that player is in my every page and it wastes the BW
You can use the preload='none' attribute. Documentation here
The "none" attribute:
Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimise unnecessary traffic. This state does not provide a hint regarding how aggressively to actually download the media resource if buffering starts anyway (e.g. once the user hits "play").
Your HTML could look something like this:
<audio preload="none">
<source src="audio.mp3" type="audio/mpeg" />
Your browser does not support this audio type.
</audio>

Django CMS Deleting HTML5 Tags and Attributes

I am having a big time issue with solving a problem. I have a placeholder called main for the content region of the page. I was building that region in the cms. Everything was going great until I attempted to add an embedded video contained in an iframe. When I save django cms completely removed the iframe and left an empty div. So I attempted to use prettyphoto light box to open the video by clicking on an image. The code I added to the page through the cms is:
<a rel='prettyPhoto[youtube]' href="https://www.youtube.com/embed/mqVZF_yb8C0?autoplay=1&start=1765&iframe=true" data-rel="prettyPhoto">Click Image</a>
When I saved, django cms completely removed the data-rel attribute from the link which is obviously needed for the js. So I went a step further and adapted the code of the data attribute to:
rel="prettyPhoto"
and the cms also removed that attribute! Also anytime I add an html5 tag like article of section it hates that too! What gives here? Am I doing something wrong? Any advice would be appreciated. 
Aaron,
Thanks.
Please see the discussion at https://github.com/divio/django-cms/issues/1529. We use html5lib to clean the contents of the text plugin (this cannot be turned off for security reasons).
What you'll want to do is write a custom plugin (possibly one that can be embedded inside text plugins).

How can I use flash files in my SDL Tridion page?

My page is showing regular component presentations very well.
I have a flash/video file in my local machine and i want to upload this file on my page.
How can I achieve this?
I have this code snippet for rendering components on my page:
<!-- TemplateBeginRepeat name="Components" -->
<!-- TemplateBeginIf cond="ComponentTemplate == 'HomePageCT'" -->
##RenderComponentPresentation()##
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
Please provide all details related to flash files and video files.
Placing a Flash file on a page follows exactly the same process as placing any image in the output of your templates. The steps are outlined below:
Create a Multimedia Schema which allows the Flash multimedia type (e.g. Flash Video Schema)
Upload your Flash file using your new Schema
Create a Component Template to render the HTML you want to use to display the Flash file, and actually publish the binary itself. (e.g. Display Flash CT)
Create a page template (you seem to have done this part) which renders the Page, and renders the Components on the page using ##RenderComponentPresentation()##
Create a Page, and place your Flash file on it using the Display Flash CT
Publish the Page
Without details of the output you want to produce, it is hard to provide the sample Dreamweaver Template Building Block code for the DisplayFlash CT, but it might look something like this:
<embed src="##Component.Id##" allowFullScreen="true" width="540"
height="438" bgcolor="#000000" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
Make sure you use the Default Finish Actions TBB after this in your Component Template so that the src link is processed and the binary is published.
There is nothing special about Flash files with Tridion. They can be treated just like any other Multimedia Component. You can upload them into the CME (or by using Webdav) and thus you will have a Multimedia Component. Make sure of course, that you Multimedia Schema allows the Flash (and extension) as Multimedia Type.
Regarding how you put the Flash file on the Page - again just like a normal Multimedia Component. In your CT you have to generate the output that will make use of your Flash file URL somewhere. You will have to publish your Flash MMC in order to get its URL. You can use Engine.AddBinary or RenderedItem.AddBinary methods for that, or use the Publish Binaries in Package Default TBB, if your MMC is in the package. Then you can simply refer to your Flash URL as package item. Have a look at this URLs for some inspiration: http://yatb.mitza.net/2012/03/publishing-images-as-variants.html (your case doesn't have to be that complex) and http://yatb.mitza.net/2012/04/referencing-image-variants-from.html.
There are several approaches to rendering Multimedia with a Tridion-managed page.
Multimedia components can be:
Part of a component presentation, added to a page with a template selected
As a linked-to multimedia component within a "container" component, which is added to a page
In a rich text format (RTF) area within another component
You could also just publish binaries with dynamic component templates and handle the markup and links outside of Tridion. Get creative with the above basic scenarios depending on the markup and/or metadata you need.
Chris addresses #1 and Mihai explains schema setup and .AddBinary. The second option would be similar, except you'd have to get the referenced ID rather than the component on the page. The third option requires you to parse multimedia within RTF which depends on your templating language and multimedia type.
I've seen XSLT (<xsl:template match="">), grep, and various .replace options to parse specific markup such as Flash videos.

How can I include sitemap breadcrumb in my Tridion page?

I used to write
<asp:SiteMapPath ID="SiteMapPath1" Runat="server" />
in my .net application to show the navigation site map breadcrumb. Can anyone please tell me how to use this type of functionality in Tridion page? Or should I use this as a user control and add it to my page?
And one more thing as you see download PDF link in the image. How can I link this text to my respective PDF file placed in building block folder? Should I write tcm id of the file(multimedia component) like this?
<a href="tcm id of file" > Download PDF </a>
Would this be the correct approach?
OK, you have 2 questions in here - these should really be 2 separate questions. Moving on.
There's nothing stopping you from using <asp:SiteMapPath> from a website that uses Tridion - as long as you have a SiteMap provider and you create the required navigation.sitemap (or whatever .NET calls it).
Alternatively, you could create your breadcrumb at publish time by determining the location of your page in the website like I explain in this post.
For your pdf download, yes, you should have a template in Tridion generating those <a tridion:href="##Component.ID##"><img src="images/pdf.png" /></a> or something like that. Don't go hard-coding your TCM Uris please.
Have a look at this article that explains how to publish a Sitemap data source XML from Tridion. You can then use it with standard .net navigation user controls.:
http://www.tridiondeveloper.com/web-sitemap

Resources