1 /*
  2  * ***** BEGIN LICENSE BLOCK *****
  3  * Zimbra Collaboration Suite Web Client
  4  * Copyright (C) 2011, 2012, 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) 2011, 2012, 2013, 2014, 2016 Synacor, Inc. All Rights Reserved.
 21  * ***** END LICENSE BLOCK *****
 22  */
 23 
 24 /**
 25  * @overview
 26  */
 27 
 28 /**
 29  * Creates a folder properties view for the folder dialog
 30  * @class
 31  * This class represents a dialog tab view displayed by a tabToolbar
 32  * 
 33  * @param	{DwtControl}	parent		    the parent (dialog)
 34  * @param	{String}	    className		the class name
 35  * 
 36  * @extends		DwtComposite
 37  */
 38 ZmFolderDialogTabView = function(parent, className) {
 39     if (arguments.length == 0) return;
 40 
 41     DwtTabViewPage.call(this, parent, className, Dwt.RELATIVE_STYLE);
 42 
 43     this._createView();
 44 };
 45 
 46 ZmFolderDialogTabView.prototype = new DwtTabViewPage;
 47 ZmFolderDialogTabView.prototype.constructor = ZmFolderDialogTabView;
 48 
 49 
 50 
 51 ZmFolderDialogTabView.prototype.toString =
 52 function() {
 53 	return "ZmDialogTabView";
 54 };
 55 
 56 ZmFolderDialogTabView.prototype.setOrganizer =
 57 function(organizer) {
 58     this._organizer = organizer;
 59 }
 60 
 61 /**  doSave will be invoked for each tab view.
 62  *
 63  * @param	{BatchCommand}	batchCommand	Accumulates updates from all tabs
 64  * @param	{Object}	    saveState		Accumulates error messages and indication of any update
 65  */
 66 ZmFolderDialogTabView.prototype.doSave =
 67 function(batchCommand, saveState) { };
 68 
 69 
 70 ZmFolderDialogTabView.prototype._handleFolderChange =
 71 function(event) { }
 72 
 73 ZmFolderDialogTabView.prototype._handleError =
 74 function(response) {
 75 	// Returned 'not handled' so that the batch command will preform the default
 76 	// ZmController._handleException
 77 	return false;
 78 };
 79 
 80 ZmFolderDialogTabView.prototype._createCheckboxItem =
 81 function(name, label) {
 82     var checkboxName  = "_" + name + "Checkbox"
 83     var containerName = "_" + name + "El"
 84 
 85     this[checkboxName] = document.createElement("INPUT");
 86     this[checkboxName].type = "checkbox";
 87     this[checkboxName]._dialog = this;
 88     this[checkboxName].id = checkboxName;
 89 
 90     this[containerName] = document.createElement("DIV");
 91     this[containerName].style.display = "none";
 92     this[containerName].appendChild(this[checkboxName]);
 93     var lbl = document.createElement("label");
 94     lbl.innerHTML = label;
 95     lbl.htmlFor = checkboxName;
 96     this[containerName].appendChild(lbl);
 97 
 98     return this[containerName];
 99 }
100 
101 ZmFolderDialogTabView.prototype._createBusyOverlay =
102 function(htmlElement) {
103     this._busyOverlay = document.createElement("div");
104     this._busyOverlay.className = "ZmDialogTabViewBusy";
105     this._busyOverlay.style.position = "absolute";
106     Dwt.setBounds(this._busyOverlay, 0, 0, "100%", "100%")
107     Dwt.setZIndex(this._busyOverlay, Dwt.Z_VEIL);
108     this._busyOverlay.innerHTML = "<table cellspacing=0 cellpadding=0 style='width:100%; height:100%'><tr><td> </td></tr></table>";
109     htmlElement.appendChild(this._busyOverlay);
110 	Dwt.setVisible(this._busyOverlay, false);
111 
112     this._setBusyFlag = false;
113 }
114 
115 ZmFolderDialogTabView.prototype._setBusy =
116 function(busy) {
117     if (!this._setBusyFlag) {
118 		// transition from non-busy to busy state
119 		Dwt.setCursor(this._busyOverlay, "wait");
120     	Dwt.setVisible(this._busyOverlay, true);
121     	this._setBusyFlag = this._blockInput = true;
122     } else if (this._setBusy) {
123 		// transition from busy to non-busy state
124 	    Dwt.setCursor(this._busyOverlay, "default");
125 	    Dwt.setVisible(this._busyOverlay, false);
126 	    this._setBusyFlag = this._blockInput = false;
127 	}
128 }