Results 1 to 3 of 3

Thread: Cannot get from address into dragSource

  1. #1
    hookmac123 is offline Member
    Join Date
    Jan 2009
    Posts
    12
    Rep Power
    6

    Default Cannot get from address into dragSource

    Here is a Zimlet that is supposed to do a Yahoo search on the From: address of an email that is dragged onto it:
    Code:
    <zimlet name="com_mydomain_test" version="1.0" description="Our Test Zimlet">
      <zimletPanelItem label="Yahoo Lookup Zimlet">
        <toolTipText>
          This Zimlet does a Yahoo lookup on an email address.
        </toolTipText>
        <dragSource type="ZmMailMsg">
          <canvas type="window" width="400" height="400" />
          <actionUrl method="get" target="http://search.yahoo.com/search">
            <param name="p">${obj.from}</param>
          </actionUrl>
        </dragSource>
      </zimletPanelItem>
    </zimlet>
    It does not work: the search that results is for the string "undefined". If I change "{$obj.from}" to "{$obj.subject}" I get a search on the email's subject; if I use ${obj.convId}" I get the correct conversation id. It only seems to fail with the from. The "to" attribute also fails.

    I checked the emails and they have From: headers of the form "From: John Public <jqpublic@mydomain.com>".

    Of the ones I tried, here are the ones that work
    • subject
    • date
    • id
    • convId
    • size


    and the ones that do not work (return "undefined"):
    • from
    • to

  2. #2
    rrao is offline Zimbra Employee
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    9

    Default

    thats because with in Zimbra, "from" is not a string, but an object with email, firstname, fullname etc properties. And unfortunately writing zimlets via xml has some limitation and doesnt do things like toString() or allow little more complex things to get the information needed.

    The good news is you can however write up a small javascript to get the same thing done.
    Code:
    com_mydomain_test.prototype.doDrop =
    function(zmObject) {
    	var from = "";
         if(zmObject.from) {
              from = zmObject.from[0];
         } else if(zmObject.participants) {//if conversation..
    	//get the first sender
    	var p = zmObject.participants;
    	for(var i =0; i < p.length; i++) {
    		if(p[i].type == "FROM") {
    			from = p[i].address;
    			break;
    		}			
    	}
         }
    
    	
         window.open("http://search.yahoo.com/search?p="+from);
     };
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    sposetti is offline Former Zimbran
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    5

    Default

    This is an older thread but posting this additional information for reference.

    This zimlet has an example of retrieving the from/to/cc addresses from a ZmMailMsg. This zimlet was written for ZCS 6.0:

    ZCS 6.0:Zimlet Developers Guide:Examples:Panel Item Drag Source Details - Zimbra :: Wiki

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Canonical address for the From: address from Blackberry?
    By bthom73 in forum Zimbra Connector for BlackBerry
    Replies: 4
    Last Post: 05-05-2009, 09:37 AM
  2. I got Ubuntu and Zimbra working
    By pacsteel in forum Installation
    Replies: 73
    Last Post: 06-23-2008, 11:41 AM
  3. Auto-link to shared address books?
    By ragaskar in forum Users
    Replies: 2
    Last Post: 02-11-2008, 04:15 PM
  4. [SOLVED] Zimbra not syncing properly with Address Book and iCal
    By Colin Day in forum CalDAV / CardDAV / iSync
    Replies: 4
    Last Post: 07-13-2007, 08:52 AM

Posting Permissions

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