¿Cómo obtener la ventana emergente de presentación del componente de inserción?

I suppose to bring the "Insert Component Presentation" functionality in my custom aspx page (which will popup on click of "Insert CP" button)

  1. Created a Custom button "Insert CP" (Done)
  2. When the user select any text from the rich text box and clicks the button, I need to open a window where user can select component and component template.

Can any one give suggestion/idea how to bring the window where user can select componetn and component template (Like, when the user open a page, navigate to component presentation tab, and when he clicks the "insert" button, the same functionality is am looking from the Component Rich Text box.)

preguntado el 31 de julio de 12 a las 15:07

Are you asking how to open the "Select Component Presentation" popup? -

yes frank, if user will select a text from rich text box and clicks button, i need to open "select Component Presentation"popup. -

In that case, see my answer below. -

Can't you link to a component using the normal linking dialog? (I'm trying to found out why you would need to link directly to a componentpresentation) -

@Kah Tang: I can link component by selecting the componet link option from the RTB, but i need to select the component as well as component template which is not OOTB in Tridion. -

2 Respuestas

Have a look at ComponentPresentations.js, which does this to open that popup:

Tridion.Cme.ComponentPresentationsTab.prototype.onInsertClick = 
             function ComponentPresentationsTab$onInsertClick()
{
    var p = this.properties;
    if (p.insertDialog.isOpen())
    {
        p.insertDialog.focus();
    }
    else
    {
        p.insertDialog.open();
    }
};

Before that it of course needs to ensure that p.insertDialog has been properly initialized, which it does in its _initializeInsertDialog method. I won't reproduce the code for that here, since you can look it up and it is copyrighted material (I'll assume that just reproducing the snippet above somehow falls under fair-use).


Nota:: I got this answer by:

  1. right clicking on the Insert button on the Component Presentations tab of a Page popup
  2. selecting "Inspect element"
  3. recording the id of the element (buttonComponentInsert en este caso)
  4. buscando el web\WebUI subdirectory of my Tridion installation folder for that value

This led to a single hit in a file called ComponentPresentations.js:

buttons.Insert = $controls.getControl($("#buttonComponentInsert"),
                                      "Tridion.Controls.Button");

Given that this is where the button from the HTML is turned into a functional control, the rest of it was just a matter of following what happens to that button inside ComponentPresentation.js.

Respondido 04 ago 12, 02:08

+1 for the answer and if I could, another +1 for the note on how to investigate other controls! - alvin reyes

To give you some more info on the root of the problem: Based on your needs, in most cases you don't really need to refer to the component template part when you render component links on the content delivery part.

The component template part when rendering them during content delivery is only necessary when you're using the same component with different component templates on your website. Yes, there is a component template argument/parameter in the content delivery API, but it's only used in these kind of cases.

Even in cases where you do use the same component with different component templates on different pages, it's better to get the component template priorities right, than to refer directly to the component template. You can read more about template priorities in the Tridion documentation.

Bottomline: In most cases you'll only need to make componentlinks with the component URI. Read more about linking priorities in the Tridion documentation.

Respondido 01 ago 12, 09:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.