6

I have added a dropdown replacing Target field's textbox in Hyperlink tab of RichText toolbar using Link.aspx present at C:\Program Files (x86)\Tridion\web\WebUI\Editors\CME\Views\Popups\Link. The Dropdown is coming in the UI of Tridion.

I want to populate the Linked Component Templates in that dropdown according to the component selected, but I am unable to populate the Component Templates in this dropdown.

I used UI Extensions for this (JS and Config files added). I have added it to the system.config and created a virtual folder in IIS too.

I think I'm making some mistake in the Config file, as I am unaware of how many of it's tags should be used.

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge" xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
  <resources cache="true">
    <cfg:filters/>
    <cfg:groups>
      <cfg:group name="Extensions.Resources.NamedTargetDropdown" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">
        <cfg:fileset>
          <cfg:file type="script">/Commands/CT_Dropdown.js</cfg:file>
        </cfg:fileset>
        <cfg:dependencies>
          <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
          <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
        </cfg:dependencies>
      </cfg:group>
    </cfg:groups>
  </resources>
  <definitionfiles/>
  <extensions>
    <ext:editorextensions>
      <ext:editorextension target="CME">
        <ext:editurls/>
        <ext:listdefinitions/>
        <ext:taskbars/>
        <ext:commands/>
        <ext:commandextensions/>
        <ext:contextmenus/>
        <ext:lists/>
        <ext:tabpages/>
        <ext:toolbars/>
        <ext:ribbontoolbars/>
      </ext:editorextension>
    </ext:editorextensions>
    <ext:dataextenders/>
  </extensions>
  <commands>
    <cfg:commandset id="Tridion.Cme.Views.NamedTargetDropdown">
      <cfg:command name="NamedTargetDropdown" implementation="Tridion.Cme.Views.Link.NamedTargetDropdown"/>
      <cfg:dependencies>
        <cfg:dependency>Extensions.Resources.Base</cfg:dependency>
      </cfg:dependencies>
    </cfg:commandset>
  </commands>
  <contextmenus/>
  <localization/>
  <settings>
    <defaultpage/>
    <navigatorurl/>
    <editurls/>
    <listdefinitions/>
    <itemicons/>
    <theme>
      <path/>
    </theme>
    <customconfiguration/>
  </settings>
</Configuration>

and the JS, I have written is:

Type.registerNamespace("Tridion.Cme.Views"); 

Tridion.Cme.Views.Link.NamedTargetDropdown = function Tridion.Cme.Views.Link$NamedTargetDropdown() { 
    Type.enableInterface(this, "Tridion.Cme.Views.Link.NamedTargetDropdown"); 
    this.addInterface("Tridion.Cme.View", ["NamedTargetDropdown"]); 
}; 

Tridion.Cme.Views.Link.NamedTargetDropdown.prototype.isAvailable = function NamedTargetDropdown$isAvailable(NamedTarget) { 
    return true; 
} 

Tridion.Cme.Views.Link.NamedTargetDropdown.prototype.isEnabled = function NamedTargetDropdown$isEnabled(NamedTarget) { 
    return true; 
} 

Tridion.Cme.Views.Link.NamedTargetDropdown.prototype._execute = function NamedTargetDropdown$_execute(NamedTarget) { 
    var p = this.properties;
    var previewItem = $models.getItem(p.itemId);
    if (previewItem && Type.implementsInterface(previewItem, "Tridion.ContentManager.VersionedItem") && previewItem.isVersion()) {
        var itemId = previewItem.getVersionlessId();
        previewItem = $models.getItem(itemId);
    }

    if (!previewItem) {
        return;
    }
    p.templateList = previewItem.getListComponentTemplates();
}

update

I think I need to add:

<ext:contextmenus>
  <ext:add>
    <ext:extension name=”NamedTargetDropdown" assignid="NamedTarget">
      <ext:menudeclaration externaldefinition=”">
        <ext:command>NamedTargetDropdown</ext:command>
      </ext:menudeclaration>
      <ext:dependencies>
        <cfg:dependency>Extensions.Resources.NamedTargetDropdown</cfg:dependency>
      </ext:dependencies>
      <ext:apply>
        <ext:view name=”PopupsView"/>
      </ext:apply>
    </ext:extension>
  </ext:add>
</ext:contextmenus>

But upon adding this I am getting the following error:

Loading configuration file "C:\Program Files (x86)\Tridion\web\WebUI\Editors\NamedTargetDropdown\NamedTargetDropdown.config" failed: Invalid character in the given encoding. Line 30, position 21

  • That could be a auto-replacement issue with Office or other software. You probably want " double quotes instead of the "curly" version. – Alvin Reyes Jun 10 '13 at 19:37
  • Also consider @BartKoopman's Item Selector extension for this. – Alvin Reyes Jun 10 '13 at 19:39
  • 1
    It seems quite strange that you would replace the 'Target' dropdown for your own use. Could you not have introduced a new field underneath? I would strongly advise against modifying the default Tridion CME behaviour in this way. As well as removing the standard behaviour for any new sites, it also means that the Tridion documentation no longer correlates with what the Tridion user is seeing. – Jonathan Williams Jul 5 '13 at 13:59
  • @Gyan I've moved your comments in your question, when you want to provide additional information, please edit the question rather than to add it as a comment. – Bart Koopman Jul 18 '13 at 13:44
1

Few comments:

  1. Modyfing existing CME popups is not supported action
  2. Extension in this post is wrong. It looks like you are trying to add new command and associate new context menu option with this command, but configuration sections for this purpose are incorrect. Please, refer documentation or check existing exstensions on how to correctly write it.
  3. New Command and Content Menu option will not help you to populate your new dropdown. That have to be done from View object implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.