With the help of jtroxel, I now have a dotProject email module working.
Drag and email onto it, it asks the users to put in a project number, task id, and there is a section for a quick internal note. After the user hits the ok button, the info is passed to dotProject and consumed.
In dotProject important project emails can be archived. Users can search by user, project, or clients. The advantage is if you have large teams with many streams of communication they can be centralized into one place.
We ran into a few unexpected problems that took quite a bit of time to work around. Some still need improvement.
1. doDrop for ZmMsg and ZmConv - ZmMsg has data types for from,to,cc, bcc, date, subject, body and a few others. ZmConv has different attributes, it's realy an array of messages. ZmConv does not have to, from, cc, but has participants. Participants is the first 5 people in all the related emails.
1.a If you drag a ZmMsg, zimbra passes it as a ZmConv and the script hangs or does not extract the correct attributes as I need them. I decided to only allow the ZmMsg to be allowed to drag and drop. I will have users that won't understand the difference. Hint, if their default for their inbox is by message, this works great. If their default is by Conversation, not so good they have to click on the conversation so it will list the messages in the conversation then they can drag and drop. I tried using the getHotMsg in the ZmConv class, but I had no success.
2. Post, if you want to post data to another site, for now I'd stay away from the AjxRcp class. The best thing to do is render the form as html and have the user click ok and use a target = new window. John did the code for that. I posted some of the fragments below of what you will need.
Code:
html[i++] = "<form method=\"POST\" id=\"dp_form\" action=\"" + this.HANDLER + "\" TARGET=\"new_popup\">";
Code:
dlg.popup();
dlg.setButtonListener(DwtDialog.OK_BUTTON,
new AjxListener(this, function() {
//this._postDialog();
var w = window.open('about:blank','new_popup','width=600,height=600,resizable=1');
this.dpForm.submit();
w.focus();
dlg.popdown();
dlg.dispose();
})); 1.b I tried getting the id for the first message in the ZmConv array and pulling that ZmMsg in by id, I may still do that when I get more time. I needed to get this working by next week.
3. formatting the time of the email. I found a block of code that works.
Code:
var formatter = AjxDateFormat.getDateTimeInstance(AjxDateFormat.FULL);
var xdate = formatter.format(new Date(obj.date)) ;
4. extracting the email addresses from obj.to, obj.cc. These are arrays, for a quick test you can do obj.to[1] if you have a few cc's. You will notice that if you render out html your code will break if the email is in the format "ericx"
ericx@domain.com. It's easy to strip the "ericx" out and just get the email address try: obj.to[1].address - this will return just
ericx@domain.com. Since it is an array you will have to loop through the array.
5. to get the obj.from I used simply
Code:
var email_from = obj.from[0].address; to get the from address.
I'm not ready to post my code yet, but if your interested send me an email through the forums.