Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Simple lookup zimlet, help needed

  1. #11
    marcmac is offline Expert Member
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    13

    Default

    Your communication problem is probably because the site you're hitting isn't in the proxy allowed domains - check the ymaps config_template.xml for info on this.

    For debugging zimlets, learn to love the js debugger (venkman) that works with firefox. Load the app with ?mode=mjsf&gzip=false, and step through your code to find the problem.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  2. #12
    Dirk's Avatar
    Dirk is offline Moderator
    Join Date
    May 2006
    Location
    England.
    Posts
    927
    Rep Power
    9

    Default

    That javascript debugger looks very powerfull, thanks. I've installed it and when I view the section relating to the zimlet I'm working on, I see:

    Code:
     // Locale: en
        2 
        3 // Basename: /msgs/uk_co_oaktyres_stockcode
     -  4 function uk_co_oaktyres_stockcode(){}
        5 
        6 // resource bundle not found
    and I've no idea why that may be. I've spent a few days on this now and I'm close to simply giving up (at least for a few weeks) I dont know if writing zimlets is supposed to be this hard, but even with the ability to look at existing files, without a decent guide or syntax instruction, it's pretty damn hard to know what to do and how to get started. The fact that I'm trying to do something really quite basic, and still failing, is frustrating me no end.

    The code I have so far is below, if anyone has any comments, throw them in but for now I a server cabinet move to plan

    Code:
    config_template.xml
    <zimletConfig name="uk_co_oaktyres_stockcode" version="1.0">
      <global>
        <property name="allowedDomains">*</property>
      </global>
    </zimletConfig>
    Code:
    uk_co_oaktyres_stockcode.xml
    <zimlet name="uk_co_oaktyres_stockcode" version="1.0" description="Stock Code">
    	<include>ZmStockObjectHandler.js</include>
    	<handlerObject>uk_co_oaktyres_stockcode</handlerObject>
    	<contentObject type="stock">
            <matchOn>
                <regex attrs="ig">(?:\d\d\d\d\d\d\d\D+)\b</regex>
            </matchOn>
        </contentObject>
    </zimlet>
    Code:
    ZmStockObjectHandler.js
    function uk_co_oaktyres_stockcode() {
    }
    
    uk_co_oaktyres_stockcode.prototype = new ZmZimletBase();
    uk_co_oaktyres_stockcode.prototype.constructor = uk_co_oaktyres_stockcode;
    
    uk_co_oaktyres_stockcode.prototype.toolTipPoppedUp =
    function(spanElement, obj, context, canvas) {
    	canvas.innerHTML = context;
    	var request = new AjxRpcRequest("zimlet");
    	var info_url = "http://oaknet.oaktyres.co.uk:81/Cambra.asp?mode=stcode&id="+context;
    	var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(info_url);
    	request.invoke(null, url, null, new AjxCallback(this, uk_co_oaktyres_stockcode._callback, canvas), true);
    };
    
    uk_co_oaktyres_stockcode._callback =
    function(canvas, result) {
    	canvas.innerHTML = result.text;
    };

  3. #13
    riogd is offline Senior Member
    Join Date
    Apr 2006
    Posts
    50
    Rep Power
    8

    Default

    Did you ever resolve your proxy service and allowed domains problem ? I believe I am running into the same issues with both the template config and the COS configs. I have documented it more in detail here.
    I didn't find this post till after that one and am not entirely sure the problem is the same you were having, but if you've resolved your problem and it is the same could you please share your solution ?

    Cheers,

    RioGD

  4. #14
    riogd is offline Senior Member
    Join Date
    Apr 2006
    Posts
    50
    Rep Power
    8

    Default

    I believe I have found the problem, and it may be a bug. As reported elsewhere, the config_template only is applied to the default COS. Thus the only way to make Zimlets work under non-default COS's, that I have found, is to manually:
    Code:
    zmprov mc <non-default-COS> zimbraProxyAllowedDomains "*.domain.com"
    Now the rather large problem, and what makes this seem even more like a bug, is that although the config isn't applied to non-default COS's, re-deploying the Zimlet wipes out the zimbraProxyAllowedDomains for all non-default COS's. So each time you redeploy the Zimlet you have to go and make that manual change. This is why I was constantly getting 403's, my manual settings kept getting wiped without my knowing it.

    If it can automatically wipe my manual settings, it would be nice if it could automatically apply the supplied config settings I want to begin with so I don't need to do it manually I suspect this may also be why I couldn't access the global settings from within the js code, the config_template is probably not accessible from non-default COS's. Time to test that theory now.

    Cheers,

    RioGD

  5. #15
    JoshuaPrismon is offline Zimlet Guru & Moderator
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by Dirk View Post
    That javascript debugger looks very powerfull, thanks. I've installed it and when I view the section relating to the zimlet I'm working on, I see:

    Code:
     // Locale: en
        2 
        3 // Basename: /msgs/uk_co_oaktyres_stockcode
     -  4 function uk_co_oaktyres_stockcode(){}
        5 
        6 // resource bundle not found
    and I've no idea why that may be. I've spent a few days on this now and I'm close to simply giving up (at least for a few weeks) I dont know if writing zimlets is supposed to be this hard, but even with the ability to look at existing files, without a decent guide or syntax instruction, it's pretty damn hard to know what to do and how to get started. The fact that I'm trying to do something really quite basic, and still failing, is frustrating me no end.

    The code I have so far is below, if anyone has any comments, throw them in but for now I a server cabinet move to plan

    Code:
    config_template.xml
    <zimletConfig name="uk_co_oaktyres_stockcode" version="1.0">
      <global>
        <property name="allowedDomains">*</property>
      </global>
    </zimletConfig>
    Code:
    uk_co_oaktyres_stockcode.xml
    <zimlet name="uk_co_oaktyres_stockcode" version="1.0" description="Stock Code">
    	<include>ZmStockObjectHandler.js</include>
    	<handlerObject>uk_co_oaktyres_stockcode</handlerObject>
    	<contentObject type="stock">
            <matchOn>
                <regex attrs="ig">(?:\d\d\d\d\d\d\d\D+)\b</regex>
            </matchOn>
        </contentObject>
    </zimlet>
    Code:
    ZmStockObjectHandler.js
    function uk_co_oaktyres_stockcode() {
    }
    
    uk_co_oaktyres_stockcode.prototype = new ZmZimletBase();
    uk_co_oaktyres_stockcode.prototype.constructor = uk_co_oaktyres_stockcode;
    
    uk_co_oaktyres_stockcode.prototype.toolTipPoppedUp =
    function(spanElement, obj, context, canvas) {
    	canvas.innerHTML = context;
    	var request = new AjxRpcRequest("zimlet");
    	var info_url = "http://oaknet.oaktyres.co.uk:81/Cambra.asp?mode=stcode&id="+context;
    	var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(info_url);
    	request.invoke(null, url, null, new AjxCallback(this, uk_co_oaktyres_stockcode._callback, canvas), true);
    };
    
    uk_co_oaktyres_stockcode._callback =
    function(canvas, result) {
    	canvas.innerHTML = result.text;
    };
    You might check and see if the HTML that is getting returned is in a <html> tag or not. If it isn't, it might not display correct in pre Zimbra 5.0B3.

  6. #16
    ei99045 is offline Junior Member
    Join Date
    Jan 2007
    Posts
    7
    Rep Power
    8

    Default non-default COS

    @riogd: thank you for the non-default COS tip!

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. [SOLVED] Amavisd-Postfix RCPT TO Takes a long time
    By samuraii in forum Administrators
    Replies: 8
    Last Post: 02-11-2009, 03:34 PM
  3. Help needed. Simple Zimlet
    By Martinchin2289 in forum Zimlets
    Replies: 6
    Last Post: 11-24-2008, 03:12 AM
  4. Replies: 5
    Last Post: 01-11-2008, 05:34 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 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
  •