Ext.namespace('Zarafa.plugins.mdm.ui'); /** * @class Zarafa.plugins.mdm.ui.MDMFolderNodeUI * @extends Zarafa.hierarchy.ui.FolderNodeUI * * {@link Zarafa.hierarchy.ui.FolderNodeUI} has limitation that it can add * (@link Ext.form.Checkbox check box} preceded to calendar item only. * So, It will add (@link Ext.form.Checkbox check box} preceded to all context items. */ Zarafa.plugins.mdm.ui.MDMFolderNodeUI = Ext.extend(Zarafa.hierarchy.ui.FolderNodeUI, { /** * Function will render {@link Zarafa.hierachy.ui.FolderNode FolderNode} based on modified template for * our custom needs. * @param {Zarafa.hierarchy.ui.FolderNode} node tree node. * @param {Object} config config object of {@link Zarafa.hierarchy.ui.FolderNode FolderNode}. * @param {Ext.Element} targetNode element in which {@link Zarafa.hierarchy.ui.FolderNode FolderNode} will be rendered. * @param {Boolean} bulkRender */ renderElements : function(node, config, targetNode, bulkRender) { // add some indent caching, this helps performance when rendering a large tree this.indentMarkup = node.parentNode ? node.parentNode.ui.getChildIndent() : ''; var scheme; var cb = Ext.isBoolean(config.checked) && !(node instanceof Zarafa.hierarchy.ui.RootFolderNode); var isCalenderNode = config.folder.isCalendarFolder(); var calendarSVGIcon = ''; if (isCalenderNode) { var calendarContextModel = node.getOwnerTree().model; // We started providing color choosing facility to all the calendar tree-nodes. // CalendarContextModel is responsible for this facility. // There is no CalendarContextModel available in the case where that particular // calendar-tree-node doesn't belongs to MultiSelectHierarchyTree. // So, simply made that ContextModel available to current HierarchyTree. if (!calendarContextModel) { var calendarContext = container.getContextByName('calendar'); calendarContextModel = calendarContext.getModel(); node.getOwnerTree().model = calendarContextModel; } scheme = calendarContextModel.getColorScheme(config.folder.get('entryid')); // Get the scheme base only if we are able to get scheme successfully, // otherwise let it be undefined instead of a JS fatal error. if(scheme && scheme.base) { calendarSVGIcon = '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' ; } } var icon = '', nel, href = config.href ? config.href : Ext.isGecko ? "" : "#", buf = '
  • ' + '
    ' + // indent space '' + this.indentMarkup + "" + // expand icon '' + // checkbox (cb ? '' : '/>') : '') + // node icon (isCalenderNode ? calendarSVGIcon : icon) + // node element (this.elNode) '" + // hierarchy node text (this.textNode) '' + (node.tpl ? node.tpl.apply(config) : node.text) + '' + // counter node (this.counterNode) '' + ''+ "" + "
    " + '' + "
  • "; if (bulkRender !== true && node.nextSibling && (nel = node.nextSibling.ui.getEl())) { this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf); }else{ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf); } this.elNode = this.wrap.childNodes[0]; this.ctNode = this.wrap.childNodes[1]; var cs = this.elNode.childNodes; this.indentNode = cs[0]; this.ecNode = cs[1]; this.iconNode = cs[2]; var index = 3; if (cb) { this.checkbox = cs[2]; this.iconNode = cs[3]; // Get child elements of caledar icon which is used to register in drag and drop manager. var groupContainerNode = this.iconNode.childNodes[0]; if (Ext.isDefined(groupContainerNode)) { var groupNode = groupContainerNode.childNodes[0]; var rectNode = groupNode.childNodes[0]; var pathNode = groupContainerNode.childNodes[1]; this.calendarSVGIconChilds = [rectNode, pathNode]; } index++; } this.anchor = cs[index]; this.textNode = cs[index].firstChild; this.counterNode = cs[index].firstChild.nextSibling; this.folderOwnerNode = this.counterNode.nextSibling; // Apply some optional CSS classes var elNode = Ext.get(this.elNode); var iconNode = Ext.get(this.iconNode); var containerNode = Ext.get(this.wrap); var textNode = Ext.get(this.textNode); if (isCalenderNode) { textNode.addClass('zarafa-hierarchy-node-color'); } if (!Ext.isEmpty(config.cls)) { elNode.addClass(config.cls); } if (config.icon) { iconNode.addClass('x-tree-node-inline-icon'); } if (config.iconCls) { iconNode.addClass(config.iconCls); } if (!Ext.isEmpty(config.containerCls)) { containerNode.addClass(config.containerCls); } this.updateCounter(node); this.showFolderOwner(node); } });