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 01-15-2009, 06:21 AM
Junior Member
 
Posts: 6
Default using login gata

Hi,
I'm writing an application outside zimbra, I'm tryng use zimbra login in to my app. So I wrote:

PHP Code:
<zimlet name="com_zimbra_testapp" version="0.1" description="testapp">
    <
zimletPanelItem label="testApp">
        <
toolTipText>test app</toolTipText>
        <
onClick>
            <
canvas type="dialog" title="testApp" width="800" height="300" />
            <
actionUrl target="http://externalpage.go" method="post">
                <
param name="user">${prop.userName}</param>
                <
param name="type">${prop.userType}</param>
            </
actionUrl>
        </
onClick>
    </
zimletPanelItem>
</
zimlet
I've got two problems:
1 - ${prop.userName} -> It's wrong I know, but what's right?
2 - I've put method="post" on "actionUrl" but I always read params in $_GET

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-15-2009, 09:10 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

Quote:
1 - ${prop.userName} -> It's wrong I know, but what's right?
What do you want to get here?
a single username created for zimbra to interact with the external app?
or the username of the user that click on the zimlet?

Quote:
2 - I've put method="post" on "actionUrl" but I always read params in $_GET
Yeah, the method="post" doesn't work.
I think there is already a bug about it in bugzilla.
For now you will have to use javascript if you want use POST.
Reply With Quote
  #3 (permalink)  
Old 01-15-2009, 10:52 AM
Junior Member
 
Posts: 6
Default

Quote:
Originally Posted by tdesorbaix View Post
What do you want to get here?
a single username created for zimbra to interact with the external app?
or the username of the user that click on the zimlet?.
I need the username of the user that click on the zimlet... I'd like something like user@domain.com, and the user type (is he an administrator? - but I don't need it at all)

(I know I need a "Zimlet for DUMMIES"! )
Reply With Quote
  #4 (permalink)  
Old 01-16-2009, 12:29 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

If you want the username, you wont be able to get it with the xml file alone.
You will have to use a js file to get it.
You can get the username in the js file with this :
Code:
var username = appCtxt.getUsername();
Reply With Quote
  #5 (permalink)  
Old 01-16-2009, 09:57 AM
Junior Member
 
Posts: 6
Default

Ok, now I can read the username using javascript :
PHP Code:
Com_Zimbra_MyApp.prototype.singleClicked = function() {
    var 
userName appCtxt.getActiveAccount().name;

I also modified the zimlet.xml file:
PHP Code:
<zimlet name="com_zimbra_testapp" version="0.1" description="testapp">
    <
zimletPanelItem label="testApp">
        <
toolTipText>test app</toolTipText>
          <
canvas type="dialog" title="testApp" width="800" height="300" />
            <
actionUrl target="http://externalpage.go" method="post">
                <
param name="user"></param>
         </
actionUrl>
    </
zimletPanelItem>
</
zimlet
Now I'd like to set the right value on the param and then open the canvas using the same javascript event ...
Reply With Quote
  #6 (permalink)  
Old 01-19-2009, 01:38 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

If you use javascript, you can't use the xml file to define the window opening, you should do it in the javascript too.

Supposing that your js file is named testapp.js, here is some code that should work :

com_zimbra_testapp.xml :
Code:
<zimlet name="com_zimbra_testapp" version="0.1" description="testapp">
	<include>testapp.js</include>
	<handlerObject>Com_Zimbra_MyApp</handlerObject>		
    <zimletPanelItem label="testApp">
        <toolTipText>test app</toolTipText>
    </zimletPanelItem>
</zimlet>
testapp.js :
Code:
function Com_Zimbra_MyApp() {
};
Com_Zimbra_MyApp.prototype = new ZmZimletBase();
Com_Zimbra_MyApp.prototype.constructor = Com_Zimbra_MyApp;
Com_Zimbra_MyApp.prototype.singleClicked = function() {
    var userName = appCtxt.getActiveAccount().name;
	var view = new DwtComposite(this.getShell());
	var el = view.getHtmlElement();
	var div = document.createElement("div");
	var url = 'http://externalpage.go/?user='+userName;
	div.innerHTML='<iframe name="" src="' + url + '" scrolling="no" height="300" width="800" FRAMEBORDER="no"></iframe>'; //CONTENT OF THE DIALOG BOX
	el.appendChild(div);
	//TITLE OF THE DIALOG BOX
	var dialog_args = {
		title : "testApp",
		view  : view
	};
	//CREATION OF THE  DIALOG BOX
	var dlg = this._createDialog(dialog_args);
	dlg.popup();
}

Last edited by tdesorbaix; 09-21-2009 at 12:49 AM..
Reply With Quote
  #7 (permalink)  
Old 01-19-2009, 02:21 AM
Junior Member
 
Posts: 6
Default

Thanks, it works!
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.