Results 1 to 8 of 8

Thread: How to change message subject from Zimlet?

  1. #1
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default How to change message subject from Zimlet?

    Hi guys! I have a question. I want to code manually some functionality that seems to be not presented in Zimbra. I have 2 users connected to 1 account. They see some message together. One of them must change the subject of this message and add string "<name of user 2>" at the begining of it to force User2 to process this message (read, understand, perform some actions and so on). Now I think, how can I do it. Suppose that I code some zimlet that lets the User1 to set up new subject for this message (integrated zimlet with menu items, dialogs, bla-bla - actually I don't know how to code it, but I will learn ). Now zimlet can send command from client to server side like "Change subject from <old subject> to <new subject> for message with ID = <message Id>" - through Ajax interface calling JSP page or somehow else... Okay. I'll do it. My server side module (for instance, JSP page) receives now this message. It knows message Id and new subject to set for this message. And there is my problem. I can't understand, how can I do it. I suppose that physically messages are stored as files in filesystem in some folder as text in MIME format, like Mozilla Thunderbird does for instance. If they are, I could find a file for particular MessageId, read it to memory using custom Java class, replace "Subject" field with new one from request and flush it down to the disk. Then 2 users synchronize their mailboxes with server and see that subject for this message have changed with value that have been set by User1. Is it good way to get functionality what I want? Or maybe there is more flexible way to do it? Maybe some standard API commands that JSP page can use? Some unterface to interacting with message store to change headers? Please, set me on the right way! Thank you very much!

    P.S. If you provide some code examples related to my ideas, it would be great!

  2. #2
    Join Date
    Jul 2006
    Location
    Pisa
    Posts
    135
    Rep Power
    9

    Default

    You have to use different code for embedded or new windows composing
    For embedded:

    var msg = this._composeView.getMsg();
    newSbj = "Your String" + msg.subject;
    this._composeView._setSubject(null, msg, newSbj);

    for new window

    var composeController = AjxDispatcher.run("GetComposeController");
    var subject = composeController._composeView._subjectField.value
    newSbj = "Your String" + subject;
    composeController._composeView._subjectField.value = newSbj;

    You can change the subject with a button or using the new function emailErrorCheck

  3. #3
    Join Date
    Jan 2010
    Posts
    161
    Rep Power
    5

    Default

    Quote Originally Posted by begemot View Post
    Hi guys! I have a question. I want to code manually some functionality that seems to be not presented in Zimbra. I have 2 users connected to 1 account. They see some message together. One of them must change the subject of this message and add string "<name of user 2>" at the begining of it to force User2 to process this message (read, understand, perform some actions and so on). Now I think, how can I do it. Suppose that I code some zimlet that lets the User1 to set up new subject for this message (integrated zimlet with menu items, dialogs, bla-bla - actually I don't know how to code it, but I will learn ). Now zimlet can send command from client to server side like "Change subject from <old subject> to <new subject> for message with ID = <message Id>" - through Ajax interface calling JSP page or somehow else... Okay. I'll do it. My server side module (for instance, JSP page) receives now this message. It knows message Id and new subject to set for this message. And there is my problem. I can't understand, how can I do it. I suppose that physically messages are stored as files in filesystem in some folder as text in MIME format, like Mozilla Thunderbird does for instance. If they are, I could find a file for particular MessageId, read it to memory using custom Java class, replace "Subject" field with new one from request and flush it down to the disk. Then 2 users synchronize their mailboxes with server and see that subject for this message have changed with value that have been set by User1. Is it good way to get functionality what I want? Or maybe there is more flexible way to do it? Maybe some standard API commands that JSP page can use? Some unterface to interacting with message store to change headers? Please, set me on the right way! Thank you very much!

    P.S. If you provide some code examples related to my ideas, it would be great!
    Were you able to get this to work? I also am trying to figure a way to create a zimlet that will allow a user to click a buttom that will basically invisibly tack something to the subject line automatically.

    Thanks!

  4. #4
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default

    No, I were not... I have refused this idea. I think, it is impossible. I wrote a zimlet, allowing operators of service desk to process messages in the common folder, and for distribution of messages on operators have created a set of custom labels - instead of operator 's name in the message subject. So the tag corresponding to the appointed operator was exposed on message. If your set of subject's additional strings is limited by quantity, it's possible to you use tags too, maybe it will help...

  5. #5
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default

    Aaa... stupid! I didn't see message above... but anyway, is it a way to changes "real" subject? As I understand, a message is presented in 2 instances - on the server as file in store and database metadata record; and in memory of my client workstation and on it's screen, synchronized with 1st instance. If I use _composeView._setSubject(), does Web Client send data back to server? You see, post was about working in common folder, so these changes must be applied on server too, to be available to other users who are watching the same folder...

  6. #6
    Join Date
    Jan 2010
    Posts
    161
    Rep Power
    5

    Default

    Quote Originally Posted by begemot View Post
    Aaa... stupid! I didn't see message above... but anyway, is it a way to changes "real" subject? As I understand, a message is presented in 2 instances - on the server as file in store and database metadata record; and in memory of my client workstation and on it's screen, synchronized with 1st instance. If I use _composeView._setSubject(), does Web Client send data back to server? You see, post was about working in common folder, so these changes must be applied on server too, to be available to other users who are watching the same folder...
    Oh.. Im just trying to create a zimlet button that will basically say 'send secure' When the user presses it - the zimlet tacks [secure] onto the subject then sends the message on its way. It seems like it would be really easy, if I knew how to program in javascript at all. Alas, I do not.

    -

  7. #7
    Join Date
    Jul 2006
    Location
    Pisa
    Posts
    135
    Rep Power
    9

    Default

    To create a button on zcs 6.x I use

    It_Seacom_myzimlet.NB = "NB";

    It_Seacom_myzimlet.prototype.initializeToolbar = function(app, toolbar, controller, viewId) {
    if (viewId.indexOf("COMPOSE") >= 0) {
    this._initComposeJMToolbar(toolbar, controller);
    }
    };

    It_Seacom_myzimlet.prototype._initComposeJMToolbar = function(toolbar, controller) {
    if (!toolbar.getButton(It_Seacom_myzimlet.NB)) {
    ZmMsg.jmAdd = "myzimlet";
    ZmMsg.jmTooltip = "instruction";
    var btn = toolbar.createOp(It_Seacom_myzimlet.NB, {text:ZmMsg.jmAdd, tooltip:ZmMsg.jmTooltip, index:5, image:"myzimlet-barIcon"});
    toolbar.addOp(It_Seacom_myzimlet.NB, 2);
    btn.addSelectionListener(new AjxListener(this, this.uploadDialog));
    this._composerCtrl = controller;
    }
    };

  8. #8
    Join Date
    Jan 2010
    Posts
    161
    Rep Power
    5

    Default

    Quote Originally Posted by lfasci View Post
    To create a button on zcs 6.x I use

    It_Seacom_myzimlet.NB = "NB";

    It_Seacom_myzimlet.prototype.initializeToolbar = function(app, toolbar, controller, viewId) {
    if (viewId.indexOf("COMPOSE") >= 0) {
    this._initComposeJMToolbar(toolbar, controller);
    }
    };

    It_Seacom_myzimlet.prototype._initComposeJMToolbar = function(toolbar, controller) {
    if (!toolbar.getButton(It_Seacom_myzimlet.NB)) {
    ZmMsg.jmAdd = "myzimlet";
    ZmMsg.jmTooltip = "instruction";
    var btn = toolbar.createOp(It_Seacom_myzimlet.NB, {text:ZmMsg.jmAdd, tooltip:ZmMsg.jmTooltip, index:5, image:"myzimlet-barIcon"});
    toolbar.addOp(It_Seacom_myzimlet.NB, 2);
    btn.addSelectionListener(new AjxListener(this, this.uploadDialog));
    this._composerCtrl = controller;
    }
    };
    I have absolutely no javascript experience whatsoever, so I am trying to dissect this in a manner that I can use. I guess I will just have to read read read the docs whenever I get a chance and try to cobble together what I need. Ive tried all sorts of example code, but nothing seems to do anything. I managed to get the sample toolbar button to work, but I havent been able to get a button to show up in the compose tab or window.

Similar Threads

  1. Zimlet for change Samba (Domain) Password
    By pbruna in forum Zimlets
    Replies: 1
    Last Post: 07-09-2010, 05:27 PM
  2. Logging message subject
    By evsta in forum Administrators
    Replies: 0
    Last Post: 10-08-2009, 07:25 AM
  3. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 08:38 AM
  4. Change Zimlet Icon??
    By kirme3 in forum Zimlets
    Replies: 3
    Last Post: 01-09-2008, 09:10 AM
  5. Zimlet Error Message
    By dmgood in forum Zimlets
    Replies: 0
    Last Post: 09-08-2006, 04:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •