updating displayAdditionHdrsInMsgView without a refresh

Interested in talking about Mash-up's? This is the place.
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 277
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: Release 8.7.11_GA_1854.RHEL6_64.P6
Contact:

updating displayAdditionHdrsInMsgView without a refresh

Postby JDunphy » Wed Mar 28, 2018 1:10 am

Was looking through the zimlet samples on github and I saw this pattern repeated a few times and thought I would improve it.
During the zimlet initialization, they do something like this.

Code: Select all

if (appCtxt.get(ZmSetting.MAIL_ENABLED)) {
                AjxPackage.require({name:"MailCore", callback:new AjxCallback(this, this._applyRequestHeaders)});
 }

which does nothing more than invoke this one time

Code: Select all

ZmMailMsg.requestHeaders["X-Mailer"] = "X-Mailer";
ZmMailMsgView.displayAdditionalHdrsInMsgView[X-Mailer"] = this.getMessage("XMailerZimlet_label_sent");

which displays the header in the MsgView area when the user clicks on a message. Later on, the zimlet allows the user to turn this feature on/off via a preference dialog. This is the area I would like to improve. They do the following:

Code: Select all

        if(this._reloadRequired) {
                window.onbeforeunload = null;
                var url = AjxUtil.formatUrl({});
                ZmZimbraMail.sendRedirect(url);
        }

which forces a refresh of the users browser for the purpose to start the zimlet initialization sequence again but this time through they make sure not to set additionalHdrsInMsgView headers by returning before setting up that callback I show above.

Is there a way of removing that header vs restarting this zimlet and all others? I was hoping to find a call to either update the requestHeaders or remove it completely without a browser refresh. I was looking inside zm-web-client/WebRoot/js/zimbraMail/mail/view for some ideas but could be in the wrong area. I am beginning to look at how zimbra is put together and thought these zimlets could be a great way to learn as I go. Stumped out of the gate. :-)

My plan B is trying it via onMsgView but I am curious if there is a better or simpler way.

Thanks for any clues.

Jim


Return to “Zimlets”

Who is online

Users browsing this forum: No registered users and 2 guests