All.
I have GUI Extension which should print id of selected item. It is setup so it works if item is selected in main central part of UI and user choose ribbon button or from right click context menu.
code is
Extensions.Tr.prototype.isEnabled = function Tr$isEnabled(selection, pipeline) {
//is disabled
settings = this.getUserSettings();
if (settings) {
var allowed = this.AllowedFoUser();
if (allowed) {
userID = settings.User["@ID"];
var items = selection.getItems();
if (items.length >= 1) {
//multiselect
for (var i = 0, len = items.length; i < len; i++) {
var itemId = selection.getItem(0);
var item = $models.getItem(itemId);
reg = new RegExp("8192$");
if (item) {
if (item.getItemType() != $const.ItemType.COMPONENT
&& item.getItemType() != $const.ItemType.PAGE
&& item.getItemType() != $const.ItemType.STRUCTURE_GROUP
&& item.getItemType() != $const.ItemType.FOLDER
&& item.getItemType() != $const.ItemType.CATEGORY
&& item.getItemType() != $const.ItemType.KEYWORD
&& (itemId.indexOf("catman-") == -1)
&& !reg.test(itemId)) {
return false;
}
}
}
return true;
}
}
}
return false;
};
GUI Extension should be disabled only if item is publication.
But if item is selected from left navigation menu (left side navigation) button in Ribbon is disabled even if item is folder.
I debugged this code and items.Length is 0 if selection is made from left menu navigation.
Is this expected behavior? Can we do some other configuration how to enable it from left menu navigation/side navigation?
Thanks.