1 /*
  2  * ***** BEGIN LICENSE BLOCK *****
  3  * Zimbra Collaboration Suite Web Client
  4  * Copyright (C) 2011, 2012, 2013, 2014, 2015, 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, 2015, 2016 Synacor, Inc. All Rights Reserved.
 21  * ***** END LICENSE BLOCK *****
 22  */
 23 
 24 /**
 25  * @class
 26  * Base class for a view displaying a single mail item (msg or conv).
 27  *
 28  * @author Conrad Damon
 29  *
 30  * @param {string}					id				ID for HTML element
 31  * @param {ZmListController}		controller		containing controller
 32  *
 33  * @extends		DwtComposite
 34  */
 35 ZmMailItemView = function(params) {
 36 
 37 	if (arguments.length == 0) { return; }
 38 	
 39 	DwtComposite.call(this, params);
 40 
 41 	this._controller = params.controller;
 42 };
 43 
 44 ZmMailItemView.prototype = new DwtComposite;
 45 ZmMailItemView.prototype.constructor = ZmMailItemView;
 46 
 47 ZmMailItemView.prototype.isZmMailItemView = true;
 48 ZmMailItemView.prototype.toString = function() { return "ZmMailItemView"; };
 49 
 50 ZmMailItemView.prototype.set =
 51 function(item, force) {
 52 };
 53 
 54 ZmMailItemView.prototype.getItem =
 55 function() {
 56 };
 57 
 58 ZmMailItemView.prototype.reset =
 59 function() {
 60 };
 61 
 62 ZmMailItemView.prototype.getMinHeight =
 63 function() {
 64 	return 20;
 65 };
 66 
 67 ZmMailItemView.prototype.getMinWidth =
 68 function() {
 69 	return 20;
 70 };
 71 
 72 ZmMailItemView.prototype.getHtmlBodyElement =
 73 function() {
 74 };
 75 
 76 ZmMailItemView.prototype.hasHtmlBody =
 77 function() {
 78 	return false;
 79 };
 80 
 81 ZmMailItemView.prototype.getItem =
 82 function() {
 83 	return this._item;
 84 };
 85 
 86 ZmMailItemView.prototype.getTitle =
 87 function() {
 88 	return this._item ? [ZmMsg.zimbraTitle, this._item.subject].join(": ") : ZmMsg.zimbraTitle;
 89 };
 90 
 91 ZmMailItemView.prototype.setReadingPane =
 92 function() {
 93 };
 94 
 95 ZmMailItemView.prototype.getInviteMsgView =
 96 function() {
 97 	return this._inviteMsgView;
 98 };
 99 
100 // Create the ObjectManager at the last minute just before we scan the message
101 ZmMailItemView.prototype._lazyCreateObjectManager =
102 function(view) {
103 	// objectManager will be 'true' at create time, after that it will be the
104 	// real object. NOTE: Replaced if (this._objectManager === true) as "==="
105 	// does deep comparision of objects which might take a while.
106 	var createObjectMgr = (AjxUtil.isBoolean(this._objectManager) && this._objectManager);
107 	var firstCallAfterZimletLoading = (!this.zimletLoadFlag && appCtxt.getZimletMgr().isLoaded());
108 
109 	if (createObjectMgr || firstCallAfterZimletLoading) {
110 		this.zimletLoadFlag = appCtxt.getZimletMgr().isLoaded();
111 		// this manages all the detected objects within the view
112 		this._objectManager = new ZmObjectManager(view || this);
113 	}
114 };
115