1 /*
  2  * ***** BEGIN LICENSE BLOCK *****
  3  * Zimbra Collaboration Suite Web Client
  4  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013, 2014, 2016 Synacor, Inc.
  5  *
  6  * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License");
  7  * you may not use this file except in compliance with the License.
  8  * You may obtain a copy of the License at: https://www.zimbra.com/license
  9  * The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15
 10  * have been added to cover use of software over a computer network and provide for limited attribution
 11  * for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
 12  *
 13  * Software distributed under the License is distributed on an "AS IS" basis,
 14  * WITHOUT WARRANTY OF ANY KIND, either express or implied.
 15  * See the License for the specific language governing rights and limitations under the License.
 16  * The Original Code is Zimbra Open Source Web Client.
 17  * The Initial Developer of the Original Code is Zimbra, Inc.  All rights to the Original Code were
 18  * transferred by Zimbra, Inc. to Synacor, Inc. on September 14, 2015.
 19  *
 20  * All portions of the code are Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013, 2014, 2016 Synacor, Inc. All Rights Reserved.
 21  * ***** END LICENSE BLOCK *****
 22  */
 23 
 24 /**
 25  * @overview
 26  */
 27 
 28 /**
 29  * Creates a generic quick add dialog (which basically mean it has different 
 30  * than regular dialogs). Dialogs always hang off the main shell since their stacking order
 31  * is managed through z-index. See "dwt.Widgets#DwtSemiModalDialog" template.
 32  * @class
 33  * This class represents a modal dialog which has at least a title and the 
 34  * standard buttons (OK/Cancel) and widgets (i.e. buttons, etc) as necessary.
 35  * 
 36  * @author Parag Shah
 37  * 
 38  * @param {DwtComposite}	parent				the parent widget (the shell)
 39  * @param {String}	title				a title for the dialog
 40  * @param {Array}	standardButtons		a list of standard button IDs (default is [{@link DwtDialog.OK_BUTTON}, {@link DwtDialog.CANCEL_BUTTON}])
 41  * @param {Array}	extraButtons 		any extra buttons to be added in addition to the standard ones
 42  * @param {Object}	loc				where to popup (optional)
 43  * 
 44  * @extends		DwtDialog
 45  */
 46 ZmQuickAddDialog = function(parent, title, standardButtons, extraButtons, loc) {
 47 	if (arguments.length == 0) return;
 48 
 49 	DwtDialog.call(this, {parent:parent, title:title, standardButtons:standardButtons,
 50 						  extraButtons:extraButtons, loc:loc});
 51 };
 52 
 53 ZmQuickAddDialog.prototype = new DwtDialog;
 54 ZmQuickAddDialog.prototype.constructor = ZmQuickAddDialog;
 55 
 56 ZmQuickAddDialog.prototype.toString =
 57 function() {
 58 	return "ZmQuickAddDialog";
 59 };
 60 
 61 //
 62 // Data
 63 //
 64 
 65 ZmQuickAddDialog.prototype.TEMPLATE = "dwt.Widgets#DwtSemiModalDialog";
 66 
 67 //
 68 // Public methods
 69 //
 70 
 71 /**
 72  * Adds a selection listener.
 73  * 
 74  * @param	{String}		buttonId		the button id
 75  * @param	{AjxListener}	listener		the listener
 76  */
 77 ZmQuickAddDialog.prototype.addSelectionListener = 
 78 function(buttonId, listener) {
 79 	this._button[buttonId].addSelectionListener(listener);
 80 };
 81