internal link to image asset

Dave's Avatar

Dave

18 Aug, 2015 09:42 PM

How do I link to an image so that it opens the asset with the Cascade interface?

I have a non-published page that provides content for two published pages, and also defines a thumbnail that is used by a page outside the CMS. I'd like to be able to get to the thumbnail from the non-published page to publish it, but my links only open the image itself, not within the Cascade interface. I have access to the name and path of the image from the page's data definition, but not the ID.

  1. 1 Posted by Wing Ming Chan on 18 Aug, 2015 11:32 PM

    Wing Ming Chan's Avatar

    Hi Dave,

    Assuming that you can attach a Velocity format to a region of your non-published page, you can use the LocatorTool to find the ID string of an image. Here is an example of using a Velocity format to create two links:

    #set( $image = "/images/howto/2-column-config.jpg" )
    #set( $site  = "cascade-admin" )
    #set( $file  = $_.locateFile( $image, $site ) )
    #set( $id    = $file.identifier.id )
    <ul>
    <li><a href="http://yourdomain.edu:1234/entity/edit.act?id=$id&amp;type=file" target="_blank">Edit the file</a></li>
    <li><a href="http://yourdomain.edu:1234/entity/publish.act?id=$id&amp;type=file" target="_blank">Publish the file</a></li>
    </ul>
    
    There are a few things worth mentioning:
    1. Given an ID string, you can use any valid URL inside Cascade to open, edit, or publish an asset.
    2. Note that the ampersand must be encoded, or else Velocity will throw an exception.
    3. I use target here. This will open a new tab or window. This is to avoid embedding a window inside Cascade.
    4. The file path can be from a data definition block, an index block, or whatever source. You may need to process a link element to get the site name.

    By clicking one of these links, I can either edit or publish the image.

    Wing

  2. 2 Posted by Dave on 19 Aug, 2015 07:33 PM

    Dave's Avatar

    Thanks Wing! I wasn't using Velocity on this page, and wasn't familiar with the available tools, so double thanks!

  3. 3 Posted by Wing Ming Chan on 19 Aug, 2015 07:57 PM

    Wing Ming Chan's Avatar

    Surely you can do this using XSLT, provided you know how to query the database directly with an XSLT format. I may talk about that in the conference next year.

    Wing

  4. Ryan Griffith closed this discussion on 27 Aug, 2015 08:19 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac