Hello,
I am working on calendar app in a zimlet to add specifics actions.
I added some buttons to actionMenu and viewActionMenu => That works well.
Now, I would like to enable / disble these buttons, depending on some conditions.
I got this working, by adding listeners to views and viewManager :
Code:
MyZimlet.prototype.init = function() {
(...)
this._gcmCalViewCtrl._viewMgr.addViewActionListener(new AjxListener(this._gcmCalViewCtrl, this._activerBoutonsViewActionMenu));
this._gcmCalViewCtrl._listView[this._gcmCalViewCtrl._currentView].addActionListener(new AjxListener(this._gcmCalViewCtrl, this._activerBoutonsActionMenu));
}
MyZimlet.prototype._activerBoutonsViewActionMenu = function(ev) {
// "this" designe le controlleur de l'agenda ZmCalViewController
if (MyZimlet.idRdvCoupe != '') {
this._myZimlet._gcmViewActionMenu.enable(MyZimlet._OP_COLLER_RDV_PATIENT,true);
} else {
this._myZimlet._gcmViewActionMenu.enable(MyZimlet._OP_COLLER_RDV_PATIENT,false);
}
};
MyZimlet.prototype._activerBoutonsActionMenu = function(ev) {
(...)
} Here are the problems :
1) addListener on viewManager works well when I open directly Calendar (with "app=calendar" parameter in Zimbra URL). But when Zimbra first open on default Mail app, viewManager isn't yet initialized => I've got an error, because I can't add listener on a null viewManager in my zimlet init() function.
2) addListener on default calendar view works well when I open directly Calendar at Zimbra startup. But for same reason, it doesn't work for other calendar views, or when Zimbra start on another app.
How can I solve this problem, please ?
I think I could put these instructions directly in Zimbra
JS files, but I would like to make "clean" work, and keep all specific code in my Zimlet. Is it possible ?
3) I have another similar problem : I redefined some Zimbra standard functions, in order to modify Calendar hours scale like this :
Code:
ZmCalColView._HOUR_HEIGHT = 84;
ZmCalColView._HALF_HOUR_HEIGHT = ZmCalColView._HOUR_HEIGHT/2;
ZmCalColView._15_MINUTE_HEIGHT = ZmCalColView._HOUR_HEIGHT/4;
ZmCalColView._DAY_HEIGHT = ZmCalColView._HOUR_HEIGHT*24;
ZmCalColView.prototype._getBoundsForDate =
function(d, duration, col) {
(...)
}
ZmCalColView.prototype._getBoundsForCalendar =
function(d, duration, folderId) {
(...)
} This works well, except when I lauch Zimbra on Calendar app. Column where hours are displayed don't take care of my changes on default calendar view. Other views are OK.
I think there is a problem in the order in which things are executed. How may I solve this, without modifying Zimbra sources ?
Thanks for any help !