Results 1 to 7 of 7

Thread: Help needed. Simple Zimlet

  1. #1
    Martinchin2289 is offline New Member
    Join Date
    Feb 2007
    Posts
    4
    Rep Power
    8

    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

  2. #2
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    8

    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.
    Last edited by Ericx; 02-20-2007 at 07:23 PM.
    EricX

  3. #3
    Martinchin2289 is offline New Member
    Join Date
    Feb 2007
    Posts
    4
    Rep Power
    8

    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

  4. #4
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    8

    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

  5. #5
    madgrepper is offline Junior Member
    Join Date
    May 2007
    Posts
    7
    Rep Power
    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

  6. #6
    rchinn is offline Active Member
    Join Date
    Dec 2007
    Location
    Missouri
    Posts
    30
    Rep Power
    7

    Default

    Did anyone figure out how to do this? I'm looking for the exact same thing...

  7. #7
    tdesorbaix is offline Zimlet Guru & Moderator
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    365
    Rep Power
    8

    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;
    	}
    };

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Replies: 5
    Last Post: 01-11-2008, 05:34 AM
  3. Simple lookup zimlet, help needed
    By Dirk in forum Zimlets
    Replies: 15
    Last Post: 09-20-2007, 08:32 AM
  4. Domain Admin Error: Permission Denied
    By shanson in forum Administrators
    Replies: 3
    Last Post: 05-29-2007, 05:48 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11: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
  •