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 (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-20-2007, 02:04 PM
New Member
 
Posts: 4
Default Help needed. Simple Zimlet

Hello, i have been dealing with this for a couple of days and i just couldn't find the way to solve it.

I only have to do a zimlet that after a single click on the panelItems, opens a window with an URL passing the logged username as a parameter.

This is my code. It is almost done, the prob is that i can't find a way to get the username property.

<zimlet name="com_x_x" version="1.0" description="Link">
<summary>
This Zimlet will provide the link
</summary>
<zimletPanelItem label="The Link" icon="http://x/test.ico">
<toolTipText>
Use the link
</toolTipText>
<onClick>
<canvas type="window" width="300" height="300"/>
<actionUrl method="post" target="http://site/Servlet">
<param name="USER">what goes here?</param>
</actionUrl>
</onClick>
</zimletPanelItem>
</zimlet>


Thanks a lot
Reply With Quote
  #2 (permalink)  
Old 02-20-2007, 07:20 PM
Loyal Member
 
Posts: 97
Default Welcome to the club!

There are several of us who have been trying to do something simple like this. First POST doesn't work so good from the xml, get works fine. There is a work around It's better to use a .js file and create a form and use javascript to send the post. I have some code at work that can get the username for you. I'll try to post it tomorrow.

If you do a search for post or qpmp.com you should find the tread talking about post.
Here it is Post and params

Also I think it's
<param name="USER">{obj.user}</param> - or something close.
If you look at the example in the developers guide (see the wiki), it shows the format.
__________________
EricX

Last edited by Ericx : 02-20-2007 at 07:23 PM.
Reply With Quote
  #3 (permalink)  
Old 02-20-2007, 07:57 PM
New Member
 
Posts: 4
Default

Hi Ericx thanks a lot for your answer.

Well if i use a fixed string between the <PARAM> tag, the POST works fine.


Also, according to the whitepaper, it should be

<param name="PARAM">${prop.Username}</param>


But this raises the following javascript error.

Error: obj has no properties
Source File: http://server/zimbra/js/ZimbraMail_a...v=070115194221
Line: 1312
Reply With Quote
  #4 (permalink)  
Old 02-27-2007, 11:29 AM
Loyal Member
 
Posts: 97
Default user name

I know that may not help you in this example. I'll keep looking for the other way I did it. If your using Javascript to create your form you can get the username using the following line of code .

this._appCtxt.get(ZmSetting.USERNAME);


I have not tested the ones below, but they should work. I'm getting them from the Ajax_all.js file and searching for ZmSetting and seeing what I can access.

this._appCtxt.get(ZmSetting.USERID);


Some other things you can get this way are

this._appCtxt.get(ZmSetting.CLIENT_DATETIME)

this._appCtxt.get(ZmSetting.CLIENT_RELEASE);

this._appCtxt.get(ZmSetting.CLIENT_VERSION);
__________________
EricX
Reply With Quote
  #5 (permalink)  
Old 06-18-2008, 05:15 PM
Junior Member
 
Posts: 7
Default Trying the same thing

Hello,

I, too, am trying to do this precise thing. I have this zimlet:

<zimlet name="com_phpministry_oss" version="1.0" description="Database">
<includeCSS>oss.css</includeCSS>
<resource>oss.gif</resource>
<zimletPanelItem label="Manage My Seminars" icon="oss-panelIcon">
<toolTipText>Right-click to Schedule Seminar</toolTipText>
<contextMenu>
<menuItem label="Online Seminar Scheduling" id="mail.familyfoundations.us:20443/oss" icon="oss-panelIcon">
<canvas type="window" title="Support Form" />
<actionUrl method="post" target="https://mail.familyfoundations.us:20443/oss">
<param name="param">${obj.appCtxt._activeAccount.name}</param>
</actionUrl>
</menuItem>
</contextMenu>
</zimletPanelItem>
</zimlet>


My goal is for the ${obj.appCtxt._activeAccount.name} to be replaced by the current logged in Zimbra user. I know that ${obj.appCtxt._activeAccount.name} is not correct, but I want to end up generating the url:

https://familyfoundations.us:20443?param="dave", where "dave" is the currently logged in user. Previously, in version 4, this was stored in ls_last_username. Under version 5, the lsl_last_username stored in the cookie is no longer there, so I want to pass the username on the url.

I looked in firebug and found that appCtxt._activeAccount.name} contains the current username, so I am trying to extract that from DOM. How do I do that?

Thanks,

Dave
Reply With Quote
  #6 (permalink)  
Old 11-23-2008, 03:19 PM
Active Member
 
Posts: 29
Default

Did anyone figure out how to do this? I'm looking for the exact same thing...
Reply With Quote
  #7 (permalink)  
Old 11-24-2008, 03:12 AM
Zimlet Guru & Moderator
 
Posts: 199
Wink

Hi Rchin.

The best way is to use a js file. Here is an example with madgrepper zimlet : (using GET method)

com_phpministry_oss.xml :
Code:
<zimlet name="com_phpministry_oss" version="1.0" description="Database">
	<includeCSS>oss.css</includeCSS>
	<resource>oss.gif</resource>
	<include>openwindow.js</include>
	<handlerObject>Com_Phpministry_Oss</handlerObject>

	<zimletPanelItem label="Manage My Seminars" icon="oss-panelIcon">
		<toolTipText>Right-click to Schedule Seminar</toolTipText>
		<contextMenu>
			<menuItem label="Online Seminar Scheduling" id="SEMINAR" icon="oss-panelIcon">
			</menuItem>
		</contextMenu>
	</zimletPanelItem>
</zimlet>
openwindow.js :
Code:
function Com_Phpministry_Oss() {
}

Com_Phpministry_Oss.prototype = new ZmZimletBase();
Com_Phpministry_Oss.prototype.constructor = Com_Phpministry_Oss;

Com_Phpministry_Oss.prototype.menuItemSelected = function(itemId) {
	switch (itemId) {
		case "SEMINAR":
			window.open("https://mail.familyfoundations.us:20443/oss?param=" + appCtxt.getActiveAccount().name);
		break;
	}
};
Reply With Quote
Reply


Thread Tools
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.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0