1

Am implementing the Ribbon toolbar button. On button click depending upon the schema name, I need to create the popup with corresponding url (Aspx page). Previously I worked with only one aspx page and I am succeeded in the same, I created a popup java script file with the same name as aspx page and configured it in configuration file. But in case of multiple aspx pages even if I create multiple popup javascript files.It is not calling the respected javascript file.

How to map the popup java script files to aspx pages in case of multiple aspx pages?

PFB the code samples.

Button java script file code fragment:

if (some condition) {
         //Creating the url    
         var url = "Editors/RTFExtension/Popups/ButtonReferencePopup_2.aspx?schemaId='" + schemaId + "'";
         var popup = $popup.create(url, "toolbar=no,width=500,height=200,resizable=yes,scrollbars=yes", null);
}
else{
        //Creating the url    
        var url = "Editors/RTFExtension/Popups/ButtonReferencePopup.aspx?schemaId='" + schemaId + "'";
        var popup = $popup.create(url, "toolbar=no,width=500,height=200,resizable=yes,scrollbars=yes", null);
}

Config file code fragment:

<cfg:group name="RTFExtension.ButtonReference">
        <cfg:fileset>          
          <cfg:file type="script">/Popups/ButtonReferencePopup.js</cfg:file>
          <cfg:file type="script">/Popups/ButtonReferencePopup_2.js</cfg:file>
          <cfg:file type="style">/Themes/ButtonReference.css</cfg:file>
        </cfg:fileset>       

        <cfg:dependencies>
          <cfg:dependency>Tridion.Web.UI.Controls</cfg:dependency>
          <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
          <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
        </cfg:dependencies>
</cfg:group>

Please help me out in this issue. Thanks in advance. Early response is appreciated.

P.Muralikrishna
  • 1,279
  • 9
  • 30
  • 2
    What did you already try? If you share your **relevant** code/configuration, we can see where you're going wrong. – Frank van Puffelen Jun 29 '12 at 12:55
  • What isn't working for you? It looks like you've done what I would have expected to work - i.e. have some logic in your JS that sets a different URL for $popup to open... If it works with one popup you should then be able to just replicate the config for the additional popups. – Jeremy Grand-Scrutton Jul 02 '12 at 07:49
  • @JeremyGrand-Scrutton Thanks for your quick reply. In my scenario I have two different aspx files and two different JS files correspondingly. I am able to open the different popups based upon the logic placed in the JS file. But the opened popup is not binding to the corresponding JS file. All opened popups are binded to single JS file,even after added the JS files as resources in config file. Your suggestion will help me a lot. Thanks in advance. – P.Muralikrishna Jul 02 '12 at 08:16
  • Though not exactly an extension, another place to wire up per-schema, or even per-field pop-ups is in `custom url`s. – Alvin Reyes Aug 13 '12 at 07:49

1 Answers1

2

I believe you need to configure different groups for each config - something like this:

<cfg:group name="RTFExtension.ButtonReference.Popup1">
    <cfg:fileset>          
      <cfg:file type="script">/Popups/ButtonReferencePopup.js</cfg:file>
      <cfg:file type="style">/Themes/ButtonReference.css</cfg:file>
    </cfg:fileset>       

    <cfg:dependencies>
      <cfg:dependency>Tridion.Web.UI.Controls</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
    </cfg:dependencies>
</cfg:group>

<cfg:group name="RTFExtension.ButtonReference.Popup2">
    <cfg:fileset>          
      <cfg:file type="script">/Popups/ButtonReferencePopup_2.js</cfg:file>
      <cfg:file type="style">/Themes/ButtonReference.css</cfg:file>
    </cfg:fileset>       

    <cfg:dependencies>
      <cfg:dependency>Tridion.Web.UI.Controls</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
    </cfg:dependencies>
</cfg:group>

In your popup code-behind you then need to reference the relevant group:

namespace Button.Reference.Popups
{
    [ControlResourcesDependency(new Type[] { typeof(Popup), typeof(Tridion.Web.UI.Controls.Button), typeof(Stack), typeof(Dropdown), typeof(List) })]
    [ControlResources("RTFExtensions.ButtonReference.Popup1")]
    public partial class PopupReference1 : TridionPage

Or:

namespace Button.Reference.Popups
{
    [ControlResourcesDependency(new Type[] { typeof(Popup), typeof(Tridion.Web.UI.Controls.Button), typeof(Stack), typeof(Dropdown), typeof(List) })]
    [ControlResources("RTFExtensions.ButtonReference.Popup2")]
    public partial class PopupReference2 : TridionPage
Jeremy Grand-Scrutton
  • 2,802
  • 14
  • 20