ZCS 6.0:Zimlet Developers Guide:Examples:Adding Toolbar Buttons: Difference between revisions

(Adding Article Infobox)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{| cellspacing="0" cellpadding="5" style="border: 1px solid rgb(153, 153, 170); margin: 0pt 0.5em 0.5em 0pt; float: none; background-color: rgb(249, 249, 255);"
{{BC|Community Sandbox}}
__FORCETOC__
<div class="col-md-12 ibox-content">
=ZCS 6.0: Zimlet Developer Guide:Examples:Adding Toolbar=
{{KB|{{Unsupported}}|{{ZCS 7.0}}|{{ZCS 6.0}}|}}
{{WIP}}{| cellspacing="0" cellpadding="5" style="border: 1px solid rgb(153, 153, 170); margin: 0pt 0.5em 0.5em 0pt; float: none; background-color: rgb(249, 249, 255);"
|[[Image:zdg-6-menu-icon-zimbra.jpg|20px]]
|[[Image:zdg-6-menu-icon-zimbra.jpg|20px]]
|[[ZCS 6.0:Zimlet Developers Guide:Introduction|Introduction]]
|[[ZCS 6.0:Zimlet Developers Guide:Introduction|Introduction]]
Line 16: Line 21:
|}
|}


 
==Description ==
{{Article Infobox|{{devel}}|{{ZCS 6.0}}||}}== Description ==


This zimlet will add a "Toolbar Button" to the mail application conversation list and message view toolbars. The new button is added at the end of the existing toolbars.  
This zimlet will add a "Toolbar Button" to the mail application conversation list and message view toolbars. The new button is added at the end of the existing toolbars.  
Line 80: Line 84:
{| cellspacing="0" cellpadding="5" border="1"
{| cellspacing="0" cellpadding="5" border="1"
|Zimlet Package
|Zimlet Package
|[http://files.zimbra.com/docs/zimlet/zcs/6.0/examples/com_zimbra_example_toolbarhook/com_zimbra_example_toolbarhook.zip com_zimbra_example_toolbarhook.zip]
|[https://github.com/Zimbra-Community/zimlets-foss/raw/master/Zimlet/src/zimlet/com_zimbra_example_toolbarhook.zip com_zimbra_example_toolbarhook.zip]
|}
|}


Line 92: Line 96:




{{Article Footer|Zimbra Collaboration Suite 6.0|2/28/2010}}
{{Article Footer|Zimbra Collaboration Server 7.0|2/28/2010}}




[[Category:Developers]]
[[Category:Developers]]
[[Category:Zimlets]]
[[Category:Zimlets]]
[[Category:ZCS 7.0]]
[[Category:ZCS 6.0]]
[[Category:ZCS 6.0]]

Latest revision as of 12:07, 3 November 2020

ZCS 6.0: Zimlet Developer Guide:Examples:Adding Toolbar

   KB 3423        Last updated on 2020-11-3  




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 Zdg-6-menu-icon-library.jpg API Specifications Zdg-6-menu-icon-checkbox.jpg Example Zimlets

Description

This zimlet will add a "Toolbar Button" to the mail application conversation list and message view toolbars. The new button is added at the end of the existing toolbars.

Screen Shot

Zcs-6-examples-toolbarhook.png

Definition File

<zimlet name="com_zimbra_example_toolbarhook" version="1.0" description="An example zimlet that adds a button to the Mail toolbar.">
    <include>com_zimbra_example_toolbarhook.js</include>
    <handlerObject>com_zimbra_example_toolbarhook_HandlerObject</handlerObject>
</zimlet>


Handler Object

Below is a snippet from the Handler Object from the zimlet JavaScript file. ZmId is used to identify the view and ZmOperation is used to identify the "View" menu button (in order to determine the index for where to insert the new button).

/**
 * This method gets called by the Zimlet framework when a toolbar is created.
 *
 * @param {ZmApp} app
 * @param {ZmButtonToolBar} toolbar
 * @param {ZmController} controller
 * @param {String} viewId
 * 
 */
com_zimbra_example_toolbarhook_HandlerObject.prototype.initializeToolbar =
function(app, toolbar, controller, viewId) {

    if (viewId == ZmId.VIEW_CONVLIST || viewId == ZmId.VIEW_TRAD) {
        // get the index of "View" menu so we can display the button after that
        var buttonIndex = 0;
        for (var i = 0; i < toolbar.opList.length; i++) {
                if (toolbar.opList[i] == ZmOperation.VIEW_MENU) {
                        buttonIndex = i + 1;
                        break;
                }
        }

        var buttonParams = {
                text: "Toolbar Button",
                tooltip: "This button shows up in Conversation List and Traditional views",
                index: buttonIndex,
                image: "zimbraicon"
        };

        // creates the button with an id and params containing the button details
        var button = toolbar.createOp("HELLOTEST_ZIMLET_TOOLBAR_BUTTON", buttonParams);
        button.addSelectionListener(new AjxListener(this, this._showSelectedMail, controller));   
    }
};

Download

Zimlet Package com_zimbra_example_toolbarhook.zip


Useful Links


Verified Against: Zimbra Collaboration Server 7.0 Date Created: 2/28/2010
Article ID: https://wiki.zimbra.com/index.php?title=ZCS_6.0:Zimlet_Developers_Guide:Examples:Adding_Toolbar_Buttons Date Modified: 2020-11-03



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