When I have developed our document management (+case management) head our IT department want show comment in every task which typed by task sender.
I'm using Alfresco 4.0 version. And I have done this using alfresco share standard functions which developed by Alfresco team.
Code for salution goes here:
/**
* Called when "read comment" img clicked
*
* @method readComment
* @param type
* @param args
*/
readComment: function CC_readComment(type, args)
{
var me = args.me;
var imgId = args.commentImgId;
for (var index in me.widgets.balloons) {
if (me.widgets.balloons.hasOwnProperty(index)) {
me.widgets.balloons[index].hide();
}
}
if( me.widgets.balloons.hasOwnProperty(imgId) ) {
me.widgets.balloons[imgId].show();
} else {
// get the url to call
var url = Alfresco.constants.PROXY_URI + "supremecourt/workflow/taskComment?taskId="+args.taskId;
var callback = {
success : function(o) {
var dataResponse = Alfresco.util.parseJSON(o.responseText);
// Iwin nomresi
var taskDescription = dataResponse.data.description;
// Werh
var comment = dataResponse.data.comment;
var imgCommentBtn = Dom.get(args.commentImgId);
me.widgets.balloons[imgId] = Alfresco.util.createBalloon(imgCommentBtn, {
width: "20em"
});
me.widgets.balloons[imgId].html("" + taskDescription + "
" + comment);
me.widgets.balloons[imgId].show();
},
failure : function (o) {
if (!YAHOO.util.Connect.isCallInProgress(o)) {
var dataResponse = Alfresco.util.parseJSON(o.responseText);
Alfresco.util.PopupManager.displayMessage(
{
text: me.msg("message.load-comment-fail")+"\nFailed! " + o.status + " : " + o.statusText + ( (dataResponse != null)? "\n"+dataResponse.message:"" )
});
}
},
timeout : 5000
};
YAHOO.util.Connect.asyncRequest('GET', url, callback);
}
},
And "me.widgets.balloons" is declared as following:
// Balloon for Comments
me.widgets.balloons = {};

No comments:
Post a Comment