Get right click email in zimlet

Interested in talking about Mash-up's? This is the place.
Post Reply
YodaMaster
Posts: 1
Joined: Tue Mar 24, 2015 8:57 am

Get right click email in zimlet

Post by YodaMaster »

I'm create zimlet which add menu item to 'on-right-click' conversation menu. But I can't get right clicked message id. I always get last left clicked message id. I try tips from other topics like use this code:

appCtxt.getCurrentController()._listView[t._currentViewId].getDnDSelection().id

but still get wrong id. My code:


pagesampleZimlet.prototype.onActionMenuInitialized =
function (controller, menu) {
this.addMenuButton(controller, menu);
};



pagesampleZimlet.prototype.addMenuButton =
function (controller, actionMenu) {
var opEditAsNew = actionMenu.getOp(ZmOperation.EDIT_AS_NEW);
var opEditAsNewIndex = actionMenu.getItemIndex(opEditAsNew);

actionMenu.createOp("INOTIS_CONTEXT_SECTION", {
style: DwtMenuItem.SEPARATOR_STYLE,
index: opEditAsNewIndex + 1
});

menuItemAttr = {
text: "Assign with case",
image: "SlideCaratGrey",
index: opEditAsNewIndex + 2
};
var clearattachZimletButton = actionMenu.createOp("ASSIGN_WITH_CASE_CONTEXT_BUTTON", menuItemAttr);
clearattachZimletButton.addSelectionListener(new AjxListener(this, this._addedButtonListener, [controller]));
controller.operationsToEnableOnMultiSelection.push("ASSIGN_WITH_CASE_CONTEXT_BUTTON");
}


pagesampleZimlet.prototype._addedButtonListener =
function (controller) {
this.archiveOptionsView = new DwtComposite(this.getShell());
this.archiveOptionsView.getHtmlElement().style.overflow = "auto";
this.archiveOptionsView.getHtmlElement().innerHTML = this._createArchiveView();
this.archiveOptionsView.setSize("340", "180");
var dialog_args = {
title: "tb_archive",
view: this.archiveOptionsView,
standardButtons: [DwtDialog.OK_BUTTON, DwtDialog.DISMISS_BUTTON],
parent: this.getShell()
};
this.archiveDialog = new ZmDialog(dialog_args);
this.archiveDialog.setButtonListener(DwtDialog.OK_BUTTON, new AjxListener(this, this.okBtnListener, [controller, this.archiveDialog]));

if (!this.archiveDialog.isPoppedUp()) {
this.archiveDialog.popup();
}
};


pagesampleZimlet.prototype.okBtnListener =
function (controller, archiveDialog) {
alert("okBtnListener");
//var message = controller.getMsg();

var inputValue = document.getElementById('taskNumber').value

AjxRpc.invoke(null, ${api.address} +"?" + ${api.address.mail.property} +"=" + appCtxt.getCurrentController()._listView[t._currentViewId].getDnDSelection().id +
"&" + ${.api.address.taskNumber.property} +"=" + inputValue, {"Content-Type": "text/html"},
new AjxCallback(this, this._handleInotisInfoResponse), true);

archiveDialog.popdown();
};



pagesampleZimlet.prototype._createArchiveView = function () {
var html = new Array();
var i = 0;

html[i++] = "<div id='archiveDiv'>";
html[i++] = "<label for='taskNumber'>Task Number:</label>";
html[i++] = "<input type='text' id='taskNumber'/>";
html[i++] = "</div>";

return html.join("");
};


Ruslan.Sovinskyy
Posts: 2
Joined: Thu Apr 02, 2015 1:50 pm

Get right click email in zimlet

Post by Ruslan.Sovinskyy »

I have the EXACT same issue!

I have dug down to the source and API and still no idea how other options do it (Mark as read/un read, delete, print)

Does anyone have a solution or a general direction where to look for one?

Thank you
Ruslan.Sovinskyy
Posts: 2
Joined: Thu Apr 02, 2015 1:50 pm

Get right click email in zimlet

Post by Ruslan.Sovinskyy »

Found the answer!



appCtxt.getAppViewMgr()._views.CLV.main.getSelection()



You need to get to AppViewMgr, that will have all the views that are loaded into the screen. It has an array of _views. In there go for CVL and then main, which will return you an DwtListView. Calling getSelection() will return an array of selected email objects
Post Reply