Search code examples
tridion

Open ItemSelectControl on a custom page (not gui extension)


I am developing a web application which will be added as a custom page in Tridion.

On the custom page I'd like to select a component of schema X. I want to use the ItemSelectControl for this purpose but I don't know how I can open that control from my custom page since I am not able to access any of Tridions javascript namespaces (e.g. $model or $const). I could simply open a new popup with the url to the ItemSelectControl and create my own filter in json but I'd rather use the constants defined in Tridions javascript namespace.

Is there a simple way to add references or something to my web application in order to access Tridions javascript namespaces? If not, do you have any suggestions how I should solve this?

More information on the custom page:

  • CMS server hostname: testcms

  • An empty ASP.NET project with one aspx page called Test.aspx published to path C:\TestPage\

  • In IIS, a web application called TestPage in the SDL Tridion site with path to C:\TestPage\

  • Trying to access the page in a broswer with url: http://testcms/TestPage/Test.aspx


Solution

  • You can accomplish this by using the following markup/code for your popup. (Popup page must be an .aspx page)

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="Tridion.Web.UI.Controls.TridionPage" ClassName="DashboardView" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html class="tridion popup">
    <head>
        <!-- Tridion manager -->
        <cc:TridionManager runat="server" Editor="CME">
            <dependencies runat="server">       
                <dependency runat="server">Tridion.Web.UI.Editors.CME</dependency>
                <dependency runat="server">Tridion.Web.UI.Editors.CME.commands</dependency>
                <dependency runat="server">Tridion.Web.UI.Editors.CME.globalCommands</dependency>
                <dependency runat="server">Tridion.Web.UI.Controls.Popup</dependency>
            </dependencies>
        </cc:TridionManager>
    </head>
    <body>
        My popup
    </body>
    

    This means that there is a dependency between your application and Tridion, because your popup page must inherit Tridion.Web.UI.Control.TridionPage. It's up to you if you want this. I don't know of another way to add the Tridion JavaScript files. (This approach is also used in the PowerTools project. Check it out here: http://code.google.com/p/tridion-2011-power-tools/)