Tried the below code in the starting :
But this works perfectly for Non-Edited ET and because the postCreate fn is called more than 1 it is not able to hold the page(as there is no invalidField value when executed for 2/3 time).
CustomJS:
define( ["dojo/_base/declare",
"ecm/widget/ItemPropertiesPaneExtension",
"ecm/widget/CommonPropertiesPane",
"dojo/aspect",
"ecm/model/Request",
"dojo/_base/array",
"dijit/registry",
"dojo/query",
"dojo/NodeList-dom",
"dojo/dom-construct"],
function(declare, ItemPropertiesPaneExtension, CommonPropertiesPane, aspect, Request, array, registry, query, nodeList, domConstruct) {
/**
*
* , used in the property editor, to add a custom section.
*
*/
return declare("entryTemplateInterceptorDojo.CustomItemPropertiesPaneExtension", [ ItemPropertiesPaneExtension ], {
postCreate: function() {
console.log("ItemPropertiesPaneExtension postCreate!");
this.inherited(arguments);
//hide the tab that is created to provide custom attributes ... We don't want it
// There are no special attribute for this solutions, just hide it!
query(this.domNode).style("visibility", "hidden");
///this is for the EditPropertiesDialog-Right Click Document-->Properties
var epdWidget;
array.forEach(registry.toArray(), function(widget,i){
//console.log(widget.dojoAttachPoint);
if(widget.dojoAttachPoint.indexOf("_itemEditPane") != -1){
console.log(widget.id);
console.log(widget);
epdWidget = widget;
}
});
if(epdWidget){
aspect.after(epdWidget, "onCompleteRendering", function(){
console.log(epdWidget._itemPropertiesPane);
var ipp = epdWidget._itemPropertiesPane;
//POC3 ContentListEditPane - start
//POC3 ContentListEditPane - finish
//POC5 EditPropertiesDialog - start
aspect.after(ipp, "validate", function(response,args){
var invalidFields = new Array();
if(args[2]){
var commProps = ipp._commonProperties;
//we have to this differently than the other because empty properties are not shown
var propJSON = new Array();
//For Non-EDITED ET
if(commProps._propertyEditors){
var fields = commProps._propertyEditors._fields;
var i;
for(i=0; i<fields.length; i++){
var prop = new Object();
prop["name"] = fields[i].name;
prop["value"] = fields[i].value;
propJSON.push(prop);
}}
//For EDITED ET
else{
var fields = commProps._view.properties;
var i;
for(i=0; i<fields.length; i++){
var prop = new Object();
prop["name"] = fields[i].controller.id;
if(fields[i].controller.get("value")==null){
prop["value"] ="";}
else{
prop["value"] =fields[i].controller.get("value");
}
propJSON.push(prop);
}
}
var serviceParams = {
"properties": JSON.stringify(propJSON)
};
var response = Request.invokeSynchronousPluginService("EntryTemplateInterceptor", "ValidatePropertiesService", serviceParams);
console.log("responsePropsEdit2: "+JSON.stringify(response.props));
array.forEach(response.props, function(item, i){
var name = item.name;
var value = item.value;
if("invalidValue" in item){
var invalidValue = item.invalidValue;
commProps.setPropertyValue(name, value);
//commProps.setFieldError(name, "Invalid field value", invalidValue);
invalidFields.push(item);
}
//For Non-Edited EntryTemplate.
if(commProps._propertyEditors){
console.log("====Inside If===");
var defaultNode = "<td class='validationSpan'><span style='color:blue'>Property Updated</span></td>"
var props = commProps._propertyEditors._fields;
array.forEach(props, function(prop, i){
var propName = prop.name;
if(propName === name){
var node = prop.domNode;
var propNode = dojo.query(node);
var parentNode = dojo.query(propNode.parent()[0]);
var grandParentNode = dojo.query(parentNode.parent()[0]);
var nlCustom = dojo.query(".validationSpan", grandParentNode[0]);
if(nlCustom.length == 0){
domConstruct.place(defaultNode, parentNode[0], "after");
}
}
});
}
//For EDITED ET
else{
console.log("====Inside Else===");
var props = commProps._view.properties;
var defaultNode = "<div class='defaultSpan'><span style='color:blue'>Property Updated</span></div>"
array.forEach(props, function(prop, i){
var propName = prop.controller.id;
if(propName === name){
console.log("EditITEMS1st=="+propName);
var node = prop.domNode;
domConstruct.place(defaultNode,node, "after");
}
});
}
});
if(invalidFields.length > 0){
return invalidFields;
}
}
});
//POC5 EditPropertiesDialog - finish
});
}
},
isEnabledFor: function(item) {
return true;
}
});
});
#IBMContentNavigator(ICN)#Support#SupportMigration