Page 1 of 2

Zimlets

Posted: Wed Jan 11, 2006 4:16 pm
by 12419Awol
I downloaded the Zimlets Preliminary draft found on your blog. Spent my afternoon trying to figure out how to create my own zimlets. Now I think I understand what is going on but still confused on how they actually work.
Been looking at the com_zimbra_url zimlet as my learning tool while trying to learn what I need to learn. I understand the definition file quite well. My problem comes from looking at the com_zimbra_url.zip contents it includes a javascript file and a class file. I'm trying to place how these are being called in the whole picture.
Unless I'm misunderstanding the xml file. (which is possible) Besides defining the include and resources I don't see where it makes use of the javascript file. As the xml file has the regex for the match and the 2 actions that can be taken on the matched content. Am I missing something here? It looks like to me the com_zimbra_url zimlet could work without the javascript code. This is why I'm confused about the whole thing, maybe looking at the com_zimbra_url zimlet as my basic learning tool was a bad choice but it basically does what I want my custom zimlet to do (get info from a website and display it in a bubble).
On a side note any help regarding zimlets would be greatful, including any simple zimlet test code to help me learn more about creating them. Thank you.

Zimlets

Posted: Wed Jan 11, 2006 6:27 pm
by 14319KevinH
The URL Zimlet is a good one for what your trying to do it seems. As you said it should be possible to complete this Zimlet without any JavaScript code but some things for the time being need to be written in JavaScript. In the URL Zimlet in particular we do some re-wrting of the regex match and define the detials of the linking and image hover.
You'll see the Com_Zimbra_Url this tells the Zimlet framework which JavaScript object to create to init this Zimlet. All the code for the ~10 sample zimlets are available in the CVS tree. You should also see this in the zimlets directory on your install.
If you have specfic questions about writing a Zimlet we can try to anwser that here.

Zimlets

Posted: Thu Jan 12, 2006 8:52 am
by 12419Awol
[QUOTE]

As you said it should be possible to complete this Zimlet without any JavaScript code but some things for the time being need to be written in JavaScript. In the URL Zimlet in particular we do some re-wrting of the regex match and define the detials of the linking and image hover.

[/QUOTE]
For my knowledge and to save on some headaches what needs to be in JavaScript currently for it to work? I'm assuming JavaScript is currently needed cause zimlets and Zimbra are still in beta and therefore still being coded.

Zimlets

Posted: Thu Jan 12, 2006 11:21 am
by 14319KevinH
[quote user="12419Awol"]For my knowledge and to save on some headaches what needs to be in JavaScript currently for it to work? I'm assuming JavaScript is currently needed cause zimlets and Zimbra are still in beta and therefore still being coded.[/QUOTE]
It depends on what you want your Zimlet to do. If you just want to display some text from a static URL with a param you can do that without JavaScript. If you want to make a more complex Webservice call then that requires JavaScript. Can you give me some more informaiton about what your trying to do? This might be easier to help you with your problem than disscuss the issues in general. For the most part simple Zimlets can be built in hours/minutes.

Zimlets

Posted: Thu Jan 12, 2006 1:29 pm
by 12419Awol
[QUOTE]It depends on what you want your Zimlet to do.[/QUOTE]
Oh ok the way I read your first reply made it sound like you needed to use Javascript for now to do it. Misunderstanding on my part.
Here is what I'm trying to do. I work for a trade association and I thought it be nice to parse member numbers out in email and when you hover the number it would show the member information. To do this we would simple write a script on out webserver in which the member number could be passed. Returning the text we want to return. I have a few other ideas as well but they are all the same just different data.

Zimlets

Posted: Thu Jan 12, 2006 2:06 pm
by 14319KevinH
Ok cool. So you'll just need a regex to pick out the member numbers and then define a simple toolTipPoppedUp method to fetch and display the returned data. Your JS code would look something like:


Com_name_zimlet.prototype.toolTipPoppedUp =

function(spanElement, obj, context, canvas) {

canvas.innerHTML = context;

var request = new AjxRpcRequest("zimlet");

var info_url = +context;

var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(info_url);

request.invoke(null, url, null, new AjxCallback(this, Com_name_zimlet._callback, canvas), true);

};
Com_name_zimlet._callback =

function(canvas, result) {

canvas.innerHTML = result.text;

};


Zimlets

Posted: Thu Jan 12, 2006 4:46 pm
by Service
Would it be possible to modify the phone zimlet to launch a SIP application (like xten) from zimbra instead of skype? If so, any tips on how to get started on this?

Zimlets

Posted: Thu Jan 12, 2006 5:09 pm
by 14319KevinH
[quote]Would it be possible to modify the phone zimlet to launch a SIP application (like xten) from zimbra instead of skype? If so, any tips on how to get started on this?[/QUOTE]
Sure. We currently use the callto: handle in the browser. If your sip application already handles browser callto: links then you should not need to make any changes.

Zimlets

Posted: Fri Jan 13, 2006 12:37 pm
by 12419Awol
First off thanks for all the help Kevin. I only have 1 more issue and I believe its a simple one. On page 32 of your Zimlets draft it says the proxy servlet checks the URL against a list of allowed domains in the COS. How do I add domains to the allowed list?

Zimlets

Posted: Fri Jan 13, 2006 12:57 pm
by 14319KevinH
[quote user="12419Awol"]First off thanks for all the help Kevin. I only have 1 more issue and I believe its a simple one. On page 32 of your Zimlets draft it says the proxy servlet checks the URL against a list of allowed domains in the COS. How do I add domains to the allowed list?[/QUOTE]
Pretty easy. Just add a "config_template.xml" file to your zimlet zip bundle. Contents would be like:






*.yahoo.com,*.yimg.com