| 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.
|  | | 
09-05-2006, 07:19 AM
| | Zimbra Employee | |
Posts: 2,103
| | 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. | 
09-06-2006, 01:32 AM
| | | 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;
}; | 
09-06-2007, 09:34 AM
| | | 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 | 
09-07-2007, 11:39 AM
| | | 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 | 
09-07-2007, 12:24 PM
| | Zimlet Guru & Moderator | |
Posts: 467
| | Quote:
Originally Posted by Dirk 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. | 
09-20-2007, 08:32 AM
| | | non-default COS @riogd: thank you for the non-default COS tip! | | Thread Tools | Search this Thread | | | | | Display Modes | Linear Mode | | Why Join? Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.  |