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 04-16-2007, 02:07 PM
Active Member
 
Posts: 29
Default Help with first Zimlet

I'm writing my first zimlet to pull property card information and am having an issue... For some reason, it doesn't seem to insert the pin into the URL correctly. No idea why. Regexes aren't my strongest...


Data sent to the zimbra proxy service
Code:
target=http://appserver/zimlets/pin2xml.php?pin=(UNDEFINED%20-%20str%20'$%7Bsrc.$1%7D'%20obj%20'%5Bobject%20Object%5D')
com_zimbra_mcis_property.xml
Code:
<zimlet name="com_zimbra_mcis_property" version="1.0" description="MCIS Property Card">
        <resource>mcisproperty.xsl</resource>
        <contentObject>
        <matchOn>
            <regex attrs="ig">(?:\d{2}-\d{2}-\d{3}-\d{3})</regex>
        </matchOn>
        <toolTip>
            <actionUrl target="http://appserver/zimlets/pin2xml.php" xslt="mcisproperty.xsl">
                <param name="pin">${src.$1}</param>
            </actionUrl>
        </toolTip>
    </contentObject>
</zimlet>
mcisproperty.xsl
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:template match="propertycard">
    <div><b>Pin:</b>                     <xsl:value-of select="pin"/></div>
    <div><b>Owner:</b>                   <xsl:value-of select="titleholder"/></div>
    <div><b>Address:</b>                 <xsl:value-of select="address"/></div>
    <div><b>City/State/Zip:</b>          <xsl:value-of select="csz"/></div>
    <div><b>Class:</b>                   <xsl:value-of select="class"/></div>
    <div><b>Homestead:</b>               <xsl:value-of select="homestead"/></div>
  </xsl:template>
  <xsl:template match="text()|@*"/>
</xsl:stylesheet>
config_template.xml
Code:
<zimletConfig name="com_zimbra_mcis_property" version="1.0">
        <global>
                <property name="url">http://ubuntuapp.co.marshall.ia.us/zimlets/pin2xml.php</property>
        <property name="allowedDomains">*.co.marshall.ia.us</property>
    </global>
</zimletConfig>
Strings to match
Code:
nn-nn-nnn-nnn (anywhere in message)
Parcel nnnnnnnnnn (case insensitive anywhere in message)
PIN nnnnnnnnnn (case insensitive anywhere in message)
Reply With Quote
  #2 (permalink)  
Old 04-17-2007, 12:42 AM
Former Zimbran
 
Posts: 5,606
Default

Is: http://appserver/zimlets/pin2xml.php? on the zimbra server?

If so, it should be:
http://appserver/service/zimlet/(name of deployed zimlet)pin2xml.php?

If it's not, It might be helpful if you put it there. We run php, and the script probably will run fine.
There might be some cross-domain security issues, and perhaps that's what's happening.
Reply With Quote
  #3 (permalink)  
Old 04-17-2007, 05:05 AM
Active Member
 
Posts: 29
Default

The PHP script isn't on the Zimbra server - it's on a second app server. Zimbra is sending the request via the Zimbra server (/service/proxy, I think) to the app server. The problem I'm having is what it's passing in the target. Rather than a result from the regex, it looks like an error message.
Reply With Quote
  #4 (permalink)  
Old 04-17-2007, 11:57 AM
Active Member
 
Posts: 29
Default

Quick update.. Based on what is in the URL, it looks like the mail client is inserting what is below as the variable returned by the regex - I've URL decoded it..

Code:
(UNDEFINED - str '${src.$1}' obj '[object Object]')
Reply With Quote
  #5 (permalink)  
Old 04-17-2007, 12:52 PM
Active Member
 
Posts: 29
Default

Ok.. Figured it out..

Replaced...

Code:
<param name="pin">${src.$1}</param>
...with...

Code:
<param name="pin">${src.objectContent}</param>
...and all is fine.
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.