View Single Post
  #12 (permalink)  
Old 09-06-2006, 02:32 AM
Dirk Dirk is offline
Moderator
 
Join Date: May 2006
Location: England
ZCS Version: Release 5.0.10_GA_2638.UBUNTU6 UBUNTU6 NETWORK edition
Posts: 494
Dirk is on a distinguished road
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;
};
Reply With Quote