1 /* 2 * ***** BEGIN LICENSE BLOCK ***** 3 * Zimbra Collaboration Suite Web Client 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 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) 2005, 2006, 2007, 2008, 2009, 2010, 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 new search dialog. 30 * @class 31 * This class represents a new search dialog. 32 * 33 * @param {DwtControl} parent the parent 34 * @param {String} className the class name 35 * 36 * @extends ZmNewOrganizerDialog 37 */ 38 ZmNewSearchDialog = function(parent, className) { 39 40 ZmNewOrganizerDialog.call(this, parent, className, ZmMsg.saveSearch, ZmOrganizer.SEARCH); 41 42 }; 43 44 ZmNewSearchDialog.prototype = new ZmNewOrganizerDialog; 45 ZmNewSearchDialog.prototype.constructor = ZmNewSearchDialog; 46 47 ZmNewSearchDialog.prototype.toString = 48 function() { 49 return "ZmNewSearchDialog"; 50 }; 51 52 //overriden properties 53 54 ZmNewSearchDialog.prototype._folderLocationLabel = ZmMsg.newSearchParent; 55 56 57 /** 58 * Pops-up the dialog. 59 * 60 * @param {Hash} params a hash of parameters 61 * @param {String} params.search the search 62 * 63 */ 64 ZmNewSearchDialog.prototype.popup = 65 function(params) { 66 ZmNewOrganizerDialog.prototype.popup.call(this, params); 67 68 var account = appCtxt.multiAccounts ? appCtxt.getActiveAccount() : null; 69 70 var ov = this._getOverviewOrOverviewContainer(); 71 72 this._searchTreeView = ov.getTreeView(ZmOrganizer.SEARCH); 73 this._search = params.search; 74 this._searchTreeView.setSelected(appCtxt.getFolderTree(account).root, true); 75 this._isGlobalSearch = appCtxt.multiAccounts && appCtxt.getSearchController().searchAllAccounts; 76 77 if (appCtxt.multiAccounts) { 78 this._searchTreeView.setVisible(true); 79 this._makeOverviewVisible(this._curOverviewId); 80 } 81 82 var overviewDiv = document.getElementById(this._folderTreeCellId); 83 if (overviewDiv) { 84 Dwt.setVisible(overviewDiv, !this._isGlobalSearch); 85 } 86 }; 87 88 ZmNewSearchDialog.prototype._getFolderData = 89 function() { 90 91 var ret = ZmNewOrganizerDialog.prototype._getFolderData.call(this); 92 if (!ret) { 93 return; 94 } 95 96 ret.isGlobal = this._isGlobalSearch; 97 ret.search = this._search; 98 99 return ret; 100 }; 101 102 103 /** 104 * @private 105 */ 106 ZmNewSearchDialog.prototype._setupFolderControl = 107 function(){ 108 ZmNewOrganizerDialog.prototype._setupFolderControl.call(this); 109 this._treeIds = [ ZmOrganizer.SEARCH ]; 110 }; 111 112 // NOTE: don't show remote checkbox 113 ZmNewSearchDialog.prototype._createRemoteContentHtml = 114 function(html, idx) { 115 return idx; 116 }; 117