-2

I have a new CME requirement to disable the "translate" item from menu based on Bundle Scheme(Bundle Type) using CME GUI.

Requirement Scenario 1 :

When the user select the Publish_Bundle(Bundle) -- > right click -- > BluePrinting -- > translate(Enable)

Requirement Scenario 2 : When the user select the Expiry_Bundle(Bundle) -- > right click -- > BluePrinting -- > translate(Disable)

Bundle Type:

  1. Publish_Bundle(translation enable)
  2. Expiry_Bundle(translation disable)

    Expiry_Bundle

Step1 : When the authors Creating Bundle with Bundle Type is "expiry_bundle"

enter image description here

Step2 : if the Bundle Type is "expiry_bundle" ? It should be able to disable the "Translate".

enter image description here

Looking for solutions and ideas.

3
  • Thanks for the update.

There's nothing out of the box here for you. I'd suggest you look at a GUI extension. I'd suggest you ensure that the logic is flexible enough to support future bundle names (or these titles being updated) by way of a simple config file - also ensure that your logic that "no-one" can send these for translation is solid - otherwise you may also want to add specific user groups being switched on/off also.

Take a look at the SDL Web8.5 documentation. If you've done GUI Extensions in previous versions of Tridion then this TREX response by Bart may also help.

If you're new to GUI extensions then you should consider utilising the Alchemy Framework to support rapid development - you'll see plenty of tutorials etc. from John Winter on TridionDeveloper.com or just Google the heck out of it.

  • I try to disable the "translate" item from the menu based on the selected bundle type schema. – Sudhakar Rao Aug 3 '17 at 17:00
  • Can you edit the question by adding how you tried to disable the translate option? Was it through a GUI extension? And if so can you describe what didn't work in the GUI extension? – Sabarish Senthilnathan Aug 3 '17 at 17:45
  • added the requirement scenario and it`s CME GUI Extensions. – Sudhakar Rao Aug 3 '17 at 20:34
1

Thanks for your response.

Final I implemented the translation menu item disable logic using CME GUI extension.

enter image description here enter image description here

** extension and code below:**

editor.config : create a commandextensions and commandset.

<ext:commandextensions>
          <ext:commands>     
            <ext:command name="Translate" extendingcommand="SecureTranslate" />
          </ext:commands>
          <ext:dependencies>
            <cfg:dependency>SDLWeb.Resources.SecureCommands</cfg:dependency>
          </ext:dependencies>
</ext:commandextensions>


<cfg:commandset id="SDLWeb.Commands.SecureCommands">
      <cfg:command name="SecureTranslate" implementation="SDLWeb.Tridion.CommandExtensions.SecureTranslate" />
      <cfg:dependencies>
        <cfg:dependency>SDLWeb.Resources.SecureCommands</cfg:dependency>
      </cfg:dependencies>
</cfg:commandset>

****Secure.js:(Create a JS file and add below code for _isAvailable,_isEnabled, _execute)

    SDLWeb.Tridion.CommandExtensions.SecureTranslate = function (name) {
        Tridion.OO.enableInterface(this, "SDLWeb.Tridion.CommandExtensions.SecureTranslate");
        this.addInterface("SDLWeb.Web.UI.Editors.Base.Commands.CommandBase", [name || "SecureTranslate"]);
    };

SDLWeb.Tridion.CommandExtensions.SecureTranslate = function (name) {
    Tridion.OO.enableInterface(this, "SDLWeb.Tridion.CommandExtensions.SecureTranslate");
    this.addInterface("SDLWeb.Web.UI.Editors.Base.Commands.CommandBase", [name || "SecureTranslate"]);
};


SDLWeb.Tridion.CommandExtensions.SecureTranslate.prototype._isAvailable = function (selection, pipeline) {

    var itemTitle = "";
    var items = selection.getItems();
    if (items.length != 1) {
        return false;
    }  
    for (var i = 0; i < items.length; i++) {
        var itemId = selection.getItem(i);
        var item = $models.getItem(itemId);

      if (item.isLoaded() == false) {
           item.load();            
      }
      if (item.isLoaded(true) && Tridion.Type.isFunction(item.getMetadataSchemaId))
      {
            var schemaId = item.getMetadataSchemaId();
            var itemInfo = $models.getItem(schemaId);
            itemTitle = itemInfo.getStaticTitle();          
      }       
       if (item) {
            if (item.getItemType() == $const.ItemType.VIRTUAL_FOLDER) {              
                if (itemTitle !== "Publish_Bundle") {
                    if (pipeline) {
                        pipeline.stop = true;
                    }
                    return false;
                }
            }
        }
    }
    return true;
};

/*
*Checks whether to enable / disable the extension 
*/
SDLWeb.Tridion.CommandExtensions.SecureTranslate.prototype._isEnabled = function (selection, pipeline) {
    if (pipeline) {
        pipeline.stop = true;
    }
    return this._isAvailable(selection, pipeline);
};
/*
* default implementation
*/
SDLWeb.Tridion.CommandExtensions.SecureTranslate.prototype._execute = function (selection, pipeline) {
    if (pipeline) {
        pipeline.stop = false;
    }
}

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.