HelloWorldZimlet: Difference between revisions
mNo edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Building a Zimlet is not difficult. Anyone with a small knowledge of XML can start building his / her first Zimlet. Knowing Javascript is a plus, and you can write very powerful Zimlets if you are familiar with AJAX programming. You can still write Zimlets even if you are not familiar with Javascript language. Many of the Zimlet features can be declared in the XML description file, and it's possible to write a useful Zimlet in fully declarative manners. | {{Archive}}Building a Zimlet is not difficult. Anyone with a small knowledge of XML can start building his / her first Zimlet. Knowing Javascript is a plus, and you can write very powerful Zimlets if you are familiar with AJAX programming. You can still write Zimlets even if you are not familiar with Javascript language. Many of the Zimlet features can be declared in the XML description file, and it's possible to write a useful Zimlet in fully declarative manners. | ||
Here is a step by step instruction of building and deploying a simple Zimlet. It matches the string "Hello World" in the emails, and create a popup balloon that says "Hello World Zimlet". All of these can be done with just a few lines of XML. | Here is a step by step instruction of building and deploying a simple Zimlet. It matches the string "Hello World" in the emails, and create a popup balloon that says "Hello World Zimlet". All of these can be done with just a few lines of XML. | ||
Line 14: | Line 14: | ||
</contentObject> | </contentObject> | ||
</zimlet> | </zimlet> | ||
Second, change the owner of the XML file to "zimbra". | |||
Then build a zip bundle of the Zimlet. | Then build a zip bundle of the Zimlet. | ||
Line 19: | Line 21: | ||
$ zip com_zimbra_hello.zip com_zimbra_hello.xml | $ zip com_zimbra_hello.zip com_zimbra_hello.xml | ||
adding: com_zimbra_hello.xml (deflated 42%) | adding: com_zimbra_hello.xml (deflated 42%) | ||
change the owner again to "zimbra". | |||
Now the Zimlet can be deployed to ZCS. | Now the Zimlet can be deployed to ZCS. | ||
Line 54: | Line 58: | ||
[[Image:HelloWorldZimlet.JPG|thumb|left|Hello World Zimlet in action]] | [[Image:HelloWorldZimlet.JPG|thumb|left|Hello World Zimlet in action]] | ||
[[Category:Zimlets]] |
Latest revision as of 22:49, 23 March 2015
Building a Zimlet is not difficult. Anyone with a small knowledge of XML can start building his / her first Zimlet. Knowing Javascript is a plus, and you can write very powerful Zimlets if you are familiar with AJAX programming. You can still write Zimlets even if you are not familiar with Javascript language. Many of the Zimlet features can be declared in the XML description file, and it's possible to write a useful Zimlet in fully declarative manners.
Here is a step by step instruction of building and deploying a simple Zimlet. It matches the string "Hello World" in the emails, and create a popup balloon that says "Hello World Zimlet". All of these can be done with just a few lines of XML.
First, write the definition file for the Zimlet.
$ cat com_zimbra_hello.xml <zimlet name="com_zimbra_hello" version="1.0" description="Hello World"> <contentObject> <matchOn> <regex attrs="ig">Hello World</regex> </matchOn> <toolTip>Hello World Zimlet</toolTip> </contentObject> </zimlet>
Second, change the owner of the XML file to "zimbra".
Then build a zip bundle of the Zimlet.
$ zip com_zimbra_hello.zip com_zimbra_hello.xml adding: com_zimbra_hello.xml (deflated 42%)
change the owner again to "zimbra".
Now the Zimlet can be deployed to ZCS.
$ /opt/zimbra/bin/zmzimletctl deploy com_zimbra_hello.zip [] INFO: Deploying Zimlet com_zimbra_hello in LDAP. [] INFO: Installing Zimlet com_zimbra_hello on this host. [] INFO: Adding Zimlet com_zimbra_hello to COS default [] INFO: Enabling Zimlet com_zimbra_hello
Verify the Zimlet is indeed installed correctly.
$ /opt/zimbra/bin/zmzimletctl listZimlets Installed Zimlet files on this host: com_zimbra_amzn com_zimbra_hello com_zimbra_phone com_zimbra_tracking com_zimbra_url Installed Zimlets in LDAP: com_zimbra_amzn com_zimbra_hello com_zimbra_phone com_zimbra_tracking com_zimbra_url Available Zimlets in COS: default: com_zimbra_amzn com_zimbra_hello com_zimbra_phone com_zimbra_tracking com_zimbra_url
Now the Zimlet is installed. From now on all the new login's will have this Zimlet. If you are already logged in, just hit reload, and this Zimlet will be loaded. Restart tomcat if needed in order to purge the cached COS and Account object in the server.