Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-14-2008, 06:49 AM
Member
 
Posts: 11
Default Has to be something simple

Trying to make a zimlet that searches email text for job number and will search db and return possible matches in new window/tab. So far I have the search for job numbers part OK (at least good enough to test with). As soon as I add any 'onCllick' info the search for job numbers stops working and I've yet to get it to open a new window and return results. Have even gone so far as just trying to have it open my company's webpage but no dice. Has to be something simple.

This is my first zimlet. Newb to js and all that too. First text is trying to search and return possible matches for job number. Second is just trying to open my company's webpage. Both are XML and have no other accompanying files

Thx..Matt

Code:
<zimlet name="com_kucera_jobnum" version="1.0" description="Kucera Job Number Zimlet">
	<summary>
		This Zimlet will search for job numbers (30000-79999) within emails and, upon user click,  
		search job database to provide likely matches in a new window (hopefully a new tab, not window).
	</summary>
	<contentObject>
		<matchOn>
			<regex attrs="ig"> [3-7][0-9][0-9][0-9][0-9] </regex>
		</matchOn>
		<toolTip sticky="false">Search Job #</toolTip>
		<onClick>
			<actionUrl method="get" target="http://ma09/writeupdb/listings.php?search_list=y&linked_items=include&title_match=partial&title=">
				<param name="">${src.objectContent}</param>
			</actionUrl>
		</onClick>
	</contentObject>
</zimlet>
Code:
<zimlet name="com_kucera_jobnum" version="1.0" description="Kucera Job Number Zimlet">
	<summary>
		This Zimlet will search for job numbers (30000-79999) within emails and, upon user click,  
		search job database to provide likely matches in a new window (hopefully a new tab, not window).
	</summary>
	<contentObject>
		<matchOn>
			<regex attrs="ig"> [3-7][0-9][0-9][0-9][0-9] </regex>
		</matchOn>
		<toolTip sticky="false">Search Job #</toolTip>
		<onClick>
			<actionUrl method="get" target="http://www.kucerainternational.com">
			</actionUrl>
		</onClick>
	</contentObject>
</zimlet>
__________________
Geography is where it's at!
Reply With Quote
  #2 (permalink)  
Old 11-14-2008, 07:25 AM
Active Member
 
Posts: 40
Default

Just add a canvas element.
Reply With Quote
  #3 (permalink)  
Old 11-14-2008, 08:00 AM
Member
 
Posts: 11
Default

Just added a canvas element, no joy. Same problem. Without any 'OnClick' and code between those tags, the job numbers are highlighted. With the 'OnClick' and code between, the job numbers don't even get highlighted.

Matt
__________________
Geography is where it's at!
Reply With Quote
  #4 (permalink)  
Old 11-14-2008, 08:21 AM
Active Member
 
Posts: 40
Default

I guess the problem is with the actionUrl element and the way you send the parameters. See a zimlets whitepaper for details on actionUrl element.

Regards
Reply With Quote
  #5 (permalink)  
Old 11-14-2008, 08:28 AM
Member
 
Posts: 11
Default

Thanks Agnes. Wish there was more documentation. I've poured through all 40 pages of the whitepaper and gotten the code directly from there. Just don't understand why it's not working. This should be an ultra-simple thing.

Any supporting files needed? (js, template, etc.)

Matt
__________________
Geography is where it's at!
Reply With Quote
  #6 (permalink)  
Old 11-18-2008, 07:06 AM
Member
 
Posts: 11
Default

SUCCESS! I'm pretty stoked even though it's rather simple and uses no js. Laugh if you will. Code below.

However, when the new window pops up, it is an actual new window and not a new tab in the browser (FireFox). The new window shows the search results but does not have a scroll bar. If following one of the search results (clickable link) it opens that job writeup in same window and the user is unable to scroll to see the complete writeup. If instead I right click on one of the search result links and select 'open link in new tab' it opens new tab in that window with a scroll bar.

- Can it be forced to open new tab in existing browser instead of new window?
- If answer to above is negative, can I force the new window to have scrollbars?
- I don't know how to use js for zimlets...although willing to learn. Really need a super simple sample of how the definition and js files work together so as to see what role each plays if js file is used.

SEARCH RESULTS NEW WINDOW- NO SCROLLBAR


CLICK LINK - NO SCROLLBAR


OPEN LINK IN NEW TAB - HAS SCROLLBAR


Code:
<zimlet name="com_kucera_jobnum" version="1.0" description="Kucera Job Number Zimlet">
	<summary>
		This Zimlet will search for job numbers within emails and, upon user click, will 
		search job database to provide likely matches in a new window.
		M.Albring, 11/2008
	</summary>
	<contentObject>
		<matchOn>
			<regex attrs="ig">\d\d\d\d\d</regex>
		</matchOn>
		<toolTip sticky="false">
			Search Writeup Database for Job ${src.objectContent}
		</toolTip>
		<onClick>
			<canvas type="window" />
			<actionUrl method="get" target="http://ma09/writeupdb/listings.php" 
				paramStart="?">
			<param name="title_match">partial</param>
			<param name="title">${src.objectContent}</param>
			</actionUrl>
		</onClick>
	</contentObject>
</zimlet>
__________________
Geography is where it's at!
Reply With Quote
  #7 (permalink)  
Old 11-24-2008, 08:15 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

Quote:
- Can it be forced to open new tab in existing browser instead of new window?
I don't think it is possible. Anyway, the choice should be left to the user.

Quote:
- If answer to above is negative, can I force the new window to have scrollbars?
Not if you only use the xml file, but you can if you use a js file.

Quote:
- I don't know how to use js for zimlets...although willing to learn. Really need a super simple sample of how the definition and js files work together so as to see what role each plays if js file is used.
To use a js file, you put in the xml :
Code:
	<include>thefile.js</include>
	<handlerObject>Zimlet_Object_Name</handlerObject>
In the js file,most of the time you write those lines to define the zimlet object :
Code:
function Zimlet_Object_Name() {
}
Zimlet_Object_Name.prototype = new ZmZimletBase();
Zimlet_Object_Name.prototype.constructor = Zimlet_Object_Name;
As you can see, you are using the object ZmZimletBase, so you can rewrite in your js file some of the ZmZimletBase methods to change the zimlet
behavior.
I recommend you to look at the file ZmZimletBase.js to see all the available methods.
Some of the methods : init, dodrop, singleclicked, doubleclicked, menuItemSelected.
Here is a link to a simple zimlet with a js file managing the event of the click on a right-click menu item :
Help needed. Simple Zimlet
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.