Results 1 to 7 of 7

Thread: using login gata

  1. #1
    Join Date
    Jan 2009
    Posts
    11
    Rep Power
    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

  2. #2
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    Default

    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?

    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.

  3. #3
    Join Date
    Jan 2009
    Posts
    11
    Rep Power
    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"! )

  4. #4
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    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();

  5. #5
    Join Date
    Jan 2009
    Posts
    11
    Rep Power
    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 ...

  6. #6
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    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 01:49 AM.

  7. #7
    Join Date
    Jan 2009
    Posts
    11
    Rep Power
    6

    Default

    Thanks, it works!

Similar Threads

  1. 2nd server redirects to the master on login
    By gilran in forum Administrators
    Replies: 6
    Last Post: 01-14-2013, 08:23 PM
  2. User login hangs up on Loading screen
    By marinew in forum Administrators
    Replies: 9
    Last Post: 07-14-2011, 09:53 PM
  3. imapsync and scalix
    By deugenin in forum Migration
    Replies: 3
    Last Post: 02-11-2008, 08:45 PM
  4. Replies: 4
    Last Post: 12-13-2007, 10:18 AM
  5. problem while building perl
    By ravinder in forum Developers
    Replies: 7
    Last Post: 05-29-2006, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •