Zimlet Developers Guide:Application Context

Revision as of 12:22, 16 July 2015 by Frederic Maussion (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Zimlet Developers Guide: Application Context

   KB 3276        Last updated on 2015-07-16  




0.00
(0 votes)


Zdg-6-menu-icon-zimbra.jpg Introduction Zdg-6-menu-icon-green-flag.png Getting Started Zdg-6-menu-icon-terminal.png Dev Environment Setup Zdg-6-menu-icon-gear.png Developing Zimlets Zdg-6-menu-icon-advanced.jpg
Advanced Concepts
Application Context
Templates
Java & JSP
Portal
Zimlet Tab
Internationalization
Zdg-6-menu-icon-library.jpg API Specifications Zdg-6-menu-icon-checkbox.jpg Example Zimlets

Overview

The Application Context is a global object available via JavaScript from your Zimlet Handler Object. Using the Application Context object, you can access various application information, dialog boxes, and user preferences. The Application Context is accessed via the appCtxt object. For example, the following shows how to access the simple message dialog from the application context:

com_zimbra_mytestzimlet.prototype.myMethod = 
function() {

  var dialog = appCtxt.getMsgDialog(); // get a simple message dialog

  dialog.reset(); // reset the dialog

  dialog.setMessage("Hello World!", DwtMessageDialog.INFO_STYLE); // set the message "info" style

  dialog.popup(); // display the dialog

};

Accessing Dialogs

The following describes some of the appCtxt methods for accessing dialogs:

Class Method Description
appCtxt.getMsgDialog() Gets the message dialog (with "OK" button).
appCtxt.getYesNoMsgDialog() Gets the message dialog (with "Yes"/"No" buttons).
appCtxt.getYesNoCancelMsgDialog() Gets the message dialog (with "Yes"/"No"/"Cancel" buttons).
appCtxt.getErrorDialog() Gets the error dialog (with "Error Report"/"Details"/"OK" buttons).

Application Information

The following describes some of the appCtxt methods for accessing application information:

Class Method Description
appCtxt.getCurrentApp() Gets the current application object.
appCtxt.getCurrentAppName() Gets current application name.
appCtxt.getCurrentController() Gets the current application controller.

Account Information

The following describes some of the appCtxt methods for accessing account information:

Class Method Description
appCtxt.getActiveAccount() Gets the active account.
appCtxt.getUsername(account) Gets the username for the specified account.
appCtxt.getUserDomain(account) Gets the user domain for the specified account.

API Documentation

The complete JavaScript documentation for the Application Context class is available at:

Zimbra JavaScript API Reference


Verified Against: Zimbra Collaboration Server 7.0 Date Created: 12/22/2009
Article ID: https://wiki.zimbra.com/index.php?title=Zimlet_Developers_Guide:Application_Context Date Modified: 2015-07-16



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search