/// <summary>
///
/// </summary>
/// <returns>boolean</returns>
Extensions.Unlocalize.prototype.isEnabled = function Unlocalize$isEnabled(selection) {
var item = $models.getItem(selection.getItem(0)),
itemTCM = item.getId(),
pubTCM = null,
isAvailable = false,
itemRegex = /.?tcm:(.*?)\-/,
pubRegex = /.*?\-(.*)-.*/;
console.log("Extensions.Unlocalize.prototype.isEnabled; Started.");
console.log("Info of parameter item at start: ", item.getInfo());
//Make sure the component is loaded before using getOwningPublicationId();
var onItemLoaded = function Extensions$Unlocalize$_onItemLoaded() {
console.log("Extensions$Unlocalize$_isEnabled; Started.");
$evt.removeEventHandler(item, "load", onItemLoaded);
var itemInfo = item.getInfo();
console.log("Info of parameter item in eventHandler: ", itemInfo);
pubTCM = item.getOwningPublicationId();
pubTCM = pubTCM.match(pubRegex);
itemTCM = itemTCM.match(itemRegex);
if (itemTCM[1] == pubTCM[1]) {
isAvailable = true;
}
console.log("Extensions$Unlocalize$_isEnabled; ", isAvailable);
};
console.log("Extensions.Unlocalize.prototype.isEnabled; addEventHandler");
$evt.addEventHandler(item, "load", onItemLoaded);
console.log("Extensions.Unlocalize.prototype.isEnabled; item.load()");
item.load(item.isLoaded(true), $const.OpenMode.VIEW);
console.log("Extensions.Unlocalize.prototype.isEnabled; Return.");
return isAvailable;
}
/// <summary>
///
/// </summary>
/// <returns>boolean</returns>
Extensions.Unlocalize.prototype.isEnabled = function Unlocalize$isEnabled(selection) {
var item = $models.getItem(selection.getItem(0)),
itemTCM = item.getId(),
pubTCM = null,
isAvailable = false,
itemRegex = /.?tcm:(.*?)\-/,
pubRegex = /.*?\-(.*)-.*/;
console.log("Extensions.Unlocalize.prototype.isEnabled; Started.");
console.log("Info of parameter item at start: ", item.getInfo());
//Make sure the component is loaded before using getOwningPublicationId();
var onItemLoaded = function Extensions$Unlocalize$_onItemLoaded() {
console.log("Extensions$Unlocalize$_isEnabled; Started.");
$evt.removeEventHandler(item, "load", onItemLoaded);
var itemInfo = item.getInfo();
console.log("Info of parameter item in eventHandler: ", itemInfo);
pubTCM = item.getOwningPublicationId();
pubTCM = pubTCM.match(pubRegex);
itemTCM = itemTCM.match(itemRegex);
if (itemTCM[1] == pubTCM[1]) {
isAvailable = true;
}
console.log("Extensions$Unlocalize$_isEnabled; ", isAvailable);
};
console.log("Extensions.Unlocalize.prototype.isEnabled; addEventHandler");
$evt.addEventHandler(item, "load", onItemLoaded);
console.log("Extensions.Unlocalize.prototype.isEnabled; item.load()");
item.load(item.isLoaded(true), $const.OpenMode.VIEW);
console.log("Extensions.Unlocalize.prototype.isEnabled; Return.");
return isAvailable;
}