Results 1 to 9 of 9

Thread: [SOLVED] Sending ZmAppt startDate via actionUrl param & to a PHP script

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Location
    California
    Posts
    8
    Rep Power
    8

    Default [SOLVED] Sending ZmAppt startDate via actionUrl param & to a PHP script

    I'm having a bit of trouble getting the startDate of an appointment sent to a PHP script that I'm writing. The subject, location, and notes for the appointment seem to be getting to the script just fine, but the date does not. Is it some other data type other than integer? (The Zimlet Whitepaper says that it's an integer). I'm pretty sure something is being sent, or the php script would send back an empty string rather than "undefined." (See code samples, and the output I'm getting below).

    Thanks for any help that anyone might provide. I'm really diggin' Zimbra, by the way; it's a really nice system. Thanks for making an open source version.

    I'm running the 4.5.7_GA_1319.UBUNTU6 UBUNTU6 FOSS edition release running under Ubuntu server 6.06.

    Here's the bit of the Zimlet's XML definition I'm having trouble with:
    Code:
    <dragSource type="ZmAppt">
            <canvas type="dialog" title="Server Response" width="200"/>
    	<actionUrl target="http://externalserver/myscript.php">
    		<param name="apptSubject">${obj.subject}</param>
    		<param name="apptLocation">${obj.location}</param>
    		<param name="apptNotes">${obj.notes}</param>
    		<param name="apptStartDate">${obj.startDate}</param>
    	</actionUrl>
    </dragSource>
    Here's the PHP script I was testing with:
    PHP Code:
    $subject   $_REQUEST['apptSubject'];
    $location  $_REQUEST['apptLocation'];
    $notes     $_REQUEST['apptNotes'];
    $startdate $_REQUEST['apptStartDate'];

    echo 
    "Subject: ".$subject."<br />";
    echo 
    "Location: ".$location."<br />";
    echo 
    "Notes: ".$notes."<br />";
    echo 
    "Start Date: ".$startdate."<br />"
    When I drop an appointment into my Zimlet I get this output in the Server Response dialog I setup:

    Subject: Test Subject
    Location: Test Location
    Notes: Some notes about stuff
    Start Date: undefined

  2. #2
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    10

    Default

    Quote Originally Posted by emoulton View Post
    I'm having a bit of trouble getting the startDate of an appointment sent to a PHP script that I'm writing. The subject, location, and notes for the appointment seem to be getting to the script just fine, but the date does not. Is it some other data type other than integer? (The Zimlet Whitepaper says that it's an integer). I'm pretty sure something is being sent, or the php script would send back an empty string rather than "undefined." (See code samples, and the output I'm getting below).

    Thanks for any help that anyone might provide. I'm really diggin' Zimbra, by the way; it's a really nice system. Thanks for making an open source version.

    I'm running the 4.5.7_GA_1319.UBUNTU6 UBUNTU6 FOSS edition release running under Ubuntu server 6.06.

    Here's the bit of the Zimlet's XML definition I'm having trouble with:
    Code:
    <dragSource type="ZmAppt">
            <canvas type="dialog" title="Server Response" width="200"/>
    	<actionUrl target="http://externalserver/myscript.php">
    		<param name="apptSubject">${obj.subject}</param>
    		<param name="apptLocation">${obj.location}</param>
    		<param name="apptNotes">${obj.notes}</param>
    		<param name="apptStartDate">${obj.startDate}</param>
    	</actionUrl>
    </dragSource>
    Here's the PHP script I was testing with:
    PHP Code:
    $subject   $_REQUEST['apptSubject'];
    $location  $_REQUEST['apptLocation'];
    $notes     $_REQUEST['apptNotes'];
    $startdate $_REQUEST['apptStartDate'];

    echo 
    "Subject: ".$subject."<br />";
    echo 
    "Location: ".$location."<br />";
    echo 
    "Notes: ".$notes."<br />";
    echo 
    "Start Date: ".$startdate."<br />"
    When I drop an appointment into my Zimlet I get this output in the Server Response dialog I setup:

    Subject: Test Subject
    Location: Test Location
    Notes: Some notes about stuff
    Start Date: undefined
    You might try using Firefox and Firebug, setting a breakpoint in ZmZimletContext._zmObjectTransformers and see if you can see what is going on there. I just looked at the code, andit seemed correct.

  3. #3
    Join Date
    Aug 2007
    Location
    California
    Posts
    8
    Rep Power
    8

    Default

    Thanks for the response.

    I've never used Firebug before, but I installed it and took a look around. Just to clarify: I'm assuming that ZmZimletContext._zmObjectTransformers is a function somewhere in the Zimbra code, and you're suggesting that I use firebug to break the execution of this function to see what it's doing; see if it's passing back bad data to the Zimlet I wrote, right?

  4. #4
    Join Date
    Aug 2007
    Location
    California
    Posts
    8
    Rep Power
    8

    Default Still A Bit Confused...

    Sorry that I've not followed up until now; I haven't had a chance to work on this until today. Here is what I've (not) found out so far:

    In firebug I can't seem to find where ZmZimletContext._zmObjectTransformers is defined. I'm not sure if it's a function, object, or what, but I searched all the script files loaded up by firebug, and found only a few references to it. I put breakpoints on all of them, but only the if statement below was executed when I dragged and dropped my appointment onto my Zimlet.

    I set a breakpoint in the file ZimbraMail_all.js.zgz in an if statement:
    Code:
    if(ZmZimletContext._zmObjectTransformers[type]){
    return ZmZimletContext._zmObjectTransformers[type](obj);
    }else{
    return obj;
    }
    The line numbers start with 1378 (at the if statement), and I set a breakpoint at the if statement, and the two return statements. When I drag and drop the appointment the if statement is evaluated as true, and the line return ZmZimletContext._zmObjectTransformers[type](obj); is run.

    I'm pretty lost here, any more ideas?

    Thanks!
    Last edited by emoulton; 10-31-2007 at 12:16 PM.

  5. #5
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    10

    Default

    Quote Originally Posted by emoulton View Post
    Sorry that I've not followed up until now; I haven't had a chance to work on this until today. Here is what I've (not) found out so far:

    In firebug I can't seem to find where ZmZimletContext._zmObjectTransformers is defined. I'm not sure if it's a function, object, or what, but I searched all the script files loaded up by firebug, and found only a few references to it. I put breakpoints on all of them, but only the if statement below was executed when I dragged and dropped my appointment onto my Zimlet.

    I set a breakpoint in the file ZimbraMail_all.js.zgz in an if statement:
    Code:
    if(ZmZimletContext._zmObjectTransformers[type]){
    return ZmZimletContext._zmObjectTransformers[type](obj);
    }else{
    return obj;
    }
    The line numbers start with 1378 (at the if statement), and I set a breakpoint at the if statement, and the two return statements. When I drag and drop the appointment the if statement is evaluated as true, and the line return ZmZimletContext._zmObjectTransformers[type](obj); is run.

    I'm pretty lost here, any more ideas?

    Thanks!
    _zmObjectTransformers is a array of procedures that take the type of object, and run it against it. If you look a above where the array is set, you will see procedures that are defined for every object type that can be dragged to a zimlet.

  6. #6
    Join Date
    Aug 2007
    Location
    California
    Posts
    8
    Rep Power
    8

    Default

    From what I can see in firebug it looks like the start date of the appointment is being converted correctly. The object that's passed back has a parameter set called startDate with what looks like a start date in it. It looks like the _zmObjectTransformers stuff is working, but the data isn't being sent to the php script. Firebug tells me that Zimbra is sending apptStartDate=undefined. Any more ideas on where in the Zimbra code I should look next? What part of the code is handling the XML actionUrl tags that send the data?

    Oh yes, I've just upgraded to version 4.5.10 to see if it would make a difference, and it hasn't.

    I'm going to try and figure out how to handle things in JavaScript, and see if that works any differently, but it might take me a while to get around to doing so. I'll post whatever I find out about it here.

    Thanks for all your help so far JoshuaPrismon, I really appreciate it.

Similar Threads

  1. Replies: 3
    Last Post: 07-19-2007, 03:00 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
  •