/* * Tine 2.0 * * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3 * @author Cornelius Weiss * @copyright Copyright (c) 2007-2016 Metaways Infosystems GmbH (http://www.metaways.de) * */ Ext.ns('Tine.Calendar'); Tine.Calendar.EventUI = function(event) { this.event = event; this.domIds = []; this.app = Tine.Tinebase.appMgr.get('Calendar'); this.init(); }; Tine.Calendar.EventUI.prototype = { zIndex: 100, addClass: function(cls) { Ext.each(this.getEls(), function(el){ el.addClass(cls); }); }, removeClass: function(cls) { Ext.each(this.getEls(), function(el){ el.removeClass(cls); }); }, focus: function() { Ext.each(this.getEls(), function(el){ el.focus(); }); }, blur: function() { Ext.each(this.getEls(), function(el){ el.blur(); }); }, clearDirty: function() { this.setOpacity(1, 1); }, setStyle: function(style) { Ext.each(this.getEls(), function(el){ el.setStyle(style); }); }, getStyle: function(property) { var value; Ext.each(this.getEls(), function(el){ value = el.getStyle(property); return false; }); return value; }, setOpacity: function(v, a) { Ext.each(this.getEls(), function(el){ el.setOpacity(v, a); }); }, /** * returns events dom * @return {Array} of Ext.Element */ getEls: function() { var domEls = []; for (var i=0; i < this.domIds.length; i++) { var el = Ext.get(this.domIds[i]); if (el) { domEls.push(el); } } return domEls; }, init: function() { // shortcut //this.colMgr = Tine.Calendar.colorMgr; }, markDirty: function() { this.setOpacity(0.5, 1); }, markOutOfFilter: function() { Ext.each(this.getEls(), function(el) { el.setOpacity(0.5, 0); el.setStyle({'background-color': '#aaa', 'border-color': '#888'}); Ext.DomHelper.applyStyles(el.dom.firstChild, {'background-color': '#888'}); if (el.dom.firstChild.firstChild) { Ext.DomHelper.applyStyles(el.dom.firstChild.firstChild, {'background-color': '#888'}); } if (_.get(el, 'dom.firstChild.children[1]')) { Ext.DomHelper.applyStyles(_.get(el, 'dom.firstChild.children[1]'), {'background-color': '#888'}); } }); }, onSelectedChange: function(state){ if(state){ //this.focus(); this.addClass('cal-event-active'); this.setStyle({'z-index': 1000}); }else{ //this.blur(); this.removeClass('cal-event-active'); this.setStyle({'z-index': this.zIndex}); } }, /** * removes a event from the dom */ remove: function() { var eventEls = this.getEls(); for (var i=0; i