Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-2010, 08:32 PM
Member
 
Posts: 14
Default [SOLVED] how do i call the zmprov command in zimlet?

Hello,

I want to call the zmprov command in zimlet to disable the "save to sent" function temporally, my zmprov command is :

zmprov ma user@domain.com zimbraPrefSaveToSent FALSE;

How do i call this command in zimlet?

Please help.
Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-12-2010, 02:45 PM
Project Contributor
 
Posts: 92
Default

Hi chengkinhung,

zmprov just send SOAP request to Zimbra server.
So I think, in your zimlet, you better send the same request as zmprov does.
Reply With Quote
  #3 (permalink)  
Old 10-12-2010, 05:18 PM
Member
 
Posts: 14
Default

Thank yutaka,

I am new in zimbra and zimlet, could you give me a sample code? or any tips how to do it? Thanks again.
Reply With Quote
  #4 (permalink)  
Old 10-12-2010, 08:29 PM
Zimbra Employee
 
Posts: 187
Default

Take a look at Force Read Receipt & Auto-Accept Read Receipt | Zimbra :: Gallery Zimlet. This Zimlet first checks if "zimbraPrefMailSendReadReceipts" property is set to always, if not it sets "zimbraPrefMailSendReadReceipts" to "always".

<code>
/**
* Sets Send read-receipt to "Always"
*/
ForceReadReceiptZimlet.prototype.setSendReceiptToA lways =
function() {
if(appCtxt.getActiveAccount().settings.get("MAIL_S END_READ_RECEIPTS") == "always") {
return;
}
if (appCtxt.get(ZmSetting.MAIL_READ_RECEIPT_ENABLED)) {
var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
var node = soapDoc.set("pref", "always");
node.setAttribute("name", "zimbraPrefMailSendReadReceipts");
var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:true, callback:respCallback});
}
};
</code>
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #5 (permalink)  
Old 10-13-2010, 12:25 AM
Member
 
Posts: 14
Default

Hi, rrao,

Thanks for you quick helping, i had download the Force Read Receipt & Auto-Accept Read Receipt | Zimbra :: Gallery

then copy and change code:

Quote:
MyMailZimlet.prototype.setSaveToSendFalse =
function() {
if(appCtxt.getActiveAccount().settings.get("SAVE_T O_SENT") == FALSE) {
appCtxt.setStatusMsg("SAVE_TO_SENT: FALSE", ZmStatusView.LEVEL_INFO);
return;
}

if (appCtxt.get(ZmSetting.SAVE_TO_SENT)) {
var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
var node = soapDoc.set("pref", FALSE);
node.setAttribute("name", "zimbraPrefSaveToSent");
var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:true, callback:respCallback});
}
};

MyMailZimlet.prototype._handlePrefChangeResponse =
function() {

But this code is not working, any idea?
Reply With Quote
  #6 (permalink)  
Old 10-13-2010, 07:27 PM
Member
 
Posts: 14
Default

Thank ever body, finially i fixed the problem and the code is working:

Quote:
/**
* Sets SaveToSend to "FALSE"
*/

MyMailZimlet.prototype.setSaveToSendFalse =
function() {
var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
var node = soapDoc.set("pref", "FALSE");
node.setAttribute("name", "zimbraPrefSaveToSent");
var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:false, callback:respCallback});
};

/**
* Sets SaveToSend to "TRUE"
*/
MyMailZimlet.prototype.setSaveToSendTrue =
function() {
var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
var node = soapDoc.set("pref", "TRUE");
node.setAttribute("name", "zimbraPrefSaveToSent");
var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:false, callback:respCallback});
};

MyMailZimlet.prototype._handlePrefChangeResponse =
function() {
//do nothing as this should happen in the background.
};
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.