/*--------------------------------------------------*//* Build at {ts '2010-11-06 05:50:19'} *//*--------------------------------------------------*//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Eve.js *//*--------------------------------------------------*//* * HyperOffice library based on Ext Js 2.0.2 * May 2008 *  * khashayar@hyperoffice.com * * http://hyperoffice.com *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *	Set Ext's Image Directory. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ Ext.BLANK_IMAGE_URL = "../views/styles/modernstyle/images/default/s.gif";/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *	Initializing ToolTip Class. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ Ext.QuickTips.init();/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Set namespaces.*/Ext.namespace(				//'Eve'					// Base namespace for HyperOffice toolbox.				'Eve.core'				// Core component: 'Command', 'Controller'				,'Eve.registery'		//				,'Eve.resource'			// Application Resource.				,'Eve.form'				// Form Controller				,'Eve.form.Action'		// Form Controller								,'Eve.uploadForm'				,'Eve.uploadForm.Action'								,'Eve.lib'				// Library				,'Eve.lib.Interlink'	// Interlinking Library				,'Eve.lib.Comment'		// Comment Library								,'Eve.lib.Desktop'		// Desktop Library				,'Eve.lib.Mail'			// Mail Library				,'Eve.lib.Calendar'     // Calendar Library				,'Eve.lib.Document'     // Document Library				,'Eve.lib.Contact'		// Contact Library				,'Eve.lib.Task'			// Task Library				,'Eve.lib.Link'			// Link Library				,'Eve.lib.Note'			// Note Library				,'Eve.lib.Reminder'		// Reminder Library				,'Eve.lib.Homepage'		// Desktop Library				,'Eve.lib.Group'		// Group Membership Library				,'Eve.lib.Forum'		// Forum Library				,'Eve.lib.Voting'		// Voting Library				,'Eve.lib.Admin'		// Admin Library                ,'Eve.lib.Personal'                ,'Eve.lib.Portal'								,'Eve.widgets'	        // Widgets				,'Eve.widgets.Calendar' // Calendar's Widgets				,'Eve.widgets.Document' // Document's Widgets				,'Eve.widgets.Contact'	// Contact's Widgets				,'Eve.widgets.Task'		// Task's Widgets				,'Eve.widgets.Link'     // Link's Widgets				,'Eve.widgets.Note'	    // Note's Widgets				,'Eve.widgets.Reminder'	// Reminder's Widgets				,'Eve.widgets.Forum'	// Forum's Widgets				,'Eve.widgets.Voting'	// Voting's Widgets								,'Eve.Dialogs'			// Dialogs				,'Eve.Dialogs.Interlink'// Interlinking's Dialogs				,'Eve.Dialogs.Comment'	// Comment's Dialogs								,'Eve.Dialogs.Desktop'  // Desktop's Dialogs				,'Eve.Dialogs.Homepage'  // Desktop's Dialogs				,'Eve.Dialogs.Calendar' // Calendar's Dialogs				,'Eve.Dialogs.Document' // Document's Dialogs				,'Eve.Dialogs.Contact' 	// Contact's Dialogs				,'Eve.Dialogs.Task' 	// Task's Dialogs				,'Eve.Dialogs.Link' 	// Link's Dialogs				,'Eve.Dialogs.Note' 	// Note's Dialogs				,'Eve.Dialogs.Reminder' // Reminder's Dialogs				,'Eve.Dialogs.Forum'	// Forum's Dialogs				,'Eve.Dialogs.Voting'	// Voting's Dialogs								,'Eve.vc'				// View Components				,'Eve.Layout'			// Layout				,'Eve.Tree'				// Custom HyperOffice Tree								,'Eve.Desktop'			// Desktop Namespace				,'Eve.Portal'   		// Container of Portal				,'Eve.Mail'			    // Mail Namespace				,'Eve.Calendar'         // Document Namespace				,'Eve.Document'         // Document Namespace				,'Eve.Contact'			// Contact Namespace				,'Eve.Task'				// Task Namespace				,'Eve.Link'				// Link Namespace				,'Eve.Note'				// Note Namespace				,'Eve.Reminder'			// Reminder Namespace				,'Eve.Homepage'				,'Eve.Group'			// Group Membership Namespace				,'Eve.Forum'			// Forum Namespace				,'Eve.Voting'			// Voting Namespace				,'Eve.Admin'			// Admin Namespace								,'Eve.Interlink'		// Interlinking				,'Eve.Interlink.Popup'								,'Eve.calendar'				,'Eve.FS'				,'Eve.Section'                ,'Eve.Personal'				,'Eve.Portal'		// Portal Administration				,'Eve.util');/**	END:	Set namespaces* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Override Console for browsers other than FireFox*/// Load the firebug Consoleif ( window.loadFirebugConsole )	window.loadFirebugConsole();if (typeof console === 'undefined'){	window.console = {};	console.log		= function() {};	console.warn	= function() {};	console.info	= function() {};}/**	END:	Override Console for browsers other than FireFox* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Error Handler*/window.onerror = function(message, file, lineNumber) {	console.warn('*Error: ', message, ' *Line: ', lineNumber);	// Let the server knows about this	Ext.Ajax.request({		url		: Eve.url		,params	: {			event			: 'modern.global.personal.logException'			,userId			: (Eve.Preference.get('id') ? Eve.Preference.get('id') : 0)			,username		: (Eve.Preference.get('username') ? Eve.Preference.get('username') : '')			,cobrandId		: (Eve.Preference.get('cobrandid') ? Eve.Preference.get('cobrandid') : '0')			,userAgent		: navigator.userAgent			,hoVersion		: Eve.hyperofficeVersion			,activeSection	: Eve.activeSec			,errorLine		: lineNumber			,errorMessage	: message		}	});	// Let the user know	/*if (Eve.Preference.get('cobrandId') != 1 && Eve.Preference.getInteger('accountLevel') > 2){		var msg = "You have encountered a site error. This error has been automatically forwarded to a site administrator. <br />If this error persists after you refresh your browser, please send an e-mail to development@hyperoffice.com describing how to reproduce the problem."		Ext.Msg.alert('Error occured', msg);	}	console.warn('cobrandId:',Eve.Preference.get('cobrandId'));	console.warn('accountLevel:',Eve.Preference.get('accountLevel'));*/		return true;};Eve.errors = [];Eve.showError = function(e){	Ext.Msg.show({		title		: e.name		,msg		: '<p>' + e.message + '</p>'		,buttons	: Ext.Msg.OK		,icon		: Ext.MessageBox.ERROR		,minWidth	: '200'	});		Eve.errors.push(e);	throw e;}/**	END:	Error Handler* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Set State of Window*/Eve.hasFocus	= true;window.onblur	= function() { Eve.hasFocus = false; }window.onfocus	= function() { Eve.hasFocus = true; }/**	END:	Set State of Window* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	CheckBox Selection Model*/Ext.override(Ext.grid.CheckboxSelectionModel, {    // private    onMouseDown : function(e, t){        if(e.button === 0 && t.className == 'x-grid3-row-checker'){ // Only fire if left-click            e.stopEvent();            var row = e.getTarget('.x-grid3-row');            if (row)			{                var index = row.rowIndex;                if (this.isSelected(index))				{					this.deselectRow(index);					this.grid.getStore().getAt(index).set('displayField', false);                }				else				{                    this.selectRow(index, true);					this.grid.getStore().getAt(index).set('displayField', true);                }            }        }    },    // private    renderer : function(v, p, record)	{		return '<div class="x-grid3-row-checker">&#160;</div>';    }});/**	END:	CheckBox Selection Model* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Global ComboRenderer for Grids*/Eve.comboRenderer = function(combo){	return function (value, meta, record) {		var idx = combo.store.find(combo.valueField, value);		var txt = '';		if (idx != -1)		{			var rec = combo.store.getAt(idx);			txt = rec.get(combo.displayField);		}		//if (record.data.completedInList == true) txt =  '<span style="text-decoration:line-through">'+txt+'</span>';		return txt;   	}}/**	END:	Global ComboRenderer for Grids* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Global XTemplate for ComboBox with Indent*/Eve.indentComboXTemplate = function(displayField) {	displayField = displayField || 'text'	return new Ext.XTemplate(		'<tpl for=".">',			'<div class="x-combo-list-item" style="padding-left:{[this.getPadding(values)]}px;">{' + displayField + '}</div>',		'</tpl>',		{			getPadding: function(values) {				var depth = parseInt(values.depth);				var paddingLeft = (depth == 1) ? 3 : (depth * 7);								return (paddingLeft);			}		}	)}/**	END:	Global XTemplate for ComboBox with Indent* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Global Mask to use everywhere you like*/Eve.mask = {	show : function(el, cfg) {		el = el || Ext.getBody();				var config = {			msg			: 'Please wait...'			,removeMask	: true		}				Ext.apply(config, cfg);				if (Eve._mask) {			Eve._mask.hide();		}				// Stupid IE8 with it's compatibility view		try {			Eve._mask = new Ext.LoadMask(el, config);			Eve._mask.show();		} catch(e) {}	}		,hide : function() {		if (Eve._mask)			Eve._mask.hide();	}}/**	END:	Global Mask to use everywhere you like* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	iFrame Component*/Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent, {	onRender : function(ct, position) {		var url		= (!this.event || this.event == "") ? this.url : [this.url, "?event=", this.event].join('');		var conf	= {			tag			: 'iframe'			,frameBorder: 0			,src		: url		}				if (this.id) {			conf.id		= 'iframe-'+ this.id		}				this.el = ct.createChild(conf);	}});/**	END:	iFrame Component* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Overrides Ext Submit Action (Ext expects JSON on responseText)*/Ext.override(Ext.form.Action.Submit, {	handleResponse : function(response){        if(this.form.errorReader){            var rs = this.form.errorReader.read(response);            var errors = [];            if(rs.records){                for(var i = 0, len = rs.records.length; i < len; i++) {                    var r = rs.records[i];                    errors[i] = r.data;                }            }            if(errors.length < 1){                errors = null;            }            return {                success : rs.success,                errors : errors            };        }        return response.responseText;    }})/**	END:	Overrides Ext Submit Action (Ext expects JSON on responseText)* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Creates setIcon Method for  Ext Button*/Ext.override(Ext.Button, {	setIcon: function(icon){		if (this.rendered) {			var btnEl = this.el.child(this.buttonSelector);			btnEl.setStyle('background-image', 'url(' +icon +')');		}	}});/**	END:	Creates setIcon Method for  Ext Button* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Global function to submit a form for downloading a file*/Eve.downloadFile = function(action){      // create hidden target iframe      var id = Ext.id();      var frame = document.createElement('iframe');      frame.id = id;      frame.name = id;      frame.className = 'x-hidden';      if(Ext.isIE) {      frame.src = Ext.SSL_SECURE_URL;      }      document.body.appendChild(frame);      if(Ext.isIE) {      document.frames[id].name = id;      }      var form = Ext.DomHelper.append(document.body, {      tag: 'form'      ,method: 'post'      ,action: Eve.url +"?"+ Ext.urlEncode(action)      ,target: id      });      document.body.appendChild(form);      var callback = function(e, iframe) {        var msg = (Ext.isIE)? iframe.contentWindow.document.body.innerHTML:  iframe.contentDocument.body.innerHTML        Ext.Msg.alert('Error', msg );        Ext.EventManager.removeListener(frame, 'load', callback, this);        setTimeout(function() {document.body.removeChild(form);}, 100);        setTimeout(function() {document.body.removeChild(frame);}, 110);      };      Ext.EventManager.on(frame, 'load', callback, this);      form.submit();}/**	END:	Global function to submit a form for downloading a file* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	???*/Function.prototype.createTextFunction = function( scope ){	Function.__iid = Function.__iid  || Math.floor( Math.random() * 1024 );	Function.__functions = Function.__functions || {};	var sc = scope;	Array.prototype.splice.apply( arguments, [0,1] );	Function.__functions[ Function.__iid++ ] = { func: this, scope: sc, args: arguments };		return "Function.CALL( event, " + (Function.__iid-1) + ");";};Function.CALL = function( e, id ){    if ( !e )        e = window.event;	var obj = Function.__functions[id];	if (!obj)		return false;		    if ( obj.args )        Array.prototype.push.apply( obj.args, [e] );	if ( obj.func.apply( obj.scope, obj.args || [e] ) ){		delete Function.__functions[id];	}		return true;};/**	END:	Set namespaces* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Login Modal*/Eve.popLoginDlg = function(){	if(!Eve.loginWindow){			var login_Handler = function(){				if( !loginForm.getForm().isValid() )				    return;				Ext.Ajax.request({					url: Eve.url,					params: {						event	: 'security.login'						,username	: Ext.getCmp('login_username').getValue()						,password	:Ext.getCmp('login_password').getValue()						,cobrandid	: Eve.Preference.get('cobrandId')					},					success: function(response, options) {                        Eve.loginWindow.hide();					}				});			}						var loginForm = new Eve.FormPanel({						layout	    : 'form'						,frame		: true			  			,labelWidth	: 70				        ,keys: {				          key: 13,				          fn: login_Handler				        }						,border	: false						,items	: [{							html: ['<div style="border:1px solid #d8000c;',									'padding:3px;font-weight:bold;background-color:#ffbaba;margin-bottom:10px;" >',									'Your login session has expired.',									' Please Re-login to HyperOffice.',									'</div>'].join('')							,anchor: '99%'						},{							xtype			: 'textfield'							,fieldLabel		: 'Username'							,labelSeparator	: ''							,name		: 'username'							,id         : 'login_username'							,allowBlank	: false							,setFocus	: true							,value      : Eve.Preference.get('username')							,maxLength	: 30							,anchor     : '95%'							}, {							xtype			: 'textfield'							,labelSeparator	: ''							,id             : 'login_password'							,fieldLabel		: 'Password'							,name		: 'password'							,inputType  : 'password'							,allowBlank	: false							,maxLength	: 30							,anchor     : '95%'						}]						,buttons: [{				            text: 'Login',				            handler: login_Handler				          },{				            text: 'Cancel',				            handler: function() {				              Eve.loginWindow.hide();				            }				          }						]			  		})			Eve.loginWindow = new Ext.Window({				title		: 'Login'				,resizable	: false				,layout     : 'fit'				,closeAction: 'hide'				,y          : 20				,width		: 400				,height	    : 190				,modal  	:true				,items		: [loginForm]				});			          }			Ext.getCmp('login_password').setValue();	  		Eve.loginWindow.show();}/**	END:	Login Modal* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Stuff about help bubble*/Eve.showBubbleHelp = function(section, display){	var params = {		event			: 'modern.user.personal.modifyShowBubbleHelp'		,showBubbleHelp	: display		,section		: section	}	Ext.Ajax.request({		url		: Eve.url		,params	: params		,success: function(response, opts){			console.log('----')		}	})}Eve.showVideo = function(url, width, height){    		var animTarget = animTarget || null;    		var iframewidth = width + 6;    		var iframeheight = height + 4;    		var context = "<iframe height='"+iframeheight+"' width='"+iframewidth+"' src='/hyperoffice2nd/views/styles/modernstyle/angels/showvideo.cfm?swflocation="+ escape(url) +"&width="+width+"&height="+height+"' style='border: none;'></iframe>";			    		this.videoPanel = new Ext.Window({    			width 		: width + 16				,modal		: true				,layout 	: 'fit'				,height 	: height + 32				,y 			: 70				,border 	: false				,resizable	: false				,bodyBorder : false				,autoScroll : false				,closable   : true				,animateTarget :animTarget				,items 		: [{					width: width					,height: height					,html : context				}]    		});    		this.videoPanel.show();}/**	END:	Login Modal* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Override HtmlEditor cleanHtml for extra question mark*/Ext.form.HtmlEditor.override({	cleanHtml : function(html){        html = String(html);        if(html.length > 5){            if(Ext.isWebKit){ // strip safari nonsense                html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');            }        }        if(!Ext.isOpera && html == String.fromCharCode(8203)){            html = '';        }	   if(!Ext.isOpera && html.indexOf(String.fromCharCode(8203)) != -1){            html = html.replace(new RegExp(String.fromCharCode(8203), 'g'), "");        }				if(Ext.isOpera && html == '&nbsp;')			html = '';        return html;    }})Ext.ns('Ext.ux.form.HtmlEditor');Eve.fixWordPaste = function(wordPaste) {    var removals = [/&nbsp;/ig, /[\r\n]/g, /<(xml|style)[^>]*>.*?<\/\1>/ig, /<\/?(meta|object|span)[^>]*>/ig,		/<\/?[A-Z0-9]*:[A-Z]*[^>]*>/ig, /(lang|class|type|href|name|title|id|clear)=\"[^\"]*\"/ig, /style=(\'\'|\"\")/ig, /<![\[-].*?-*>/g, 		/MsoNormal/g, /<\\?\?xml[^>]*>/g, /<\/?o:p[^>]*>/g, /<\/?v:[^>]*>/g, /<\/?o:[^>]*>/g, /<\/?st1:[^>]*>/g, /&nbsp;/g,         /<\/?SPAN[^>]*>/g, /<\/?FONT[^>]*>/g, /<\/?STRONG[^>]*>/g, /<\/?H1[^>]*>/g, /<\/?H2[^>]*>/g, /<\/?H3[^>]*>/g, /<\/?H4[^>]*>/g,         /<\/?H5[^>]*>/g, /<\/?H6[^>]*>/g, /<\/?P[^>]*><\/P>/g, /<!--(.*)-->/g, /<!--(.*)>/g, /<!(.*)-->/g, /<\\?\?xml[^>]*>/g,         /<\/?o:p[^>]*>/g, /<\/?v:[^>]*>/g, /<\/?o:[^>]*>/g, /<\/?st1:[^>]*>/g, /style=\"[^\"]*\"/g, /style=\'[^\"]*\'/g, /lang=\"[^\"]*\"/g,         /lang=\'[^\"]*\'/g, /class=\"[^\"]*\"/g, /class=\'[^\"]*\'/g, /type=\"[^\"]*\"/g, /type=\'[^\"]*\'/g, /href=\'#[^\"]*\'/g,         /href=\"#[^\"]*\"/g, /name=\"[^\"]*\"/g, /name=\'[^\"]*\'/g, / clear=\"all\"/g, /id=\"[^\"]*\"/g, /title=\"[^\"]*\"/g,         /<span[^>]*>/g, /<\/?span[^>]*>/g, /class=/g];				    Ext.each(removals, function(s){        wordPaste = wordPaste.replace(s, "");    });        // keep the divs in paragraphs    wordPaste = wordPaste.replace(/<div[^>]*>/g, "<p>");    wordPaste = wordPaste.replace(/<\/?div[^>]*>/g, "</p>");    return wordPaste;    };Ext.ux.form.HtmlEditor.Word = Ext.extend(Ext.util.Observable, {	curLength: 0,	lastLength: 0,	lastValue: '',	wordPasteEnabled: true,	// private    init: function(cmp){                this.cmp = cmp;        this.cmp.on('render', this.onRender, this);		this.cmp.on('initialize', this.onInit, this, {delay:100, single: true});            },	// private	onInit: function(){				Ext.EventManager.on(this.cmp.getDoc(), {            'keyup': this.checkIfPaste,            scope: this        });		this.lastValue = this.cmp.getValue();		this.curLength = this.lastValue.length;		this.lastLength = this.lastValue.length;			},	// private	checkIfPaste: function(e){				var diffAt = 0;		this.curLength = this.cmp.getValue().length;				if (e.V == e.getKey() && e.ctrlKey && this.wordPasteEnabled){						this.cmp.suspendEvents();						diffAt = this.findValueDiffAt(this.cmp.getValue());			var parts = [				this.cmp.getValue().substr(0, diffAt),				this.fixWordPaste(this.cmp.getValue().substr(diffAt, (this.curLength - this.lastLength))),				this.cmp.getValue().substr((this.curLength - this.lastLength)+diffAt, this.curLength)			];			this.cmp.setValue(parts.join(''));						this.cmp.resumeEvents();		}				this.lastLength = this.cmp.getValue().length;		this.lastValue = this.cmp.getValue();			},	// private	findValueDiffAt: function(val){				for (i=0;i<this.curLength;i++){			if (this.lastValue[i] != val[i]){				return i;						}		}			},    /**     * Cleans up the jubberish html from Word pasted text.     * @param wordPaste String The text that needs to be cleansed of Word jibberish html.     * @return {String} The passed in text with all Word jibberish html removed.     */    fixWordPaste: function(wordPaste) {        return Eve.fixWordPaste(wordPaste);            },	// private    onRender: function() {                this.cmp.getToolbar().add({            iconCls: 'x-edit-wordpaste',            pressed: true,            handler: function(t){                t.toggle(!t.pressed);                this.wordPasteEnabled = !this.wordPasteEnabled;            },            scope: this,            tooltip: {                text: 'Cleanse text pasted from Word or other Rich Text applications'            }        });		    }});/**	END:	Overrride HtmlEditor* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Override Ext.Element to fix the following error in Firefox 3.5.9:*			"Permission denied to access property 'dom' from a non-chrome context "*/Ext.override(Ext.Element, {    contains : function(el){	    try {	        return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);	    } catch(e) {	        return false;	    }	}});/**	END:	Override Element* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	CheckBox Selection Model*/Ext.override(Ext.PagingToolbar, {    // private    onRender : function(ct, position){        Ext.PagingToolbar.superclass.onRender.call(this, ct, position);        this.first = this.addButton({            tooltip: this.firstText,            iconCls: "x-tbar-page-first",            disabled: true,            handler: this.onClick.createDelegate(this, ["first"])        });        this.prev = this.addButton({            tooltip: this.prevText,            iconCls: "x-tbar-page-prev",            disabled: true,            handler: this.onClick.createDelegate(this, ["prev"])        });        this.addSeparator();        this.add(this.beforePageText);        this.field = Ext.get(this.addDom({           tag: "input",           type: "text",           size: "3",           value: "1",           cls: "x-tbar-page-number"        }).el);        this.field.on("keydown", this.onPagingKeydown, this);        this.field.on("focus", function(){this.dom.select();});        this.field.on("blur", this.onPagingBlur, this);        this.afterTextEl = this.addText(String.format(this.afterPageText, 1));        this.field.setHeight(18);        this.addSeparator();        this.next = this.addButton({            tooltip: this.nextText,            iconCls: "x-tbar-page-next",            disabled: true,            handler: this.onClick.createDelegate(this, ["next"])        });        this.last = this.addButton({            tooltip: this.lastText,            iconCls: "x-tbar-page-last",            disabled: true,            handler: this.onClick.createDelegate(this, ["last"])        });        this.addSeparator();        this.loading = this.addButton({            tooltip: this.refreshText,			text: this.btnRefreshText,            iconCls: "x-tbar-loading",            handler: this.onClick.createDelegate(this, ["refresh"])        });        if(this.displayInfo){            this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});        }        if(this.dsLoaded){            this.onLoad.apply(this, this.dsLoaded);        }    }});/**	END:	CheckBox Selection Model* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */Eve.util.getCookie = function(c_name){	if (document.cookie.length>0)	  {	  c_start=document.cookie.indexOf(c_name + "=");	  if (c_start!=-1)	    {	    c_start=c_start + c_name.length+1;	    c_end=document.cookie.indexOf(";",c_start);	    if (c_end==-1) c_end=document.cookie.length;	    return unescape(document.cookie.substring(c_start,c_end));	    }	  }	return "";}Eve.isFlashInstalled = function() {	return false; // FlashDetect.installed;}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Command.js *//*--------------------------------------------------*//** Hyperoffice : Omid **//**------- Start ------**/// Since this object is going to be a singleton// underline is put behind it ...Eve._CommandManager= function(){	this.addEvents(		/** Fires when all of the requests are finished **/		"allrequestcomplete"	);};Ext.extend( Eve._CommandManager, Ext.util.Observable, {	// Holds commands lists	queue: {}		// Command priority table	,priority: []		// Checks if we have any command running right now.	,isRunning : false		// Called in pushCommand, You can put command handling logic in here	,processCommand: function( o ){ return true; }		// Inserts a new command into the queue	,pushCommand: function( o ){		Ext.applyIf( o, { action:'unknown' } );				if ( !this.processCommand( o ) )			return false;				var a = o.action;				if ( typeof o.action == "function" ){			a = a.call(o.scope||window, o);		}				// Create a new array		if ( typeof this.queue[a] == 'undefined'  ){			this.queue[a] = [];		}				var list = this.queue[a];			// Add command to the list		list[list.length] = o;		this.handlePriority( o );		if ( !this.isRunning )			this.sendCommand();				return true;	}		,unshiftCommand: function( o ){		Ext.applyIf( o, { action:'unknown' } );				if ( !this.processCommand( o ) )			return false;				var a = o.action;				if ( typeof o.action == "function" ){			a = a.call(o.scope||window, o);		}				// Create a new array		if ( typeof this.queue[a] == 'undefined'  ){			this.queue[a] = [];		}				var list = this.queue[a];			// Add command to the list		list.unshift(o);		this.priority.unshift( o.action );								if ( !this.isRunning )			this.sendCommand();				return true;	}	,sendCommand: function(){		this.isRunning = true;						if ( !this.priority )			return false;					var action = this.priority.shift();				if ( typeof action == 'undefined' ){			this.isRunning = false;						this.fireEvent( "allrequestcomplete", this );						return true;		}				// Get the next command		var c = this.queue[action].shift();		if ( typeof c == 'undefined' ){			throw new Error('Critical Error in COMMAND_MANAGER : Can not shift() an empty array.' );		}		if (c.url.indexOf('CFID') == -1 && c.url.indexOf('CFTOKEN') == -1){			if(Eve.CFId.length !=0 && Eve.CFToken.length !=0)				c.url += (c.url.indexOf('?') != -1 ? '&' : '?') + "CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;		}				Ext.Ajax.sendRequest(c);				return true;	}		// TODO: Override this to set commands priority	,handlePriority: function( o ){		this.priority[this.priority.length] = o.action;	}			// TODO: Returns the next command in queue	,getNextCommand: function(){		var list = this.queue[0];				return list[0];	}		// Returns the list of commands that have the same action	,getCommandList: function( action ){		return this.queue[action];	}});Eve.CommandManager = new Eve._CommandManager();Ext.override( Ext.data.Connection, {	request: function( o ){		Eve.CommandManager.pushCommand( o );		}		,sendRequest: function( o ){		if(this.fireEvent("beforerequest", this, o) !== false){		//@@Benchmark		//console.log("@@Benchmark -- Time(H1): ",(new Date()).getRTime() % 100000);			            var p = o.params;            if(typeof p == "function"){                p = p.call(o.scope||window, o);            }            if(typeof p == "object"){                p = Ext.urlEncode(p);            }            if(this.extraParams){                var extras = Ext.urlEncode(this.extraParams);                p = p ? (p + '&' + extras) : extras;            }            var url = o.url || this.url;            if(typeof url == 'function'){                url = url.call(o.scope||window, o);            }            if(o.form){                var form = Ext.getDom(o.form);                url = url || form.action;                var enctype = form.getAttribute("enctype");                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){                    return this.doFormUpload(o, p, url);                }                var f = Ext.lib.Ajax.serializeForm(form);                p = p ? (p + '&' + f) : f;            }            var hs = o.headers;            if(this.defaultHeaders){                hs = Ext.apply(hs || {}, this.defaultHeaders);                if(!o.headers){                    o.headers = hs;                }            }            var cb = {                success: this.handleResponse,                failure: this.handleFailure,                scope: this,                argument: {options: o},                timeout : o.timeout || this.timeout            };            var method = o.method||this.method||(p ? "POST" : "GET");            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){                url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());            }            if(typeof o.autoAbort == 'boolean'){ // options gets top priority                if(o.autoAbort){                    this.abort();                }            }else if(this.autoAbort !== false){                this.abort();            }            if((method == 'GET' && p) || o.xmlData || o.jsonData){                url += (url.indexOf('?') != -1 ? '&' : '?') + p;                p = '';            }		//@@Benchmark		//console.log("@@Benchmark -- Time(H2): ",(new Date()).getRTime() % 100000);                        this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);            return this.transId;        }else{            Ext.callback(o.callback, o.scope, [o, null, null]);            return null;        }	}		// private    ,handleResponse : function(response){	//@@Benchmark	//console.log("@@Benchmark -- Time(H3): ",(new Date()).getRTime() % 100000);				this.transId = false;        var options = response.argument.options;        response.argument = options ? options.argument : null;        this.fireEvent("requestcomplete", this, response, options);        Ext.callback(options.success, options.scope, [response, options]);        Ext.callback(options.callback, options.scope, [options, true, response]);	//@@Benchmark	//console.log("@@Benchmark -- Time(H4): ",(new Date()).getRTime() % 100000);        		// TODO:		// You can write extra commands to handle Success		Eve.CommandManager.sendCommand();    }        ,doFormUpload : function(o, ps, url) {        var id = Ext.id();        var frame = document.createElement('iframe');        frame.id = id;        frame.name = id;        frame.className = 'x-hidden';        if(Ext.isIE){            frame.src = Ext.SSL_SECURE_URL;        }        document.body.appendChild(frame);        if(Ext.isIE){           document.frames[id].name = id;        }        var form = Ext.getDom(o.form);        form.target = id;        form.method = 'POST';        form.enctype = form.encoding = 'multipart/form-data';        if(url){            form.action = url;        }        var hiddens, hd;        if(ps){             			hiddens = [];            ps = Ext.urlDecode(ps, false);            for(var k in ps){                if(ps.hasOwnProperty(k)){                    hd = document.createElement('input');                    hd.type = 'hidden';                    hd.name = k;                    hd.value = ps[k];                    form.appendChild(hd);                    hiddens.push(hd);                }            }        }        function cb(){            var r = {                  				responseText : ''                ,responseXML : null            };            r.argument = o ? o.argument : null;            try {                 var doc;                if(Ext.isIE){                    doc = frame.contentWindow.document;                }else {                    doc = (frame.contentDocument || window.frames[id].document);                }                if(doc && doc.body){                    r.responseText = doc.body.innerHTML;                }                if(doc && doc.XMLDocument){                    r.responseXML = doc.XMLDocument;                }else {                    r.responseXML = doc;                }            }            catch(e) {                            }            Ext.EventManager.removeListener(frame, 'load', cb, this);            this.fireEvent("requestcomplete", this, r, o);            Ext.callback(o.success, o.scope, [r, o]);            Ext.callback(o.callback, o.scope, [o, true, r]);            setTimeout(function(){Ext.removeNode(frame);}, 100);        }        Ext.EventManager.on(frame, 'load', cb, this);        form.submit();        if(hiddens){             for(var i = 0, len = hiddens.length; i < len; i++){                Ext.removeNode(hiddens[i]);            }        }                Eve.CommandManager.sendCommand();    }        // private    ,handleFailure : function(response, e){        this.transId = false;        var options = response.argument.options;        response.argument = options ? options.argument : null;        this.fireEvent("requestexception", this, response, options, e);        Ext.callback(options.failure, options.scope, [response, options]);        Ext.callback(options.callback, options.scope, [options, false, response]);				this.failureController(options, response, e );		// TODO:		// You can write extra commands to handle Failure		Eve.CommandManager.sendCommand();    }	// Default behaviour for handling failure	// Will retry on Status Code = -1	// And pops a window on Status code = 500	,failureController: function( options, response, e ) {				/* SIMPLE FAILURE CONTROLLER */		Eve.ErrorManager.pushError( { 			type		:'unexpected',			scope		: this,			tryHandle	: true,			handle		:function() {				options  = arguments[0];				response = arguments[1];				console.log( response.status )				switch( response.status ){				case -1:					if (typeof options.count == 'undefined') {						options.count = 3;					}					options.count--;					if (options.count) {						Eve.CommandManager.unshiftCommand(options);						if (options.count == 2) {							Ext.tools.msg('Error', "Please excuse us, we are experiencing a delay in processing your request.", 15);						}						if (options.count == 1) {							Ext.tools.msg('Error', "Sorry, the server is not responding we will try to process your request one more time.", 15);						}					} else {						Ext.tools.msg('Error', "Pardon the inconvenience, the server is not responding, please close all windows/active tabs and log back into your portal to reestablish a connection.", 20);					}					break;				case 0:					if (typeof options.count == 'undefined') {						options.count = 3;					}					options.count--;					if (options.count) {						Eve.CommandManager.unshiftCommand(options);					} else {						alert('Unable to reach HyperOffice. Please check your internet connection and try again');					}					break;				case 500:					var msg = response.responseText.split('<body>')[1].split('</body>')[0]					if (Eve.DEBUG) {						var text = '<div style="overflow:scroll; height:400px">' + msg + '</div>';						var win = new Ext.Window({							title:'Error',							width:800,							y:0,							items: {								xtype: 'panel',								layout:'fit',								html: text							}						});						win.show();					} else {						/* Majid: Wait : next lines was commented */						Eve.mask.hide();						Ext.Msg.alert('Error', msg );					}										break;				case 550:					//Ext.Msg.alert('Session', 'Your seesion has been expired');					Eve.popLoginDlg()					break;				}			},			args: [options,response]	  });		}});/**-------- End -------**//** Hyperoffice : Omid **/Ext.Ajax = new Ext.data.Connection({    /**     * @cfg {String} url @hide     */    /**     * @cfg {Object} extraParams @hide     */    /**     * @cfg {Object} defaultHeaders @hide     */    /**     * @cfg {String} method (Optional) @hide     */    /**     * @cfg {Number} timeout (Optional) @hide     */    /**     * @cfg {Boolean} autoAbort (Optional) @hide     */    /**     * @cfg {Boolean} disableCaching (Optional) @hide     */    /**     * @property  disableCaching     * True to add a unique cache-buster param to GET requests. (defaults to true)     * @type Boolean     */    /**     * @property  url     * The default URL to be used for requests to the server. (defaults to undefined)     * @type String     */    /**     * @property  extraParams     * An object containing properties which are used as     * extra parameters to each request made by this object. (defaults to undefined)     * @type Object     */    /**     * @property  defaultHeaders     * An object containing request headers which are added to each request made by this object. (defaults to undefined)     * @type Object     */    /**     * @property  method     * The default HTTP method to be used for requests. Note that this is case-sensitive and should be all caps (defaults      * to undefined; if not set but parms are present will use "POST," otherwise "GET.")     * @type String     */    /**     * @property  timeout     * The timeout in milliseconds to be used for requests. (defaults to 30000)     * @type Number     */		timeout : 120000,     /**     * @property  autoAbort     * Whether a new request should abort any pending requests. (defaults to false)     * @type Boolean     */    autoAbort : false,    /**     * Serialize the passed form into a url encoded string     * @param {String/HTMLElement} form     * @return {String}     */    serializeForm : function(form){        return Ext.lib.Ajax.serializeForm(form);    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/ErrorManager.js *//*--------------------------------------------------*//** Hyperoffice : Omid **//**------- Start ------**/Eve._ErrorManager = function(){};Ext.extend( Eve._ErrorManager, Ext.util.Observable, {	errorQueue: {} // Contains error types			// Pushes an error into the queue and tries to handle it.	,pushError: function( e ){		Ext.applyIf( e, {type:'unknown', tryHandle: false, handle: function(){}, scope: this, args:[] } );		if ( typeof this.errorQueue[e.type] == 'undefined' ){			this.errorQueue[e.type] = [];		}				this.errorQueue[e.type].push( e );				// try to handle the error		if ( e.tryHandle ){			e.handle.apply( e.scope, e.args );		}	}		,getErrors: function( type ){		return this.errorQueue[type];	}});Eve.ErrorManager = new Eve._ErrorManager();/**-------- End -------**//** Hyperoffice : Omid **//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Tree.js *//*--------------------------------------------------*//* * HyperOffice library based on Ext Js 2.2 * May 2008 *  * khashayar@hyperoffice.com * * http://hyperoffice.com */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Eve.Tree*/Eve.Tree = function(config) {	this.__config	= this.config = config;	var cls			= (typeof config.cls == 'undefined') ? 'ev-hide': config.cls;	if (config) {		config.loader = new Ext.tree.TreeLoader(config.loader);		var id = config.id || config.sectionPrefix + this.getRootId();		if (id === undefined) {			id = 0;		}				config.root	= new Ext.tree.AsyncTreeNode({			text		: config.rootTitle			,id 		: id			,cls		: cls			,expanded   : true			,draggable	: false			,isTarget	: false		});				// Important!!!		config.root.loaded = true;			} else {		// TODO: Handle this in new way.		Ext.Msg.alert("Config required", "Please set the config for tree.");		return false;	}		// Invoke the parent constructor.	Eve.Tree.superclass.constructor.call(this, config);		this.root = config.root;	var that  = this;		// Append Nodes	(function() {		var section		= that.config.section;		var secTree		= Eve.Preference.get('tree')[section];				if (! secTree) {			config.root.loaded = false;			config.root.expand();			return;		}				var nodes		= secTree.nodes;		var loadMode	= secTree.loadingMode;				for (var i = 0; i < nodes.length; ++i) {			var record = nodes[i];					switch (loadMode) {				case 'allGroups':					if (record.get('depth') == 1 || record.get('type') == 'group') {						var node = that.loader.createNode(record, this);												// Groups or Group?						if (record.get('type') == 'groups' || record.get('type') == 'group') {							node.loaded = true;						}						that.getNodeById(record.get('parentId')).appendChild( node );					}										break;									case 'groupsOnly':					if (record.get('depth') == 1) {						var node = that.loader.createNode(record, this);												// Groups or All Groups?						if (record.get('type') == 'groups') {							node.loaded = true;						}												that.getNodeById(record.get('parentId')).appendChild( node );					}										break;									default:					console.info('Unhandled Tree Node');			}		}	})();		// All events handles through this.	this.regBehaviour();};Ext.extend(Eve.Tree, Ext.tree.TreePanel, {	// Section Prefix	getSP : function()	{		// return Eve.Resource.pre;		return this.sectionPrefix;	}		,initEvents: function()	{		Eve.Tree.superclass.initEvents.apply( this, arguments );//		this.root.expand();	}	,getPre : function(root, type)	{		root	= root || "personal";		root	= (root == "personal") ? "P" : "G";		type	= type || "folder";		type	= (type == "folder") ? "F" : "";				return [ this.getSP(), root, type ].join('').toUpperCase();	}		,getMode : function(nid)	{		if (!nid || nid === undefined)			return;					var pre  = nid.split('_')[0];		var post = nid.split('_')[1];				if (pre == this.getPre('personal', 'root'))			return {root: 'personal', id: 0};				if (pre == this.getPre('personal', 'folder'))			return {root: 'personal', id: post};					if (pre == this.getPre('group', 'root'))			return {root: 'group', id: 0, groupId: post};					if (pre == this.getPre('group', 'folder'))			return {root: 'group', id: post};	}		,createId : function(root, id, groupId)	{		if (root == 'personal' && id == 0)			return this.getSP() + "P_" + id;					if (root == 'personal' && id != 0)			return this.getSP() + "PF_" + id;					if (root == 'group' && id == 0)			return this.getSP() + "G_" + groupId;					if (root == 'group' && id != 0)			return this.getSP() + "GF_" + id;				}		,getRootId : function()	{		return [this.getSP(), "P_-1"].join('');	}		,getPersonalId : function()	{		return [this.getSP(), "P_0"].join('');	}		,getGroupsId : function()	{		return [this.getSP(), "P_-2"].join('');	}			// Call this to add context menu on tree.	,setMenu: function(name, config) {		this[name] = new Ext.menu.Menu(config);	}	,isParentOf: function(src, dest) {		dest = this.getNodeById(dest.rawId);				while (dest.id != this.getRootId()) {			dest = dest.parentNode;			if (dest.id.split("_")[1] === src.id)				return true;		}						return false;	}			// If the selected node is group, returns groupId.	// If the selected node is group's subfolders, returns groupId of parent.	// Else returns false;	,getGroupId: function(node) {		do {			if (node.id == this.getRootId() || node.id == this.getGroupsId()) return;			var obj = this.getMode(node.id);			if (obj.root == 'group' && obj.id == 0)				return obj.groupId;			node = node.parentNode;		}		while (node.id != this.getRootId())		return null;	}		// If the selected node is group, returns 0 that means root folder of the group.	// If the selected node is folder, returns its id.	// Else returns nodeId	,getFolderId: function(node) {		if (node.id == this.getRootId() || node.id == this.getGroupsId()) return node.id;		return this.getMode(node.id).id;	}		,getNodePath: function(node) {		var arr = [];		var curNode = node;		var superPath = {};				while(curNode !== undefined && curNode ){			var obj = this.getMode(curNode.id);						if (obj.id == 0) {				superPath.group = curNode.text;				break;			}						// TODO:			if (superPath.folder === undefined && curNode.id.indexOf(this.getPre(obj.root)) !== -1 ) {				superPath.folder = curNode.text;			}						arr.unshift( curNode.id.split("_")[1] );			curNode = curNode.parentNode;		}		arr.unshift('');		arr.push('');				return {path:arr.join('\\'), header:superPath};	}			// Get info about currently selected node.	,getNodeInfo: function (node) {		if (node === undefined || !node) {			node = this.getSelectionModel().getSelectedNode();			if (!node) return false;		}				var	gId 	= this.getGroupId(node);						// Group ID		var fId 	= this.getFolderId(node);						// Folder ID		var pId		= node.parentNode ? node.parentNode.id : '';	// Parent ID		var nId 	= node.id;		var nPath 	= this.getNodePath(node);		switch (nId) {			case this.getRootId():				nId = '-1';				break;			case this.getGroupsId():				nId = '-2';				break;			default:				var obj = this.getMode(nId);				if (obj !== undefined)					nId = obj.id;		}		switch(pId) {			case this.getRootId():				pId = '-1';				break;			case this.getGroupsId():				pId = '-2';				break;			default:				var obj = this.getMode(pId);				if (obj !== undefined)					pId = obj.id;		}		return {			id			: nId			,headerPath : nPath.header			,groupId	: gId			,folderId	: fId			,parentId	: pId			,path		: nPath.path			,root		: (gId && gId != this.getGroupsId() && gId != this.getPersonalId() && gId != this.getRootId())							? 'group' : 'personal'}; 	}			,expandNode : function( root, groupPath, folderPath )	{  		var preSec	= this.getSP();  		var path	= [ preSec + 'P_-1', preSec + 'P_-2'];  		var textPath	= [];				// Group  		var arr = groupPath.split('\\');  		arr.shift();  		arr.splice(arr.length - 1, 1);				var preGroup  = [this.getPre('group', 'root'),"_"].join('');		for (var i = 0, len = arr.length; i < len; i++) {			path.push(preGroup + arr[i]);		}				// Folder		if (folderPath) {			if (this.section == 'document')			{				var arr = folderPath.split('\/');				arr.shift();				//arr.splice(arr.length - 1, 1);								var preFolder = [this.getPre('group', 'folder'),"_"].join('');				for (var i = 0, len = arr.length; i < len; i++) {					textPath.push(arr[i]);				}			} else	{				var arr = folderPath.split('\\');				arr.shift();				arr.splice(arr.length - 1, 1);								var preFolder = [this.getPre('group', 'folder'),"_"].join('');				for (var i = 0, len = arr.length; i < len; i++) {					path.push(preFolder + arr[i]);				}			}		}				var depth	= 0;		var expandTextPath	= function(n, p) {			var next = p.shift();			// check if it is the right one...			try{			if ((n.attributes.text).toLowerCase() == next.toLowerCase()) {				if ( p.length == 0 ) {					n.select();					// n.getUI().toggleCheck(true);					return true;				}				if ( !n.isExpanded() ) {										p.unshift( next );					n.on('expand', expandTextPath.createDelegate( this, [p], true ), this, {single: true} );										if ( n.isExpandable() )						n.expand();										return true;				}				n.eachChild( function(child) {					expandTextPath(child, p);				});				return true;			}			}catch(e){}			p.unshift( next );									return false;		}				var expand	= function(n, p, tp) {			var next = p.shift();			// check if it is the right one...			if (n.attributes.id == next) {				if ( p.length == 0 ) {					if (tp.length > 0)					{						tp.unshift(n.attributes.text);						expandTextPath(n, tp);					} else {						n.select();						// n.getUI().toggleCheck(true);					}					return true;				}				if ( !n.isExpanded() ) {										p.unshift( next );					n.on('expand', expand.createDelegate( this, [p, tp], true ), this, {single: true} );										if ( n.isExpandable() )						n.expand();										return true;				}				n.eachChild( function(child) {					expand(child, p, tp);				});				return true;			}			p.unshift( next );									return false;		}		expand(root, path, textPath);	}			,isValidDropZone: function(e) {		var isMultiSelected = (!e.dropNode) ? true : false;		if (!e.dropNode) {			// Dragged From Grid.			var items = e.data.items;			var id =[];			for(var i=0; i< items.length; i++){				id.push(items[i].info.id);			}			var id = id.join(',');			e.data.items[0].info.ids = id;						var src		= e.data.items[0].info;			src.type	= e.data.items[0].type;			var p = this.getNodeInfo(null);			src.parentId = p.id;			src.root	= p.root;			src.path 	=  p.path;			src.groupId	= (src.root == this.getPersonalId()) ? null : p.groupId;			src.dragSrc	= 'grid';		}		else {			// Dragged From Tree.			var src		= this.getNodeInfo(e.dropNode);			src.path    = this.getNodeInfo(e.dropNode.parentNode).path;			src.per		= e.dropNode.attributes.per;			src.dragSrc	= 'tree';		}		src.title	= e.data.items[0].title;				// Target Element info.		var dest 	= this.getNodeInfo(e.target);		dest.rawId	= e.target.id;		var msg = Eve.Resource.getDDMsg;		//console.log("src : ", src);		//console.log("dest : ", dest);		// Dropped on Overlay		if (dest.id == '-10')			return msg.ddTitle, msg.betweenGroups;				// D&D Between Groups.		if (dest.root == 'group' && src.groupId != dest.groupId)			return msg.ddTitle, msg.betweenGroups;		// Dropped on parent folder		if (src.parentId === dest.id)			return msg.ddTitle, msg.parentFolder;		//If drag from grid		if(items){			for(var i=0; i< items.length; i++){	    		// Dropped on itself.				if(items[i].info.id === dest.id)					return msg.ddTitle, msg.itself;				//Drag diffrent types				if(items[i].type !== src.type)				    return msg.ddTitle, msg.diffrentType;			}		}		else{			if (src.id === dest.id)				return msg.ddTitle, msg.itself;		}		// Drag & Drop between 'Personal' & 'Groups'.		if (src.root !== dest.root)			return msg.ddTitle, msg.personalGroups;		// Dropped on its Children.		if (this.isParentOf(src, dest))			return msg.ddTitle, msg.itsChildren;		// If it's ok		return {src: src, dest: dest, isMultiSelected : isMultiSelected};	}	// All events handles through this.	// Monitor the Tree behaviour.	,regBehaviour : function() {				// Expand the 'Groups' node, everytime 'All xxx' expanded.		this.on('expandnode', function(node) {			if (node.id == this.getRootId()) {				var groupsNode = this.getNodeById( this.getGroupsId() );				if (groupsNode) {					groupsNode.expand();				}			}		}, this);		// Prevent the user to select "All xxx" and "Groups" nodes.		this.getSelectionModel().on('beforeselect', function (dsm, newNode, oldNode) {			if (newNode.id == this.getRootId() || newNode.id == 'groups') {				return false;			}		}, this);	} // End of regBehaviour.	}); // End of Ext.extend/**	END:	Eve.Tree* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Eve.Task.Tree*/Eve.Task.Tree = function(config) {	// Invoke the parent constructor.	Eve.Task.Tree.superclass.constructor.call(this, config);};Ext.extend(Eve.Task.Tree, Eve.Tree, {	getSharedId : function() {		return [this.getSP(), "P_-10"].join('');	}	// Get info about currently selected node.	,getNodeInfo: function (node) {		if (node === undefined || !node) {			node = this.getSelectionModel().getSelectedNode();			if (!node) return false;		}		var	gId 	= this.getGroupId(node);						// Group ID		var fId 	= this.getFolderId(node);						// Folder ID		var pId		= node.parentNode ? node.parentNode.id : '';	// Parent ID		var nId 	= node.id;		var nPath 	= this.getNodePath(node);		switch (nId) {			case this.getRootId():				nId 		= '-1';				break;			case this.getGroupsId():				nId 		= '-2';				break;			case this.getSharedId():				nId = '-10';				break;			default:				var obj = this.getMode(nId);				if (obj !== undefined)					nId = obj.id;		}		switch(pId) {			case this.getRootId():				pId = '-1';				break;			case this.getGroupsId():				pId = '-2';				break;			case this.getSharedId():				pId = '-10';				break;			default:				var obj = this.getMode(pId);				if (obj !== undefined)					pId = obj.id;		}		return {			id			: nId			,headerPath : nPath.header			,groupId	: gId			,folderId	: fId			,parentId	: pId			,path		: nPath.path			,root		: (gId && gId != this.getGroupsId() && gId != this.getPersonalId() && gId != this.getRootId())							? 'group' : 'personal'		}	}	,regBehaviour : function(){		Eve.Task.Tree.superclass.regBehaviour.call(this);				this.on('render', function(){				var b = new Ext.Button({					text	: 'All projects'					,renderTo: 'task_tree_toolbar_menu'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('all-tasks','task')					,id		: 'task_filter_menu'					,handler: function() { this.showMenu(); }					,menu	: new Ext.menu.Menu({						items: [							new Ext.menu.CheckItem({								text	: 'All projects'								,checked: true								,cls	: "x-btn-text-icon"								,icon	: Eve.Resource.getIcon('all-tasks','task')								,group	: 'fi'								,handler: function(e) {									Eve.Resource.superbridge.broadcast(this, 'task_clear_folders_filter' ,{});								}								,scope	: this							})							,new Ext.menu.CheckItem({								text	: 'Incomplete projects'								,cls	: "x-btn-text-icon"								,icon	: Eve.Resource.getIcon('incompleted','task')								,group	: 'fi'								,handler: function(e) {									Eve.Resource.superbridge.broadcast(this,'task_filter_folders', {filterBy: 'completed'})								}								,scope	: this							})						]					})			});					},this);	}}); /**	END:	Eve.Task.Tree* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Tree Loader*/// Change the Tree Loader behaviour to read the Xml instead of Json.Ext.override(Ext.tree.TreeLoader, {	reader : new Ext.data.XmlReader({			record : 'node'		}, [				 {name: 'text'				, type: 'string'}				,{name: 'id'				, type: 'string'}				,{name: 'leaf'				, type: 'boolean'}				,{name: 'cls'				, type: 'string'}				,{name: 'selectPermission'	, type: 'boolean'}				,{name: 'newPermission'		, type: 'boolean'}				,{name: 'editPermission'	, type: 'boolean'}				,{name: 'deletePermission'	, type: 'boolean'}				,{name: 'administrator'		, type: 'boolean', defaultValue: true }//used in contact        		,{name: 'system'			, type: 'string'}        				// Mail Section				,{name: 'system'			, type: 'string'}				,{name: 'path'				, type: 'string'}				,{name: 'unread'			, type: 'int'}				,{name: 'title'				, type: 'string'}				// Task Section				,{name: 'completed'			, type: 'string'}			]	),		createNode : function(record, tree)	{		var attr = {};		attr.text	= record.get('text');		attr.id		= record.get('id');		attr.leaf	= record.get('leaf');		attr.cls	= this.section + '-tree-' + record.get('cls');		attr.completed = record.get('completed');		if(tree.isFiltered)			attr.hidden = (attr.completed== "1" || attr.completed == true) ? true : false;		var permission = {			Select	: record.get('selectPermission')			,New	: record.get('newPermission')			,Edit	: record.get('editPermission')			,Delete	: record.get('deletePermission')			,DeleteAll: record.get('administrator')|| ( Eve.Preference.getInteger('accountlevel') >= 140 )//Now use in contact		};		attr.per	= permission;		attr.loader = this;        	attr.system = record.get('system');		attr.title	= record.get('title');    	attr.unread = record.get('unread');    	attr.path 	= record.get('path');    		var temp = (attr.id.indexOf("P_0") != -1	||					attr.id.indexOf("P_-2") != -1	||					attr.id.indexOf('P_-10') != -1 ||					parseInt(attr.id.split('_')[1]) <= -100) ? false : true;		/*		var temp = (attr.id == this.getRootId() 	||					attr.id == this.getPersonalId() || 					attr.id == this.getGroupsId() 	|| 					attr.id.indexOf('G_') != '-1' 	|| 					attr.id.indexOf('P_-10') != '-1' ) ? false : true;		*/				// Prevent Special Nodes from Dragging.		attr.draggable	= temp;		// Prevent Special Nodes to be Target Node.		attr.isTarget	= (attr.id.indexOf("P_-2") != -1) ? false : true;    		//Prevent system folders (used in mail section) from being dragged		if (attr.system !== "") {			attr.draggable = false;		}		if (typeof attr.uiProvider == 'string'){			attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);		}				return (attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr));	},	processResponse: function ( response, node, callback ){		try {			var rec = response.records;            node.beginUpdate();            for(var i = 0, len = rec.length; i < len; i++){                var n = this.createNode(rec[i], node.ownerTree);                if (n) {                    node.appendChild(n);                }            }            node.endUpdate();            if(typeof callback == "function"){				try {                	callback(this, node);				} catch(e) {					return false;				}            }        } catch(e) {            this.handleFailure(response, e);        }	},		getParams : function(node){		var buf = [], bp = this.baseParams;		if ( typeof bp == "function"){			bp = bp(node);		}		        for(var key in bp){            if(typeof bp[key] != "function"){                buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");            }        }        return buf.join("");	},		requestData : function( node, callback ){		if(this.fireEvent("beforeload", this, node, callback) !== false){            this.transId = Ext.Ajax.request({                method	: this.requestMethod,                url		: this.dataUrl||this.url,                success	: this.handleResponse,                failure	: this.handleFailure,                scope	: this,                argument: {callback: callback, node: node},                params	: this.getParams(node)            });        } else {            // if the load is cancelled, make sure we notify            // the node that we are done            if(typeof callback == "function") {                callback();            }        }	},		handleResponse: function( r, args ) {		if (!r.responseXML) {			Eve.ErrorManager.pushError({type:'unexpected', tryHandle: true, handler: function(){alert('Salam');}});			return false;		}		var a = args.argument;		var ret = this.reader.readRecords( r.responseXML );		setTimeout(function(){ 		this.processResponse( ret, a.node, a.callback );		this.fireEvent("load", this, a.node, r);		}.createDelegate( this ), 200 );			},		handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}});/**	END:	Tree Loader* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Tree D&D Zone*/Ext.override(Ext.tree.TreeDragZone, {    beforeInvalidDrop : function(e, id){        var sm = this.tree.getSelectionModel();    }});// Overrided to solve Dropping on leaf nodes.Ext.override(Ext.tree.TreeDropZone, {    getDropPoint : function(e, n, dd) {        var tn = n.node;        if(tn.isRoot){            return tn.allowChildren !== false ? "append" : false; // always append for root        }        var dragEl = n.ddel;        var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;        var y = Ext.lib.Event.getPageY(e);        var noAppend = tn.allowChildren === false; //|| tn.isLeaf();        if(this.appendOnly || tn.parentNode.allowChildren === false){            return noAppend ? false : "append";        }        var noBelow = false;        if(!this.allowParentInsert){            noBelow = tn.hasChildNodes() && tn.isExpanded();        }        var q = (b - t) / (noAppend ? 2 : 3);        if(y >= t && y < (t + q)){            return "above";        }else if(!noBelow && (noAppend || y >= b-q && y <= b)){            return "below";        }else{            return "append";        }    }});/**	END:	Tree D&D Zone* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/GridView.js *//*--------------------------------------------------*/Eve.GridView = Ext.extend(Ext.grid.GridView, {	createCtxMenu : function() {		this.hmenu.add(			{id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},			{id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}		)				for (var i = 0; i < this.hMenuItems.length; ++i) {			this.hmenu.add(this.hMenuItems[i]);		}	}	,renderUI : function() {        var header = this.renderHeaders();        var body = this.templates.body.apply({rows:''});        var html = this.templates.master.apply({            body: body,            header: header        });        var g = this.grid;        g.getGridEl().dom.innerHTML = html;        this.initElements();                Ext.fly(this.innerHd).on("click", this.handleHdDown, this);        this.mainHd.on("mouseover", this.handleHdOver, this);        this.mainHd.on("mouseout", this.handleHdOut, this);        this.mainHd.on("mousemove", this.handleHdMove, this);        this.scroller.on('scroll', this.syncScroll,  this);        if(g.enableColumnResize !== false){            this.splitone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);        }        if(g.enableColumnMove){            this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);            this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);        }        if(g.enableHdMenu !== false){            if(g.enableColumnHide !== false){                this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});                this.colMenu.on("beforeshow", this.beforeColMenuShow, this);                this.colMenu.on("itemclick", this.handleHdMenuClick, this);            }            this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});            this.createCtxMenu();            if(g.enableColumnHide !== false){                this.hmenu.add('-',                    {id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'}                );            }            this.hmenu.on("itemclick", this.handleHdMenuClick, this);                    }        if(g.enableDragDrop || g.enableDrag){            this.dragZone = new Ext.grid.GridDragZone(g, {                ddGroup : g.ddGroup || 'GridDD'            });        }        this.updateHeaderSortState();    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Header.js *//*--------------------------------------------------*/// JavaScript DocumentEve.showHelp = function() {	if (!Eve.bubbleWin) {		Eve.bubbleWin = new Ext.Window({			 id     	: 'bubbleHelpWindow'			,width		: 500			,height		: 400			,y			: 100			,title		: ''			,modal  	: true			,layout		: 'fit'			,closeAction: 'hide'			,items		: [{				xtype		: 'container'				,autoEl		:'div'				,id			:'TestingBubble'				,listeners: {					render: {						fn	: function(){							Ext.get('TestingBubble').dom.innerHTML = '<div style="background-color: #FFFFCC; width:100%; height:100%;">' +																		'<div id="helptip">Welcome to help section</div>' + 																		'<div style="position:absolute; width:485px; bottom:100px;"><hr /></div>' + 																		'<div style="position:absolute; right:20px; bottom:10px; valign:top;">' + 																		'<input type="checkbox" name="hello"/>&nbsp;Turn off all help bubbles</div></div>';						}					}				}			}]		});	}		Eve.bubbleWin.show('help_icon');};Eve.Header = function( config ){	this.config = config || {};		// Apply the default behaviour if not available	Ext.applyIf( config, {border:false, frame:false, style:'margin:0px', layout:'fit'} );		// Call the parent	Eve.Header.superclass.constructor.call( this, config );};Ext.extend( Eve.Header, Ext.Panel, {		tpl : new Ext.Template([			'<div id="{id}_header" class="ev-header {cls}">',				'<span id="{id}_section" class="ev-header-section {cls}-section">',					'{section}',				'</span>',				'<span id="{id}_group" class="ev-header-group {cls}-group">',					'{group}',				'</span><span id="{id}_folder" class="{cls}-folder">',					'{folder}',					'{filter}',				'</span>',								'<div id="help_icon" style="position: absolute; top: 9px; right: 10px;" onmouseover="this.style.cursor=\'pointer\'" onclick="Eve.showHelp()">',					'<img src="' + Eve.imagePath + 'ajax/eve-help.png />',				'</div>',			'</div>'	])		// Initialize this component	,initComponent : function() {		Eve.Header.superclass.initComponent.call( this, arguments );	}		,setSection : function(section) {		this.section = section;		this.body.update(this.tpl.apply({ section: this.section, group: this.group, folder: this.folder, filter: ''}));	}	,setGroup : function(group) {		this.group = group;		this.body.update(this.tpl.apply({ section: this.section, group: this.group, folder:this.folder, filter: ''}));	}	,setFolder : function(folder) {		this.folder = folder;		this.body.update( this.tpl.apply({ section: this.section, group: this.group, folder: this.folder, filter: '' }));	}	,setFilter : function(filter){	  this.filter = filter;	  if (this.body)	  this.body.update (this.tpl.apply({ section : this.section, group: this.group, folder: this.folder, filter: this.filter}));	}	,afterRender : function() {		Eve.Header.superclass.afterRender.apply(this, arguments);				this.setSection( this.section	? this.section	: '' );		this.setGroup  ( this.group		? this.group	: '' );		this.setFolder ( this.folder 	? this.folder 	: '' );	}});Ext.reg( 'ev-header', Eve.Header );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Portal.js *//*--------------------------------------------------*/Eve.PortletManager = (function(){	Ext.onReady(		function(){ Eve.PortletManager.init(); }	);		var lastCmp = null;	var enable = true;		return {		init: function(){			Ext.EventManager.addListener( document, 'mousemove', Eve.PortletManager.mouseMove );		}				,toggleFunc: function( params ){			var mode =params.mode;						enable = (mode == 'edit');						if ( lastCmp )				lastCmp.header.setStyle( 'display', 'none' );							lastCmp = null;		}				,mouseMove: function( e ){			Eve.activeSec = Eve.activeSec || '';			if ( enable && ( Eve.activeSec.toLowerCase()  == 'desktop' || Eve.activeSec.toLowerCase()  == 'homepage' ) ){				var cmp = Ext.get(e.getTarget());				if ( !cmp.hasClass('find-me') )					cmp = cmp.up('.find-me');								if ( !cmp ){					if ( lastCmp )						lastCmp.header.setStyle('display', 'none' );										return ( lastCmp = null );				}								cmp = Ext.getCmp( cmp.id );								if ( lastCmp != cmp ){					if ( lastCmp )						lastCmp.header.setStyle('display', 'none' );				}								lastCmp = cmp;								var relY = e.getXY()[1] - cmp.el.getXY()[1];								if ( relY < 25 ){					// Lol... I got some strange behaviour when I used cmp.header					Ext.get(cmp.el.dom.firstChild).setStyle('display','');				}else{					cmp.header.setStyle('display', 'none' );				}			}		}	};})();Eve.Portlet = function( config ){	this.config = config || {};		// Apply the default behaviour if not available	var tools = [];	var cf = config.section;	var lookUp;	if( Eve.activeSec == 'desktop' )		lookUp = ['Schedule','Reminders','Tasks', 'Notes', 'Links', 'Messages', 'News'  ];	else if( Eve.activeSec == 'homepage')		lookUp = ['Calendar'];	if( lookUp.indexOf( cf ) !== -1 ){		tools.push(	{					  	id : 'gear',					  	handler: function( e, target, panel ){					  		this.dialog.popDialog( this.xhr.params || {}, this.updateContent );					  	}					  	,scope: this  					});	}	tools.push({ 				id : 'refresh',                handler : function(e, target, panel){                  this.xhr.sendRequest( this.section );                }                ,scope: this              }              ,{                id : 'close',              	handler: function(e, target, panel){              	Eve.Resource.superbridge.broadcast( this, 'desktop_close_portlet', { obj: this, section: this.section } );                //panel.ownerCt.remove(panel, true);              },                scope: this              });		Ext.applyIf( config, { anchor: '98%'	                      ,startingText: '<!--Loading...<div style="height:100px"></div>-->'                        ,draggable:true                        ,cls   : 'portlet find-me'                        ,bodyStyle : 'padding:10px;line-height:20px;'                        ,header : true                        ,tools : tools                       	,listeners: {                       		'render': {                       			fn: function(){                       				// Make headers invisible                       				this.header.setStyle('display', 'none');                       				                       				// Add relative positioning to the el, so the header wont extend all page                       				this.el.setStyle('position', 'relative');                       				                       				// Correct the header positioning                       				this.header.setStyle('position', 'absolute');                       				this.header.setStyle('left', '0px');                       				this.header.setStyle('right', '0px');                       				this.header.setStyle('z-index', '8000');                       				                       				// Add the top border to the panel                       				this.body.setStyle('border-style', 'solid');                       				this.body.setStyle('border-width', '1px');                       				                       				// Initiate the renderer                       				this.renderer.setTarget( this.body );                       				this.renderer.preRender();                       													this.header.removeClass( this.headerCls + '-noborder' );									                       				//this.xhr.sendRequest.defer( 1000, this.xhr, [this.section] );                       			}                       			,scope: this                   			}                   		                       }        	}          );		Eve.Portlet.superclass.constructor.call( this, config );};Ext.extend(Eve.Portlet, Ext.Panel, {          initComponent: function() {        		this.html = this.startingText;        		Eve.Portlet.superclass.initComponent.call(this);        	}        	         ,updateContent: function( params ){         	this.xhr.params = params;         	this.xhr.sendRequest( params );         }                  ,initEvents: function(){         	Eve.Portlet.superclass.initEvents.apply( this, arguments );         }          		 ,setBorders: function( b ){			if ( !this.el || !this.body ){				this.border = b;				return true;			}						if ( !b ){				this.body.setStyle( 'border-style' , 'none' );			}else{				this.body.setStyle( 'border-style' , 'solid' );			}		 }      });Ext.reg('ev-portlet', Eve.Portlet);/**************************************************************************************************                             Portal Container Component***************************************************************************************************/  Eve.DesktopColumn = Ext.extend(Ext.Container, {    layout        : 'anchor'    ,autoEl       : 'div'    ,style        :  'padding:10px'    ,defaultType  : 'ev-portlet'  });  Ext.reg('desktopcolumn', Eve.DesktopColumn);   Eve.Portal = Ext.extend( Ext.Panel,{	 layout		: 'column'	,border     : false 	,autoScroll	: true	,defaults	: {bodyStyle:'padding:15px'}	,defaultType: 'desktopcolumn'	,region     : 'center'      	,createColumns: function( numColumns ){		if ( !this.items ){			for ( var i = 0; i < numColumns; ++i ){				this.add( new Eve.DesktopColumn({columnWidth : 1/numColumns}));			}					}else{			var len 	= this.items.items.length;			var width 	= 1 / numColumns;						if ( len < numColumns ){				while( len < numColumns ){					this.add( new Eve.DesktopColumn({columnWidth: .1}) );					++len;				}			}else{				while( len > numColumns ){					--len;					this.remove( this.items.items[len-1] );				}			}						this.items.each( function( r ){				r.columnWidth = width;			});		}				//this.doLayout();	}	      ,initComponent : function(){        Eve.Portal.superclass.initComponent.call(this);        this.addEvents({            validatedrop:true,            beforedragover:true,            dragover:true,            beforedrop:true,            drop:true        });      }      ,initEvents : function(){        Eve.Portal.superclass.initEvents.call(this);        this.dd = new Eve.Portal.DropZone(this, this.dropConfig);      }          ,beforeDestroy: function() {        if(this.dd){            this.dd.unreg();        }        Eve.Portal.superclass.beforeDestroy.call(this);			}            ,getState: function() {        var state = [];        for (var i = 0; i < this.items.length; i++) {            var col = this.items.items[i];            state[i] = [];            for (var j = 0; j < col.items.length; j++) {                var p = col.items.items[j];                state[i][j] = Ext.applyIf({xtype: p.getXType(), id: p.id}, p.initialConfig);            }        }        return state;    }                  ,saveState : function(){        if(Ext.state.Manager && this.stateful !== false){          var state = this.getState();                      Ext.state.Manager.set(this.stateId || this.id, state);                            }            }		});    Ext.reg('portal', Eve.Portal);        Eve.Portal.DropZone = function(portal, cfg){    this.portal = portal;    Ext.dd.ScrollManager.register(portal.body);    Eve.Portal.DropZone.superclass.constructor.call(this, portal.bwrap.dom, cfg);    portal.body.ddScrollConfig = this.ddScrollConfig;    };        Ext.extend(Eve.Portal.DropZone, Ext.dd.DropTarget, {    ddScrollConfig : {        vthresh: 50,        hthresh: -1,        animate: true,        increment: 200    },    createEvent : function(dd, e, data, col, c, pos){        return {            portal: this.portal,            panel: data.panel,            columnIndex: col,            column: c,            position: pos,            data: data,            source: dd,            rawEvent: e,            status: this.dropAllowed        };    },    notifyOver : function(dd, e, data){        var xy = e.getXY(), portal = this.portal, px = dd.proxy;        // case column widths        if(!this.grid){            this.grid = this.getGrid();        }        // handle case scroll where scrollbars appear during drag        var cw = portal.body.dom.clientWidth;        if(!this.lastCW){            this.lastCW = cw;        }else if(this.lastCW != cw){            this.lastCW = cw;            portal.doLayout();            this.grid = this.getGrid();        }        // determine column        var col = 0, xs = this.grid.columnX, cmatch = false;        for(var len = xs.length; col < len; col++){            if(xy[0] < (xs[col].x + xs[col].w)){                cmatch = true;                break;            }        }        // no match, fix last index        if(!cmatch){            col--;        }        // find insert position        var p, match = false, pos = 0,            c = portal.items.itemAt(col),            items = c.items.items;        for(var len = items.length; pos < len; pos++){            p = items[pos];            var h = p.el.getHeight();            if(h !== 0 && (p.el.getY()+(h/2)) > xy[1]){                match = true;                break;            }        }        var overEvent = this.createEvent(dd, e, data, col, c,                match && p ? pos : c.items.getCount());        if(portal.fireEvent('validatedrop', overEvent) !== false &&           portal.fireEvent('beforedragover', overEvent) !== false){                        // make sure proxy width is fluid            px.getProxy().setWidth('auto');            if(p){                px.moveProxy(p.el.dom.parentNode, match ? p.el.dom : null);            }else{                px.moveProxy(c.el.dom, null);            }            this.lastPos = {c: c, col: col, p: match && p ? pos : false};            this.scrollPos = portal.body.getScroll();            portal.fireEvent('dragover', overEvent);            return overEvent.status;        }else{            return overEvent.status;        }    },    notifyOut : function(){        delete this.grid;    },    notifyDrop : function(dd, e, data){                delete this.grid;        if(!this.lastPos){            return;        }        var c = this.lastPos.c, col = this.lastPos.col, pos = this.lastPos.p;        var dropEvent = this.createEvent(dd, e, data, col, c,                pos !== false ? pos : c.items.getCount());        if(this.portal.fireEvent('validatedrop', dropEvent) !== false &&           this.portal.fireEvent('beforedrop', dropEvent) !== false){            dd.proxy.getProxy().remove();            dd.panel.el.dom.parentNode.removeChild(dd.panel.el.dom);            if(pos !== false){                c.insert(pos, dd.panel);            }else{                c.add(dd.panel);            }                        c.doLayout();            this.portal.fireEvent('drop', dropEvent);            // scroll position is lost on drop, fix it            var st = this.scrollPos.top;            if(st){                var d = this.portal.body.dom;                setTimeout(function(){                    d.scrollTop = st;                }, 10);            }        }        delete this.lastPos;            },    // internal cache of body and column coords    getGrid : function(){        var box = this.portal.bwrap.getBox();        box.columnX = [];        this.portal.items.each(function(c){             box.columnX.push({x: c.el.getX(), w: c.el.getWidth()});        });        return box;    },    // unregister the dropzone from ScrollManager    unreg: function() {       // Ext.dd.ScrollManager.unregister(this.portal.body);        Eve.Portal.DropZone.superclass.unreg.call(this);    }}); /*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Preference.js *//*--------------------------------------------------*/Eve._Preference = function(){	this.event  = 'modern.user.personal.getPreferences';	this._prefs = {};};Eve._Preference.prototype = {	update: function( key, val ){		this._prefs[key.toLowerCase()] = val;	}		,get: function( key ){		return this._prefs[key.toLowerCase()];	}	,set: function( key, value ){		this._prefs[key.toLowerCase()] = value;	}		,load: function( params ){		//var mask = Ext.getBody().mask( 'Loading your preferences...', 'x-mask-loading' );		var mask = Ext.getBody().mask();				mask.setOpacity(1);		mask.setStyle('height','100%');		mask.setStyle('z-index','30000');		var tpl = new Ext.XTemplate(			'<div id="loading_holder" style="width:782px;height:400px;">',			'<div>{[this.getImage()]}</div>',			'<div style="text-align:center;font-family:tahoma;">please wait while we load your preferences and configure your portal...</div>',			'<div id="progress_holder"></div>',			'</div>',			{				getImage: function(){						var sum =0;					var imageWeight = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3];					var imageName = ["1_assignandnotify","1_blog","1_contactcategories","1_customfields","1_draggingcolumns",					"1_fastfasterfastest","1_modifycolumns","1_PhoneReminders","1_skypeplugin","1_TurnOffSend","1_uploadfromemail",					"2_Apple","2_CalendarQuickAdd","2_ColorCoding","2_DocumentSearch","2_dragcalendarevents","2_Feedback",					"2_linkedin","2_mobilesync","2_NavigationPane","2_Outlook","2_passwordlinks","2_Profiles",					"2_subscribe","2_tasksubscribe","2_VideoTutorials","2_WhatsNew","2_workflows",					"3_viewprojectstasks","3_FreeTraining","3_HyperDrive","3_Voting"];										for(var i=0; i< imageWeight.length; i++){						sum +=imageWeight[i];					}					var rnd = Math.floor(Math.random()*sum);					console.log('sum:',sum,',random:',rnd);					sum = 0;					for(i=0; i<imageWeight.length; i++){						sum += imageWeight[i];						if(sum >= rnd)							return'<img width=782 height= 355 src="' + Eve.imagePath + 'tips/'+imageName[i]+'.png">';					}					return'<img width=782 height= 355 src="' + Eve.imagePath + 'tips/'+imageName[0]+'.png">';				}			}		);						tpl.overwrite(mask,{ });		var pbar = new Ext.ProgressBar({			id:'progress-bar',			cls:'left-align',			style: 'width:100%;margin:20px auto;',			renderTo: Ext.get('progress_holder')		});		Ext.get('loading_holder').center();		pbar.updateProgress(.07, 'Checking Security...');				this.event = params.event || this.event;		var func = params.success ? params.success.createInterceptor( this.read, this ) : this.read;		var lp = ['authenticating your permissions', 'refueling super powers', 'applying your preferences' ];		for(var i=0; i<3; i++){			var j = i;			setTimeout(function(){				try{					pbar.updateProgress( (j+1)*.07, lp[j]+'...');				}catch(e){console.log(e)}			}, ( j + 1 )* 700)					}		Ext.Ajax.request({			url		: 'index.cfm?event=' + this.event			,success: func			,scope	: params.success ? params.scope : this			,failure: function() {				Ext.getBody().unmask();			}		});	}		,read: function( response, opt ){		//Ext.getBody().unmask();		var xml = response.responseXML;		var dq	= Ext.DomQuery;				var dt  = dq.selectNode( 'data', xml );				if (!dt) {			alert("Error Occurred while trying to connect to server.\nPlease ensure your network connection is established and login again.");			document.location = Eve.url + "?event=security.logout&cid=" + Eve.Preference.getInteger("cobrandId") + "&CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;			return;		}				for ( var i = 0, len = dt.childNodes.length; i < len; ++i ){			var node = dt.childNodes[i];						if ( node.nodeType == 1 ){				this._prefs[node.tagName.toLowerCase()] = dq.selectValue( node.tagName, dt );			}		}						this._prefs['taskpersonalgrid'] = dq.selectNode('grids/personalTaskGrid', xml);		this._prefs['contactpersonalgrid'] = dq.selectNode('grids/personalContactGrid', xml);		this._prefs['mailgrid'] = dq.selectNode('grids/mailGrid', xml);		this._prefs['mailpopaccout'] = dq.selectNode('trees/popAccountsSubtree', xml);		this._prefs['calendarmonthly'] = dq.selectNode('grids/calendarGrid', xml);		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Read Applications		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				delete this._prefs.applications;		var apps  = dq.selectNode('applications', dt);		var applications = [];		for (var i = 0, len = apps.childNodes.length; i < len; ++i) {			var node  = apps.childNodes[i];						if (node.nodeType == 1) {				var items = {};				for (var j = 0; j < node.childNodes.length; ++j) {					var subNode = node.childNodes[j];										if (subNode.nodeType == 1) {						var v = dq.selectValue(subNode.tagName, node)						items[subNode.tagName.toLowerCase()] = (subNode.nodeName == 'name' || subNode.nodeName == 'm_url') ? v : v.toLowerCase();					}				}								// Push the app in the applications				applications.push(items)			}		}				if (applications.length > 0) {			this._prefs.applications = applications;		}				// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Read Applications		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Read Tree		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		delete this._prefs.grouptree;		var sections	= dq.selectNode('groupTree', dt);		var secLength	= sections.childNodes.length;		var tree		= {};		var reader		= new Ext.data.XmlReader({			record 		: 'node'			,id			: 'id'		}, [			 {name: 'index',			type: 'int'}			,{name: 'path', 			type: 'string'}			,{name: 'type',				type: 'string'}			,{name: 'text',				type: 'string'}			,{name: 'depth',			type: 'int'}			,{name: 'color',			type: 'string'}			,{name: 'id',				type: 'string'}			,{name: 'owner',			type: 'boolean'}			,{name: 'administrator',	type: 'boolean'}			,{name: 'deletePermission',	type: 'boolean'}			,{name: 'selectPermission',	type: 'boolean'}			,{name: 'parentId',			type: 'string'}			,{name: 'leaf',				type: 'boolean'}			,{name: 'editPermission',	type: 'boolean'}			,{name: 'newPermission',	type: 'boolean'}			,{name: 'cls',				type: 'string'}			,{name: 'checked',			type: 'string'}			,{name: 'columns',			type: 'string'}			,{name: 'columnsChanged',	type: 'boolean', defaultValue: false}			// Mail Section			,{name: 'system'			, type: 'string'}			,{name: 'unread'			, type: 'int'}			,{name: 'title'				, type: 'string'}		])		for (var i = 0; i < secLength; ++i) {			var node = sections.childNodes[i];			if (node.nodeType == 1) {				var secName		= node.nodeName.replace('Nodes', '');				var loadingMode	= dq.selectValue('loadingMode', node);				tree[secName]				= {};				tree[secName].nodes			= (reader.readRecords(node).records);				tree[secName].loadingMode	= loadingMode;			}		}		// Put it in Preference		this._prefs.tree = tree;		var node = dq.selectNode('mailFolders', dt);		if(node){			this._prefs.mailfolders = reader.readRecords( node ).records;		}		// Free some memory		delete reader;		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Read Tree		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Read Sections Config		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				delete this._prefs.sections;		var reader		= new Ext.data.XmlReader({			record 		: 'section'			,id			: 'name'		}, [			{name: 'name',				type: 'string'}			,{name: 'showBubbleHelp',	type: 'boolean'}		]		);					var sections			= {};		var sectionsConfig		= reader.readRecords(dq.selectNode('sections', dt)).records;		for(var i = 0, len = sectionsConfig.length; i<len; ++i){			sections[sectionsConfig[i].id] = {};			sections[sectionsConfig[i].id].showBubbleHelp = sectionsConfig[i].get('showBubbleHelp');		}				// Put it in Preference		this._prefs.sections = sections;		delete reader;		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Read Sections Config		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -						/*		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Read Grid Columns		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				delete this._prefs.grids;		var sections  = dq.selectNode('grids', dt);		var secLength = sections.childNodes.length;		var grid	  = {};				for (var i = 0; i < secLength; ++i) {			var node = sections.childNodes[i];						if (node.nodeType == 1) {				var secName	= node.nodeName.replace('Grid', '');				var colLen	= node.childNodes.length;								// Column info holder				grid[secName] = {};				grid[secName].columns = [];								for (var j = 0; j < colLen; ++j) {					var attr = node.childNodes[j]					if (attr.nodeType == 1) {						grid[secName].columns.push({							title : dq.selectValue('title', attr)							,width: dq.selectNumber('width', attr)						})					}				}			}		}				// Put it in Preference		this._prefs.grid = grid;				// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Read Grid Columns		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		*/		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Read Dialogs		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		delete this._prefs.popups;				// Put it in Preference		this._prefs.popups = {			calendar: dq.selectNode('popups/personalEventDomain', dt),			task	: dq.selectNode('popups/personalTaskDomain', dt)		};		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Read Dialogs		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		return true;	}		,orFunc: function( a, b ){		return a || b;	}		,getBoolean: function( key, func ) {		var last = undefined;		if ( key.constructor == Array ){			func = func || this.orFunc;						for ( var i = 0; i < key.length; ++i ){				last = func( last, this.getBoolean( key[i] ) );			}						return last;		}				var b = this._prefs[key.toLowerCase()];		return ( b === '1' || b === 1 || b === true || b === 'true' || typeof b === "undefined"  );	}		,getInteger: function( key ){		var b = this._prefs[key.toLowerCase()];		return parseInt( b, 10 );	}};Eve.Preference = new Eve._Preference();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Eve/Cache.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.Cache = new function(){	// Private	var items = [{		name	: 'AllContacts'		,type	: 'mixed'		,lazy	: true		,loaded	: false		,event	: 'modern.user.personal.getAllEmails'		,xmlInfo: {			root	: 'emails'			,record	: 'row'			,fields	: ['email', 'type', 'id', {name:"emailValue", mapping: "email"}]		}	}];		function getBoolean(val)	{		return (val === true	||				val === 'true'	||				val === 1		||				val === '1'		||				val === 'on')	}	function getInteger(val)	{		return parsInt(val);	}	function getString(val)	{		return val.toString();	}	function getMixed(item)	{		if (! item.value) {			item.value = new Ext.data.Store({				data: []				,reader: new Ext.data.XmlReader({					record: item.xmlInfo.record				}, item.xmlInfo.fields)			})		}		return item.value;	}	function load(item, fetchOnIdle)	{		if (item.type == 'mixed') {			// Make sure value set			getMixed(item);		}				var ajax = function() {			Ext.Ajax.request({				url		: Eve.url				,params	: {					event	: item.event				}				,success: function(response) {					var xml = response.responseXML;					var dq	= Ext.DomQuery;					if (item.type == 'mixed') {						var result	= item.value.reader.read(response);						item.value.loadRecords(result, {add: false}, true);					} else {						item.value = dq.selectValue(xml, item.xmlInfo.root);					}					item.loaded = true;				}				,failure: function() {					item.loaded = false;				}			});		}		var fn = function() {			if (!Eve.done || Eve.CommandManager.isRunning) {				console.log('Waiting...');			} else {				console.log('Sending...');				clearInterval(iv);				ajax();			}		}		// If we need to fetch data when all requests completed, wait for them to complete!		if (fetchOnIdle === true) {			var iv = setInterval(fn, 100);		} else {			ajax();		}	}	// Public	this.get = function(key, fetchOnIdle)	{		key = key.toLowerCase();		for (var i in items) {			if(! items[i].name) {				continue;			}			var name = items[i].name.toLowerCase();			if (name == key) {				var ci = items[i];				// Found our babe, let's terminate the loop				break;			}		}		// Couldn't find any match		if (! ci) {			return;		}				// Decide if we should send and AJAX request or not		if (ci.loaded) {			if (ci.type == 'mixed') {				return getMixed(ci);			} else {				var cmd = 'get' + ci.type + '(' + ci.value + ')';				return eval(cmd);			}		} else {			if (ci.lazy) {				// Mark it as loaded and load it :D				ci.loaded = true;				load(ci, fetchOnIdle);				return ci.value;			} else {				throw "Cache: item is not lazy but ain't loaded yet!"			}		}	}	// Initialize	var init = function()	{		for (var i in items) {			var item = items[i];			// load it if it's not lazy			if (item.lazy === false) {				load(item);			}		}	};}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/View.js *//*--------------------------------------------------*/// JavaScript Document// View object that is passed to factoryEve.lib.View = function(){}Eve.lib.View.prototype = {	// Initializes the component	// It is written this way so Bridge could add 	// configuration based on the XHR object	init 	: function( obj ){		obj = obj || {};				this.bridge 	= obj.bridge || Eve.lib.EmptyBridge;		this.view		= obj.view;		this.conn		= obj.conn   || Eve.lib.EmptyXHR;	}  								// Returns the view component.	// like TreePanel, or GridPanel	,get	: function(){		return this.view;	}		,getBridge : function(){		return this.bridge;	}		,getConn : function(){		return this.conn;	}}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Factory.js *//*--------------------------------------------------*/// Written by OmidEve.lib.Factory = function() {}Eve.lib.Factory.prototype = {	// THE ITEM THAT 'CREATE' RETURNS SHOULD BE LIKE THIS ( for regions )-->	// ret -> { config, view }	// view should have been initiated	//	createTopWest	: function(){}	,createNorth	: function(){}	,createSouth	: function(){}	,createWest		: function(){}	,createEast		: function(){}	,createDialogs	: function(){}	,createMenus	: function(){}	,createRest		: function(){}	,createBefore	: function(){}	,createDefaults : function(brdg){}	,createCenter	: function(){		// Dont' Remove this		// Sections like WIKI that don't have factory need this.		return {			view	: {				get		: function() { return {html: ''} }			}			,config	: {}		}	}	,getSettings: function()	{		var items = [];		var sections = Eve.SectionManager.sections;		var accountLevel = Eve.Preference.getInteger('accountLevel');		var resellerId = Eve.Preference.getInteger('resellerId');		var useHyperSync = Eve.Preference.getInteger('useHyperSync');		var hasAdmin = false;				function setIcon( name, title )		{			return "<a href='#' class='ev-section-href' >"			+ "<div id='navbarbtn_" + name + "' align='center' class='ev-section-wrapper'>"			+ "<img src='" + Eve.Resource.getIcon(name, 'navbar') + "' class='ev-section-img' /><br />" + title + "</div></a>";		}		for ( var i = 0; i < sections.length; ++i ){			if ( sections[i].type == 'setting' ){				switch( sections[i].id ){					case 'admin':						if ( hasAdmin )							break; 						if( accountLevel >= 140)							items.push( {								html: setIcon( sections[i].name, sections[i].title )							})						else if( accountLevel >= 2 && accountLevel < 140)							items.push( {								html: setIcon( sections[i].name, sections[i].title )							});						hasAdmin = true;							break;						case 'personal':					case 'setupTools':						items.push( {							html: setIcon( sections[i].name, sections[i].title )						});						break;						case 'mobileSync':						if (useHyperSync !== undefined && useHyperSync == '1'){							items.push( {								html: setIcon( sections[i].name, sections[i].title )							});						}						break;											case 'siteAdministration' :						if(accountLevel >= 200)							items.push( {								html: setIcon( sections[i].name, sections[i].title )							});						break;					    					case 'portalAdministration' :						if(accountLevel >= 155)							items.push( {								html: setIcon( sections[i].name, sections[i].title )							});						break;					        					case 'billing' :						if(accountLevel == 155 && resellerId <= 0)							items.push( {								html: setIcon( sections[i].name, sections[i].title )							});						break;				}				}		}		return items;	}	  	,getApplications: function()	{		var items	= [];		var apps        = Eve.Preference.get('applications');				function setIcon(name, img) {			return "<a href='#' class='ev-section-href' >"			+ "<div id='navbarbtn_" + name + "' align='center' class='ev-section-wrapper'>"			+ "<img src='" + img + "' class='ev-section-img' /><br />" + name + "</div></a>"		}		for (var j = 0; apps && j < apps.length; ++j) {				items.push({					html: setIcon( apps[j].name, apps[j].iconurl )				})		}		return items;	}	  	,getGroups: function()	{		var items = [];		var sections = Eve.SectionManager.sections;				function setIcon( name, title ) {			return "<a href='#' class='ev-section-href' >"			+ "<div id='navbarbtn_" + name + "' align='center' class='ev-section-wrapper'>"			+ "<img src='" + Eve.Resource.getIcon(name, 'navbar') + "' class='ev-section-img' /><br />" + title + "</div></a>"		}		for ( var i = 0; i < sections.length; ++i ) {			if ( sections[i].type == 'group' ){				if ( Eve.Preference.getBoolean( sections[i].name ) ){					items.push( {						html: setIcon( sections[i].name, sections[i].title )					} );				}			}		}		return items;	}	,getPersonals: function()	{		var items 		= [];		var sections = Eve.SectionManager.sections;				function setIcon( name, title ) {			return "<a href='#' class='ev-section-href' >"			+ "<div id='navbarbtn_" + name + "' align='center' class='ev-section-wrapper'>"			+ "<img src='" + Eve.Resource.getIcon(name, 'navbar') + "' class='ev-section-img' /><br />" + title + "</div></a>";		}		for ( var i = 0; i < sections.length; ++i ){			if ( sections[i].type == 'personal' ){				if ( Eve.Preference.getBoolean( sections[i].name ) ){					items.push( {						html: setIcon( sections[i].name, sections[i].title )					} );				}			}		}		return items;	}	,scroller : function(cmp) {		var el = cmp.getEl().down('.x-panel-bwrap').first();				(function() {			if (!cmp.attachedScroller && el.dom.scrollHeight > el.dom.clientHeight) {				var ct = el.wrap({cls: 'ux-menu-container'});				var up = Ext.DomHelper.insertHtml('afterBegin', ct.dom, '<div></div>');				Eve.dn = Ext.DomHelper.insertHtml('beforeEnd', ct.dom, '<div></div>');								Ext.fly(Eve.dn).addClass('ev-scroller').createChild({tag: 'span', cls: 'ev-scroller-arrow-down'})				Ext.fly(Eve.dn).on('click', function() {					el.scroll('down', 100, true);				})								Ext.fly(up).addClass('ev-scroller').createChild({tag: 'span', cls: 'ev-scroller-arrow-up'})				Ext.fly(up).on('click', function() {					el.scroll('up', 100, true);				})								Ext.fly(ct).on('DOMMouseScroll', function(e) {					if (e.browserEvent.detail > 0) {						el.scroll('down', 100, true);					} else {						el.scroll('up', 100, true);					}				})				var extra = (!Ext.isIE)? 10 : 0;				el.setHeight(el.getHeight() - (Ext.fly(Eve.dn).getHeight() + Ext.fly(Eve.dn).getHeight() + extra));				cmp.attachedScroller = true;				//Eve.___dn = dn;			}			// Attach an Resize handler to update the hieght of Navigation Bar on each resize			/*			cmp.ownerCt.on('resize', function() {				var dn = Eve.___dn;				el.setHeight(el.getHeight() - (Ext.fly(dn).getHeight() + Ext.fly(dn).getHeight() + 10));			});			*/		}).defer(100)			}		,createTopWest : function()	{		var ret = {			items		: []			,width		: 110		}		// Add Personal		var p = this.getPersonals();		if (p.length > 0) {			ret.items.push({				title		: 'Personal'				,type		: 'personal'				,bodyStyle	: "background-color: #E5E5E5;"				,defaults	: {					border		: false					,cls		: "ev-nav-button"				}				,items		: p				,listeners	: {					render			: this.scroller					,'afterlayout'	: {						'fn'			: function(cmp) {							console.log("******************");							this.scroller(cmp);						}						,scope: this					}				}			})		}		// Add Group		var g = this.getGroups();		if (g.length > 0) {			ret.items.push({				title		: 'Groups'				,type		: 'group'				,bodyStyle	: "background-color: #E5E5E5;"				,defaults	: {					border		: false					,cls		: "ev-nav-button"				}				,items		: g				,listeners	: {					expand		: this.scroller				}			})		}				// Add Applications		var a = this.getApplications();		if (a.length > 0) {			ret.items.push({				title		: 'Applications'				,type		: 'application'				,bodyStyle	: "background-color: #E5E5E5;"				,defaults	: {					border		: false					,cls		: "ev-nav-button"				}				,items		: a				,listeners	: {					expand		: this.scroller				}			})		}						// Add Settings		var s = this.getSettings();		if (s.length > 0){			ret.items.push({				title		: 'Settings'				,type		: 'setting'				,bodyStyle	: "background-color: #E5E5E5;"				,defaults	: {					border		: false					,cls		: "ev-nav-button"				}				,items		: s				,listeners	: {					expand		: this.scroller				}			})				}				return ret;	}	,createTopSouth : function(){		var brdg = Eve.Resource.superbridge;		Eve.StatusBar = new Eve.vc.StatusBar();		var statusBridge = new Eve.widgets.StatusBarBridge();		brdg.addBridge( statusBridge );		statusBridge.init( { superbridge: brdg, view: Eve.StatusBar } );		return {			region: 'south'			,titleBar: false			,height: 25			,split: false			,border: false			,items:[ Eve.StatusBar.get()]		}	}	,createSouth  : function()	{		/*		if(!Eve.StatusBar){			var brdg = Eve.Resource.superbridge;			Eve.StatusBar = new Eve.vc.StatusBar();			var statusBridge = new Eve.widgets.StatusBarBridge();			brdg.addBridge( statusBridge );			statusBridge.init( { superbridge: brdg, view: Eve.StatusBar } );		}		return { view: Eve.StatusBar, config: { titleBar: false, height: 25, split: false, border: false } };		*/	}	,createDialogs	: function(brdg) { /* Don't Delete This */ }	,createRest 	: function(brdg) { /* Don't Delete This */ }}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Layout.js *//*--------------------------------------------------*/// Written by OmidEve.lib.Layout = function() {	}Ext.extend( Eve.lib.Layout, Eve.lib.View, {		// Initializes the layout with a new factory and a new superbridge	 init : function( factory, superbridge, section )	{		this.factory 		= factory;		this.superbridge 	= superbridge;				var pass = [];		factory.createBefore(superbridge);				// Fill the pass with the correct configuration		var temp = factory.createNorth( superbridge );		if ( typeof temp != 'undefined' && temp != false ) {			temp = Ext.apply(temp.config, {region:'north', items:temp.view.get(), layout:'fit'});			pass.push(temp);		}				temp = factory.createEast(superbridge);		if ( typeof temp != 'undefined' && temp != false ) { 			temp = Ext.apply(temp.config, {region:'east', items:temp.view.get(), layout:'fit'});			pass.push(temp); 		}				temp = factory.createCenter(superbridge);		if (typeof temp != 'undefined' && temp != false) {			temp = Ext.applyIf(temp.config, {region:'center', items:temp.view.get()/*, layout:'fit'*/});			pass.push(temp);		}		temp = factory.createWest(superbridge);		if ( typeof temp != 'undefined' && temp != false ) { 			temp = Ext.applyIf(temp.config, {region:'west',items:temp.view.get(), layout:'fit'});			pass.push(temp);		}				temp = factory.createSouth(superbridge);		if ( typeof temp != 'undefined' && temp != false ) {			temp = Ext.applyIf(temp.config, {region:'south', items:temp.view.get(), layout:'fit'});			pass.push(temp);		}				// Create the Rest		factory.createMenus		( superbridge );		factory.createDialogs	( superbridge );		factory.createRest		( superbridge );		factory.createDefaults	( superbridge );		this.createViewContainer( pass, section );	}		// private	,createViewContainer : function( pass, section )	{		this.vc = new Ext.Panel({			 layout  : 'border'			,titlebar: false			,items	 : pass		});	}		,get : function()	{		return this.vc;	}});// It is so easy to change the whole thingEve.lib.MainLayout = Ext.extend( Eve.lib.Layout, {	init: function(){		Eve.lib.MainLayout.superclass.init.apply( this, arguments );	}		,createViewContainer : function( pass, section )	{  		var west = this.factory.createTopWest();				if (typeof west != 'undefined' && west != false) {			west = Ext.apply( west,{				region			: "west"				,layout			: "scrollaccordion"				,id				: "topWestAccordion"				//,title			: "Navigation"				,collapseMode	: 'mini'				,collapsible	: true				,split			: true				,layoutConfig	: { 					hideCollapseTool: true					,animate	: true				}			});		}		if(!Eve.StatusBar)			var statusBar = this.factory.createTopSouth();				var generateName = function(){			if ( Eve.Preference.get('organization' ) && Eve.Preference.get('organization' ).trim() !== '' ){				return Eve.Preference.get('organization' ).trim();			}						return Eve.Preference.get('firstname') + ' ' + Eve.Preference.get('lastname');		};		if (!this.vc) {			var shortcuts = [[ 'Shortcuts', '0' ]			                 , [ '---------', '' ]];						if (Eve.Preference.get('mail') == "1")				shortcuts.push([ 'New Message', 'mail']);			if (Eve.Preference.get('mycalendar') == "1")				shortcuts.push([ 'New Event', 'calendar']);			if (Eve.Preference.get('mycontacts') == "1")				shortcuts.push([ 'New Contact', 'contact']);			if (Eve.Preference.get('mytasks') == "1")				shortcuts.push([ 'New Task', 'task']);			if (Eve.Preference.get('reminders') == "1")				shortcuts.push([ 'New Reminder', 'reminder']);			if (Eve.Preference.get('mydocuments') == "1")				shortcuts.push([ 'New Document', 'document']);			if (Eve.Preference.get('mylinks') == "1")				shortcuts.push([ 'New Link', 'link']);			if (Eve.Preference.get('notes') == "1")				shortcuts.push([ 'New Note', 'note']);						//announcement style			var displayAnnounce = (Eve.announcements == "0")? 'none': '';			this.vc = new Ext.Viewport({				layout		: 'border'				,defaults	: { split:false }				,titlebar	: false								,items		: [{					 region		: 'north'					,layout		: 'column'					,height		: 44					,bodyStyle	: "background-color: #B2D5F5; color: #FFF;"					,defaults	: {						border: false						,height: 44					}					,items		: [{						   cls: 'navbar-background-north'						 , id: 'navbar-cobrand-title'						 , html: (Eve.Preference.getInteger('resellerId') <= 0 ) ? ('<div title="' + generateName() + '" style="white-space:nowrap; margin-right:20px; ' + (generateName().length < 27 ? 'width: 260px;' : 'width: auto;') + '" class="navbar-background-cobrand">' + generateName() + '</div>' ) : ('<div style="white-space:nowrap; margin-right:20px; ' + (generateName().length < 27 ? 'width: 260px;' : 'width: auto;') + '" class="navbar-background-nocobrand">' + generateName() + '</div>' )					 },{						   width: 200						 , bodyStyle: 'padding-top: 10px;'						 , cls: 'navbar-background'						 , items: [{								 xtype: 'combo'								,style: 'margin-left:5px;'								,store: new Ext.data.SimpleStore({ data: shortcuts																 , fields: [ 'data', 'value' ]} )								,displayField: 'data'								,valueField: 'value'								,mode: 'local'								,editable: false								,triggerAction: 'all'								,emptyText : 'shortcuts'								,listeners: {									'select': {										'fn': function( c, r, idx ){											var val = r.get('value');											if ( val == '0' || val == '' ){												return true;											}											Eve.Resource.superbridge.broadcast( window, 'proxy_dialog', { type: val ,func: function(){													Eve.Resource.superbridge.broadcast( window, val + '_create_item_dlg', { info: { id:0 , path: '\\', parentId: 0, root: 'personal' }																														  , mode: 'create' } 																					  );											} } );											c.setValue( '0' );										}									}								}						   }]					},{						   html: [						   		'<div style="float:right"><TABLE><TR>',									  (( Eve.Preference.getBoolean('accountTrial') && Eve.Preference.getInteger('chatLoggedIn')) ? ('<TD class="buttontd" onclick="Eve.Resource.showChat();"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG HIGHT=16 WIDTH=16 SRC="' + Eve.imagePath + 'topbar/live_support.png"></TD><TD class="buttonimageclass">Live Support</TD></TR></TABLE></TD>') : ''),								  (( Eve.Preference.getBoolean('accountTrial') && Eve.Preference.getInteger('resellerId') <= 0 ) ? ('<TD class="buttontd" onclick="Eve.Resource.showBuyNow('+Eve.Preference.getInteger('id')+','+Eve.Preference.getInteger('cobrandId')+');"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG HIGHT=16 WIDTH=16 SRC="' + Eve.imagePath + 'topbar/buy_now.png"></TD><TD class="buttonimageclass">Buy Now</TD></TR></TABLE></TD>') : ''),								  '<TD class="buttontd" id="announceTD" style="display:'+displayAnnounce+'" onclick="Eve.Resource.showAnnouncement.call(this);"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG SRC="' + Eve.imagePath + 'topbar/announcements.png"></TD><TD class="buttonimageclass" style="color:#168019;">Announcements <span id="announce_count" style="color:#168019">('+Eve.announcements+')</span></TD></TR></TABLE></TD>',						   		'<TD style="display:none;" class="buttontd" onclick="Eve.Resource.changeStyle();"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG SRC="' + Eve.imagePath + 'topbar/change-style.png"></TD><TD class="buttonimageclass">Change Style</TD></TR></TABLE></TD>',								  (( Eve.Preference.getBoolean('im') ) ? ('<TD class="buttontd" onclick="Eve.Resource.showIM();"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG SRC="' + Eve.imagePath + 'topbar/im.png"></TD><TD class="buttonimageclass">IM</TD></TR></TABLE></TD>') : ''),								  '<TD class="buttontd" onclick="Eve.Resource.showHelp();"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG SRC="' + Eve.imagePath + 'topbar/help.png"></TD><TD class="buttonimageclass">Help</TD></TR></TABLE></TD>',								  '<TD width="91" class="buttontd" onclick="Eve.Resource.logout();"><TABLE cellpadding=0 cellspacing=0 border=0><TR><TD><IMG SRC="' + Eve.imagePath + 'topbar/logout.png"></TD><TD class="buttonimageclass">Logout</TD></TR></TABLE></TD>',								  '</TR></TABLE></div>'].join('')						 , cls : 'navbar-background'						 , columnWidth: 1					}]				}, west, {					 region		: 'center'					,layout		: 'border'					//,id			: 'MainCardLayout'					,border     : false					//,activeItem	: 0					,deferredRender : false					,items			: [{							layout	: 'card'							,region	: 'center'							,id		: 'MainCardLayout'							,border	: false							,activeItem	: 0							,deferredRender : false							,items: [							{								id    			: section								,border			: false								,layout 		: "border"								,items  		: pass								//Added by Ghazal								,listeners		:{									'render'      :{										'fn'    : function(cmp){																			}									}								}								//							}, {								id				: 'TempLayout'								,border			: false							}							]					},statusBar]				}]			});			//Added by Ghazal for loadingbar			var spec = {				tag: 'div',				id:'loading_bar',				cls: 'my-list',				style: 'display:none;padding:1px;width:200px;margin:0px 550px;;background-color:#CF4342;color:#fff;top:0px;position:fixed;border:1px solid;',				html: '<img src="/hyperoffice2nd/views/styles/ModernStyle/images/default/grid/wait.gif" style="float:left;"> Loading... &nbsp;'			};			Ext.DomHelper.append(				document.body,				spec			);			//						Eve.LayoutManager.navMonitor();		}		else {			var lt = {				layout		: 'border'				,id			: section				,defaults	: { split: true }				,border		: false				,items		: pass				,deferredRender : false				//Added by ghazal				,listeners		:{					'render'      :{						'fn'    : function(cmp){							cmp.on('show', function(){							});						}					}				}				//			}						// Get the Card Layout.			//debugger;			//var center = this.vc.items.itemAt(2);			var center = this.vc.items.itemAt(2).items.itemAt(0);			center.add(lt);			center.doLayout();		}				// center.doLayout();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Bridge.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Bridge = function(){}Eve.lib.Bridge.prototype = {	addBridge : function(){		return false;	}		,init : function(data) {		this.superbridge = data.superbridge || new Eve.lib.SuperBridge();		this.view 		 = data.view 		|| new Eve.lib.EmptyView;		this.conn 		 = data.conn  		|| new Eve.lib.EmptyXHR;		this.manager	 = data.manager;				if (data.section === undefined) {			throw 'Section name should be set to prevent Resource confusion!!!';		}				this.section	 = data.section	}		,fire : function( type, object, self ){		// Broadcasts a command to the superbridge object		this.superbridge.broadcast( this, type, object, self );	}		,broadcast : function( callee, type, obj ){		console.log( this, ' can not broadcast ', type, object );		return false;	}		,execute : function( callee, type, object ){		// Default  behaviour is to log ... 		// console.log( 'SuperBridge Called :', this, type, object );	}}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/LayoutManager.js *//*--------------------------------------------------*/// Written by Khashayar.Eve.lib.LayoutManager = function() {};Ext.extend(Eve.lib.LayoutManager, Eve.lib.Bridge, {	init : function(obj) {		this.superbridge = obj.superbridge;				this.sectionName	= null;		this.selectGroup = false;		Eve.registery.allContacts = Eve.Cache.get('allContacts', true);	}	,navMonitor : function() {		Ext.select('.ev-nav-button').on('click', function(e, target) {			var t = (target.tagName == 'DIV') ? target : target.parentNode;			var sectionName = t.id.split('_')[1];			//show loading bar			//			if ( this.sectionName != sectionName && sectionName != "GroupMembership" && sectionName != "SiteAdministration")//				Ext.get('loading_bar').show();						var that = this;			if (sectionName == "GroupMembership"){				Eve.Resource.superbridge.broadcast( this, 'show_group_select', {					force	: true					,func	: function() {						that.sectionName = "GroupMembership";						that.loadSection('Homepage');					}					,scope : window				});			} else {				this.loadSection( sectionName );			}		}, this)	}	,loadSection : function(sectionName, info, forceLoad) {		if (this.sectionName == sectionName)			return;		// Hide the junks....		Eve.Interlink.Popup.hideInterlinkPopup();		Eve.calendar.Bubble.closeBubble();		Eve.calendar.MonthlyBubble.hide();		var sectionInfo = Eve.SectionManager.getSectionByName( sectionName );		this.showHelpBubble(sectionInfo.id);		this[sectionInfo.method]( sectionName, info, forceLoad );		this.sectionName	= sectionInfo.name;				this.setActiveIcon(sectionInfo.name, sectionInfo.type);	}	// # # # # # # # # # # # # # #	// # # # # # # # # # # # # # #	// # # # # # # # # # # # # # #	,showTreeGrid : function( sectionName, info, forceLoad )	{		var that = this;		Eve.SectionManager.load( sectionName );				var showGroupSelect = false;		if (!info){			if (Eve.Preference.get("landingGroupId") == 0)				showGroupSelect = true;		}		else{			if (!info.groupId || info.groupId == 0)				showGroupSelect = true;		}		if ( Eve.SectionManager.isGroupSection( sectionName ) && showGroupSelect ){			Eve.Resource.superbridge.broadcast( this, 'show_group_select', {				func:	function( groupId, groupPath ){					that.selectGroup = true;					if (!info)						var info = {}											info.groupId = groupId;					info.groupPath = groupPath;					that.tryToChangeLayout( sectionName, info, forceLoad ) 				} 			})		}		else if ( Eve.SectionManager.isGroupSection( sectionName ) && !this.selectGroup){						Eve.Resource.superbridge.broadcast( this, 'direct_group_select',				{ id: Eve.Preference.get("landingGroupId") 					,name: ''					,path:Eve.Preference.get("landingGroupPath") 					,func: function( groupId, pageId, groupPath ){						that.selectGroup = true;												if (!info)							var info = {}													info.groupId = groupId;						info.groupPath = groupPath;						that.tryToChangeLayout( sectionName, info, forceLoad ) 					}				}			);					}		else{			that.tryToChangeLayout( sectionName, info, forceLoad );		}	}	,tryToChangeLayout : function( sectionName, info, forceLoad )	{		if (!info){			var info = {};			if (Eve.SectionManager.isGroupSection( sectionName )){				info.groupId = Eve.Preference.get("landingGroupId");				info.groupPath = Eve.Preference.get("landingGroupPath");			}			else{				info.groupId = 0;				info.groupPath = '\\';			}		}		Eve.activeSec = Eve.SectionManager.getSectionId( sectionName );		console.log( Eve.activeSec )		if (sectionName == 'Wiki' || sectionName == 'Publisher')		{			var eventName ;			if(sectionName == 'Wiki')				eventName = 'wiki.home'			else{				eventName = 'modern.publisher.view&pageId=' + Eve.GroupSelect.PageId + '&groupId='  +Eve.GroupSelect.groupId;			}						var panel = {				xtype		: 'panel'				,id			: 'TempLayout'				,layout		: 'fit'				,items		: [ new Ext.ux.IFrameComponent({ url: Eve.url, event: eventName + "&CFID=" + Eve.CFId + "&CFTOKEN=" + Eve.CFToken }) ]			};			var el	= Ext.getCmp('MainCardLayout');			var lt	= el.getLayout();							el.remove(Ext.getCmp('TempLayout'));			el.add(panel);			lt.setActiveItem(el.items.items.length-1)		}		else		{			this.fire('show_section', {				sectionName			: sectionName				,info				: info				,forceLoad			: forceLoad			});						Ext.getCmp('MainCardLayout').getLayout().setActiveItem( Eve.SectionManager.getSectionId( sectionName ) );			Ext.getCmp('MainCardLayout').getLayout().activeItem.doLayout();		}		var unmask = function(){			if(Eve.done)				Ext.getBody().unmask();			else 				setTimeout(unmask(), 100);		}		if(Eve.Preference.get("landingPage") != "Desktop")			unmask();//		if(Ext.get('loading_bar'))//			Ext.get('loading_bar').hide();				}	,showApplication : function( sectionName, info, forceLoad )	{		var url, event;		var apps = Eve.Preference.get('applications');				for (var i = 0; i < apps.length; ++i) {			if (apps[i].name == sectionName) {				var app = apps[i];				break;			}		}				var panel = {			xtype		: 'panel'			,id		: 'TempLayout'			,layout		: 'fit'			,items		: [ new Ext.ux.IFrameComponent({ url:app.m_url, event: null, style:'position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px;' }) ]		};				var el	= Ext.getCmp('MainCardLayout');		var lt	= el.getLayout();				el.remove(Ext.getCmp('TempLayout'));		el.add(panel);		lt.setActiveItem(el.items.items.length-1)		Eve.activeSec = "TempLayout";	}	,showSetting : function( sectionName, info, forceLoad )	{		var sectionId = Eve.SectionManager.getSectionId( sectionName );				if(sectionId == 'siteAdministration'){			window.open(Eve.url + "?event=cobrand.home");			return;		}				var event = "";		var myUrl = Eve.url;		if (info && info.event) {		    event = info.event;		} else {			switch (sectionId) {				case 'manageUsersAndGroups':				    event = "administrator.dispatcher";				    break;				case 'manageGroups':				    event = "administration.groups.initialize";				    break;				case 'personal':				    event = "userPreferences.personal.and.general.edit&id=-1&multipleControllers=userPersonalSettingController,userGeneralSettingController";				    break;				case 'setupTools':				    event = "administrator.setup.tools";				    break;		    		case 'mobileSync':				    event = "mobile.sync";				    myUrl = "../applications/SyncProfile/index.cfm";				    break;				    				case 'siteAdministration':				    event = "cobrand.home";				    break;				case 'portalAdministration':				    event = "cobrand.portalAdministration.sidebar&id=" + Eve.Preference.getInteger("cobrandId");				    break;				case 'billing':				    event = "billing";				    myUrl = "../admin/userbilling/billingmanager.cfm";				    break;			}				}						if (myUrl.indexOf('CFID') == -1 && myUrl.indexOf('CFTOKEN') == -1){			if (event == "") {				event = "CFID=" + Eve.CFId + "&CFTOKEN=" + Eve.CFToken;			} else {				event += "&CFID=" + Eve.CFId + "&CFTOKEN=" + Eve.CFToken;			}		}						var panel = {			xtype		: 'panel'			,id			: 'TempLayout'			,layout		: 'fit'			,items		: [ new Ext.ux.IFrameComponent({ url: myUrl, event: event }) ]		};						var el	= Ext.getCmp('MainCardLayout');		var lt	= el.getLayout();				el.remove(Ext.getCmp('TempLayout'));		el.add(panel);		lt.setActiveItem(el.items.items.length-1)		Eve.activeSec = "TempLayout";	}	,setActiveIcon : function(sectionName, type){		var dq = Ext.DomQuery;		var accordion	= Ext.getCmp('topWestAccordion');		var activeIcons = [];		var icons = [];				/*		 * There's a bug in Ext 2.2:		 * SetActiveItem method missed from the source of accordion layout		 * If we switch to Ext 3.0 we can use setActiveItem instead of this approch.		 */		for (var i = 0; i<accordion.items.length; i++){			activeIcons.push( dq.select('div.ev-section-wrapper-active',accordion.items[i]));			icons.push(dq.select('div.ev-section-wrapper',accordion.items[i]));			if (accordion.items.itemAt(i).type == type){				accordion.items.itemAt(i).expand();				break;			}		}		for(var i=0; i<activeIcons.length; i++){			Ext.get(activeIcons[i]).removeClass('ev-section-wrapper-active');			Ext.get(activeIcons[i]).addClass('ev-section-wrapper')		}		var el = Ext.get('navbarbtn_'+ sectionName);		el.addClass('ev-section-wrapper-active')	}	,showHelpBubble : function(sectionId){		var config = Eve.Preference.get('sections')[sectionId];		var display = (config)? config.showBubbleHelp : false;		if(display){				var temp = (Eve.isSSL == "0") ?'http://' : 'https://';				Ext.Ajax.request({					url			: temp + Eve.loginUrl +'/hyperoffice2nd/views/Styles/ModernStyle/Angels/'+ sectionId +'.html'					,callback	: function(el, success, response){						if(success){							var helpWindow = new Ext.Window({								layout  		: 'fit'								,modal  		: true								,border 		: false								,width  		: 648								,y      		: 100								,height 		: 400								,autoScroll 	: true								,closeAction    : 'close'								,resizable      : true								,items  		: [{										xtype: 'form'										,html: response.responseText								}]							});														helpWindow.show();							helpWindow.getEl().setStyle('z-index', '30000')							Eve.Preference.get('sections')[sectionId].showBubbleHelp = false;						}					}				})		}	}		,execute : function(callee, type, data)	{		switch (type) {			case 'load_section':				this.loadSection(data.sectionName, data.info, data.forceLoad);							break;							case 'load_section_completed':				//this.showHelpBubble(data.sectionId);				//Eve.registery.allContacts = Eve.Cache.get('allContacts');				if(window.console && window.console.firebug){					//Ext.Msg.alert('Warning', 'Firebug is known to cause performance issues with the application.');				}								if(!this.isTaskRunner){						this.isTaskRunner = true;						var that = this;						Eve.ReminderIds = [];						Eve.MeetingIds = [];						Eve.TaskRunner.createTask( 'RefreshInterval', {							run: function(){								Ext.Ajax.request( {									url: Eve.url									,params: {										event: 'modern.global.personal.backgroundCount'										,oldreminders: Eve.ReminderIds.join(',')										,oldmeetings: Eve.MeetingIds.join(',')									}									,success : function(response, options){										var dq = Ext.DomQuery;										var reminderCount, invitCount, meetingCount;										var xml = response.responseXML;										reminderCount	= dq.selectValue('remindersCount', xml);										invitCount		= dq.selectValue('invitationsCount', xml);										meetingCount 	= dq.selectValue('meetingsCount', xml);										var reminderXML = dq.select('reminders/reminder', xml);										var meetingXML	= dq.select('meetings/row', xml);										var len = reminderXML.length;										if(len > 0){											for(var i=0; i < len; i++){												Eve.ReminderIds.push( dq.selectValue('id', reminderXML[i]).split('_')[1] );											}										}										len = meetingXML.length;										if(len > 0){											for(var i=0; i < len; i++){												Eve.MeetingIds.push( dq.selectValue('id', meetingXML[i]).split('_')[1] );											}										}										var obj = {											reminderCount : reminderCount											,invitCount: invitCount											,meetingCount:meetingCount										};										if( reminderXML.length > 0 )											obj.reminderXML = dq.select('reminders', xml)										if( meetingXML.length > 0 )											obj.meetingXML = dq.select('meetings', xml)																				that.fire('set_popOut_counts', obj );									}								} );							}							,interval: Eve.Preference.getInteger('DesktopRefreshInterval' )*1000						} );				}				break;						}		}		});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Filter.js *//*--------------------------------------------------*/// Written by KhashayarEve.Filter = function() {}Ext.extend(Eve.Filter, Eve.lib.Bridge, {		getSection : function(u) {		var sec = this.section;		return u ? sec.substr(0, 1).toUpperCase() + sec.substr(1) : sec;	}		// Set 'Flat View' or 'Items Only'.	,setGridView : function(data)	{		var btn = Ext.getCmp(this.getSection() + '_folderItem');				if (!btn || btn === undefined)			return;					var xml		= data.store.reader.xmlData;		var root	= xml.documentElement || xml;		var itemsOnly = Ext.DomQuery.selectValue('itemsOnly', root);		if (itemsOnly == 'false') {			var txt = (this.getSection() == 'task') ? 				'View Projects and Tasks' : 				this.getSection(true) + 's and Folder';				           	btn.setText(txt);			btn.menu.items.items[0].setChecked(true);		}		else {			var txt = (this.getSection() == 'task') ? 				'View All Tasks (Including Sub-Projects)' :				this.getSection(true) + 's Only';							btn.setText(txt);			btn.menu.items.items[1].setChecked(true);		}	}		,setCalendarFromTo : function(data)	{		var dq		= Ext.DomQuery;		var xml		= data.store.reader.xmlData;		var filter	= dq.selectNode('filter', xml.documentElement || xml);		var startDate	= dq.selectValue('startDate', filter, '');		var startTime	= dq.selectValue('startTime', filter, '');		var endDate		= dq.selectValue('endDate', filter, '');		var endTime		= dq.selectValue('endTime', filter, '');				Ext.getCmp('calFilterFrom').setText('Start: ' + startDate + ' ' + startTime);		Ext.getCmp('calFilterTo').setText('End: ' + endDate + ' ' + endTime);		var start	= Date.parseDate(startDate + ' ' + startTime, [Eve.Preference.get('dateformat'),' ',Eve.Preference.get('timeformat')].join('')/*'n/j/y G:i A'*/);		var end		= Date.parseDate(endDate + ' ' + endTime, [Eve.Preference.get('dateformat'),' ',Eve.Preference.get('timeformat')].join('')/*'n/j/y G:i A'*/);		Ext.getCmp('calFilterFromPicker').picker.setValue( start );		Ext.getCmp('calFilterToPicker').picker.setValue( end );	}		,setTaskFilterItems : function(data)	{	 	 	var btn;		 	var text, icon;					 	if (data.store.getTotalCount() != 0) {	     		var xml			= data.store.reader.xmlData;	 		 	var jsonObject	= xml2json(xml, "");	  		 	var filters		= (jsonObject.data)?jsonObject.data.filter : jsonObject.filter;								Ext.getCmp('task_quick_search').el.dom.value = filters.searchText;								switch (filters.completeMode) {					case 'all':						text = 'All Tasks';						icon = Eve.Resource.getIcon('all-tasks', 'task');						break;					case 'completed':						text = 'Complete';						icon = Eve.Resource.getIcon('completed', 'task');						break;					case 'incomplete':						text = 'Incomplete';						icon = Eve.Resource.getIcon('incompleted', 'task');						break;					case 'overdue':						text = 'Overdue';						icon = Eve.Resource.getIcon('overdue', 'task');						break;			    }								btn = Ext.getCmp('completeMode');				btn.setText(text);				btn.setIcon(icon);				switch (filters.assignMode) {					case 'toMe':						text = 'Assigned To Me';						icon = Eve.Resource.getIcon('assigned-to-me', 'task');						break;											case 'byMe':						text = 'Assigned By Me';						icon = Eve.Resource.getIcon('assigned-by-me', 'task');						break;											case 'all':						text = 'All Assigned';						icon = Eve.Resource.getIcon('all-assigned', 'task');						break;											case 'unassigned':						text = 'Unassigned';						icon = Eve.Resource.getIcon('unassigned', 'task');						break;				}								btn = Ext.getCmp('assignMode');				btn.setText(text);				btn.setIcon(icon);			}	}		,setContactSearchText : function(data)	{		var searchField	 = Ext.getCmp('contact_quick_search');				var xml		= data.store.reader.xmlData;		var filter	= Ext.DomQuery.selectNode('filter', xml.documentElement || xml);				// Update searchField's value		searchField.setValue( Ext.DomQuery.selectValue('searchText', filter, '') );	}		,execute : function(callee, type, data) {		switch(type) {			case (this.getSection() + '_grid_store_reload'):				this.setGridView(data);								switch (this.getSection()) {					case 'calendar':						this.setCalendarFromTo(data);						break;											case 'task':						this.setTaskFilterItems(data);						break;											case 'contact':						this.setContactSearchText(data);						break;				}								break;				case (this.getSection() + '_filter_folders'):						switch(this.getSection()){							case 'task':								var menu = Ext.getCmp('task_filter_menu');								menu.setText('Incomplete');								menu.setIcon(Eve.Resource.getIcon('incompleted', 'task'));								break;						}					break;				case (this.getSection() +'_clear_folders_filter'):					switch(this.getSection()){						case 'task':							var menu = Ext.getCmp('task_filter_menu');							menu.setText('All projects');							menu.setIcon(Eve.Resource.getIcon('all-tasks', 'task'));							break;					}		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Permission.js *//*--------------------------------------------------*/// Written by KhashayarEve.Permission = function() {}Ext.extend(Eve.Permission, Eve.lib.Bridge, {	 nodePrm 	: {Select: false, New: false, Edit: false, Delete: false,Enable: true, Disable: false, DeleteAll:false}	,rowPrm		: {Edit: false, Delete: false, Open: true, Enable: true, Disable: false}	,multiRowPrm: {Edit: false, Delete: true, Open:false, Linked: false}	,custPrm	: {}		,tbButtons	: {}	,gridMenus	: {}	,treeMenus	: {}		,getSection : function(u) {		return this.section;	}		,getValue : function(val) {		var btn = "";		switch (val) {			case "New":			case "Add":			case "New Folder":			// Used in 'Documents'			case "Upload File":			// Used in 'Documents'				btn = "New";				break;							case "Edit":			case "Rename":			case "Restore":				// Used in 'Recycle Bin'			case "Edit Topic":				btn = "Edit";				break;							case "Delete":			case "Purge":				// Used in 'Recycle Bin'			case "Delete File":			case "Delete Folder":			case "Delete Topic":			case "Empty Recycle Bin":	// Used in 'Recycle Bin'				btn = "Delete";				break;						case "Details":				// Used in 'Documents'				btn = (this.root == 'personal') ? "Disable" : "Edit";				break;			case "Permissions":			    btn = (this.root == 'personal') ? "Disable" : "Enable";			    break;			case "Audit":				// Used in 'Documents'				btn = (this.root == 'personal') ? "Disable" : "Enable";				break;			case "All Assigned":		// Used in 'Tasks'				btn = (this.root == 'personal') ? "Disable" : "Enable";				break;						case "Vote":			case "Open Link":			case "Open Note":			case "Open Contact":			    btn = "Open";			    break;			case "Comments":			case "Linked Items":			    btn = "Linked";			    break;			    			case "Up":				btn	= (this.id == 0 || !this.id) ? "Disable" : "Enable";				break;			case "Purge All":				btn = "DeleteAll";				break;			default:				btn = "Enable";			// Change it to Disable if u want to disable unknown butttons		}				return btn;	}		,showMsg : function() {		Ext.tools.msg('Permission Denied', "Sorry, but you don't have permission for this operation.");	}				// - - - - - - - - - - - - - - - 	// Buttons & Menus Registration.	// - - - - - - - - - - - - - - - 		,regTreeMenu : function(menu) {		this.treeMenus[this.getSection()] = menu;	}	,regGridMenu : function(menu) {		if (this.gridMenus[this.getSection()] === undefined)			this.gridMenus[this.getSection()] = [];				this.gridMenus[this.getSection()].push(menu);	}	,regToolbarButton : function(menu) {		this.tbButtons[this.getSection()] = menu;	}				// - - - - - - - - - - - - - - - 	// Permission Setters.	// - - - - - - - - - - - - - - - 		,setNodePermission : function(p) {		Ext.apply(this.nodePrm, p);	}	,setRowPermission : function(p) {		Ext.apply(this.rowPrm, p);	}		// - - - - - - - - - - - - - - - 	// Permission Checkers.	// - - - - - - - - - - - - - - - 		,setTreeMenus : function(d)	{		var m = this.treeMenus[this.getSection()];		//var t = (d.type == "group") ? "groupmenu" : "foldermenu";				if ( !m )		    return;		    		var opt = m[d.type + 'menu'].items.items;		var prm = "";				for (var i in opt) {			var ret = this.getValue(opt[i].text);			if (ret && opt[i].setDisabled) {				opt[i].setDisabled(!this.nodePrm[ret]);			}		}				this.fire(this.getSection() + "_treemenu", d);	}		,setGridAddMenu : function(d)	{		var amenu = this.gridMenus[this.getSection()][0].menu.items.items;		for (var i in amenu) {			if (typeof amenu[i] == 'object')				amenu[i].setDisabled(!this.nodePrm.New)		}	}		,setGridAddDialog : function(d)	{		if (this.nodePrm.New)			this.fire(this.getSection() + "_create_item_dlg", d);		else {			this.showMsg();		}	}		,setGridEditMenu : function(d)	{		var type 	= (d.type != '') ? d.type : 'item';		type		= type || 'item';		type		= type.toLowerCase();				try {			type		= (type + "_menu");						// Section Menu			var sm		= this.gridMenus[this.getSection()];						// By default, I expect edit menu being pushed after add menu so the index will be 1			// but if there's no index 1, so get the index 0 (happens in Documents' Recycle Bin)			sm			= sm[1] || sm[0];						// If there's no menu with passed type, let's try the pure 'menu'			sm			= sm[type] || sm['menu'];			var emenu	= sm.items.items;		} catch(e) {}		for (var i in emenu) {			var ret = this.getValue(emenu[i].text);			if (emenu[i].setDisabled)				emenu[i].setDisabled(!this.rowPrm[ret])		}				this.fire(this.getSection() + "_editmenu", d);	}	,setGridMultiEditMenu : function(obj)	{		var d = obj.data;		var type 	= (d[0].type != '') ? d[0].type : 'item';		type		= type || 'item';		type		= type.toLowerCase();				d.isMultiSelected = true;		d.type = type;		d.title = obj.info.title;		d.pos  = obj.info.pos;		d.info = obj.info;		try {			type		= (type + "_menu");			// Section Menu			var sm		= this.gridMenus[this.getSection()];			// By default, I expect edit menu being pushed after add menu so the index will be 1			// but if there's no index 1, so get the index 0 (happens in Documents' Recycle Bin)			sm			= sm[1] || sm[0];			// If there's no menu with passed type, let's try the pure 'menu'			sm			= sm[type] || sm['menu'];			var emenu	= sm.items.items;		} catch(e) {}		for (var i in emenu) {			var ret = this.getValue(emenu[i].text);			if (emenu[i].setDisabled){				if(emenu[i].text == 'Copy' && this.section == 'task')					emenu[i].setDisabled(false);				else					emenu[i].setDisabled(!this.multiRowPrm[ret]);			}		}		this.fire(this.getSection() + "_editmenu", d);	}		,setToolbarButtons : function(d)	{		var tb	= this.tbButtons[this.getSection()];		var btn = tb.items.items;		for (var i in btn) {			var ret = this.getValue(btn[i].text);			if (ret && btn[i].setDisabled)				if(ret == "DeleteAll") //Use in Contact for purgeAll					btn[i].setVisible(this.nodePrm[ret]);								// New Button checked with tree permissions.				// Empty Recycle Bin too!				else if (ret == "New" || btn[i].text == 'Empty Recycle Bin')					btn[i].setDisabled(!this.nodePrm[ret]);				else					btn[i].setDisabled(!this.rowPrm[ret]);			}			}		,chNodePermission : function(d, type)	{		if (d.node !== undefined) {			var per = d.node.attributes.per;			this.setNodePermission(per);		}		else if (this.getSection() == 'reminder') {			var per = {Select: true, New: true,	Edit: true,	Delete: true};			this.setNodePermission(per);		}				for (var i=0; i < type.length; ++i) {			var run = "set" + type[i];			this[run](d);		}	}		,chRowPermission : function(d, type)	{		// Start: Added By Ghazaleh		if(this.section == "Voting"){			var userVoted = (d.rec.data.userVoted == "0")? false : true;			var voteOpen =(d.rec.data.open == "0")? false : true;			var open = (!(userVoted) && voteOpen);		}		// End: Added By Ghazaleh		// Start: Added By Syavash		if(this.section == "contact"){			var open = (d.rec.data.openPermission == 0)? false : true;			var linked = open;		}		// End: Added By Syavash						var per = {			Edit			: d.rec.data.editPermission			,Delete			: d.rec.data.deletePermission			,Open			: (open !== undefined)? open : true			,Linked			: (linked !== undefined)? linked : true		}				this.setRowPermission(per);		var run = "set" + type;		this[run](d);	}		,chMultiRowPermission : function(obj, type)	{		var d = obj.data;		var delPer = false;		var editPer = false;				for(var i=0; i<d.length; i++){			delPer = delPer || d[i].rec.data.deletePermission;			if(this.section == 'doc_recycle')			    editPer = editPer || d[i].rec.data.editPermission;		}		var per = {			 Edit 		: editPer			,Open		: false			,Delete     : delPer		}		//		Ext.apply(this.multiRowPrm, per);		var run = "set" + type;		this[run](obj);			}	,execute : function(callee, type, data)	{		switch (type) {			case (this.getSection() + "_before_treemenu"):				this.chNodePermission(data, ["TreeMenus"]);				break;			case (this.getSection() + "_set_active_node"):				Ext.apply(this, data.info);				this.chNodePermission(data, ["GridAddMenu", "ToolbarButtons"]);				break;							case (this.getSection() + "_before_create_item_dlg"):				this.chNodePermission(data, ["GridAddDialog"]);				break;							case (this.getSection() + "_before_editmenu"):				this.chRowPermission(data, ["GridEditMenu"]);				break;			case (this.getSection() + "_before_multi_editmenu"):				this.chMultiRowPermission(data, ["GridMultiEditMenu"]);				break;			case (this.getSection() + "_set_active_row"):				this.chRowPermission(data, ["ToolbarButtons"]);				break;			case (this.getSection() + "_set_multi_active_row"):				this.chMultiRowPermission(data, ["ToolbarButtons"]);				break;							case (this.getSection() + "_permission_denied"):				this.showMsg();				break;							case ("show_section"):				if (this.getSection() != Eve.SectionManager.getSectionId( data.sectionName )) {					return;				}				this.root = (data.info.groupId > 0) ? 'group' : 'personal';								var tree = Eve.Preference.get('tree');				if (! tree[ this.getSection() ]) { return; }								var nodes	= tree[ this.getSection() ].nodes;				var groupId	= data.info.groupId;								for (var i = 0; i < nodes.length; ++i) {					var node = nodes[i];					var id	 = node.id.split('_')[1];										if (id == groupId) {						var per = {							Select	: node.get('selectPermission')							,New	: node.get('newPermission')							,Edit	: node.get('editPermission')							,Delete	: node.get('deletePermission')							,DeleteAll : node.get('administrator') || ( Eve.Preference.getInteger('accountlevel') >= 140 )						}												break;					}				}								data = {					node : {						attributes : {							per			: per						}					}				}								this.chNodePermission(data, ["GridAddMenu", "ToolbarButtons"]);								break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/SuperBridge.js *//*--------------------------------------------------*/// Written by Omid// Superbridge wont need a View and XHR objectEve.lib.SuperBridge = function( layout ){	// You need to pass a layout object to this one	this.layout = layout;}Ext.extend( Eve.lib.SuperBridge, Eve.lib.Bridge, {	bridges: []		// Adds a list of bridges to the superbridge object	,addBridge : function( vl ) {		// Check the typeof vl		if ( vl.constructor !== Array ){			// just push this into the Views			this.bridges.push( vl );			return true;		}				for ( var i = 0, len = vl.length; i < len; ++i ){			// push each view to the array list			this.bridges.push( vl[i] );		}	}		,broadcast : function(obj, type, object, self) {		console.log('. . . . . . ', type, ' - - - - - -> ', object);		//@@Benchmark		//console.log("@@Benchmark -- Time(O1): ",(new Date()).getRTime() % 100000);				// - - - - - - -		// Start:  - - -				var section = type.split('_')[0];		try {			if ( Eve.SectionManager.getSectionById(section) )				if (! object) {					object = {}				}								// Wondering why in try & catch???!! guess what??? stupid IE encounter an error on edit comment!!!				try {					object.section = section;				} catch(e) {}		}catch (e){		}				// End:  - - -		// - - - - - -						if (typeof self !== 'undefined' && self == true) {			obj.execute( obj, type, object );		}				// Call each of the bridges		for ( var i = 0, len = this.bridges.length; i < len; ++i ) {			// Execute the command in each view			if ( this.bridges[i] !== obj ) {					this.bridges[i].execute(obj, type, object);			}		}				//@@Benchmark		//console.log("@@Benchmark -- Time(O2): ",(new Date()).getRTime() % 100000);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/ViewComponent.js *//*--------------------------------------------------*/// Written by Omid//--------------------------------------------------------------------// Method for creating Eve Components//--------------------------------------------------------------------Eve.vc.createComponent = function(name, baseclass){	Eve.vc[name] = Ext.extend( Eve.lib.View, {		component : {}				,init : function(config) {			this.component = new baseclass(config);		}				,get : function() {			return this.component;		}				,getBridge : function() {			return Eve.lib.EmptyBridge;		}				,getConn : function() {			return Eve.lib.EmptyConn;		}	});};//--------------------------------------------------------------------// Basic components//--------------------------------------------------------------------Eve.vc.createComponent( 'EditorGridPanel'	, Ext.grid.EditorGridPanel );Eve.vc.createComponent( 'TreePanel'		 	, Eve.Tree );Eve.vc.createComponent( 'Panel'			 	, Ext.Panel );Eve.vc.createComponent( 'Header'		 	, Eve.Header );Eve.vc.createComponent( 'StatusBar'		 	, Ext.StatusBar );Eve.vc.createComponent( 'Selector'		 	, Ext.ux.Multiselect );//--------------------------------------------------------------------// Eve's method Form Panel creator//--------------------------------------------------------------------Eve.vc.createFormPanel = function(name, baseclass){	Eve.vc[name] = Ext.extend( Eve.lib.View, {		component : {}				,init : function(config, scope)		{			this.component = new baseclass(config);						// Append loaded flag to each form on initialize.			this.component.getForm().loaded = false;						this.dlgIns = scope;		}				,get : function()		{			return this.component;		}				,getBridge : function()		{			return Eve.lib.EmptyBridge;		}				,getConn : function()		{			return Eve.lib.EmptyConn;		}				,getParams : function()		{			//return Ext.lib.Ajax.serializeForm( this.component.getForm().el.dom );			return this.component.getForm().getValues();		}						// Use the normal Load method for loading the form		,load : function(options, id)		{   			if(typeof id !='undefined')				this.dlgIns.setLoaded(id);			   // this.component.ownerCt.ownerCt.items.items[id].loaded = true;		        			this.component.getForm().load(options);		}				// Use Ajax based request for submiting the form		,submit : function(options)		{			console.log('abc:',options);			//Ext.Ajax.request(options);			this.component.getForm().submit(options);		}				,reset : function()		{			this.component.getForm().reset();		}				,loadEvent		: Ext.EmptyFn		,submitEvent	: Ext.EmptyFn	});};/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/SectionBridge.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.SectionBridge = function(sectionId) {	if (! sectionId) { throw "Section name is not defined"; }		Eve.lib.SectionBridge.superclass.init.call(this, {section: sectionId})		// Virtual Constants	this.STATUS_NOTLOADED	= 'notloaded';	this.STATUS_LOADING		= 'loading';	this.STATUS_LOADED		= 'loaded';	this.DISPLAY_VISIBLE	= 'visible';	this.DISPLAY_INVISIBLE	= 'invisible';		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	// Private	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 		var section		= sectionId;	var statLoad  = this.STATUS_NOTLOADED;	var statDisplay = this.DISPLAY_INVISIBLE;	var components	= [];		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	// Privileged	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 		this._getSection = function() {		return section;	}		this._setLoadStatus = function(status) {		statLoad = status;	}		this._getLoadStatus = function() {		return statLoad;	}		this._setDisplayStatus = function(status) {		statDisplay = status;	}		this._getDisplayStatus = function() {		return statDisplay;	}		this._setComponent = function(cmp) {		components.push(cmp);	}		this._getComponents = function() {		return components;	}};Ext.extend( Eve.lib.SectionBridge, Eve.lib.Bridge, {	// Public		isLoading : function()	{		return (this._getLoadStatus() == this.STATUS_LOADING)	}		,isLoaded : function()	{		return (this._getLoadStatus() == this.STATUS_LOADED)	}		,isVisible : function()	{		return (this._getDisplayStatus() == this.DISPLAY_VISIBLE)	}				,updateStatus : function(data, sameSection)	{			if (sameSection) {					this._setDisplayStatus(this.DISPLAY_VISIBLE);					} else {					this._setDisplayStatus(this.DISPLAY_INVISIBLE);					}				return this;	}		,registerComponents : function(c)	{		if (! Ext.isArray(c)) {			c = [c];		}				for (var i = 0; i < c.length; ++i) {			c[i].managerData = {				loaded	: false			}						this._setComponent(c[i]);		}				return this;	}		,loadComponents : function(data)	{		var c = this._getComponents();		if (!this.isLoaded()){						for (var i = 0; i < c.length; ++i) {				c[i].managerData.loaded = false;				c[i].forceLoad(data);			}						this._setLoadStatus(this.STATUS_LOADING);		}		else{			for (var i = 0; i < c.length; ++i) {				c[i].setSharedSection(data);			}		}				return this;	}		,loadFinished : function(caller)	{		var load = true;		var c	 = this._getComponents();				caller.managerData.loaded = true;				for (var i = 0; i < c.length; ++i) {			load = load && c[i].managerData.loaded;						// Load is false means the section in not loaded completely			if (! load) {				break;			}		}				// Section completely loaded?		if (load && !this.isLoaded()) {			this._setLoadStatus(this.STATUS_LOADED);			this.fire('load_section_completed', {sectionId: this._getSection()});		}				return this;	}		,execute : function(callee, type, data)	{		switch (type) {			case 'show_section':				data.section = Eve.SectionManager.getSectionId( data.sectionName );				data.sharedSection = Eve.SectionManager.isGroupSection( data.sectionName );				    				var sameSection = (data.section == this._getSection());								if (sameSection && (this._getSection() == 'desktop' || this._getSection() == 'homepage')) {				    data.forceLoad = true;				}								if (sameSection && data.forceLoad) {					// Reset load status					this._setLoadStatus(this.STATUS_NOTLOADED);				}								// Update loading & display status				this.updateStatus(data, sameSection);								if (sameSection && this.isVisible()) {					this.loadComponents(data);				}				break;			case 'change_active_group':				if (this._getSection()!= 'calendar') {					this._setLoadStatus(this.STATUS_NOTLOADED);				}				break;		}	}	});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/XHR.js *//*--------------------------------------------------*/// JavaScript Document// XHR Object.. Nothing special here except this one// would probably hold a store and will make commands based on // the given optionsEve.lib.XHR = function(){}Eve.lib.XHR.prototype = {	request : function(type){} // Requests should accept a type	}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/Empty.js *//*--------------------------------------------------*/// Written by OmidEve.CreateEmpty = function(){	var temp = function(){};		for ( var i = 0, len = arguments.length; i < len; ++i ){		temp.prototype[arguments[i]] = Ext.emptyFn;	}		temp.prototype.isEmptyClass = true;	return temp;}Eve.lib.EmptyBridge = Eve.CreateEmpty( 					'update', 'broadcast', 					'addBridge', 'init', 'execute' );Eve.lib.EmptyView = Eve.CreateEmpty(					'init', 'get', 'getBridge', 'getConn' );Eve.lib.EmptyXHR  = Eve.CreateEmpty(					'init', 'request' );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/FormController.js *//*--------------------------------------------------*///-------------------------------------// THE OVERLOADED FORM AND BASIC FORM//-------------------------------------Eve.FormPanel = Ext.extend( Ext.FormPanel, {	createForm: function()	{			delete this.initialConfig.listeners;		this.initialConfig.panel = this;		return new Eve.form.BasicForm(null, this.initialConfig);	}	,getState: function()	{		var o = {fields: []}		this.form.items.each( function(f) {			o.fields.push({				id		: f.getId(),				name	: f.getName(),				value	: f.getValue(),				rawValue: f.getValue(),				hidden	: f.hidden,				disabled: f.disabled			});		}, this);		return o;	}	,setState: function(state)	{		var fields = state.fields;		if (! fields) {			return;		}		this.form.items.each( function(f) {			for (var i = 0; i < fields.length; ++i) {				var fld = fields[i];				if (fld.id == f.getId()) {					f.setValue( fld.value );					f.setDisabled( fld.disabled );					f.setVisible( !fld.hidden );				}			}		}, this);	}});//-------------------------------------// Overriding basicform default behaviour//-------------------------------------Eve.form.BasicForm = function(el, config){	Eve.form.BasicForm.superclass.constructor.apply(this, arguments);	//if (!this.transit)	//{	this.transit = new Eve.form.Transit();	this.transit.add( new Eve.form.DefaultStrategy() );	this.transit.add( new Eve.form.TextFieldStrategy() );	this.transit.add( new Eve.form.TextAreaStrategy() );	this.transit.add( new Eve.form.HTMLEditorStrategy() );	this.transit.add( new Eve.form.TimeFieldStrategy() );	this.transit.add( new Eve.form.DateFieldStrategy() );	this.transit.add( new Eve.form.RadioStrategy() );	this.transit.add( new Eve.form.GroupRadioStrategy() );	this.transit.add( new Eve.form.CheckBoxStrategy() );	this.transit.add( new Eve.form.GroupCheckBoxStrategy() );	this.transit.add( new Eve.form.SimpleComboStrategy() );	this.transit.add( new Eve.form.ComboBoxStrategy() );	this.transit.add( new Eve.form.MultiSelectStrategy() );	this.transit.add( new Eve.form.ItemSelectorStrategy() );	this.transit.add( new Eve.form.ThreeColumnItemSelectorStrategy() );	this.transit.add( new Eve.form.DataViewStrategy() );	this.transit.add( new Eve.form.xDataViewStrategy() );	this.transit.add( new Eve.form.xButtonStrategy() );	this.transit.add( new Eve.form.xLabelStrategy() );	//}		this.transit.init(this);}Ext.extend( Eve.form.BasicForm, Ext.form.BasicForm, {	doAction : function(action, options)	{		if (typeof action == 'string') {			options.method = "POST";			action = new Eve.form.Action.ACTION_TYPES[action](this, options);		}		if (this.fireEvent('beforeaction', this, action) !== false)	{			this.beforeAction(action);			action.run.defer(100, action);		}		return this;	}	,submit : function(options)    {		var params = this.transit.collect();		if (this.standardSubmit) {			var v = this.isValid();						if(v) {				this.el.dom.submit();			}						return v;		}		Ext.apply(options.params, params);		this.doAction('submit', options);		return this;	}		,hasChanged: function()	{		if (!this.orgState)			return false;				var resp	= this.orgState.response;		var panel	= this.orgState.panel;		var result	= false;				this.items.each( function(field) {			if (panel.transit.chainCheck(field, resp.responseXML) === true) {				console.log('changed!!!!___', field);				result = true;				return;			}		});				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.related !== undefined) {			for (var i = 0; i < this.related.length; ++i)	{				this.related[i].items.each( function(field) {					if (panel.transit.chainCheck(field, resp.responseXML) === true) {						console.log('relation changed!!!!___', field);						result = true;						return;					}				})								if (result) {					break;				}			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -				// Reset the state info		this.orgState = null;				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.related !== undefined) {			// Detach state info from each related form.			for (var i = 0; i < this.related.length; ++i)	{				this.related[i].orgState = null;			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -				return result;	}} );//-------------------------------------// Submit Action//-------------------------------------Eve.form.Action.Submit = Ext.extend( Ext.form.Action.Submit, {	/**	* @cfg {Ext.data.DataReader} errorReader <b>Optional. JSON is interpreted with no need for an errorReader.</b>	* <p>A Reader which reads a single record from the returned data. The DataReader's <b>success</b> property specifies	* how submission success is determined. The Record's data provides the error messages to apply to any invalid form Fields.</p>.	*/	/**	* @cfg {boolean} clientValidation Determines whether a Form's fields are validated	* in a final call to {@link Ext.form.BasicForm#isValid isValid} prior to submission.	* Pass <tt>false</tt> in the Form's submit options to prevent this. If not defined, pre-submission field validation	* is performed.	*/	type : 'submit'    // private	,run : function()	{		var o = this.options;		var method = this.getMethod();		var isGet = method == 'GET';				// THIS WONT WORK WITH GET....		if (o.clientValidation === false || this.form.isValid()) {			params = Ext.urlEncode(o.params);						Ext.Ajax.request(Ext.apply(this.createCallback(o), {				 url	: this.getUrl(isGet)				,method	: method				,headers: o.headers				,params	: !isGet ? params : null			}));		}		else if (o.clientValidation !== false){ // client validation failed			this.failureType = Ext.form.Action.CLIENT_INVALID;			this.form.afterAction(this, false);		}	}		,success : function(response, action)	{        //this.form.afterAction(this, true);		this.options.success.call(this.options.scope, response, action);		//this.options.scope.submitSuccess(response, action)	}	,failure : function(response)	{		Eve.form.Action.Submit.superclass.failure.call(this, response);		// Save state		var panel	= this.form.panel;		var state	= panel.getState();		console.log('State saved...', state, this.options);		var id, event, parts, section, mode, type;		id		= this.options.params.id;		event	= this.options.params.event		if (!event) { return }		parts	= event.split('.');		section	= parts[1].toLowerCase();		type	= 'item';		if (section.match(/folder/)) {			section = section.toLowerCase().replace('folder');			type	= 'folder';		}		if (id == 0 || !id) {			mode = 'create';		} else {			mode = 'edit';		}		// Commented By KHASHAYAR//		this.form._state = state;////		var data = {//			form	: panel//			,state	: state//			,msg	: [section, mode, type, 'dlg'].join('_')//			,info	: this.options.scope//		}////		Eve.Resource.superbridge.broadcast(this, 'form_submission_failure', data);	}});//-------------------------------------// Load Action//-------------------------------------Eve.form.Action.Load = Ext.extend( Ext.form.Action.Load, {	success : function(response, conf)	{		/*var result = this.processResponse(response);		if(result === true || !result.success || !result.data){			this.failureType = Ext.form.Action.LOAD_FAILURE;			this.form.afterAction(this, false);			return;		}		*/				// Remember original response		var state = {			response: response			,panel	: conf.scope.form		}				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.form.related !== undefined) {			// Attach state info to each related form.			for (var i = 0; i < this.form.related.length; ++i)	{				this.form.related[i].orgState = state;			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -		this.form.orgState = state;		this.form.clearInvalid();		this.form.transit.load(response.responseXML);		// Restore state of in case of form failed last time		if (this.form._state) {			this.form.panel.setState( this.form._state );			delete this.form._state;		}		//this.form.afterAction(this, true);		this.options.success.call(this.options.scope, response);	}	,run : function() {		Eve.form.Action.Load.superclass.run.apply( this, arguments );	}});//-------------------------------------// Action Types//-------------------------------------Eve.form.Action.ACTION_TYPES = {	'load' : Eve.form.Action.Load,	'submit' : Eve.form.Action.Submit};//-------------------------------------// THE CONTROLLERS AND THE STRATEGIES CLASS....//-------------------------------------Eve.form.Transit = function(){	this.chain = [];}//-------------------------------------// Transit handles the Form Submit and Load events//-------------------------------------Eve.form.Transit.prototype = {	init : function(form)	{		this.bform	= form;	}	,collect : function()	{		var params = {};				this.bform.items.each( function(f) {			Ext.apply(params, this.chainCollect(f));		}, this);				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.bform.related !== undefined) {			for (var i = 0; i < this.bform.related.length; ++i)	{				this.bform.related[i].items.each( function(f) {					Ext.apply(params, this.chainCollect(f));				}, this);			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -				return params;	}	,load : function(resp)	{		this.bform.items.each( function(f) {			this.chainLoad(f, resp);		}, this);				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.bform.related !== undefined) {			for (var i = 0; i < this.bform.related.length; ++i)	{				this.bform.related[i].items.each( function(f) {					this.chainLoad(f, resp);				}, this);								// Set the loaded flag to true				this.bform.related[i].loaded = true;			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -	}	,reset : function(resp)	{		this.bform.items.each( function(f) {			this.chainReset(f, resp);		}, this);				// - - - - - - - - - - - - - - -		// Start: Form Relation		// - - - - - - - - - - - - - - -		if (this.bform.related !== undefined) {			for (var i = 0; i < this.bform.related.length; ++i)	{				this.bform.related[i].items.each( function(f) {					this.chainReset(f, resp);				}, this);			}		}		// - - - - - - - - - - - - - - -		// End: Form Relation		// - - - - - - - - - - - - - - -	}	,chainCollect : function(element)	{		var c = this.chain;		var ret = null;		for (var i = 0, len = c.length; i < len; ++i) {			var s = c[i];			ret = s.collect(element);						if ( ret !== false )				return ret?ret:{};		}		return {};	}	,chainLoad : function(element, node)	{		var c	= this.chain;		var ret = null;		for (var i = 0, len = c.length; i < len; ++i) {			var s	= c[i];			ret		= s.load(element, node);						if (ret !== false)				return true;		}		return true;	}	,chainReset : function(element, node)	{		var c = this.chain;		var ret = null;		for ( var i = 0, len = c.length; i < len; ++i ){			var s = c[i];			ret = s.load( element, node );			if ( ret !== false )				return true;		}		return true;	}	,chainCheck : function(element, node)	{		var c = this.chain;				for (var i = 0, len = c.length; i < len; ++i) {			if (true === c[i].check(element, node)) {				return true;			}		}				return false;	}	,add : function(strategy)	{		this.chain.push(strategy);		this.chain.sort( function(p1, p2)		{			if (p1.priority < p2.priority)				return 1;			else if(p1.priority == p2.priority)				return 0;			else				return -1;		});	}}//-------------------------------------// Strategy Interface//-------------------------------------Eve.form.Strategy = function(){}Eve.form.Strategy.prototype = {	priority : -1		,getName : function(element)	{		if (element.smname !== undefined && element.smname != '') {			return element.smname;		}		else 			return element.getName();	}	// Collects an Element attributes for sending to the backend	// On a side note a return value of	//   1.false means I don't know how to handle this	//   2.null  means I did handle it, and it returned nothing	,collect : function( element ){}	// Loads an Element from a XML Node	,load : function( element, node ){}	,reset : function( element, node ){}}//-------------------------------------// Default Element//-------------------------------------Eve.form.DefaultStrategy = function(){}Ext.extend( Eve.form.DefaultStrategy, Eve.form.Strategy, {	priority : 0	,collect  : function(element)	{		try {			var ret = {};			ret[element.getName()] = element.getValue();			return ret;		}		catch(e) {			return null;		}	}	,load : function(element, node) {		var q = Ext.DomQuery;		try {			/** Syavash: I don't get it, why we are getting the value of parent's child instead of the node itself!			var nodes = q.select(this.getName(element), node);			var parentNode = nodes[0].parentNode;			var value = q.selectValue(this.getName(element), parentNode, undefined)			**/			var value = q.selectValue(this.getName(element), node, undefined);			if (value)				element.setValue(value);			return true;		}		catch(e) {			return false;		}	}	,check : function(element, xml)	{		return false;	}})//-------------------------------------// Text Field//-------------------------------------Eve.form.TextFieldStrategy = function(){}Ext.extend( Eve.form.TextFieldStrategy, Eve.form.Strategy, {	priority : 95	,collect : function( element )	{		if ( element.getXType() != 'textfield' ){ return false; }		try{			var ret = {};			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return null;		}	}	,load : function(element, node)	{		if ( element.getXType() != 'textfield' ){ return false; }		try{			/** Commented by Syavash			var node = Ext.DomQuery.select( this.getName(element), node );			var value = Ext.DomQuery.selectValue( this.getName(element), node[0].parentNode, '' )			**/			var value = q.selectValue(this.getName(element), node, undefined);			element.setValue( value );			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'textfield')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (element.getValue() == value) ? false : true;		}		catch(e) {			return false;		}	}} )//-------------------------------------// Text Area//-------------------------------------Eve.form.TextAreaStrategy = function(){}Ext.extend( Eve.form.TextAreaStrategy, Eve.form.Strategy, {	priority : 90	,collect  : function( element )	{		if ( element.getXType() != 'textarea' ){			return false;		}		try{			var ret = {};			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return null;		}	}	,load : function( element, node )	{		if ( element.getXType() != 'textarea' ){			return false;		}		var q = Ext.DomQuery;		try{			var nodes = q.select( element.getName(), node );			var value = q.selectValue( element.getName(), nodes[0].parentNode, '' )			element.setValue( value );			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'textarea')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (element.getValue().trim() == value.trim()) ? false : true;		}		catch(e) {			return false;		}	}} )//-------------------------------------// HTML Editor//-------------------------------------Eve.form.HTMLEditorStrategy = function(){}Ext.extend( Eve.form.HTMLEditorStrategy, Eve.form.Strategy, {	priority : 85	,collect  : function( element )	{		if ( element.getXType() != 'htmleditor' ) return false;		try{			var ret = {};			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return null;		}	}	,load : function( element, node )	{		if ( element.getXType() != 'htmleditor' ) return false;		try{			var q = Ext.DomQuery;			var nodes = q.select( element.getName(), node );			var value = q.selectValue( element.getName(), nodes[0].parentNode, '' );			element.setValue( value );			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'htmleditor')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (el.getValue().trim().replace(String.fromCharCode(8203), '') == value.trim()) ? false : true;		}		catch(e) {			return false;		}	}} )//-------------------------------------// Time Filed//-------------------------------------Eve.form.TimeFieldStrategy = function(){}Ext.extend( Eve.form.TimeFieldStrategy, Eve.form.Strategy, {	priority : 80	,collect : function( element )	{		if ( element.getXType() != 'timefield' ){ return false; }		try{			var ret = {};			ret[element.getName()] = element.getRawValue();			return ret;		}catch(e){			return false;		}	}	,load : function( element, node )	{		if ( element.getXType() != 'timefield' ){ return false; }		try{			node = Ext.DomQuery.select( element.getName(), Ext.DomQuery.select( element.getName(), node ) );			var value = Ext.DomQuery.selectValue( element.getName(), node[0].parentNode, '' )			element.setValue( value );			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'timefield')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (element.getValue() == value) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// Date Field//-------------------------------------Eve.form.DateFieldStrategy = function(){}Ext.extend( Eve.form.DateFieldStrategy, Eve.form.Strategy, {	priority : 75	,collect  : function( element )	{    	if ( element.getXType() != 'datefield' ){ return false; }		try{			var ret = {};			var val = element.getRawValue();			if (val.trim() == '') {				return '';			}			val = (typeof val == 'object') ? val : Date.parseDate(val, Eve.Preference.get('dateFormat'));			if (element.format !== undefined) {				ret[element.getName()] = (val !== '') ? val.dateFormat('n/j/y'): "";			} else {				ret[element.getName()] = (val !== '') ? val.dateFormat('m/d/y'): "";			}			return ret;		}catch(e){			return null;		}	}	,load : function( element, node )	{		if ( element.getXType() != 'datefield' ) return false;		try{			node = Ext.DomQuery.select( element.getName(), Ext.DomQuery.select( element.getName(), node ) );			var value = Ext.DomQuery.selectValue( element.getName(), node[0].parentNode, '' )			//element.format = 'm/d/Y';			element.setValue( value );			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'datefield')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (element.getValue().format(element.format) == value) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// Radio//-------------------------------------Eve.form.RadioStrategy = function(){}Ext.extend( Eve.form.RadioStrategy, Eve.form.Strategy, {	priority : 70	,collect : function(element)	{		if (element.getXType() != 'radio') { return false; }				try {			var ret = {}						if (element.checked)				ret[element.name] = element.inputValue;						return ret;		} catch(e) {			return false;		}	}	,load : function(element, node)	{		if (element.getXType() != 'radio') { return false; }				try {			var q			= Ext.DomQuery;			var nodes		= q.select(element.name, node);			var parentNode	= nodes[0].parentNode;			var value		= q.selectValue(element.name, parentNode, '');						if (element.inputValue == value)				element.setValue(value);						return true;					} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'radio')			return false;				try {			var node  = Ext.DomQuery.select(element.name, xml);			var value = Ext.DomQuery.selectValue(element.name, node[0].parentNode, '');						if (element.inputValue == value) {				return !(element.getValue() == true);			}			else {				return (element.getValue() == true);			}		}		catch(e) {			return false;		}	}});//-------------------------------------// Group Radio//-------------------------------------Eve.form.GroupRadioStrategy = function(){}Ext.extend( Eve.form.GroupRadioStrategy, Eve.form.Strategy, {	priority : 71	,collect : function(element) {		if (element.getXType() != 'radiogroup') { return false; }				try {			var ret = {}				var radios = element.items.items;						for (var i = 0, len = radios.length; i < len; i++ ) {				if (radios[i].checked)					ret[element.name] = radios[i].inputValue;			}						return ret;					} catch(e) {			return false;		}	}	,load : function(element, node) {		if (element.getXType() != 'radiogroup') { return false; }				try {			var q			= Ext.DomQuery;			var nodes		= q.select(element.name, node);			var parentNode	= nodes[0].parentNode;			var value		= q.selectValue(element.name, parentNode, '');			var radios		= element.items.items;						for(var i=0, len=radios.length; i<len; i++ ) {				if (radios[i].inputValue == value) {					radios[i].setValue(value);				}			}					return true;					} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'radiogroup')			return false;				try {			var node   = Ext.DomQuery.select(element.name, xml);			var value  = Ext.DomQuery.selectValue(element.name, node[0].parentNode, '');			var radios = element.items.items;						for (var i = 0, len = radios.length; i < len; i++) {				if (radios[i].inputValue == value) {					return !(radios[i].getValue());				}			}		}		catch(e) {			return false;		}	}} );//-------------------------------------// CheckBox//-------------------------------------Eve.form.CheckBoxStrategy = function(){}Ext.extend( Eve.form.CheckBoxStrategy, Eve.form.Strategy, {	priority : 65	,collect : function( element )	{		if ( element.getXType() != 'checkbox' ){			return false;		}		try {			var ret = {}						// If checkbox needs to send the unchecked status too			if (element.shout && element.getValue() == false) {				ret[element.getName()] = 'false';				return ret;			}						if (element.getValue() == false)				return true;			ret[element.getName()] = 'true'			return ret;		} catch(e) {			return false;		}	}	,load : function( element, node )	{		if ( element.getXType() != 'checkbox' ) return false;		try{			var q			= Ext.DomQuery;			var nodes		= q.select(element.getName(), node);			var parentNode	= nodes[0].parentNode;			var value		= q.selectValue(element.getName(), parentNode, '');						if (value === 'true' || value === '1' || value === 'ON')				element.setValue(true);			else				element.setValue(false);						return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'checkbox')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						if (value === 'true' || value === '1' || value === 'ON') {				return !(element.getValue());			}			else {				return element.getValue();			}		}		catch(e) {			return false;		}	}});//-------------------------------------// Group CheckBox//-------------------------------------Eve.form.GroupCheckBoxStrategy = function(){}Ext.extend( Eve.form.GroupCheckBoxStrategy, Eve.form.Strategy, {	priority : 66	,collect : function(element) {		if (element.getXType() != 'checkboxgroup') { return false; }				try {			var ret = {};			ret[element.name] = "";						var chBoxes = element.items.items;			for (var i = 0, len = chBoxes.length; i < len; i++ ) {				if (chBoxes[i].checked) {					ret[element.name] += chBoxes[i].inputValue;										if (i != len-1)						ret[element.name] += ",";				}							}						return ret;					} catch(e) {			return false;		}	}	,load : function(element, node) {		if (element.getXType() != 'checkboxgroup') { return false; }				try {			var q			= Ext.DomQuery;			var nodes		= q.select(element.getName(), node);			var parentNode	= nodes[0].parentNode;			var values		= q.selectValue(element.getName(), parentNode, '');						values 		= values.split(',');			var chBoxes = element.items.items;						for (var i = 0; i < chBoxes.length; ++i) {				if (values.indexOf(chBoxes[i].inputValue) != -1)					chBoxes[i].setValue(true);			}			return true;					} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'checkboxgroup')			return false;				try {			var node 	= Ext.DomQuery.select(element.getName(), xml);			var value	= Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '').split(',');			var chBoxes = element.items.items;						for (var i = 0; i < chBoxes.length; ++i) {				if (chBoxes[i].getValue()) {					if (value.indexOf(chBoxes[i].inputValue) == -1) {						return true;					}				}				else {					if (value.indexOf(chBoxes[i].inputValue) != -1) {						return true;					}				}			}						return false;		}		catch(e) {			return false;		}	}});//-------------------------------------// ComboBox (Simple)//-------------------------------------Eve.form.SimpleComboStrategy = function(){};Ext.extend(Eve.form.SimpleComboStrategy, Eve.form.Strategy,{	priority : 61   	,collect : function(element)	{		if (element.xxtype != 'combo'){ return false; }		try{			var ret = {}			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return false;		}	}	   	,load : function( element, node )	{		if ( element.xxtype != 'combo' ){ return false; }		try{			node	= Ext.DomQuery.select(this.getName(element), node);			if(node[0]){				var store	= element.store;				element.setValue(node[0].firstChild.nodeValue);			}		}catch(e){			return false;		}  	}	,check : function(element, xml)	{		if (element.xxtype != 'combo')			return false;				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue(element.getName(), node[0].parentNode, '');						return (element.getValue() == value) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// ComboBox//-------------------------------------Eve.form.ComboBoxStrategy = function(){}Ext.extend( Eve.form.ComboBoxStrategy, Eve.form.Strategy, {	priority : 60	,collect : function(element)	{		if ( element.getXType() != 'combo' ){ return false; }				try{			var ret = {}			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return false;		}	}	,load : function(element, node)	{			if ( element.getXType() != 'combo' || element.loadPrevent == true ){ return false; }		node		= Ext.DomQuery.select(this.getName(element), node);		var store	= element.store;				if (!store)	{			var text 	= element.displayField 	|| "text";			var value 	= element.valueField 	|| "value";			var record 	= element.record 		|| "row";						store = new Ext.data.Store({				data	:[]				,fields	:[ text, value ]				,reader	: new Ext.data.XmlReader({					id		: 'id'					,record	: record				}, [ text, value, 'depth' ])			});			element.bindStore( store, false );			Ext.apply(element, {				triggerAction	: 'all'				,selectOnFocus	: true				,forceSelection : true				,minChars      	: 1				,mode           : 'local'			})		}		var reader = store.reader;		if (!reader) {			store.reader = new Ext.data.XmlReader({				record: record			}, [ text, value ]);			reader = store.reader;		}		try{			var records = reader.readRecords(node).records; 			store.removeAll();			store.add( records );			var selected = Ext.DomQuery.selectValue( 'selectedValue', node[0], '' );						if (selected == "" ) {				selected = Ext.DomQuery.selectValue( element.valueField, node[0], '' );			}						store.fireEvent('load', store, records);						if (element.defaultSelection === false) {				return true;			}						element.setValue( selected );						return true;		} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'combo' ||			(element.getXType() == 'combo' && element.xxtype == 'combo') ||			element.disabled == true ||			element.loadPrevent == true ||			element.bypassCheck == true)		{			return false;		}				try {			var node  = Ext.DomQuery.select(element.getName(), xml);			var value = Ext.DomQuery.selectValue('selectedValue', node[0], '');						if (value == "") {				value = Ext.DomQuery.selectValue(element.valueField, node[0], '');			}						return (element.getValue() == value) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// MultiSelect Strategy//-------------------------------------Eve.form.MultiSelectStrategy = function(){}Ext.extend( Eve.form.MultiSelectStrategy, Eve.form.Strategy, {	priority : 55	,collect : function( element ){		if ( element.getXType() != 'multiselect' ){ return false; }		try{			var ret = {}			return ret;		}catch(e){			return false;		}	}	,load : function( element, node ){		if ( element.getXType() != 'multiselect' ){ return false; }		var store = new Ext.data.Store( {fields:['data','value', 'selected'], data:[], reader:new Ext.data.XmlReader( {			record: "record"		}, [ 'data', 'value', 'selected'] )} );		element.store = store;		element.view.setStore( store );		element.displayField = 'data';		element.valueField = 'value';		element.triggerAction = 'all';		element.mode = 'local';		element.editable = false;		var reader = store.reader;		try{			node = Ext.DomQuery.select( element.getName(), node );			element.store.removeAll();			store.add( store.reader.readRecords( node).records );			return true;		}catch(e){			return false;		}		element.view.refresh();	}	,check : function(element, xml)	{		return false;	}});//-------------------------------------// ItemSelector Strategy//-------------------------------------Eve.form.ItemSelectorStrategy = function(){}Ext.extend( Eve.form.ItemSelectorStrategy, Eve.form.Strategy, {	priority : 50	,collect : function(element)	{		if (element.getXType() != 'itemselector')			return false;		try		{			var ret = {}			ret[element.getName()] = element.toStore.data.keys.join(element.collectSeparator || ',');//element.getValue();			return ret;		}		catch(e)		{			return false;		}	}	,load : function(element, node)	{		if (element.getXType() != 'itemselector' || element.loadPrevent == true)			return false;		node = Ext.DomQuery.select(this.getName(element), node);		var value	= element.valueField || 'id';		var display = element.displayField || 'title';		var fromNodeField = element.fromNodeField || 'unassociated';		var toNodeField = element.toNodeField || 'associated';		var dataFields = element.dataFields || [display, value];				var fromStore = new Ext.data.Store({			fields	: dataFields			,data	: []			,reader	: new Ext.data.XmlReader({				record	: "row"				,id		: value			}, dataFields)		});				element.fromStore = fromStore;		element.fromMultiselect.view.setStore(fromStore);		element.fromMultiselect.store = fromStore;		element.valueField		= value;		element.displayField 	= display;		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;		var toStore = new Ext.data.Store({			fields	: [display, value]			,data	: []			,reader	: new Ext.data.XmlReader( {				record	: "row"				,id		: value			}, [display, value])		});				if ( element.toStore ){				element.toStore.un('add', this.valueChanged );			element.toStore.un('remove', this.valueChanged );			element.toStore.un('load', this.valueChanged );		}				toStore.on('add', element.valueChanged, element );		toStore.on('remove', element.valueChanged, element );		toStore.on('load', element.valueChanged, element );				element.toStore = toStore;		element.toMultiselect.view.setStore( toStore );		element.toMultiselect.store = toStore;		element.displayField	= display;		element.valueField		= value;		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;		try		{			fromNode = Ext.DomQuery.select(fromNodeField, node);			element.fromStore.removeAll();			fromStore.add( fromStore.reader.readRecords(fromNode).records);			toNode = Ext.DomQuery.select(toNodeField, node);			element.toStore.removeAll();			toStore.add( toStore.reader.readRecords(toNode).records);			return true;		}		catch(e)		{			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'itemselector')			return false;				try {			var node  	 = Ext.DomQuery.select(element.getName(), xml);			var fromNode = Ext.DomQuery.select('unassociated', node);						return (element.fromStore.getCount() == parseInt(fromNode[0].childNodes.length / 2) ||					element.fromStore.getCount() == fromNode[0].childNodes.length) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// ThreeColumn ItemSelector Strategy//-------------------------------------Eve.form.ThreeColumnItemSelectorStrategy = function(){}Ext.extend( Eve.form.ThreeColumnItemSelectorStrategy, Eve.form.Strategy, {	priority : 53	,collect : function(element)	{		if (element.getXType() != 'threecolumnitemselector') { return false; }				try	{			var ret = {}			var column1Name = element.fromName || 'column1';			var column2Name = element.toName || 'column2';			var column3Name = element.nextToName || 'column3';			// From Value			var fromVal = [];			element.fromStore.each( function(rec) {				if (rec.get('hidden') == '0') {					fromVal.push(rec.get('id'));				} else {					fromVal.push(rec.get('id') + 's');				}			});			// To Value			var toVal = [];			element.toStore.each( function(rec) {				if (rec.get('hidden') == '0') {					toVal.push(rec.get('id'));				} else {					toVal.push(rec.get('id') + 's');				}			});			// NextTo Value			var nextToVal = [];			element.nextToStore.each( function(rec) {				if (rec.get('hidden') == '0') {					nextToVal.push(rec.get('id'));				} else {					nextToVal.push(rec.get('id') + 's');				}			});			ret[column1Name] = fromVal.join(',');			ret[column2Name] = toVal.join(',');			ret[column3Name] = nextToVal.join(',');						return ret;		} catch(e) {			return false;		}	}	,load : function(element, node)	{		if (element.getXType() != 'threecolumnitemselector' ) {	return false; }				node = Ext.DomQuery.select(this.getName(element), node);		var value	= element.valueField || 'id';		var display = element.displayField || 'title';		var column1NodeField = element.column1NodeField || 'column1';		var column2NodeField = element.column2NodeField || 'column2';		var column3NodeField = element.column3NodeField || 'column3';		var dataFields = element.dataFields || [display, value];				var fromStore = new Ext.data.Store({			fields	: dataFields			,data	: []			,reader	: new Ext.data.XmlReader({				record	: "row"				,id		: value			}, dataFields)		});				element.fromStore = fromStore;		element.fromMultiselect.view.setStore(fromStore);		element.fromMultiselect.store = fromStore;		element.valueField		= value;		element.displayField 	= display;		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;		var toStore = new Ext.data.Store({			fields	: dataFields			,data	: []			,reader	: new Ext.data.XmlReader( {				record	: "row"				,id		: value			}, dataFields)		});				if ( element.toStore ){				element.toStore.un('add', this.valueChanged );			element.toStore.un('remove', this.valueChanged );			element.toStore.un('load', this.valueChanged );		}				toStore.on('add', element.valueChanged, element );		toStore.on('remove', element.valueChanged, element );		toStore.on('load', element.valueChanged, element );				element.toStore = toStore;		element.toMultiselect.view.setStore( toStore );		element.toMultiselect.store = toStore;		element.displayField	= display;		element.valueField		= value;		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;						var nextToStore = new Ext.data.Store({			fields	: dataFields			,data	: []			,reader	: new Ext.data.XmlReader( {				record	: "row"				,id		: value			}, dataFields)		});				if ( element.nextToStore ){				element.nextToStore.un('add', this.valueChanged );			element.nextToStore.un('remove', this.valueChanged );			element.nextToStore.un('load', this.valueChanged );		}				nextToStore.on('add', element.valueChanged, element );		nextToStore.on('remove', element.valueChanged, element );		nextToStore.on('load', element.valueChanged, element );				element.nextToStore = nextToStore;		element.nextToMultiselect.view.setStore( nextToStore );		element.nextToMultiselect.store = nextToStore;		element.displayField	= display;		element.valueField		= value;		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;								try	{			var fromNode = Ext.DomQuery.select(column1NodeField, node);			element.fromStore.removeAll();			fromStore.add( fromStore.reader.readRecords(fromNode).records);						var toNode = Ext.DomQuery.select(column2NodeField, node);			element.toStore.removeAll();			toStore.add( toStore.reader.readRecords(toNode).records);						var nextToNode = Ext.DomQuery.select(column3NodeField, node);			element.nextToStore.removeAll();			nextToStore.add( nextToStore.reader.readRecords(nextToNode).records);						return true;		} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'threecolumnitemselector')			return false;				try {			var node  	 = Ext.DomQuery.select(element.getName(), xml);			var fromNode = Ext.DomQuery.select('unassociated', node);						return (element.fromStore.getCount() == parseInt(fromNode[0].childNodes.length / 2) ||					element.fromStore.getCount() == fromNode[0].childNodes.length) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// DataView Strategy//-------------------------------------Eve.form.DataViewStrategy = function(){}Ext.extend( Eve.form.DataViewStrategy, Eve.form.Strategy, {	priority : 40	,collect : function( element ){		if ( element.getXType() != 'dataview' ){			return false;		}		try{			var ret = {};			ret[element.getName()] = element.getValue();			return ret;		}catch(e){			return false;		}	}	,load : function( element, node ){		if ( element.getXType() != 'dataview' ){			return false;		}		var q = Ext.DomQuery;		node = q.select( element.getName(), node );		try{			return true;		}catch(e){			return false;		}	}	,check : function(element, xml)	{		return false;	}});//-------------------------------------// xDataView Strategy//-------------------------------------Eve.form.xDataViewStrategy = function(){}Ext.extend( Eve.form.xDataViewStrategy, Eve.form.Strategy, {	priority : 45	,collect : function( element ) {		if (element.getXType() != 'xdataview' ) return false;				try {			var ret = {}			var str;			var strArray = [];						element.store.each( function(record) {				str = record				if (element.field.length == 2) {					str = record.get(element.field[0])+"|"+record.get(element.field[1]);				}								if (element.field.length == 1) {					str = record.get(element.field[0])				}				/**				 * Syasvsh: 				 * We can replace second above conditions with the following condition.				 * I haven't done this 'cause I thought it might break something.				 */				if (element.field.length >= 3) {					arrFields = [];					for (var j = 0; j < element.field.length; j++)					{						arrFields.push(record.get(element.field[j]));					}					str = arrFields.join('|');				}								strArray.push(str);			});			str = strArray.join(",");			ret[element.getName()] = str;			return ret;					} catch(e) {			return false;		}	}	,load : function(element, node) {		if (element.getXType() != 'xdataview') return false;				try {			node = Ext.DomQuery.select(this.getName(element), node);			if (!node[0]) return false;						element.store.removeAll();			var result = element.store.reader.readRecords(node).records;			element.store.add(result);			return true;					} catch(e) {			return false;		}	}	,check : function(element, xml)	{		if (element.getXType() != 'xdataview')			return false;				try {			var row	  = element.rowName || 'row';			var node  = Ext.DomQuery.select(element.getName(), xml);			var recs  = Ext.DomQuery.select(row, node);						return (element.store.getCount() == recs.length) ? false : true;		}		catch(e) {			return false;		}	}});//-------------------------------------// Form Button//-------------------------------------Eve.form.xButtonStrategy = function(){}Ext.extend( Eve.form.xButtonStrategy, Eve.form.Strategy, {	priority : 66	,collect : function(element)	{		if (element.getXType() != 'button' && element.enableToggle != true)	{			return false;		}				try	{			var ret = {}			if (element.pressed == false)				return;			ret[element.name] = element.pressed;			return ret;		} catch(e) {			return false;		}	}	,load : function( element, node )	{		if (element.getXType() != 'xbutton' && element.enableToggle != true) return false;		try {			var q			= Ext.DomQuery;			var nodes 		= q.select(element.name, node);			var parentNode	= nodes[0].parentNode;			var value		= q.selectValue(element.name, parentNode, '');			if (value == 'true' || value == '1')				element.toggle(true);			return true;		}		catch(e)		{			return false;		}	}	,check : function(element, xml)	{			// You think user can change button's text???!!!!		return false;	}} );//-------------------------------------// Form Label//-------------------------------------Eve.form.xLabelStrategy = function(){}Ext.extend( Eve.form.xLabelStrategy , Eve.form.Strategy, {	priority : 63	,collect : function(element)	{		if (element.xtype != 'xlabel') return false;		return ' ';	}	,load : function( element, node )	{		if (element.xtype!= 'xlabel') return false;		try {			var q			= Ext.DomQuery;			var nodes 		= q.select(element.name, node);			var parentNode	= nodes[0].parentNode;			var value		= q.selectValue(element.name, parentNode, '');			element.setText(value, false);			return true;		}		catch(e)		{			return false;		}	}	,check : function(element, xml)	{		// You think user can change label's text???!!!!		return false;	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/UploadFormController.js *//*--------------------------------------------------*/Eve.UploadFormPanel = Ext.extend( Ext.FormPanel, {	createForm: function()	{		delete this.initialConfig.listeners;		return new Eve.uploadForm.BasicForm(null, this.initialConfig);	}});Eve.uploadForm.BasicForm = function(el, config){	Eve.uploadForm.BasicForm.superclass.constructor.apply(this, arguments);};Ext.extend( Eve.uploadForm.BasicForm, Ext.form.BasicForm, {	doAction : function(action, options)	{	if (typeof action == 'string') {			options.method = "POST";			action = new Eve.uploadForm.Action.ACTION_TYPES[action](this, options);		}		if (this.fireEvent('beforeaction', this, action) !== false)	{			this.beforeAction(action);			action.run.defer(100, action);		}		return this;	}});Eve.uploadForm.Action.Submit = function(form, options){    Eve.uploadForm.Action.Submit.superclass.constructor.call(this, form, options);};Eve.uploadForm.Action.Submit = Ext.extend( Ext.form.Action.Submit, {	//Override	processResponse : function(response){        this.response = response;        if(!response.responseText || response.responseXML){            return true;        }        this.result = this.handleResponse(response);        return this.result;    }});Eve.uploadForm.Action.ACTION_TYPES = {	'submit' : Eve.uploadForm.Action.Submit};/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/DragDrop.js *//*--------------------------------------------------*/// JavaScript DocumentEve._DragDrop = function(){};Eve._DragDrop = Ext.extend( Eve.lib.Bridge, {	// Public properties	 id : 0	,parentId : 0	,groupId  : 0	,root	  : 0	,path	  : ''		,init : function(data) {		Eve._DragDrop.superclass.init.call(this, data);	}		,unify : function( classA, type ){		try {			this['unify_'+type]( classA );		}catch(e){			console.log( e );		}	}		,unify_grid: function( classA ){		var that = this;		classA.prototype.getDragData = function(e){			// Grid object						var t = Ext.lib.Event.getTarget(e);	        var rowIndex = this.view.findRowIndex(t);	        if(rowIndex !== false){	            // Items format is :				// parentId, groupId, path, root, id, object : item	            	            var sm = this.grid.selModel;	            if(!sm.isSelected(rowIndex) || e.hasModifier()){                	sm.handleMouseDown(this.grid, rowIndex, e);            	}            					return {					sourceType	: 'grid'					,source		: this.grid					,items		: that.unify_grid_items.apply(that, [sm.getSelections()] )				}	        }	        return false;		}				classA.prototype.onBeforeDrag = function(data, e) {			if (this.grid && this.grid.id == 'task_grid') {				if (this.grid.bridge.id == "-10") {					return false;				}			}						return true;		}	}		,unify_tree : function( classA ){		var that = this;		classA.prototype.getDragData = function(e){			var r = Ext.dd.Registry.getHandleFromEvent( e );						if ( r ){				that.fire('get_node_info', {node:r.node} );				Ext.apply( r, { sourceType : 'tree', source: this.tree, 						  items: [{								type:(r.node.id.indexOf('G_')==-1)?'folder':'group'								,title: r.node.text								,info :{id: r.node.id.split('_')[1]								, groupId : that.groupId								, parentId: that.parentId								, root: that.root								, path: that.path }							}] 						  }						 );						 				return r;			}						return false;		}		}		,unify_dataview : function( classA ){			}		,execute : function( callee, type, object ){		switch( type ){			case "grid_stat":			case "tree_stat":			case "node_info":				this.id 	  = object.info.id;				this.parentId = object.info.parentId;				this.groupId  = object.info.groupId;				this.root	  = object.info.root;				this.path	  = object.info.path;								break;		}	}		// This one might change per section	,unify_grid_items : function( items ){		var ret = [];		//this.fire( 'get_grid_stat' );		for ( var i = 0; i < items.length; ++i ){			var obj = {};						if ( items[i].id ){				obj.info	 	  = {};				obj.info.id 	  = items[i].id.split('_')[1];				obj.info.parentId = this.id;				obj.info.groupId  = this.groupId;				obj.info.root	  = this.root;				obj.info.path	  = this.path;								obj.title	 	  = items[i].data.title;				obj.type		  = items[i].data.type;				obj.data		  = items[i].data;							ret.push(obj);			}		}				return ret;	}});Eve.DragDrop = new Eve._DragDrop();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/FunctionFilters.js *//*--------------------------------------------------*///-------------------------------------// A Global yet, private space... more like a register//-------------------------------------Eve.State = (function(){	var states = {};	return {		get : function( key ){			return states[key];		}				,set : function( key, val ){			states[key] = val;						return Eve.State;		}				,del : function( key ){			var val = states[key];			delete states[key];						return val;		}	}})();//-------------------------------------// AutoIncrement class//-------------------------------------Eve.Auto = (function(){	var counter = {}		return function( key ){		counter[key] = !counter[key] ? 1 : (++counter[key]);		return counter[key];	}} )();//-------------------------------------// Filter class//-------------------------------------Eve.Proxy = (function(){	return {		//------------------------		// Extracts the path components		//------------------------		extract : function( path ){			path 	= path.split( '.' );			var ns 	= window;						for ( var i = 0, len = path.length-1; i < len; ++i )				ns = ns[path[i]];							return {				ns		: ns				,func 	: path[path.length-1]			}		}			//------------------------		// Creates a filter before the function		//------------------------		,before : function( path, func ){			var c = Eve.Proxy.extract( path );			var n = c.func + '_' + Eve.Auto( path );						c.ns[n] = c.ns[c.func];					c.ns[c.func] = function(){				if ( func.apply( this, arguments ) )					return c.ns[n].apply( this, arguments );								return false;			}		}			//------------------------		// Creates a filter after the function		//------------------------		,after : function( path, func ){			var c = Eve.Proxy.extract( path );			var n = c.func + '_' + Eve.Auto( path );						c.ns[n] = c.ns[c.func];					c.ns[c.func] = function(){				var ret = c.ns[n].apply( this, arguments );				func.apply( this, arguments );							return ret;			}		}	}} )();Eve.Proxy.before('Eve.lib.Layout.prototype.init', function() {														   	return true;});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/InterlinkProxy.js *//*--------------------------------------------------*/Eve.InterlinkProxy = function(){	this.cache = {};};Ext.extend( Eve.InterlinkProxy, Eve.lib.Bridge, {   get: function( dlg ){				// create a ghost of the object		var cc = this.createGhost( dlg );				// check if no ghost was nessecary		if ( cc == dlg ){			return dlg;		}				// append the ghost the parent		cc.parent.appendChild( cc.ele );				// return the dialog		return dlg;	}		// Creates a ghost of the component	,createGhost: function( cmp ){		// First of all check if the dialog is visible		// if it isn't just return the component;		if ( !cmp.isVisible() ){			return cmp;		}				var id = cmp.getId();		// Destory the element and create a new ghost		if ( cache[id] ){			cache[id].ele.parentNode.removeChild( cache[id].ele );		}else{			cache[id] = {};		}				var cc = cache[id];				// Save the state of the object		cc.state 	= cmp.saveState();				// Restore the state to the component on hide.		cc.hideFunc = function(){			// Restore the Panel state			cmp.restoreState( cc.state );						// Delete the ghost			cc.ele.parentNode.removeChild( cc.ele )						// and show the dialog again						// Also remove the hideFunc we just wrote			cmp.un('hide', cc.hideFunc );						delete cache[id];		};				cmp.on('hide', cc.hideFunc );		var ele = document.createChild( 'div' );		ele.innerHTML = cc.el.dom.innerHTML;				// Now cleanup the ele from any possible Ids		this.cleanUp( ele );		cc.ele 		= ele;				// Inorder to keep the Relative positioning....		cc.parent 	= cmp.el.dom.parentNode;				return cc;	}		// Clean up any id from nodes	,cleanUp: function( ele, from ){		from = from || 'id';		if ( ele.childNodes ){			for ( var i = 0; i < ele.childNodes.length; ++i ){				this.cleanUp( ele.childNodes[i], from );			}		}				if ( ele.id ){			ele.id = '';		}	}		,execute: function( c, t, object ) {		switch(t) {			case 'proxy_dialog':				var sectionId = object.type;				var section = Eve.SectionManager.getSectionById(sectionId);								Eve.SectionManager.load(section.name);								var func = object.func || function() { 					that.fire( object.type + '_create_item_dlg', { info: object.info, mode: object.mode } ); 				};				func();								break;		}				return true;	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/TaskRunner.js *//*--------------------------------------------------*/Eve._TaskRunner = function(){	this.tasks = {};};//---------------------------------------------------------// Parameters are ://	@param: autoStart//	@desc : true if the task should start automatically////	@param: method//	@desc : the function to run////	@param: scope //	@desc : the scope in which function will be called////	@param: delay//	@desc : delays between each caLl in milliseconds////---------------------------------------------------------Eve._TaskRunner.prototype = {	createTask: function( name, params ){		// Remove the old task		this.remove( name );				this.tasks[name] = params;				if ( params.autoStart === false )			return;								Ext.TaskMgr.start( params )	}		,start: function( name ){		if ( this.tasks[name] )			Ext.TaskMgr.start( this.tasks[name] );	}		,stop: function( name ){		if ( this.tasks[name] ){			Ext.TaskMgr.stop( this.tasks[name] );		}	}		,remove: function( name ){		if ( this.tasks[name] ){			Ext.TaskMgr.stop( this.tasks[name] );			delete this.tasks[name];		}	}};// The only difference is that... this version uses names to handle// the tasks ( instead of objects that ext uses );// Create a new task runner...Eve.TaskRunner = new Eve._TaskRunner();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/SectionManager.js *//*--------------------------------------------------*/Eve.lib.SectionManager = function(){};Eve.lib.SectionManager.prototype = {	init: function(){				this.sections	= [			{id:'desktop',		name:'Desktop', 	title:'Desktop', 	type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'mail',		name:'Mail', 		title:'Mail', 		type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'calendar',	name:'MyCalendar', 	title:'Calendar', 	type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'document',	name:'MyDocuments', 	title:'Documents',	type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'contact',		name:'MyContacts', 	title:'Contacts', 	type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'task',		name:'MyTasks', 	title:'Tasks', 		type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'link',		name:'MyLinks', 	title:'Links', 		type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'note',		name:'Notes', 	title:'Notes', 		type:'personal',	method:'showTreeGrid',	loaded:false }			,{id:'reminder',	name:'Reminders', 	title:'Reminders', 	type:'personal',	method:'showTreeGrid',	loaded:false }				,{id:'groupMembership',	name:'GroupMembership', title:'Group Membership',	type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'homepage',	name:'Homepage', 	title:'Homepage', 		type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'calendar',	name:'SharedCalendar', 	title:'Shared Calendar', 	type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'document',	name:'SharedDocuments', title:'Shared Documents',	type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'contact',		name:'SharedContacts', 	title:'Shared Contacts', 	type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'task',		name:'SharedTasks', 	title:'Shared Tasks', 		type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'link',		name:'SharedLinks', 	title:'Shared Links', 		type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'voting',		name:'Voting', 		title:'Voting', 		type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'forum',		name:'Forum', 		title:'Forum', 			type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'wiki',		name:'Wiki', 		title:'Wiki', 			type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'publisher',	name:'Publisher', 	title:'Publisher', 		type:'group',	method:'showTreeGrid',	loaded:false }			,{id:'admin',	name:'ManageUsersAndGroups', 	title:'Manage<br />Users & Groups',	type:'setting',	method:'showTreeGrid',	loaded:false }			,{id:'admin',		name:'ManageGroups', 		title:'Manage Groups',			type:'setting',	method:'showTreeGrid',	loaded:false }			,{id:'personal',                name:'Personal', 		title:'Personal',			type:'setting',	method:'showTreeGrid',	loaded:false }			,{id:'setupTools',		name:'SetupTools', 		title:'Setup Tools',			type:'setting',	method:'showSetting',	loaded:false }			,{id:'mobileSync',		name:'MobileSync', 		title:'Mobile Sync',			type:'setting',	method:'showSetting',	loaded:false }			,{id:'siteAdministration',	name:'SiteAdministration', 	title:'Site<br />Administration',	type:'setting',	method:'showSetting',	loaded:false }			,{id:'portalAdministration',	name:'PortalAdministration', 	title:'Portal<br />Administration',	type:'setting',	method:'showSetting',	loaded:false }			,{id:'billing',			name:'Billing', 		title:'Billing',			type:'setting',	method:'showSetting',	loaded:false }				];				var apps = Eve.Preference.get('applications');		if ( apps ) {			for (var i = 0; i < apps.length; ++i) {				this.sections.push({id:apps[i].name,	name:apps[i].name,	title:apps[i].name,	type:'application',	method:'showApplication',	loaded:false })			}		}	}		,getSectionById: function( id ){		for ( var i = 0; i < this.sections.length; ++i ) {			if ( this.sections[i].id.toLowerCase() == id.toLowerCase() ){				return this.sections[i];			}		}		throw ['Section ID [',id,'] is invalid!'].join('');	}		,getSectionByName: function( name ){		for ( var i = 0; i < this.sections.length; ++i ) {			if ( this.sections[i].name.toLowerCase() == name.toLowerCase() ){				return this.sections[i];			}		}		throw ['Section Name[',name,'] is invalid!'].join('');	}	,getSectionId: function( name ){		for ( var i = 0; i < this.sections.length; ++i ) {			if ( this.sections[i].name.toLowerCase() == name.toLowerCase() ){				return this.sections[i].id;			}		}		throw ['Section Name [',name,'] is invalid!!'].join('');	}		,getSectionName: function( id , type){		type = type || 'personal';		for ( var i = 0; i < this.sections.length; ++i ) {			if ( this.sections[i].id.toLowerCase() == id.toLowerCase() && this.sections[i].type == type){				return this.sections[i].name;			}		}		throw ['Section ID [',id,'] is invalid!!'].join('');	}		,load: function( name ){		var section = this.getSectionByName( name );		if ( !section.loaded ) {			if (name != 'GroupMembership' && name != 'Wiki' && name != 'Publisher') {				for ( var i = 0; i < this.sections.length; ++i ) {					if ( this.sections[i].id == section.id) {						this.sections[i].loaded = true;					}				}				var SectionId = section.id.charAt(0).toUpperCase() + section.id.substr(1).toLowerCase();				var Fact = new Eve.lib[SectionId].Factory();			} else if (name == 'Wiki' || name == 'Publisher') {								(function(name) {					Eve.Resource.superbridge.broadcast( this, 'load_section_completed', { sectionId: name.toLowerCase() });				}).defer(5000, this, [name]);			}			Fact = Fact || new Eve.lib.Factory();			var SuperBridge = new Eve.lib.SuperBridge();						Eve.MainLayout.init( Fact || {}, SuperBridge || {}, section.id );		}	}		,isGroupSection: function( name ){		return ( this.getSectionByName(name).type == 'group' )	}}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Grid.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */  // The Grid View / Wrapper of GridStore, GridBridge, and Eve.vc.EditorGridPanel// The XHR ObjectEve.widgets.GridStore = function() {	}//----------------------------------------------------------// One click ..... One    click --> Edit...// One click ..... Double click --> Nothing ... ( LoLs )//----------------------------------------------------------Ext.grid.EditorGridPanel.prototype.clicksToEdit = 1;Eve.Proxy.before('Ext.grid.EditorGridPanel.prototype.startEditing', function(row, col, manual) {	// Flag to skip this process.	if (manual)		return true;		var d = new Date(); 	var ms = Date.UTC( d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds() );	var last = { row: row, col: col, time: ms };		if ( !this.last ){		this.last = last;		return false;	}		// if anything happened while we have a timer pending... ignore the editing process	if ( this.timeout ){		clearTimeout( this.timeout );		this.timeout = false;	}		// Check if this is the last CELL	if ( this.last.row == last.row && this.last.col == last.col ){		// Also check if this click has happened T Milliseconds after initial click		if ( Math.abs( this.last.time- last.time ) < 500 ){			this.last.time = last.time;						return false;		}				// We ll always return false because of the second condition		this.last.time = last.time;				// init the init after 300 miliseconds		this.timeout = setTimeout( this.startEditing.createDelegate( this, [ row, col, true ] ), 300 );		return false;	}		this.last = last;	return false;} );//----------------------------------------------------------//----------------------------------------------------------Ext.extend( Eve.widgets.GridStore, Eve.lib.XHR, {	store	: {}		,init	: function(rd, config) {		if (this.store[this.section] === undefined)		{			var conf = { 				url			: Eve.url				,reader 	: rd				,remoteSort	: true			};			this.store[this.section] = new Ext.data.Store(conf);		}	}		// Executes the config	,request: function(command)	{		//@@Benchmark		//console.log("@@Benchmark -- Time(D): ",(new Date()).getRTime() % 100000);		this.store[this.section].load({ 			params		: command		});	}		,nakedRequest : function(command)	{		Ext.Ajax.request(command);	}		,getStore : function()	{		return this.store[this.section];	}		,setSection : function(sec)	{		this.section = sec;	}});//-------------------------------------------------------------Eve.widgets.GridGroupStore = function(){};Ext.extend( Eve.widgets.GridGroupStore, Eve.widgets.GridStore, {	init : function(rd, config){		if (this.store[this.section] === undefined)		{			var conf = {				url			: Eve.url				,reader 	: rd				,remoteSort	: true				,groupField : config.groupField			//	,sortInfo	: { field: config.sortField, direction: "ASC" }			};			this.store[this.section] = new Ext.data.GroupingStore(conf);		}	}		,request: function(){		Eve.widgets.GridGroupStore.superclass.request.apply( this, arguments );	}});//--------------------------------------------------------------// The BridgeEve.widgets.GridBridge = function() {}Ext.extend( Eve.widgets.GridBridge, Eve.lib.Bridge, {	 minorId		: 0				// Id of the selected row in grid	,id		  		: 0				// Id of the current node in Tree	,groupId 		: 0				// Group Id of this object	,parentId 		: 0				// Parent Id of this object	,path			: '\\'	,root			: 'personal'	// Root --> 'personal', or 'group'	,view			: {}	,conn			: {}		,init : function(obj)	{		Eve.widgets.GridBridge.superclass.init.call(this, obj);	}		,getId : function()	{		return this.id;	}		,getGroupId : function()	{		return this.groupId;	}		,getParentId : function()	{		return this.parentId;	}		,getRoot : function()	{		return this.root;	}		,getPath : function()	{  		return this.path;	}				// Returns the Type of the Row	,getRowType : function(r)	{		return this.view.get().getStore().getAt(r).get('type');	}		// Returns the Row Id	,getRowId : function(r)	{		return this.view.get().getStore().getAt(r).id.split('_')[1];	}		// Returns the Row Title	,getRowTitle : function(rec)	{		if (typeof rec != 'object')			rec = this.view.get().getStore().getAt(rec);				var title	=	rec.get("title") ||			// General						rec.get("name") ||			// General						rec.get("subject") ||		// Calendar						rec.get("FullName") ||		// Contact						rec.get("reminder");		// Reminder				return title;	}	,getKeyMap : function()	{		var map	= [{			key		: 13			,fn		: function() {				var grid = this.view.get();				var sel	 = grid.getSelectionModel().getSelections();				switch (this.section) {					case 'link':						if (sel.length == 1) {							var data = {								info	: {									id		: sel[0].id.split('_')[1]									,rawId	: sel[0].id									,groupId: this.getGroupId()									,path	: this.getPath()									,root	: this.getRoot()									,rec	: sel[0]								}							}							this.fire('link_open_link', data, true);						}						break;					case 'contact':					case 'note':						if (sel.length == 1) {							var data = {								info	: {									id		: sel[0].id.split('_')[1]									,rawId	: sel[0].id									,groupId: this.getGroupId()									,path	: this.getPath()									,root	: this.getRoot()									,rec	: sel[0]								}							}							this.fire(this.section + '_load_icon_popup', data);						}						break;				}			}			,scope	: this		}, {			key		: 46			,fn		: this.deleteHdl			,scope	: this		}];		return map	}		,getColModel : function(id, hasExpander)	{		hasExpander = (hasExpander === false) ? false : true;				var data	= Eve.Preference.get('tree');				if (! data[this.section]) {			return;		}				var nodes	= data[this.section].nodes;				for (var i = 0; i < nodes.length; ++i) {			if (id == nodes[i].id.split('_')[1]) {				var tempModel = nodes[i].get('columns');				break;			}		}				if (tempModel) {			var cols	 = tempModel.split(',');			var colModel = [];						for (var i = 0; i < cols.length; ++i) {				var col = cols[i].split(':');				colModel.push({					dataIndex	: col[0]					,width		: parseInt(col[1])					,index		: hasExpander ? i + 1 : i					,hidden		: (col[2])? col[2] : 0				});			}						return colModel;		}	}		,syncColumnModel : function(id)	{			var hasExpander	 = (this.section == 'document' || this.section == 'forum') ? false : true;		var grid	 	 = this.view.get();		var gridColModel = grid.getColumnModel();		var colModel	 = this.getColModel(id, hasExpander);				if (colModel) {			for (var i = 0, len = gridColModel.getColumnCount(); i < len; ++i) {				var cm	= colModel[i];				var col = gridColModel.getColumnsBy( function(config, idx) {					// For columns haven't been saved in back end					if (!cm) return cm;										return (config.dataIndex == cm.dataIndex)				});				// If Column exists in Grid				if (col[0]) {					var oldIndex = gridColModel.getIndexById(col[0].id);					var newIndex = cm.index;										// Update Column Position					if (oldIndex != newIndex) {						gridColModel.moveColumn(oldIndex, newIndex);					}					try {						// Update Column Width						gridColModel.setColumnWidth(cm.index, cm.width);						// Update Column visibility						var hidden	= (cm.hidden == "1") ? true : false;						hidden		= (this.section == 'contact') ? false : hidden;						gridColModel.setHidden(cm.index, hidden);					} catch (e) {						console.log('syncColumnModel: couldnt find the matched column.',cm.dataIndex,cm.width,cm.index)					}				} else {					try{						// Update Column visibility						var j		= (hasExpander)? i+1 : i;						var index	= gridColModel.getIndexById(gridColModel.config[j].id)						var hidden	= (this.section == 'contact') ? false : true;						gridColModel.setHidden(index, hidden);					} catch (e) {						console.log('syncColumnModel: couldnt find the matched column.',gridColModel.config[ j ])					}				}			}		}	}		// - - - - - - - - - - - - - - - - - - - - - 	// Event Handler Attached to Grid	// - - - - - - - - - - - - - - - - - - - - - 		// Set Filters on each store's load.	,setFilterParams: function(ds, rec, opt) {		if (!ds.lastOptions){			ds.lastOptions = {};			ds.lastOptions.params = {};		}		try {			var root;			try{				 root = opt.params.event.split('.')[2];			}catch(e){				try{				root = opt.params.root				}catch(e){root = 'personal'}			}			ds.lastOptions.params.event		= Eve.Resource.cmdChangeSort(this.section, root);			ds.lastOptions.params.groupId	= opt.params.groupId || this.getGroupId();			ds.lastOptions.params.limit		= Eve.Preference.get('itemsperpage');			ds.lastOptions.params.start		= ds.lastOptions.params.start || 0;		} catch(e) {}				// Special Hook for contact section.		/*		if (this.gridSection == 'contact' && ds.done === undefined )			this.updateColumnModel(ds, opt);		*/	}		// Context Menu Handler	,hdlContextMenu : function(e)	{		// If clicked on header, ignore it		if (e.getTarget().className.indexOf('x-grid3-hd-inner') != -1) {			e.stopEvent();			return;		}				this.fire( 'force_hide_interlink_popup', {} );		e.stopEvent();				var data = {			pos		: e.getXY()			,info	: {				id			: 0				,parentId	: this.getId()				,groupId	: this.getGroupId()				,root		: this.getRoot()				,path		: this.getPath()			}		}	/*	if(e.getTarget().className.indexOf('x-grid3-body') == -1)		    return;*/		this.fire(this.gridSection + '_addmenu', data);	}		// Row Context Menu Handler	,hdlRowContextMenu : function(grid, rowIndex, e)	{		e.stopEvent();		var selections = grid.getSelectionModel().selections;		if(selections.getCount() == 0 || selections.indexOf(grid.store.getAt(rowIndex)) == -1)			grid.getSelectionModel().selectRow(rowIndex);						if(selections.length > 1){			var dataArr = [];			var ids 	= [];			var titles  = [];			var type 	= selections.first().get('type');			var sameType = true			selections.each(function(_rec){				if(_rec.get('type') !== type){					sameType = false;				    return;				}				data = {					type	: _rec.get('type')					,title	: this.getRowTitle(_rec)					,rec	: _rec					,info	: {						id			: _rec.id.split('_')[1]						,rawId		: _rec.id						,reminderId	: _rec.data.reminderId	// Used in Reminders					}				};				dataArr.push(data);				ids.push(_rec.id.split('_')[1]);				titles.push(this.getRowTitle(_rec))			},this);			if(!sameType){   				Ext.tools.msg('','All selected rows must have the same type');   				return;			}			var info = {				typeId		: Eve.Resource.getTypeId(this.getRoot(), type, this.section)				,id         : ids.join(',')				,title      : titles.join(',')				,parentId	: this.getId()				,groupId	: this.getGroupId()				,root		: this.getRoot()				,path		: this.getPath()				,pos		: e.getXY()			};			var dataObj ={ info : info, data : dataArr};						this.fire(this.gridSection + '_before_multi_editmenu', dataObj);			return;		}				var rec	 = this.view.get().getStore().getAt(rowIndex);		var type = this.getRowType(rowIndex);				var data = { 			pos		: e.getXY()			,type	: type			,title	: this.getRowTitle(rowIndex)			,rec	: rec			,info	: { 				id			: this.getRowId(rowIndex)				,typeId		: Eve.Resource.getTypeId(this.getRoot(), type, this.section)				,parentId	: this.getId()				,groupId	: this.getGroupId()				,root		: this.getRoot()				,path		: this.getPath()				,rawId		: rec.id				,reminderId	: rec.data.reminderId	// Used in Reminders			}		}		this.fire(this.gridSection + '_before_editmenu', data);	}		// Handler for Column Resize or Move	,hdlColResizeMove : function(oldIdx, newIdx)	{		var columns = this.view.get().getColumnModel().config;		var data	= [];				for (var i = 0; i < columns.length; ++i) {			var col = columns[i];			var hidden = (col.hidden)? 1 : 0;			if (col.dataIndex != '') {				data.push(col.dataIndex + ':' + col.width + ':'+ hidden );			}		}				var tree	= Eve.Preference.get('tree');		if(tree[this.section] && tree[this.section].nodes){						var nodes	= tree[this.section].nodes;			if (this.getId() >= 0 || this.getId() == -10) {				var id = (this.getRoot() == 'personal') ? ( (this.getId() == -10) ? -10 : 0 ) : this.getGroupId();				//var id = (this.getRoot() == 'personal') ? 0 : this.getGroupId();				for (var i = 0; i < nodes.length; ++i) {					var node = nodes[i];					if (id == nodes[i].id.split('_')[1]) {						node.set('columns', data.join(','));						node.set('columnsChanged', true);						break;					}				}			}		}	}		,hdlGridRender : function()	{		var pr = Eve.Preference;				if (this.sharedSection || Eve.SectionManager.isGroupSection(pr.get('landingpage'))) {			var id	 = pr.get('landinggroupid');			var path = pr.get('landinggrouppath');			var info = {				id		: 0				,path	: path				,root	: 'group'				,groupId: id			}					} else {			// Suppose 'Personal' node selected			var info = {				id			: 0				,parentId	: -1				,path		: '\\'				,root		: 'personal'			}		}				// Get Node's Premission		var tree = pr.get('tree')[this.section];				if (tree) {			for (var i = 0; i < tree.nodes.length; ++i) {				var node = tree.nodes[i];								if ( info.id == node.id.split('_')[1] ) {					var pDelete = node.get('deletePermission');					var pEdit	= node.get('editPermission');					var pNew	= node.get('newPermission');					var pSelect = node.get('selectPermission');				}			}		}				var data = {			info	: info			,node	: {				attributes	: {					per			: {						Delete		: pDelete	|| false						,Edit		: pEdit		|| false						,New		: pNew		|| true						,Select		: pSelect	|| true					}				}			}		}				Ext.apply(this, data.info);		this.fire(this.section + '_set_active_node', data, true);	}			// - - - - - - - - - - - - - - - - - - - - - 	// Register Handlers to its Event	// - - - - - - - - - - - - - - - - - - - - - 		,registerView : function()	{		var grid  = this.view.get();		var store = grid.getStore();		var sel	  = grid.getSelectionModel();				//grid.on('beforerender', this.hdlGridRender, this);		store.on('load', function(store, records, options) {			//@@Benchmark			//console.log("@@Benchmark -- Time(E2): ",(new Date()).getRTime() % 100000);			if (this.manager) {				this.manager.loadFinished(this);			}		}, this);				store.on('load', this.setFilterParams, this);				sel.on('selectionchange', function(sm) {			var selections = sm.selections;			if (selections.length > 1){				var dataArr = [];				selections.each(function(_rec){					data = {						type	: _rec.get('type')						,title	: this.getRowTitle(_rec)						,rec	: _rec						,info	: {							id			: _rec.id.split('_')[1]							,rawId		: _rec.id							,reminderId	: _rec.data.reminderId	// Used in Reminders						}					};					dataArr.push(data);				},this);				var dataObj ={ data : dataArr};				this.fire(this.gridSection + '_set_multi_active_row', dataObj);				return;			}			rec = sm.getSelected();			if (rec) {				var data = {					rec		: rec					,info	: {						id				: rec.id.split('_')[1]						,root			: this.getRoot()						,groupId		: this.getGroupId()						,parentId		: this.getParentId()						,path			: this.getPath()					}				}				this.fire(this.gridSection + '_set_active_row', data)				}		}, this, {buffer: true})								// Handle Grid Cell Double Click		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm 	= grid.colModel;						// Make sure it is the right column			if (cm.getDataIndex(colIdx) != 'linkedItems')				return;						var id = this.getRowId(rowIdx);						// we are gonna fire the interlinkg thingy...			var el = grid.getView().getCell( rowIdx, colIdx );			var rec = grid.getStore().getAt( rowIdx );						if (  rec.get('linkedItems') && rec.get('linkedItems') != '0' ){			// TODO: Check the record id here...				this.fire( this.gridSection + '_show_interlink_popup', {info: {id : rec.id.split('_')[1], el: Ext.get(el), bridge: this, grid: grid, record: rec, parentId: this.getId(), groupId: this.getGroupId(), root: this.getRoot(), path: this.getPath(), rowIndex: rowIdx }} );			}		}, this);								// Handle GridBody Right Click		grid.on('contextmenu', this.hdlContextMenu, this);						// Handle Row Right Click		grid.on('rowcontextmenu', this.hdlRowContextMenu, this );						// Handle Grid Click		grid.on('click', function(e) {			var target 	= e.getTarget();			var row		= this.view.get().getView().findRowIndex(target);			// If clicked on Grid's body not any row, so the row is equal to false.			if (row === false && (target.className === 'x-grid3-scroller' || target.className == 'x-grid3-body')) {				this.view.get().getSelectionModel().clearSelections();			}			this.fire( 'force_hide_interlink_popup' );		}, this);						// Handle Row Click		grid.on('rowclick', function(grid, rowIndex, e){			this.fire( 'force_hide_interlink_popup',{root : this.getRoot(), type:this.getRowType(rowIndex), groupId : this.getGroupId() } );		}, this);						// Handle GridBody Double Click		grid.on('dblclick', function(e) {			var target 	= e.getTarget();			var row		= this.view.get().getView().findRowIndex(target);						// If clicked on Grid's body not any row, so the row is equal to false.			if (row === false && (target.className === 'x-grid3-scroller' || target.className == 'x-grid3-body')) {				var data = {					info	: {						id			: 0						,parentId	: this.getId()						,groupId	: this.getGroupId()						,root		: this.getRoot()						,path		: this.getPath()					}				}								this.fire(this.gridSection + '_before_create_item_dlg', data);			}		}, this);				// Handle Grid Before Cell Edit.		grid.on('beforeedit', function(e) {			var rec = e.record;						if (!rec.data.editPermission)				return false;		}, this);		// Handle after a cell is edited, but before the value is set in the record.		grid.on('validateedit', function(e) {			if(  e.value.match && e.value .match(/[\\/]/))				return false;		});				// Handle Grid After Cell Edit.		grid.on('afteredit', function(e) {			this.submitChanges();		}, this);				// Handle Grid After Cell Edit.		grid.on('keydown', function(e) {			if (e.getKey() < '47' || e.getKey() > '91')				return false;						var sm  = grid.getSelectionModel();			var rec = sm.getSelected();			if (rec && rec !== undefined)				grid.startEditing(grid.store.indexOf(rec), 2);		},this)		//		// Handle Grid's Store Load Event.		store.on('load', function(ds, recs, opt) {						this.fire(this.gridSection + '_grid_store_reload', { store: ds });			try{								var xml = grid.store.reader.xmlData;				var orderBy =  Ext.DomQuery.selectValue( 'orderBy', xml );				var orderDir = Ext.DomQuery.selectValue( 'orderDir', xml, 'ASC' );				grid.store.setDefaultSort( orderBy, orderDir );				grid.store.fireEvent( 'datachanged', this ); 			}catch( e ){}				}, this);						// Handle Column Move		grid.on('columnmove', this.hdlColResizeMove, this, {buffer: true});						// Handle Column Resize		grid.on('columnresize', this.hdlColResizeMove, this);		// Handle Column Visibility		grid.getColumnModel().on('hiddenchange', this.hdlColResizeMove, this)		} // End of registerView.		,submitChanges : function() {		var store = this.conn.getStore();				if (store.modified.length <= 0) {			return;		}				// Loop throught all modified records		for (var k = 0; k < store.modified.length; ++k ) {			var params = '';									var mf = store.modified[k].modified;			var map = store.modified[k];			var newObj = {};						for (var i in mf) {				newObj[i] = map.data[i];								if ( typeof newObj[i] == 'object' ){					try{						// BOOO, scary Aye?!						// commented by majid... it isn't support in Ext 2.3						//newObj[i] = newObj[i].format0();						newObj[i] = newObj[i].format('n/j/y');					}catch(e){						console.log(e);					}				}				else if ( typeof newObj[i] == 'function' ) {					newObj[i] = newObj[i]();				}			}		}				var type = map.data.type;						var data = {			params		: newObj			,itemType	: type			,record		: map			,mode		: 'inline'			,info 		: {				id			: map.id.split('_')[1]				,parentId	: this.getId()				,groupId	: this.getGroupId()				,root		: this.getRoot()				,path		: this.getPath()			}		}			 	//ToDO, in Reminder section :)	 	if( mf.reminderShowOnDesktop || mf.reminderPopupSent || mf.reminderEmailSent || mf.reminderSMSSent){			var temp = "reminder";		    data.event =  "modern."+temp+"."+this.getRoot()+".updateFields";	 	}		this.fire(this.gridSection + '_update_' + type.toLowerCase(), data);	}		,fetchData : function(){		console.log( 'Fetch data called : since this function is specialized for each section so nothing would happen as this is a base class' );	}		,updateData : function() {}		,syncData : function(data) {}			,execute : function(callee, type, data)	{		switch(type) {			case ('show_section'):				if (this.section == Eve.SectionManager.getSectionId( data.sectionName )) {					this.id 	 = data.info.id || 0;					this.groupId = data.info.groupId || 0;					this.root	 = (data.info.groupId == '0') ? 'personal' : 'group';					this.path	 = data.info.path || '\\';					this.parentId= 0;				}				break;							case (this.gridSection + '_set_active_node'):				if (this.gridSection == 'contact' && data.catchIt !== true) {					return;				}								if (this.gridSection == 'task' ||					this.gridSection == 'contact')				{					// Reset Filter if there's any					this.onFilterChange({criteria: ''})				}								// Update the this.[id, groupId, parentId, root, path]				Ext.apply(this, data.info);												// Sync ColumnModel with Preference				if (this.getId() >= 0 || this.getId() == -10){					var rid = (this.root == 'personal') ? ( (this.getId() == -10) ? -10 : 0 ) : data.info.groupId;					this.syncColumnModel(rid);				}												// Update grid according to new id and parentId				this.fetchData(data);				break;							case ( this.gridSection + '_after_change_state' ):				var store	= this.view.get().getStore();				store.removeAll();				store.commitChanges();								break;			case (this.gridSection + '_open_link'):				this.openLink(data);				break;						case (this.gridSection + '_filter_grid'):				this.filterData(data.params);				break;							case (this.gridSection + '_success_create_folder'):			case (this.gridSection + '_success_create_item'):				this.createObject(callee, type, data);				break;							case (this.gridSection + '_success_modify_folder'):			case (this.gridSection + '_success_modify_item'):				this.modifyObject(callee, type, data);				break;							case (this.gridSection + '_success_update_folder'):			case (this.gridSection + '_success_update_item'):				if (data.info.parentId == this.getId())					this.updateObject(callee, type, data);				break;							case (this.gridSection + '_success_delete_folder'):			case (this.gridSection + '_success_delete_item'):				//if (data.info.parentId == this.getId() || this.gridSection == 'forum')					this.deleteObject(callee, type, data);				break;							case (this.gridSection + '_success_print_folder'):				this.printFolder(callee, type, data);				break;						case (this.gridSection + '_filter'):				this.filter(callee, type, data);				break;						case (this.gridSection + '_success_modify_filter'):				var store	= this.view.get().getStore();				var result	= store.reader.read(data);				store.loadRecords(result, {add: false}, true);				/* Majid: Wait : next lines was commented */				Eve.mask.hide();				break;							case (this.gridSection + '_get_grid_stat'):				this.fire(this.gridSection + '_grid_stat', { info: {id: this.getId(), parentId: this.getParentId(), groupId : this.getGroupId(),						  									 root: this.getRoot(), path: this.getPath()}});				break;							case (this.gridSection + '_rename_item_inline_editor'):			case (this.gridSection + '_rename_folder_inline_editor'):				this.inlineEdit(callee, type, data);				break;							case (this.gridSection +"_success_update_grid"):			    this.updateGrid(data);			    break;							case (this.section + '_change_state'):				// Rembmer if it's Shared section				if (data.state == 'group_section') {					this.sharedSection = true;				} else {					this.sharedSection = false;				}								break;						}	}		,createObject	: Ext.emptyFn	,modifyObject	: Ext.emptyFn	,deleteObject	: Ext.emptyFn	,updateObject	: Ext.emptyFn	,printFolder	: Ext.emptyFn	,filter		 	: Ext.emptyFn	,setColumnModel	: Ext.emptyFn	,augmentToRecord: function(record, xml) { return record; }	,onFilterChange	: function() { return true; }	,getTitle       : function(rec){return rec.get('title');}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Tree.js *//*--------------------------------------------------*/	// Written by OmidEve.widgets.TreeStore = new Eve.lib.EmptyXHR();// Eve.widgets.TreeBridge = function(){	Eve.widgets.TreeBridge.superclass.constructor.apply( this, arguments );	}Ext.extend( Eve.widgets.TreeBridge, Eve.lib.Bridge, {	// active node properties	id : -1	,parentId : 0	,groupId  : 0	,root	  : ''	,path	  : '\\'		// selected node properties	,selId 		: -1	,selPId 	: 0	,selGId		: 0	,selRoot	: ''	,selPath	: ''		,init : function(obj) {		Eve.widgets.TreeBridge.superclass.init.call(this, obj);		if (obj.prefix === undefined) {			throw 'Section Prefix should be set in tree!';		}		this.view.init({			border			: false			,autoScroll		: true			,rootTitle		: Eve.Resource.getRootTitle()			,loader			: {				url				: Eve.url				,baseParams		: this.fetchData.createDelegate(this)				,section		: obj.section			}			,enableDD		: (this.section == 'calendar') ? false : true			,ddGroup		: Eve.Resource.getTreeGroup()			,ddAppendOnly	: true			,section		: obj.section			,sectionPrefix	: obj.prefix		});		console.log(obj, this.view)		// Set the Tree Editor		this.treeEd = new Ext.tree.TreeEditor(this.view.get(), {			completeOnEnter : true			,autosize 		: true			,ignoreNoChange : true		});				this.registerView();	}		,getBackendSectionName: function( section ){		this._backendSectionName = this._backendSectionName || {			 'document' : 'Documents'			,'task'		: 'Tasks'			,'calendar'	: 'Calendar'			,'link'		: 'Links'			,'contact'	: 'Contacts'		}				return this._backendSectionName[section] || section;	}			,fetchData : function(){		throw new TypeError('FetchData should be overloaded.');	}			// A Longgg.............................ggg list of Events for the tree to handle	,registerView : function(){		var tree = this.view.get(); // Get Tree component		var sel  = tree.selModel;				sel.on( 'beforeselect', function(sm, node, oldNode)		{			if ( node.attributes.per === undefined ||!node.attributes.per.Select )			{				this.fire( this.section + '_permission_denied', {} );				return false;			}		}, this)								/*		// Start: Don't Change it or Calendar will crash.		*/				// Remember this Handler, cause Calendar needs to remove it.		sel._onSelChange = function(sm, node) {			//@@Benchmark			//console.log("@@Benchmark -- Time(I1): ",(new Date()).getRTime() % 100000);			if (!node) {				return false;			}						var temp = tree.getNodeInfo(node);			var data = {				info	: temp				,header	: temp.headerPath				,node	: node			}						if (parseInt(node.id.split('_')[1]) <= -100) {				// Called this, because of Permission checking				this.fire('doc_recycle_set_active_node', data);			}						if (this.loadForce) {				this.loadForce = false;				return;			}						// Fire a set_active_node event			this.fire(this.section + '_set_active_node', data);			//@@Benchmark			//console.log("@@Benchmark -- Time(I2): ",(new Date()).getRTime() % 100000);		};				sel.on('selectionchange', sel._onSelChange, this);				/*		// End: Don't Change it or Calendar will crash.		*/						tree._onBeforeLoad = function(n) {			var temp = tree.getNodeInfo(n);			   			this.id 		= temp.id;			this.groupId 	= temp.groupId;			this.parentId 	= temp.parentId;			this.root		= temp.root;			this.path		= temp.path;						var info = {				id			: this.id				,parentId	: this.parentId				,groupId	: this.groupId				,root		: this.root				,path		: this.path			}						this.fire(this.section + '_set_loading_node', { info: temp, permissions: n.attributes.per} );		};				tree.on('beforeload', tree._onBeforeLoad, this);						/*		// Start: Don't Change it or Calendar will crash.		*/				// Remember this Handler, cause Calendar needs to remove it.		tree._onContextMenu = function(node, e) {			var temp = tree.getNodeInfo(node);			var isSelected = tree.getSelectionModel().isSelected(node);						this.id			= temp.id;			this.groupId 	= temp.groupId;			this.parentId 	= temp.parentId;			this.root		= temp.root;			this.path		= temp.path;						var obj = tree.getMode(node.id);			if (node.id == tree.getRootId())				return;							// In case of node is 'Personal' the way we send data is diffrent from other cases.			if (obj.root == 'personal' && obj.id == 0) {				var data = {					type		: 'group'					,pos		: e.getXY()					,node		: node					,title		: node.text					,isSelected	: isSelected					,info	: {						id			: 0						,parentId	: 0						,root		: 'personal'						,path		: '\\'					}				}								this.fire(this.section + '_before_treemenu',  data);				return;			}						if (node.id.split('_')[1] == '-100') {				var type = 'recycle';			}			else {				var type = (node.id.indexOf('G_')==-1) ? 'folder' : 'group';			}						var data = {				type		: type				,pos		: e.getXY()				,node		: node				,title		: node.text				,isSelected	: isSelected				,info	: {					id			: this.id					,parentId	: this.parentId					,groupId	: this.groupId					,root		: this.root					,path		: this.path				}			}						this.fire(this.section + '_before_treemenu', data);		};				tree.on('contextmenu', tree._onContextMenu, this);				/*		// End: Don't Change it or Calendar will crash.		*/								/*		// Start: Don't Change it or Calendar will crash.		*/				// Prevent chenge on 'Personal' node.		this.treeEd._onBeforeStartEdit = function(ct, el, value) {			if (value == 'Personal') {				return false;			}						if ( this.treeEd.editNode && this.treeEd.editNode.id.indexOf('G_') !== -1 )				return false;						// Check Edit Permission			var node = tree.getSelectionModel().getSelectedNode();			if (node.attributes.per.Edit == 'false' || node.attributes.per.Edit == false)				return false;						return true;		}				this.treeEd.on('beforestartedit', this.treeEd._onBeforeStartEdit, this);				/*		// End: Don't Change it or Calendar will crash.		*/						this.treeEd._onComplete = function(ct, value, oldValue) {			if (value == '' || (value == oldValue) || value.match(/[\\/]/))				return false;			if ( this.treeEd.editNode && this.treeEd.editNode.id.indexOf('G_') !== -1 )				return false;			var temp = ct.tree.getNodeInfo(this.treeEd.editNode);			this.id			= temp.id;			this.groupId 	= temp.groupId;			this.parentId 	= temp.parentId;			this.root		= temp.root;			this.path		= temp.path;			this.fire(this.section + '_update_folder', {params: {title:value} ,info:{ id: this.id, parentId : this.parentId, groupId : this.groupId,					  											root: this.root, path: this.path }, mode: 'inline' });		};		this.treeEd.on('complete', this.treeEd._onComplete, this);						// Handle Drag & Drop		tree.on('beforenodedrop', function(e) {			var o = tree.isValidDropZone(e);						if (typeof o == 'object') {				var data = {					info			 : o.src					,destInfo		 : o.dest					,itemType		 : e.data.items[0].type					,isMultiSelected : o.isMultiSelected				}								this.fire(this.section + '_move_folder', data);			}			else {				Ext.tools.msg(o);				return false;			}					}, this)		// Handle Drag & Drop		tree.on('nodedragover', function(e) {			// Don't check it with false.						if (typeof tree.isValidDropZone(e) != 'object')				return false;		}, this);	}				,execute : function(callee, type, object)	{		var tree = this.view.get();				switch(type) {			case (this.section + '_activate_child_node' ):				// This changes the active Node				var sm 		= tree.getSelectionModel();				var nodeId	= tree.getPre( object.info.root ) + "_" + object.info.id;								// Now the node might be open				var node = sm.getSelectedNode();				if (! node) {					return;				}								if ( node.isExpandable() && !node.isExpanded() ){					var nodeSelector = function(){						// Try to select the node						this.getNodeById( nodeId ).select();						node.un('expand', nodeSelector );					}										node.on('expand', nodeSelector, tree );					node.expand();				}else{					// Try to select the node directly					tree.getNodeById( nodeId ).select();				}								break;			case (this.section + '_activate_parent_node'):				var selModel = tree.getSelectionModel();				var selNode	 = selModel.getSelectedNode();								if (selNode && selNode.parentNode) {					selNode.parentNode.select();				}				break;							case (this.section + '_success_create_folder'):				if (object.byPass) {					return;				}				var parentId = tree.createId(object.info.root, object.info.parentId, object.info.groupId);				var parent	 = tree.getNodeById(parentId);								if (parent) {					// Make sure the parent is not a leaf anymore					parent.leaf = false;										// Make the node here;					var attr = {						text	: object.params.title						,id		: object.info.rawId || object.info.id						,leaf	: true						,cls	: Eve.activeSec + '-tree-folder-node'					};										// Permissions					attr.per	= {						Select	: object.info.selectPrm || true						,New	: object.info.newPrm	|| true						,Edit	: object.info.editPrm	|| true						,Delete	: object.info.deletePrm || true					}										parent.appendChild(new Ext.tree.TreeNode(attr));				}												if (object.info.parentId == 0 && parent) {					// Update the Preference					var nodes = Eve.Preference.get('tree')[this.section].nodes;										for (var i = 0; i < nodes.length; ++i) {						var node = nodes[i];												if (node.get('id') == parent.id) {							node.set('leaf', false);														// We found it, so let's skip the loop							return;						}					}				}								break;											case 'change_active_group':				Eve._treeLandingGroupPath = object.selectedPath;				if (this.curTreeState == 'group_section') {					this.curTreeState = 'bleh';				}								break;											case (this.section + '_success_delete_folder'):				var node;				/*  If selected node and deleted node was the same, 					after deleting the parent node must be selected */				var sm	= tree.getSelectionModel();				var sel	= sm.getSelectedNode();								if (object.isMultiSelected) {					var ids = [];					var successIds = Ext.DomQuery.selectValue('successfulIds', object.info.xml);										ids = successIds.split(',');					if (ids.length > 0) {						for (var i=0; i< ids.length; i++) {							node = tree.getNodeById(ids[i]);							if (node) {							    node.parentNode.removeChild(node);							}															if (sel == node) {								var path = node.parentNode.getPath();								tree.selectPath(path);							}						}					}				} else {					var id	= object.info.rawId || object.info.id;	     			node	= tree.getNodeById(id);					if (sel == node) {						var path = node.parentNode.getPath();						tree.selectPath(path);					}					if (node !== undefined) {      					node.parentNode.removeChild(node);					}				}								break;											case (this.section + '_success_modify_folder'):			case (this.section + '_success_update_folder'):				try {					var title = object.params.title || object.params.name;				} catch(e) {}								if (title === undefined)					return;				var node = tree.createId(object.info.root, object.info.id, object.info.groupId);				node = tree.getNodeById(node);								if (node && node !== undefined)					node.setText(title);				//Added by Ghazale				//Change color of completed node in task				if(this.section == 'task' && object.extra && object.extra.response){					var xml = object.extra.response.responseXML;					try					{						var completed = Ext.DomQuery.selectValue('completed', xml);						var textNode = Ext.get(Ext.DomQuery.selectNode('span', node.getUI().anchor));						if(completed == "true" || completed == "1"){							node.attributes['completed'] = true;							textNode.setStyle('color', '#808080');							textNode.setStyle('font-style', 'italic');									if(tree.isFiltered)								node.getUI().hide();						}						else{							node.attributes['completed'] = false;							textNode.setStyle('color', '#000');							textNode.setStyle('font-style', 'inherit');							if(tree.isFiltered)								node.getUI().show();						}					}catch(e){}				}								break;											case (this.section + '_get_tree_stat'):				this.fire(this.section + '_tree_stat', { info: {id: this.id, parentId: this.parentId,						  										groupId : this.groupId, root: this.root, path: this.path}});				break;											case (this.section + '_get_node_info'):				if (object.node) {					var temp = tree.getNodeInfo(object.node);					this.fire(this.section + '_node_info',  { node: object.node, info: {id: temp.id						,groupId: temp.groupId, parentId: temp.parentId, root: temp.root, path: temp.path} });				}								break;											case (this.section + '_success_move_folder'):				var type	= object.itemType.toLowerCase();				var tid		= object.destInfo.id;				var root	= object.destInfo.root;				var groupId = object.destInfo.groupId;								tid = tree.createId(root, tid, groupId)				var target	= tree.getNodeById(tid);				switch (type) {					case 'folder': // Changed By Majid						if(object.info.dragSrc == "tree"){							var id = object.info.rawId = tree.getPre(object.info.root, 'folder') + '_' + object.info.id;							this.fire(this.section + '_success_delete_folder', object, true);							var node = tree.getNodeById(id);							if(node)								node.remove();						}						else{							this.fire(this.section + '_success_delete_folder', object, true);							var ids = object.info.ids.split(",");							var prefix = tree.getPre(object.info.root ,'folder')+"_";							var node;							for(var i=0; i<ids.length; i++){								node = tree.getNodeById(prefix + ids[i]);								if(node)									node.remove();							}						}						if(!target.reload ){							if( parseInt(tid.split("_")[1])<= -100 )								return;							var attr = target.attributes;							var parent = target.parentNode;							var n = new Ext.tree.AsyncTreeNode(attr);							n.leaf = false;							n.id = target.id;							var next = target.nextSibling;							target.remove();							if(next){								parent.insertBefore(n, next);							}							else{								if(parent.hasChildNodes()){									parent.appendChild(n);								}								else{									parent.appendChild(n);									parent.expand();								}							}							parent.getUI().updateExpandIcon();							n.expand();						}						else{							target.reload();						}						break;					case 'item':						object.info.rawId = tree.getPre(object.info.root ,'item') + 'I_' + object.info.id;						this.fire(this.section + '_success_delete_item', object);						break;				}								break;											case (this.section + '_rename_folder_inline'):				var id		= tree.createId(object.info.root, object.info.id, object.info.groupId);				var node 	= tree.getNodeById(id);				this.treeEd.triggerEdit(node);								break;			case (this.section + '_filter_folders'):				var root = tree.getRootNode();				tree.isFiltered = true;				root.cascade(function(node){					var filterField = node.attributes[object.filterBy];					if(filterField == "true" || filterField == "1"){						if(node.isSelected()){							if(this.root == 'personal')								tree.getNodeById(tree.getPersonalId()).select();							else								tree.getNodeById([tree.getSP(),'G_',this.groupId].join('')).select();													}						node.getUI().hide();					}				}, this);				break;			case (this.section + '_clear_folders_filter'):				var root = tree.getRootNode();				tree.isFiltered = false;				root.cascade(function(node){						node.getUI().show();				});				break;		}	}});Ext.tree.TreeEditor.prototype.triggerEdit_1 = Ext.tree.TreeEditor.prototype.triggerEdit;Ext.tree.TreeEditor.prototype.triggerEdit = function(){	// Try Catch, added because of IE	try {		Ext.tree.TreeEditor.prototype.triggerEdit_1.apply( this, arguments );	} catch (e) {}}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Menu.js *//*--------------------------------------------------*/// Written by Omid// -----------------------------------------------------------------------// Nothing special here// -----------------------------------------------------------------------Eve.widgets.Menu = Ext.extend( Eve.lib.Bridge, {	 menu : {}	,title	 : ''	// Temp object for whatever you want	,id   	 : 0	,groupId : 0	,parentId: 0	,root	 : "personal"	,path	 : ""	,section : ""	,init : function(data) {		Eve.widgets.Menu.superclass.init.call(this, data);	}});// -----------------------------------------------------------------------// Simple Add Menu// -----------------------------------------------------------------------Eve.widgets.BaseAddMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data) {		Eve.widgets.BaseAddMenu.superclass.init.call(this, data);	}	,registerView : function() {		this.menu.on('itemclick', function( bi ) {			switch(bi.id) {				case 'item':					this.fire(this.section + '_create_item_dlg'  , { info: {id: 0, groupId : this.groupId,							  							parentId: this.parentId, root: this.root, path: this.path} });					break;				case 'folder':					this.fire(this.section + '_create_folder_dlg', { info: {id: 0, groupId : this.groupId,							  							parentId: this.parentId, root: this.root, path: this.path} });					break;			}		}, this );	}	,execute : function( callee, type, obj ) {		switch( type ) {			case (this.section + '_addmenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.path		= obj.info.path;				this.menu.showAt( obj.pos );				break;		}	}});// -----------------------------------------------------------------------// Basic Add Menu used in most of the Windows// -----------------------------------------------------------------------Eve.widgets.AddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.AddMenu.superclass.init.call(this, data);				this.menu = new Ext.menu.Menu({			items : [{					text: "New " + Eve.activeSec + " Folder"					,id	: 'folder'				}, {					text: "New " + Eve.activeSec					,id	: 'item'				}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Simple Edit Menu// -----------------------------------------------------------------------Eve.widgets.BaseEditMenu = Ext.extend( Eve.widgets.Menu, {	folder_menu : {}	,item_menu 	: {}	,type		: {}	,init : function(data) {		Eve.widgets.BaseEditMenu.superclass.init.call(this, data);	}	,registerView : function( brdg )	{		this.item_menu.on('itemclick', function(bi)		{			console.log("registerView , itemClick")			var data = {				title	: this.title				,isMultiSelected : this.isMultiSelected				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}			switch(bi.id)			{				case 'edit':									//@@Benchmark					//console.log("@@Benchmark -- Time(N1): ",(new Date()).getRTime() % 100000);									this.fire(this.section + '_edit_item_dlg'  , data);					break;								case 'delete':					this.fire(this.section + '_delete_item_dlg'  , data );					break;								case 'open':					switch (this.section) {						case 'link':							this.fire(this.section + '_open_link', data);							break;													case 'note':							this.fire('note_load_icon_popup', data);							break;					}					break;									case 'linked':					this.fire(this.section + '_interlinking_dlg', data);					break;								case 'comments':					this.fire(this.section + '_comment_dlg', data);					break;			}		}, this );		if (this.folder_menu.on) {			this.folder_menu.on('itemclick', function( bi )			{				var data = {					title			: this.title					,isMultiSelected : this.isMultiSelected					,info	: {						id			: this.id						,typeId		: this.typeId						,reminderId	: this.reminderId						,parentId	: this.parentId						,groupId	: this.groupId						,root		: this.root						,path		: this.path					}				}								switch(bi.id)				{					case 'edit':						this.fire(this.section + '_edit_folder_dlg' ,data);						break;					case 'delete':							this.fire(this.section + '_delete_folder_dlg' ,data);				}			}, this);		}	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_editmenu'):				Ext.apply(this, obj.info);				this.type		= obj.type;				this.title		= obj.title;				this.record		= obj.rec				this.isMultiSelected = obj.isMultiSelected;				var amenu = (this.type == 'folder') ? this.folder_menu : this.item_menu;				var pos = obj.pos								amenu.showAt(pos);				break;		}	}});// -----------------------------------------------------------------------// Basic Edit Menu used in most of the Windows// -----------------------------------------------------------------------Eve.widgets.EditMenu = Ext.extend( Eve.widgets.BaseEditMenu, {	init : function(data){		Eve.widgets.EditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.imagePath + 'ajax/eve-edit.png'			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.imagePath + 'ajax/eve-delete.png'			}]		});		this.folder_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.imagePath + 'ajax/eve-edit.png'			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.imagePath + 'ajax/eve-delete.png'			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Extended Edit Menu// -----------------------------------------------------------------------Eve.widgets.ExtendedEditMenu = Ext.extend( Eve.widgets.EditMenu, {	init : function(data) {		Eve.widgets.AddMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.imagePath + 'ajax/eve-edit.png'			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.imagePath + 'ajax/eve-delete.png'			}, {				text	: "Open " + this.section				,id		: "open"			}]		});		this.folder_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.imagePath + 'ajax/eve-edit.png'			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.imagePath + 'ajax/eve-delete.png'			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Simple Tree Add Menu// -----------------------------------------------------------------------Eve.widgets.BaseTreeMenu = Ext.extend( Eve.widgets.Menu, {	foldermenu : {}	,groupmenu  : {}		,init : function(data) {		Eve.widgets.BaseTreeMenu.superclass.init.call(this, data);	}	,registerView : function(){		this.foldermenu.on('itemclick', function( bi ) {			switch( bi.id ) {				case 'add':					this.fire(this.section + '_create_folder_dlg'  ,							  { info: {id: 0, groupId : this.groupId, parentId: this.id, root: this.root, path: this.path} });					break;				case 'edit':					this.fire(this.section + '_edit_folder_dlg' ,							  { info: {id: this.id, groupId : this.groupId, parentId: this.parentId, root: this.root, path: this.path}, title: this.title });					break;				case 'delete':					this.fire(this.section + '_delete_folder_dlg' ,							  { info: {id: this.id, groupId : this.groupId, parentId: this.parentId, root: this.root, path: this.path}, title: this.title });					break;				case 'rename':					this.fire(this.section + '_rename_folder_inline' ,							  { info: {id: this.id, groupId : this.groupId, parentId: this.parentId, root: this.root, path: this.path}, title: this.title });					break;			}		}, this );		this.groupmenu.on('itemclick', function( bi ) {			switch( bi.id ){				case 'add':					this.fire(this.section + '_create_folder_dlg'  , { info: {id: 0, groupId : this.groupId, parentId: 0, root: this.root, path: this.path} });					break;			}		}, this );	}	,execute : function( callee, type, obj ) {		switch( type ) {			case (this.section + '_treemenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.title		= obj.title;				this.path		= obj.info.path;				this.isSelected	= obj.isSelected;								var amenu = (obj.type==='folder') ? this.foldermenu : this.groupmenu;								amenu.showAt( obj.pos );				break;		}	}});// -----------------------------------------------------------------------// Basic Add Menu used in most of the Trees// -----------------------------------------------------------------------Eve.widgets.TreeMenu = Ext.extend( Eve.widgets.BaseTreeMenu, {	init : function(data){		Eve.widgets.TreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({		items : [{				text	: "Add"				,id		: 'add'				,icon	: Eve.imagePath + 'ajax/eve-add.png'			}, {				text	: "Edit"				,id		: 'edit'				,icon	: Eve.imagePath + 'ajax/eve-edit.png'			},/* {				text	: "Rename"				,id		: 'rename'			},*/ {				text	: "Delete"				,id		: 'delete'				,icon	: Eve.imagePath + 'ajax/eve-delete.png'			}]		});		this.groupmenu = new Ext.menu.Menu({		items : [{				text	: "Add"				,id		: 'add'				,icon	: Eve.imagePath + 'ajax/eve-add.png'			}]		});		this.recyclemenu = new Ext.menu.Menu({		items : [{				text	: "Empty Recycle Bin"				,id		: 'empty'			}]		});		this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/CRUD.js *//*--------------------------------------------------*//** * Hyperoffice CRUD based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.CRUDStore = Ext.extend( Eve.lib.XHR, {	init : Ext.emptyFn		// A Simple ajax request	,request : function( config ){		Ext.Ajax.request( config );		}});Eve.lib.CRUDBridge = Ext.extend( Eve.lib.Bridge, {	id			: 0	,parentId 	: 0	,groupId  	: 0	,root	  	: 'personal'	,path	  	: '\\'		,confirmDelete : function(callee, type, object, itemType) {		// Verification of delete process		if (object.title === undefined)			object.title = '';		else			object.title = ['[', object.title, ']'].join('');		if (object.byPass) {			this.deleteRequest(callee, type, object, itemType);			return;		}				if (Eve.Preference.getBoolean('delPrompt' + itemType) == false ) {            	this.deleteRequest(callee, type, object, itemType);            	return;        }        		var msg = (object.title) ?			['Are you sure you want to delete ', itemType, ' ', object.title, ' ?'].join('') :			'Are you sure you want to delete this item?';		Ext.Msg.confirm('Delete Confirmation', msg,			function(btn) {				if (btn == 'yes') {					this.deleteRequest(callee, type, object, itemType);				}		}, this);	}	,deleteRequest 	: Ext.emptyFn	,renameRequest 	: Ext.emptyFn	,updateRequest 	: Ext.emptyFn	,moveRequest	: Ext.emptyFn		,execute : function( callee, type, object )	{		var object	= object || {};		var section = object.section || '';				// Handle requests based on the type of the request		switch(type) {			case (section + '_delete_folder_dlg'):				this.confirmDelete(callee, type, object, 'folder');				break;							case (section + '_delete_item_dlg'):				this.confirmDelete(callee, type, object, 'item');				break;			case (section + '_update_folder'):				this.updateRequest(callee, type, object, 'folder');				break;			case (section + '_update_item'):				this.updateRequest(callee, type, object, 'item');				break;						case (section + '_move_folder'):				this.moveRequest(callee, type, object, object.itemType);				break;						case (section + '_print_folder'):				this.printFolder(callee, type, object);				break;						case (section + '_get_config'):				this.getDesktopConfRequest(callee, type);				break;						case ('desktop_get_portlet_content'):				this.getPortletContent(callee, type, object);				break;						// For Calendar Color Chooser			case (section + '_change_color'):				this.updateColor(callee, type, object);				break;							// For Delete Calendar Meeting Attendees			case ('calendar-meeting_attendee_delete'):			    this.deleteCalendarMeeting(callee, type, object);			    break;						// For Delete Calendar Meeting Attendees			case ('calendar_set_filter_list'):			    this.calendarModifyFilter(callee, type, object);			    break;			// For Contacts' Moving items to Categories			case ('contact_move_item'):				this.moveContactRequest(callee, type, object);				break;						// For Contacts' Categories			case (section + '_get_categories'):				this.getCategories(callee, type, object);				break;						// For Contacts' Icon Layout (Popout)			case ('note_load_icon_popup'):			case ('contact_load_icon_popup'):				this.loadPopout(callee, type, object);				break;						// For Contacts' Icon Filter			case (section + '_modify_filter'):				this.contactModifyFilter(callee, type, object);				break;			case (section + '_delete_all_items'):				this.deleteAllContacts(callee, type, object);				break;			// For Documents' Download File			case ('document_download_file'):				this.downloadRequest(callee, type, object);				break;						// For Documents' Toggle Lock			case (section + '_toggle_lock'):				this.toggleLockRequest(callee, type, object);				break;						// For Documents' Toggle Versioning			case (section + '_toggle_versioning'):				this.toggleVersioningRequest(callee, type, object);				break;						// For Documents' Revert			case (section + '_item_revert'):			    this.revertRequest(callee, type, object);			    break;			    			// For Documents' Toggle Subscription			case (section + '_toggle_subscription'):				this.toggleSubscriptionRequest(callee, type, object);				break;			//For Documents' Purge			case (section + '_purge'):				this.confirmPurge(callee, type, object);			    break;			case (section + '_purge_all'):			    this.confirmPurgeAll(callee, type, object);			    break;			    			case (section + '_restore'):				this.recycleRequest(callee, type, object);			    break;			// For Comments Dialogs.			case (section + '_edit_comment'):				this.editComment(callee, type, object);				break;						// For Comments Dialogs.			case ('taskfolder_delete_comment'):				object.section = 'task';			case (section + '_delete_comment'):				this.deleteComment(callee, type, object);				break;						// For Interlinking Dialogs.			case ("interlink_reload_combo"):				this.ilReloadCombo(callee, type, object);				break;						// For Interlinking Dialogs.			case ("interlink_delete"):				this.ilDelete(callee, type, object);				break;						// For Interlinking Dialogs.			case ("interlink_search"):				this.ilSearch(callee, type, object);				break;						// For Interlinking (In purpose of update other grids for any changes)			case ("interlink_update_section"):				this.ilGetItems(callee, type, object);				break;						case ("task_get_summary"):				/* Majid: Wait : next lines was commented */				Eve.mask.show();				this.getTaskProjectSummary(callee, type, object); 				break;							// For import export wizard				case("get_import_mapping"):				this.getMapGrid(callee, type, object);				break;						case("complete_map_import"):				this.submitImp(callee, type, object);				break;			// For Filter Dialog			case(section + "_filter_info"):			    this.getFilterInfo(callee, type, object);			    break;			    			// For Attachment			case ("document_get_files"):			    this.getList(callee, type, object);			    break;			    			case ("forum_get_grid"):			    this.getGridRequest(callee, type, object);			    break;			case ("forum_get_msg_topics"):			    this.getMessages(callee, type, object);			    break;			case ("forum_notify_category"):				this.toggleNotifyCategory(callee, type, object);				break;			    			//For popOut			case ("popout_reminder_request"):			    this.reminderPopoutRequest(callee, type, object);			    break;			    			case ("popout_invitation_request"):			    this.invitaionPopoutRequest(callee, type, object);			    break;			    			case ("popout_meeting_request"):			    this.meetingPopoutRequest(callee, type, object);			    break;			    			//For Mail			case("task_assign_request"):			    this.assignedTaskRequest(callee, type, object);			    break;			//Grid Updater			case("update_grid"):			    this.updateGridRequest(callee, type, object);			    break;			//Desktop setting			case("modify_desktop_setting"):				this.modifyDesktop(callee, type, object )				break;			    			}	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Header.js *//*--------------------------------------------------*/// JavaScript Document// A simple bridge for a simple header...Eve.lib.HeaderBridge = Ext.extend( Eve.lib.Bridge, {	init : function(obj) {		this.view = obj.view;		this.view.init();				this.superbridge = obj.brdg;	}		,execute : function(callee, type, object) {		switch(type) {			case (this.section + '_set_active_node'):								var node = object.header;								if (node) {					var f = (object.header.folder === undefined) ? null : (": " + object.header.folder);					this.view.get().setFolder(f || '');										if (object.info.folderId != "0") {						this.view.get().setGroup("");					}					else {						var g = ": " + object.header.group;						this.view.get().setGroup(g || '');					}				}				break;					case (this.section + '_update_folder')	:				this.view.get().setFolder( ": " + object.params.title);				break;						case (this.section + '_header_update'):				this.view.get().setFilter(object.breadCrumb);				break;			}	}		,setSection : function(section) {		this.view.get().section = section;		this.section = section.toLowerCase().substr(0, section.length-1);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/PagingToolbar.js *//*--------------------------------------------------*/// Written by KhashayarEve.PagingToolbar = Ext.override(Ext.PagingToolbar, {    doLoad: function(start) {	//@@Benchmark	//console.log("@@Benchmark -- Time(J1): ",(new Date()).getRTime() % 100000);        var o = {}, pn = this.paramNames;        o[pn.start] = start;        o[pn.limit] = Eve.Preference.getInteger("itemsPerPage");                // If extra params needed, it'll read them from Store.params        o = Ext.applyIf(o, this.store.params);        o.forcePaging = true;        if(this.fireEvent('beforechange', this, o) !== false){                  this.store.load({params:o});        }	//@@Benchmark	//console.log("@@Benchmark -- Time(J2): ",(new Date()).getRTime() % 100000);    }});// Written by OmidExt.PagingToolbar.prototype.initComponent = function(){	this.pageSize = Eve.Preference.getInteger( 'itemsperpage' );	    this.addEvents('change', 'beforechange');    Ext.PagingToolbar.superclass.initComponent.call(this);    this.cursor = 0;    this.bind(this.store);};/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/StatusBar.js *//*--------------------------------------------------*/Eve.widgets.StatusBarBridge = Ext.extend( Eve.lib.Bridge, {	callee			: {}	,failedForms	: []	,meetingTxt 	: 'No Meeting'	,reminderTxt 	: 'No Reminder'	,invitTxt 		: 'No Invitation'	,init : function( obj ) {		this.view		 = obj.view;		this.superbridge = obj.superbridge;		this.clock = new Ext.Toolbar.TextItem('');		this.date  = new Ext.Toolbar.TextItem('');		this.feedbackTpl = new Ext.XTemplate(				'<div class="x-feedback-bubble" style="width:450px;">',					'<div class="x-feedback-bg" style="z-index:200">',					'<table width="100%" cellpadding="0" cellspacing="0">',					 '<tr>',						'<td class="x-feedback-left "></td>',						'<td class="x-feedback-middle2 "></td>',						'<td class=" x-feedback-middle"></td>',						'<td class="x-feedback-right"></td>',					 '</tr>',					'</table>',					'</div>',					'<div class="x-feedback-content">',						'<div class="mbubble-mm"></div>',					'</div>',				'</div>'		);		this.el = this.feedbackTpl.append( document.body, {}, true );		this.el.setDisplayed( false );		this.feedbackForm = {			border		: false			,bodyBorder	: false			,shim		: false			,id			: 'frm_user_feedback'			,shadow		: false			,cls		: 'mfeedback-panel'			,labelWidth	: 61			,width		: 350			,title		: 'Report a Bug'			,tools		: [{				id			: 'close'				,handler	: function() {					this.el.setDisplayed( false );					Ext.getCmp('feedback_comment').reset();					Ext.getCmp('feedback_user_mail').setValue(Eve.Preference.get('emailAddress'));				}				,scope: this			}]			,toolTemplate: new Ext.Template('<div class="x-tool x-tool-{id}" style=";height:12px;border:0px solid gray;">&#160;</div>')			,items: [{			layout:'form'			,border: false			,items: [{			 layout: 'form'			,labelPad	: -50			,border: false						,style: 'margin-top:10px;'			,items:[{			xtype	: 'textarea'			,width	: 375			,height	:58        	,labelSeparator : ''			,hideLabel: true			,anchor		: '100%'			,allowBlank: false			,id			: 'feedback_comment'			},{			xtype		: 'textfield'			,fieldLabel	: 'Email'			,labelStyle : 'width: 40px'			,labelSeparator : ''			,id			: 'feedback_user_mail'			,value		: Eve.Preference.get('emailAddress')			,width		: 326			,anchor		: '100%'			,allowBlank: false		}]		}]			}]			,buttons	: [{				text		: 'Submit'				,handler	: function() {						var mail = Ext.getCmp('feedback_user_mail');					if(mail.getValue().trim() ==""){						this.feedbackForm.getForm().markInvalid();						return;					}					var comment = Ext.getCmp('feedback_comment');					if(comment.getValue().trim() == "" ){						this.feedbackForm.getForm().markInvalid();						return;					}					var browserType;					if(Ext.isIE){						if(Ext.isIE7)							browserType = 'IE7' ;						else if(Ext.isIE6)							browserType = 'IE6';						else if (/msie 8/.test(navigator.userAgent))							browserType = 'IE8';					}					else if(Ext.isGecko){						browserType = 'firefox'					}					else if(Ext.isChrome){						browserType = 'chrome';					}					var params = {						event		: 'submit'						,formId		: 713						,Iam		: 'Customer'						,browserType: browserType						,email0		: mail.getValue()						,Comment	: comment.getValue()						,Name		:Eve.Preference.get('firstName') + ' ' + Eve.Preference.get('lastName')						,Customer	:Eve.Preference.get('organization')						,ProductType : 'Ajax'						,Iam : ( Eve.Preference.getBoolean('accounttrial') == false ) ? "Customer" : "Trial"					};					var lookUp = {						'calendar'	: '1'						,'contact'	: '2'						,'document'	: '3'						,'mail'		: '4'						,'forum'	: '5'						,'note'		: '6'						,'task'		: '7'						,'voting'	: '8'						,'publisher': '14'						,'wiki'		: '22'											};					/*if(Ext.getCmp('feedback_bug').pressed)						params.PTID = 5					else if(Ext.getCmp('feedback_feature').pressed)						params.PTID = 4					else if(Ext.getCmp('feedback_other').pressed)						params.PTID = 3;					else {						Ext.tools.msg('Fill the required field.', '');						return;					}*/					params.PTID = 5					params.PPID = lookUp[Eve.activeSec] || 20;					if(!this.et){						this.et =document.createElement('div');						document.body.appendChild(this.et);					}					var prop = {id:'__ho__iframe__feedback__', style:'width:0px;height:0px;border:0px solid;'};					this.et.innerHTML = '<iframe src="'+ Ext.SSL_SECURE_URL +'" name="' + prop.id + '" id="' + prop.id + '" style="' + prop.style + '" />';					this._ifr = document.getElementById(prop.id);					var that = this;					setTimeout( function(){								var frm		= document.createElement('form');								frm.setAttribute('action', 'http://portal.hyperoffice.com:8080/hyperbase/hbForm.jsp?' + Ext.urlEncode(params));								frm.setAttribute('method', 'POST');								try{									that._ifr.contentDocument.body.appendChild(frm);								}catch(e){									that._ifr.contentWindow.document.body.appendChild(frm);								}								frm.submit();					},500);					this.el.setDisplayed( false );					comment.reset();					mail.setValue(Eve.Preference.get('emailAddress'));				}				,scope: this			}]			,buttonAlign: 'right'		};		var mainFeedbackForm = {				layout: 'form'				,border		: false				,title		: 'Feedback'				,tools		: [{					id			: 'close'					,handler	: function() {						this.el.setDisplayed( false );						Ext.getCmp('feedback_comment').reset();						Ext.getCmp('feedback_user_mail').setValue(Eve.Preference.get('emailAddress'));					}					,scope: this				}]				,items:[{					layout  	: 'column'					,border		: false					,style		: 'margin: 10px 4px 5px 1px;'					,items		: [{						columnWidth : .1						,width		:110						,border		: false						,style		:'margin-right:3px;'						,items		: [{							xtype	: 'button'							,text	: '&nbsp;&nbsp;&nbsp;&nbsp;Report a Bug&nbsp;&nbsp;&nbsp;&nbsp;'							,ctCls	: 'feedback'							,handler: function(){								this.feedbackPanel.layout.setActiveItem(1);							}							,scope: this						}]					}, {						columnWidth : .9						,border		: false						,style		:'margin-left:5px;'						,items      : [{								width:270								,border: false								,html: 'Report non-urgent errors and odd behaviors to be submitted to our development team.'						}]					}]},{					layout  	: 'column'					,border		: false					,style		: 'margin: 15px 4px 5px 1px;'					,items		: [{						columnWidth : .1						,border		: false						,width		:110						,style		:'margin-right:3px;'						,items		: [{							xtype	: 'button'							,text	: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get Support&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'							,ctCls	: 'feedback'							,handler: function(){								window.open('http://collaborationsoftware.hyperoffice.com/index.php?LOGINURL='+Eve.loginUrl+'&isssl='+Eve.isSSL+'&CFID='+Eve.CFId+'&CFTOKEN='+Eve.CFToken,'helpengine','width=1000, height=680, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');							}						}]					}, {						columnWidth : .9						,border		: false						,style		:'margin-left:5px;'						,items      : [{								width:270								,border: false								,html: 'Contact our support team for urgent issues and immediate problems.'						}]					}]},{					layout  	: 'column'					,border		: false					,style		: 'margin: 15px 4px 5px 1px'					,items		: [{						columnWidth : .1						,border		: false						,style		:'margin-right:3px;'						,width		:110						,items		: [{							xtype	: 'button'							,text	: 'Product Feedback'							,ctCls	: 'feedback'							,handler: function(){								var action = {													CFID	: Eve.CFId													,CFTOKEN: Eve.CFToken													,event	: 'modern.preferences.user.feedback'												}								window.open([Eve.url ,"?", Ext.urlEncode(action)].join('')	, "Feedback", 'width=1000, height=680, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');							}						}]					}, {						columnWidth : .9						,border		: false						,style		:'margin-left:5px;'						,items      : [{								width:270								,border: false								,html: 'Want to see something new? Request improvements and enhancements using our feedback system.'						}]					}]}]			};		this.feedbackPanel = new Ext.Panel({			border		: false			,layout		: 'card'			,bodyBorder	: false			,shim		: false			,shadow		: false			,cls		: 'mfeedback-panel'			,labelWidth	: 61			,width		: 400			,items: [mainFeedbackForm, this.feedbackForm]		});		this.feedbackPanel.render( Ext.DomQuery.selectNode( ".mbubble-mm", this.el.dom ) );		var that = this;		this.view.init({        id		: 'win-statusbar',        items	: [{				xtype	: 'button'				,id		: 'user_feedback'				,text	: 'Feedback'				,style	: 'margin-right:150px; background:url(' + Eve.imagePath + 'calendar/monthly-title-background-selected.png); border: 1px solid black;'				,handler: function(btn, e){					var pos = e.getXY();					this.el.setDisplayed( 'block' );					this.el.setXY( [pos[0]-430 , pos[1]-240]);					this.feedbackPanel.layout.setActiveItem(0);				}				,scope:this			},{				text 		: 'Compose'				,cls 		: 'x-btn-text-icon'				,style		: 'margin-right:50px'				,hidden		: true				,icon		: Eve.Resource.getIcon('compose', 'mail')			},{				xtype	: 'button'				,id		: 'status_reminder'				,text	: Eve.widgets.StatusBarBridge.prototype.reminderTxt				,hidden : true				,handler: function(btn) {					if (btn.getText().split(' ')[0] != "No" )						that.fire('show_popout_reminder');				}			}, {				xtype	: 'button'				,id 	: 'status_invit'				,hidden : true				,text	: Eve.widgets.StatusBarBridge.prototype.invitTxt				,handler: function(btn){					if (btn.getText().split(' ')[0] != "No" )						that.fire('show_popout_invitation');				}			}, {				xtype	: 'button'				,id		: 'status_meeting'				,hidden : true				,text	: Eve.widgets.StatusBarBridge.prototype.meetingTxt				,handler: function(btn){					if (btn.getText().split(' ')[0] != "No" )						that.fire('show_popout_meeting');				}			}, {				xtype	: 'button'				,id		: 'status_form'				,hidden : true				,text	: '<span style="color:blue">Forms</span>'				,handler: function() {					var data = this.failedForms.pop();					this.fire(data.msg, data);					if (this.failedForms.length < 1) {						Ext.getCmp('status_form').hide();					}				}				,scope	: this			}, '-'				, this.clock				, ' '				, '-'				, new Date().format(Eve.Preference.get('dateFormat')/*'n/d/Y'*/)			]        });				this.initStatusBar();	}		,initStatusBar : function()	{		var max 		= 0;		var current 	= 0;		var task = {			run : function(){				if ( Eve.CommandManager.isRunning ){					max		= (max > Eve.CommandManager.priority.length+1)?max:Eve.CommandManager.priority.length+1;					current = Eve.CommandManager.priority.length;					this.view.get().showBusy({						text : ['<span class="ev-red">Loading... ( ',								Math.floor(((max-current)*100-1)/max), '% Completed )</span>'								].join('')					});								}else{					max = 0;					this.view.get().setStatus({text: 'Done', iconCls: 'x-status-custom', clear:true});									}								Ext.fly(this.clock.getEl()).update(new Date().format(Eve.Preference.get('timeFormat')/*'g:i:s A'*/));				Ext.fly(this.date .getEl()).update(new Date().format(Eve.Preference.get('dateFormat')/*'n/d/Y'*/));			}			,scope: this			,interval : 500		};				Ext.TaskMgr.start(task);	}	,setRemindersCount : function(data)	{			var count = data.reminderCount;		var remindersBtn = Ext.getCmp('status_reminder');		var text = Eve.widgets.StatusBarBridge.prototype.reminderTxt = (count == "0" || count === undefined) ?					 'No Reminder' : count + " Reminders";					 		if (typeof remindersBtn !== 'undefined') {			remindersBtn.setText(text);		}				if (count > 0 ) {			remindersBtn.show();			//if(!Eve.widgets.PopOut.dismissAllReminder)			//	this.fire('show_popout_reminder');			if( data.reminderXML ){				this.fire('show_popout_new_reminders', {xml : data.reminderXML})			}		}		else{            remindersBtn.hide();		}	}		,setInvitCount : function(count)	{		var invitBtn = Ext.getCmp('status_invit');		var text = Eve.widgets.StatusBarBridge.prototype.invitTxt = (count == "0" || count === undefined) ?				 'No Invitation' : count + " Invitations";				 		if (typeof invitBtn !== 'undefined') {			invitBtn.setText(text);		}		if (count > 0 ) {			invitBtn.show();			if(!Eve.widgets.PopOut.dismissAllInvitation)				this.fire('show_popout_invitation');					}		else{            invitBtn.hide();		}	}	,setMeetingCount : function(data)	{		var count = data.meetingCount;		var meetingBtn = Ext.getCmp('status_meeting');		var text = Eve.widgets.StatusBarBridge.prototype.meetingTxt = Eve.meetingTxt = (count == "0" || count === undefined)?					'No Meeting' : count + " Meetings";				if (typeof meetingBtn !== 'undefined') {			meetingBtn.setText(text);		}		if (parseInt(count) > 0) {			meetingBtn.show();			//if(!Eve.widgets.PopOut.dismissAllMeeting)			//	this.fire('show_popout_meeting');			if( data.meetingXML ){				this.fire('show_popout_new_meetings', {xml : data.meetingXML})			}					}		else {            meetingBtn.hide();		}	}	,setFormText : function(data)	{		var btnForm = Ext.getCmp('status_form');		this.failedForms.push(data);		btnForm.show();	}		,execute : function(callee, type, data)	{		this.callee = callee;				switch (type) {			case 'set_reminders_count':			    this.setRemindersCount( data );			    break;			    			case 'set_invitations_count':				this.setInvitCount( data.count );			    break;			    			case 'set_meetings_count':			    this.setMeetingCount( data.count );			    break;			    			case 'set_popOut_counts':				this.setRemindersCount( data );				this.setInvitCount( data.invitCount );    			this.setMeetingCount( data );			    break;			case 'form_submission_failure':				this.setFormText(data);			    break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Selector.js *//*--------------------------------------------------*//* * HyperOffice library based on Ext Js 2.2 * December 2008 *  * khashayar@hyperoffice.com * * http://hyperoffice.com */Eve.widgets.SelectorBridge = Ext.extend( Eve.lib.Bridge, {	init : function(obj)	{		Eve.widgets.SelectorBridge.superclass.init.call(this, obj);		// Export Dialog also use this store		Eve.Contact.dsCategories = new Ext.data.Store({			mode	: 'local'			,reader	: new Ext.data.XmlReader({				record	: 'row'				,id		: 'id'			}, ['id', 'title', 'system'])		})				// Initilize the view		this.view.init({			id				: 'contactCatSelector'			,width			: 195			,height			: 'auto'			//,autoHeight		: true			// Commented By Khashayar			//,hideBodyScroll	: obj.hideBodyScroll   			,valueField		: 'id'   	   		,displayField	: 'title'			//,layout			: 'fit'			,keyMapField	: 'title'			,dropGroup		: Eve.Resource.getGridGroup()			,noBorder		: true   			,store			: Eve.Contact.dsCategories		})		this.view.get().on('click', function(el, e) {			this.onClick(el, e);		}, this);				this.view.get().on('contextmenu', function(ds, index, node, e) {			this.onCtxMenu(ds, index, node, e);		}, this);				this.view.get().on('drop', function(ddView, n, dd, e, data) {			console.log(arguments)		}, this);	}		,forceLoad: function(data)	{		this.loadForce = true;				var info = {			groupId		: data.info.groupId			,root		: (!data.info.groupId || data.info.groupId == '0') ? 'personal' : 'group'			,path		: data.info.groupPath		}		this.fire(this.section + '_set_active_node', {info: info}, true );	}	,setSharedSection : function(data)	{		this.sharedSection = data.sharedSection;	}		// Handle clicks on each item.	,onClick : function(el, e)	{		var id = el.getValue().split('_')[1];		var info = {			id			: id			,groupId	: this.groupId			,root		: this.root			,path		: this.path			,parentId	: this.parentId		}				this.fire(this.section + '_set_active_node', {info: info, catchIt: true} );				// Disabled Modify Columns on 'All Category' or 'Uncategorized'.		var index = el.store.indexOfId(el.getValue());				/*if (index == 0 || index == 1) {			Ext.getCmp('contactModifyColumns1').disable();			Ext.getCmp('contactModifyColumns2').disable();		} else {			Ext.getCmp('contactModifyColumns1').enable();			Ext.getCmp('contactModifyColumns2').enable();		}*/	}		,onCtxMenu : function(store, index, node, e)	{		e.stopEvent();				// Prevent to Edit or Delete 'All Category' or 'Uncategorized'.		if (index == 0 || index == 1)			return;				this.showMenu(e, index);	}		// Reload the store	,loadStore : function(xml)	{		var store	= this.view.get().store;		var result	= store.reader.read({responseXML: xml});		store.loadRecords(result, {add: false}, true);				// Update the grid.id		var id		= Ext.DomQuery.selectValue('selected', xml);		this.view.get().setValue(id);				var info	= {			id			: id.split('_')[1]			,parentId	: this.parentId			,groupId	: this.groupId			,root		: this.root			,path		: this.path		}				/*Ext.getCmp('contactModifyColumns1').disable();		Ext.getCmp('contactModifyColumns2').disable();*/		if (this.loadForce) {			this.loadForce = false;			return;		}				this.fire(this.section + '_set_active_node', {info: info, catchIt: true});	}		// Add new category	,addItem : function(data)	{		var store 	= this.view.get().store;		var id		= data.info.rawId;		var title	= data.params.title;				var rec 	= Ext.data.Record.create(['id', 'title']);		var record	= new rec({			id		: id			,title	: title		});		record.id = id;		store.add(record);	}		,editItem : function(idx)	{		var store	= this.view.get().store;		var rec		= store.getAt(idx);		var id		= rec.id.split('_')[1]		var info	= {			id			: id			,root		: this.root			,parentId	: this.parentId			,path		: this.path			,groupId    : this.groupId		}				this.fire(this.section + '_edit_folder_dlg', {info: info});	}	,exportItem : function(idx)	{		var store	= this.view.get().store;		var rec		= store.getAt(idx);		var id		= rec.id.split('_')[1]		var data	= {			id			: 0			,folderId	: id			,root		: this.root			,parentId	: this.parentId			,path		: this.path			,groupId    : this.groupId			,contextMenu: true		}		this.fire(this.section + '_do_export', data);	}		,successEdit : function(data)	{		var store	= this.view.get().store;		var id		= data.info.rawId;		var rec		= store.getById(id);				rec.set('title', data.params.title);	}		,deleteItem : function(idx)	{		var store	= this.view.get().store;		var rec		= store.getAt(idx);		var id		= rec.id.split('_')[1]		var info	= {			id			: id			,root		: this.root			,parentId	: this.parentId			,path		: this.path			,groupId    : this.groupId		}				this.fire(this.section + '_delete_folder_dlg', {info: info, title: rec.get('title')});	}		,successDelete : function(data)	{		var store	= this.view.get().store;		var rec		= store.getById(data.info.id);		store.remove(rec);	}		,showMenu : function(e, index)	{		var menu = new Ext.menu.Menu({			items	: [{				text	: 'Edit'				,id		: 'edit'				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: 'Delete'				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}			, {				text	: 'Export'				,id		: 'export'				,icon	: Eve.Resource.getIcon('export','contact')			}]		})				menu.on('itemclick', function(bi) {			this[bi.id + 'Item'](index);		}, this);				menu.showAt(e.getXY());	}		,execute : function(callee, type, data)	{		switch(type)		{			case (this.section + '_set_active_node'):				Ext.apply(this, data.info);				this.fire(this.section + '_get_categories', data);				break;							case ('success_get_categories'):				this.loadStore(data.responseXML);				this.manager.loadFinished(this);				break;							case (this.section + '_success_create_folder'):				this.addItem(data);				break;							case (this.section + '_success_modify_folder'):				this.successEdit(data);				break;							case (this.section + '_success_delete_folder'):				this.successDelete(data);				break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/PopOut.js *//*--------------------------------------------------*/Eve.widgets.PopOut = Ext.extend( Eve.lib.Bridge, {	init : function(brdg)	{		// TODO:	}		,create : function()	{		Ext.Msg.alert('Popout Parent Class', 'The create Method should be overriden by subcalsses!');	}		,show : function(type)	{		if (! Eve.widgets.PopOut[type]) {			Eve.widgets.PopOut[type] = this.create();			Eve.widgets.PopOut[type].on('hide', function() {				var pt = 'dismissAll' + type;				Eve.widgets.PopOut[pt] = true;			})		}		Eve.widgets.PopOut[type].show();		this.loadPopOut();	}		,loadPopOut : Ext.emptyFn});Eve.widgets.ReminderPopOut = Ext.extend( Eve.widgets.PopOut, {	create : function()	{	// Snooz Combo Store		var timeSt = new Ext.data.SimpleStore({		fields : ['value', 'text'],		data : [			['1'		,'5  Minutes']			,['2'		,'10  Minutes ']			,['3'		,'15  Minutes ']			,['4'		,'20  Minutes ']			,['5'		,'30  Minutes ']			,['6' 		,'1  Hour ']			,['7' 		,'2  Hours ']			,['8' 		,'3  Hours ']			,['9' 		,'1  Day']			,['10' 		,'2  Days ']			,['11' 		,'3  Days ']			,['12' 		,'1  Week ']			,['13' 		,'2  Weeks ']			,['14' 		,'3  Weeks ']			,['15' 		,'1  Month ']			,['16' 		,'2  Months ']		]	});		this.win = new Ext.Window({			title		: 'Reminders'			,resizable	: false			,width      : 510			,height     : 270			,closeAction: 'hide'			,items	: [new Eve.FormPanel({				layout	: 'form'				,id		: 'popout-reminder'				,width	: 500				,height	: 250				,frame	: true				,border	: false				,items	: [{ 					xtype	: 'panel'					,height			: 150					,border			: true					,autoScroll		: true					,style			: 'background-color:#FFF; border: 1px solid;'					,items			: [new Ext.ux.xDataView ({						xtype			: 'xdataview'						,id				: 'popout_reminder_dv'						,name			: 'reminders'						,hideLabel		: true						,itemSelector	: 'div.x-doc-select'						,overClass		: 'x-doc-over'						,multiSelect	: true						,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No items.</i></div>'						,selectedClass     : 'x-doc-selected'						,store			: new Ext.data.Store({							reader	: new Ext.data.XmlReader({							record	: 'reminder'							,id		: 'id'							}, ['id', 'reminder_message', 'reminder_date', 'reminder_time', 'reminderAssociatedText', 'reminder_textdate'])						})						,tpl			: new Ext.XTemplate(							'<div class="x-form-item">',								'<tpl for=".">',								'<div style="margin:0px;padding:3px 4px; width: 98%;font-size:8pt" class="x-doc-select">',									'<table width="100%">',									 '<tr>',										'<td width="50px"><img src="' + Eve.Resource.getIcon('reminder-pop-item', 'reminder') + '" /></td>',										'<td>',											'<div><b style="font-size:130%">{reminder_message}</b></div>',											'<div>{reminder_textdate} at {reminder_time}</div>',											'<div>{[this.getReminderAssociatedText(values)]} {reminder_message}</div>',										'</td>',									 '</tr>',									'</table>',								'</div>',								'</tpl>',							'</div>', {								formatDate : function(date) {									var dt = new Date(date);									return dt.format("l, F j, y");								}								,getReminderAssociatedText : function(values){									if(values.reminderAssociatedText != ""){										return [values.reminderAssociatedText , ' - '].join('');									}									else										return '';								}							})//							,listeners		: {//								render      : function(cmp) {//									cmp.view.on('click',function(dv, index, node, e){//										e.stopEvent();//										var st      	= dv.store;//										if(dv.getSelectedRecords().length > 1)//											Ext.getCmp('btn_popout_open').disable();//										else//											Ext.getCmp('btn_popout_open').enable();//									});//								}//							}						})					]					},{ layout		: "column"					    ,style      : 'padding:5px 0px'						,items		: [{							columnWidth	: .7							,layout		: "form"							,anchor     : '100%'							,items		: [{								 xtype		: 'button'								,text       : 'Dismiss All'								,id         : 'btn_popout_dismissall'								,handler    : function(){									var dv = Ext.getCmp('popout_reminder_dv').view;									var ids = [];									Ext.Msg.confirm( 'Dismiss Confirmation','Are you sure you want to dismiss all these reminders? ',										function(btn) {											if (btn == 'yes') {												dv.store.each( function(rec){													ids.push(rec.get('id').split('_')[1]);												});												var params = {													ids : ids.join(',')													,event: 'modern.reminder.personal.dismissAll'												};												Eve.Resource.superbridge.broadcast(this,'popout_reminder_request', {params: params, 																																	isCountChange: true});											}									}, this);								}							}]						} ,{							columnWidth	: .15							,layout		: "form"							,items		: [{								 xtype		: 'button'								,text       : 'Open Item '								,id         : 'btn_popout_open'								//,disabled   : true								,handler    : function(){									var dv = Ext.getCmp('popout_reminder_dv').view;									//var selectedRec = dv.getSelectedRecords();									var selectedRec = (dv.store.getTotalCount() == 1)? dv.store.data.items :dv.getSelectedRecords();																		if( selectedRec.length == 0){										return;									}									else{											Eve.Resource.superbridge.broadcast(this, 'proxy_dialog', { type:'reminder', func:function(){												var info = {													id: selectedRec[0].get('id').split('_')[1]													,path: '\\'													,parentId: -1													,root   : 'personal'												};												Eve.Resource.superbridge.broadcast(this,'reminder_edit_item_dlg',{info: info});											}										});									}								}							}]						}, {							columnWidth	: .15							,layout		: "form"							,style      : 'padding-left:3px'							,items		: [{								 xtype		: 'button'								,text       : '&nbsp;&nbsp;Dismiss&nbsp;&nbsp; '								,id         : 'btn_popout_dismiss'								//,disabled   : true								,handler    : function(){									var dv = Ext.getCmp('popout_reminder_dv').view;									//var selectedRec = dv.getSelectedRecords();									var selectedRec = (dv.store.getTotalCount() == 1)? dv.store.data.items :dv.getSelectedRecords();																		if( selectedRec.length == 0){										return;									}									else{										var id = [];										for(var i=0; i<selectedRec.length; i++ ){											id.push(selectedRec[i].get('id').split('_')[1])										}										var params = {											id : id.join(',')											,event: 'modern.reminder.personal.dismiss'										};										Eve.Resource.superbridge.broadcast(this,'popout_reminder_request', {params: params, isCountChange:true});									}								}							}]						}]					},{							xtype			: 'label'							,style          : 'padding:5px; font-weight: 600'							,text			: 'Click Snooze to be reminded in'					}					,{ layout		: "column"						,style      : 'padding:5px'						,items		: [{							columnWidth	: .87							,layout		: "form"							,items		: [{								xtype           : 'combo'								,xxtype			: 'combo'								,hiddenName		: 'snooz'								//,disabled    	: true								,id             : 'popout_reminder_cmbsnooze'								,mode			: 'local'								,hideLabel      : true								,store          : timeSt								,lazyInit		: false								,valueField		: 'value'								,value          : 3								,displayField	: 'text'								,labelStyle 	: 'width: 70px'								,labelSeparator : ''								,typeAhead		: true								,editable		: false								,selectOnFocus 	: true								,triggerAction 	: 'all'								,anchor 		: '98%'							}]						} ,{							columnWidth	: .13							,layout		: "form"							,items		: [{								 xtype		: 'button'								,text       : 'Snooze'								//,disabled   : true								,id         : 'btn_popout_snooze'								,handler    : function(){									var dv = Ext.getCmp('popout_reminder_dv').view;									var selectedRec = (dv.store.getTotalCount() == 1)? dv.store.data.items :dv.getSelectedRecords();																		var id;									if( selectedRec.length == 0){										return;									}									else{										var id = [];										for(var i=0; i<selectedRec.length; i++ ){											id.push(selectedRec[i].get('id').split('_')[1])										}										var params = {											id 				: id.join(',')											,rescheduleon   : Ext.getCmp('popout_reminder_cmbsnooze').getValue()											,event          : 'modern.reminder.personal.snooze'										};																				Eve.Resource.superbridge.broadcast(this,'popout_reminder_request', {params: params,																											isCountChange: true});									}								}							}]						}]					}]			})],listeners: {				hide:function(){					Ext.getCmp('popout_reminder_cmbsnooze').setValue(3);				}			}		});				return this.win;	}		,loadPopOut: function(isCountChange)	{		var popOut	= Ext.getCmp('popout-reminder');		if (popOut !== undefined) {			var mask	= new Ext.LoadMask(popOut.el);		}				var options	= {			url		: Eve.url			,params	: {event :'modern.global.personal.popupReminders'}			,failure: function() { mask.hide(); }			,scope	: this			,success : function(r){				mask.hide();				var count = Ext.DomQuery.selectValue('total', r.responseXML);				if (count == "0")				    this.win.hide();				    				if (isCountChange)					Eve.Resource.superbridge.broadcast( this, 'set_reminders_count', {reminderCount : count});			}		};				if (popOut!== undefined) {			mask.show()			//Eve.mask.show(popOut.el);			popOut.getForm().load(options);		}	}	,execute : function(callee, type, data)	{		switch(type)		{			case "show_popout_reminder"://Fired by clicking on reminder button on statusBar				this.show('Reminder');				break;							case "load_popout_reminder"://Fired after dismiss and snooz			    this.loadPopOut(data.isCountChange);			    break;						case "reminder_success_delete_item":			case "reminder_success_modify_item":			case "reminder_success_update_item":				Eve.ReminderIds.remove( data.info.id );				if(this.win && this.win.isVisible())					this.loadPopOut(true);				else					Eve.TaskRunner.start('RefreshInterval');			    break;			case "show_popout_new_reminders":				if(!Eve.widgets.PopOut['Reminder']){					Eve.widgets.PopOut['Reminder'] = this.create();				}				this.win.show();				var st = Ext.getCmp('popout_reminder_dv').store;				st.loadData(data.xml);				break;			    					}	}});/*--------------------------------------------			Invitation PopOut----------------------------------------------*/Eve.widgets.InvitationPopOut = Ext.extend( Eve.widgets.PopOut, {	create : function()	{	//************************	//  Store Definition		this.st = new Ext.data.Store({			reader	: new Ext.data.XmlReader({				record	: 'row'				,id		: 'id'			}, ['id', 'groupTitle', 'senderUserName', 'sendDate', 'groupId', 'message'])			,url    : Eve.url		})		var that = this;		this.win = new Ext.Window({			title		: 'Group Invitations'			,width      :510			,height     :220			,closeAction: 'hide'			,resizable	: false			,items	: [new Eve.FormPanel({				layout	: 'form'				,id   : 'popout-invitations'				,width	: 500				,height	: 200				,frame	: true				,border	: false				,items	: [{ xtype	: 'panel'							,height			: 150							,border			: true							,autoScroll		: true							,style			: 'margin-top:1px; background-color:#FFF; border: 1px solid;'							,items			: [ new Ext.DataView({									 id					: 'popout_invit_dv'									,name				: 'invitations'									,singleSelect       : true									,hideLabel			: true									,itemSelector		: 'div.x-doc-select'									,overClass          : 'x-doc-over'									,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Invitations.</i></div>'									,selectedClass      : 'x-doc-selected'									,store				: that.st									,tpl	: new Ext.XTemplate(										'<div class="x-form-item">',					 					'<tpl for=".">',									 	'<div style="margin:0px;padding:3px 4px; width: 98%;font-size:8pt" class="x-doc-select">',									 	    '<table style="font-size:8pt" width=100%>',									 	    '<tr>',												'<td width=85%><b> Invitaions to group ( {groupTitle} )</b></td>',											 	'<td rowspan=2>',													'<span class="btn-join">Join</span>',													'<span class="btn-decline">Decline</span>',													//'<img class="btn-join" src="'+Eve.Resource.getIcon("join","popout")+'" height="20" style="float:left;cursor:pointer;padding-right:20px;" title="join">',													//'<img class="btn-decline" src="'+Eve.Resource.getIcon("decline","popout")+'" height="20" style="float:left;cursor:pointer" title="decline">',												 '</td>',										 	'</tr>',									 	    '<tr><td>Sent by {senderUserName} on {sendDate}</td></tr>',									 	    '</table>',									 	    '{[this.getDescription(values)]}',									 	'</div>',									 	'</tpl>',									 	'</div>', {											getDescription: function(val) {												if(val.message == "")												   return '';												var str = '<div style="background-color:#E3FDBF;border: 1px solid #538A00;padding:1px; 5px ">'															+val.message+'</div>';												return str;											}										 })                                    	,listeners		:{											render      : function(cmp){												cmp.el.on('click', function(e, item){													try{														var rec = cmp.getRecord( Ext.get(item).up(cmp.itemSelector).dom );													}catch(e){console.log('Error! invitation pop up')}													if(rec === undefined)													    return;														switch(Ext.get(item).dom.className.split(' ')[0]){															case( 'btn-join' ) :																var params = {																	groupId 	: rec.get('groupId')																	,event      : 'modern.group.invitation.accept'																};																/* Majid: Wait : next lines was commented */																Eve.mask.show(Ext.getCmp('popout-invitations').el);																var data = {																	params: params																	,isCountChange: true																};																//dv.store.remove(rec);																Eve.Resource.superbridge.broadcast(this,'popout_invitation_request', data);																break;															case( 'btn-decline' ) :																Ext.Msg.confirm( 'Confirmation',																['Are you sure you want to decline "',rec.get('groupTitle'), '?'].join(''),																	function(btn)																	{																		if (btn == 'yes') {																			var params = {																				id 		: rec.get('id').split('_')[1]																				,event          : 'modern.group.invitation.decline'																			};																			/* Majid: Wait : next lines was commented */																			Eve.mask.show(Ext.getCmp('popout-invitations').el);																			var data = {																				params: params																				,isCountChange: true																			};																			Eve.Resource.superbridge.broadcast(this,'popout_invitation_request', data);																		}																	}, this );																break;														}												});											}									}							})]},{									 xtype		: 'button'									 ,style     : 'margin-top:4px'									,text       : 'Accept All Invitations'									,id         : 'btn_popout_acceptall'									,handler    : function(){										var dv = Ext.getCmp('popout_invit_dv');										var ids = [];										/*Ext.Msg.confirm( 'Dismiss Confirmation','Are you sure you want to dismiss all these reminders? ',											function(btn) {												if (btn == 'yes') {												}										}, this);*/										dv.store.each( function(rec){						    			ids.push(rec.get('groupId'));										});										var params = {											groupIds : ids.join(',')											,event: 'modern.group.invitation.acceptAll'										};										var data = {											params: params											,isCountChange: true										};										Eve.Resource.superbridge.broadcast(this,'popout_invitation_request', data);									}								}						]			})]		});		return this.win;	}	,loadPopOut: function( isCountChange )	{		var popOut	= Ext.getCmp('popout-invitations');		var mask	= new Ext.LoadMask(popOut.el);		var that = this;				if (popOut!== undefined) {			mask.show();			//loading  store			this.st.load({params: {event :'modern.global.personal.popupInvitations'}, callback: function(records, option, success){					mask.hide();					var count = Ext.DomQuery.selectValue('total', this.reader.xmlData);					if(isCountChange){						Eve.Resource.superbridge.broadcast( this, 'set_invitations_count', {count : count});					if(count == 0)     					that.win.hide();					}			}});		}	}	,execute : function(callee, type, data)	{		switch(type) {			case "show_popout_invitation":				this.show('Invitation');				break;			case "load_popout_invitaion":			    this.loadPopOut(data.isCountChange);			    break;		}	}});/*---------------------------------------------------					Meeting popOut-----------------------------------------------------*/Eve.widgets.MeetingPopOut = Ext.extend( Eve.widgets.PopOut, {	create : function()	{		this.store = new Ext.data.Store({			reader	: new Ext.data.XmlReader({				record	: 'row'				,id		: 'id'			}, ['id', 'groupTitle', 'subject', 'firstName', 'lastName', 'userName'				,'groupId', 'message', 'description', 'dateMeetingString','dateMeeting', 'timeMeeting'			])			,url    : Eve.url		});		this.store.on('load', function(st, records, opt){			Ext.getCmp('popout_meeting_dv').select(0)		},this);				this.win = new Ext.Window({			title		: 'Meeting Invitations'			,resizable	: false			,width      :510			,height     :350			,closeAction: 'hide'			,items	: [new Eve.FormPanel({				layout	: 'form'				,id   : 'popout-meetings'				,width	: 500				,height	: 340				,frame	: true				,border	: false				,items	: [{ xtype	: 'panel'							,height			: 150							,border			: true							,autoScroll		: true							,anchor             : '99%'							,style			: 'margin-top:1px;background-color:#FFF;border:1px solid;'							,items			: [									new Ext.DataView ({ 									id					: 'popout_meeting_dv'									,name				: 'meetings'									,hideLabel			: true									,itemSelector		: 'div.x-doc-select'									,overClass          : 'x-doc-over'									,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No items.</i></div>'									,selectedClass      : 'x-doc-selected'									,singleSelect       : true									,store				: this.store									,tpl	: new Ext.XTemplate(										'<div class="x-form-item" style="overflow:hidden;">',					 					'<tpl for=".">',									 	'<div style="margin:0px;padding:3px 4px; width: 98%;font-size:8pt" class="x-doc-select">',										 	'<div style=""> <b>Invitation to Meeting ( {subject} )</b></div>',											'<div id="meeting-reminder-{id}" style="float:right;"/>',											//'{[this.getReminderBtn(values)]}'src="'+Eve.Resource.getIcon("item-new","reminder")+'",											'<img class="meeting-reminder"  src="'+Eve.Resource.getIcon("add-reminder","popout")+'" ',											'height="27" style="float:left;cursor:pointer" title="add reminder">',											'</div>',										 	'<div style="padding-top:3px;font-size:8pt;">Invited By: {firstName} {lastName} ({userName})</div>',										 	'<div style="font-size:7pt;padding: 3px 0px"> for {groupTitle}</div>',										 	'{[this.getDescription(values.description)]}',										 	'{dateMeetingString}',											'<div style="clear:both;"></div>',									 	'</div>',									 	'</tpl>',									 	'</div>'										 ,{											getDescription: function(desc){												if(desc == "")												   return '';												var str = '<div style="margin-top:5px;margin-bottom:3px ">'															+desc+'</div>';												return str;											}											,getReminderBtn : function(values){																							}										 })                                    	,listeners		:{											render      : function(cmp){												cmp.el.on('click', function(e, item){													try{														var rec = cmp.getRecord( Ext.get(item).up(cmp.itemSelector).dom );													}catch(e){ console.log('Error! meeting pop up')}																										if(rec === undefined)													    return;														switch(Ext.get(item).dom.className.split(' ')[0]){															case( 'meeting-reminder' ) :																Eve.widgets.MeetingPopOut.dlg(Ext.get(item), rec);																// Set Title																Ext.getCmp('meetingreminderSubject').setValue(rec.data.subject);																break;														}												})											}											,scope: this									}							})]},{								xtype		: 'label'								,html		: '<div style="margin-top:20px"><b>Comment: </b></div>'								,anchor		: '100%'							},{								xtype		: 'textarea'								,style      : 'margin:2px auto;'								,name		: 'comment'								,id         : 'meeting_comment'								,hideLabel	: true								,anchor		: '-3'							},{								xtype           : 'checkbox'								,labelSeparator	: ''								,style          : 'padding-left:0px'								,id				: 'meeting_schedule'								,hideLabel      : true								,boxLabel 		: 'Schedule a Reminder'								,hidden         : true								,name 			: ''							},{ layout	: "column"							    ,style      : 'padding:5px 0px'								,items		: [{								columnWidth	: .2								,layout		: "form"								,items		: [{									 xtype		: 'button'									,text       : 'Accept Meeting'									,id         : 'btn_accept_meeting'									,handler    : function(){										var dv = Ext.getCmp('popout_meeting_dv');										var selectedRec = dv.getSelectedRecords();										if( selectedRec.length == 0){										    return;										}										else{											var params = {												meetingId 		: selectedRec[0].get('id').split('_')[1]												,event          : 'modern.group.meeting.accept'												,comments       : Ext.getCmp('meeting_comment').getValue()											};											/* Majid: Wait : next lines was commented */											Eve.mask.show(Ext.getCmp('popout-meetings').el);											var data = {												params: params												,isCountChange: true											};											Eve.Resource.superbridge.broadcast(this,'popout_meeting_request', data);											/*											if(selectedRec[0].get('hasReminder') == true){												var params = {};											}											*/										}									}								}]							} ,{								columnWidth	: .2								,layout		: "form"								,items		: [{									 xtype		: 'button'									,text       : 'Decline Meeting '									,id         : 'btn_decline_meeting'									,handler    : function()									{										var dv = Ext.getCmp('popout_meeting_dv');										var selectedRec = dv.getSelectedRecords();										var id;										if( selectedRec.length == 0){										    return;										}										else{											Ext.Msg.confirm( 'Confirmation',											['Are you sure you want to decline "',selectedRec[0].get('subject'), '?'].join(''),												function(btn)												{													if (btn == 'yes') {														var data =														{															params			:{meetingId 		: selectedRec[0].get('id').split('_')[1]															,event          : 'modern.group.meeting.decline'															,comments       : Ext.getCmp('meeting_comment').getValue()}															,isCountChange : true														};														/* Majid: Wait : next lines was commented */														Eve.mask.show(Ext.getCmp('popout-meetings').el);														Eve.Resource.superbridge.broadcast(this,'popout_meeting_request', data);													}												}, this );									}								}								}]							}, {								columnWidth	: .3								,layout		: "form"								,style      : 'padding-left:3px'								,items		: [{									 xtype		: 'button'									,text       : 'Request a Reschedule '									,id         : 'btn_reschedule'									,handler    : function(){										var dv = Ext.getCmp('popout_meeting_dv');										var selectedRec = dv.getSelectedRecords();										if( selectedRec.length == 0){										    return;										}										else{											var data = {												params : {													meetingId 		: selectedRec[0].get('id').split('_')[1]													,event          : 'modern.group.meeting.reschedule'													,comments       : Ext.getCmp('meeting_comment').getValue()												}												,isReschedule       : Ext.getCmp('meeting_schedule').getValue()												,isCountChange     : true											};											/* Majid: Wait : next lines was commented */											Eve.mask.show(Ext.getCmp('popout-meetings').el);											Eve.Resource.superbridge.broadcast(this,'popout_meeting_request', data );										}									}								}]							}]						}						]			})]		});		return this.win;	}	,loadPopOut: function( isCountChange)	{		var popOut	= Ext.getCmp('popout-meetings');		var mask	= new Ext.LoadMask(popOut.el);		var that = this;				if (popOut!== undefined) {			mask.show(popOut.el);				//loading  store				this.store.load({params: {event :'modern.global.personal.popupMeetings'}, callback: function(records, option, success){					mask.hide(popOut.el);										if(success){						Ext.getCmp('meeting_comment').setValue("");						Ext.getCmp('meeting_schedule').setValue(false);						Ext.getCmp('popout_meeting_dv').select(0);						var count = records.length;						if(isCountChange)							Eve.Resource.superbridge.broadcast( this, 'set_meetings_count', {count : count});						if(count == 0 || records.length == 0)							that.win.hide();					}				}				});			}	}	,execute : function(callee, type, data)	{		switch(type)		{			case "show_popout_meeting":				this.show('Meeting');				break;			/*case "load_popout_invitaion":			    this.loadPopOut(data.isCountChange);			    break;*/			    			case "load_popout_meeting":			    this.loadPopOut(data.isCountChange);			    break;							case "show_popout_new_meetings":				if(!Eve.widgets.PopOut['Meeting']){					Eve.widgets.PopOut['Meeting'] = this.create();				}				this.win.show();				var st = Ext.getCmp('popout_meeting_dv').store;				st.loadData(data.xml);				break;		}	}});Eve.widgets.MeetingPopOut.dlg = function(el, record){	var c ={section: 'meeting'}	var	reminderWindow = new Ext.Window({			modal			: true			,header			: false			,draggable		: false			,closable		: false			,resizable		: false			,shadow			: false			,border			: false			,closeAction	: 'close'			,width			: 300			,x				: el.getLeft()			,y				: el.getTop() + el.getHeight()			,items			: [new Eve.FormPanel({				layout			: 'form'				,border			: false				,id				: 'meeting_reminder_form'				,labelWidth		: 50				,bodyStyle		: 'padding: 5px'				,items			: [{					xtype			: 'combo'					,xxtype			: 'combo'					,id				: c.section + 'reminderWhen'					,name           : 'relativeMinutes'					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,hideLabel		: true					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '100%'					,store			: new Ext.data.SimpleStore({						fields	: ['text', 'value']						,data	: [							 ['None', '-1']							,['At Event Time', '0']							,['5 Minutes Before', '5']							,['15 Minutes Before', '15']							,['30 Minutes Before', '30']							,['1 Hour Before', '60']							,['2 Hour Before', '120']							,['3 Hour Before', '180']							,['4 Hour Before', '240']							,['5 Hour Before', '300']							,['6 Hour Before', '360']							,['7 Hour Before', '420']							,['8 Hour Before', '480']							,['9 Hour Before', '540']							,['10 Hour Before', '600']							,['11 Hour Before', '660']							,['12 Hour Before', '720']							,['1 Day Before', '1440']							,['2 Days Before', '2880']							,['1 Week Before', '10080']						]					})					,value			: '15'				}, {					xtype			: 'textfield'					,fieldLabel		: 'Subject'					,id				: c.section + 'reminderSubject'					,anchor 		: '100%'					,name           : 'reminder_message'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderPopup'					,hideLabel		: true					,boxLabel		: 'Popup'					,anchor			: '100%'					,name           : 'reminder_popup'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderShowOnDesktop'					,hideLabel		: true					,checked		: true					,boxLabel		: 'Show on Desktop'					,anchor			: '100%'					,name           : 'reminderShowOnDesktop'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderSMS'					,name           : 'reminder_sms'					,boxLabel		: 'Send Text'					,hideLabel		: true					,anchor			: '100%'					,listeners		: {						check		: function(box, checked) {							if (checked) {								var sms = Eve.Preference.get('sms');								if (!sms || sms.trim() == '') {									// Uncheck									this.setValue(false);									Ext.Msg.show({										title	: 'SMS'										,msg	: 'Please add your phone number under "Settings > General Preferences" before activating this feature.'										,buttons: Ext.Msg.OK										,icon	: Ext.MessageBox.INFO									})								}							}						}					}				}, {					layout			: 'column'					,border			: false					,defaults		: {						layout			: 'form'						,border			: false					}					,items			: [{						columnWidth		: .3						,items			: [{							xtype			: "checkbox"							,id				: c.section + 'UseEmail'							,hideLabel		: true							,boxLabel   	: 'Email'							,anchor			: '100%'							,name           : 'use_email'							,listeners		: {								check: function(t, checked) {									var cmp = Ext.getCmp(c.section + 'reminderSendTo');									if (checked) {										cmp.setValue( Eve.Preference.get('emailAddress') );										cmp.enable();									}									else {										cmp.setValue("");										cmp.disable();									}								}							}						}]					}, {						columnWidth		: .7						,border			: false						,items			: [{							 xtype			: 'combo'							,id				: c.section + 'reminderSendTo'							,mode			: 'local'							,valueField		: 'value'							,displayField	: 'value'							,record			: 'item'							,lazyInit		: false							,hideLabel		: true							,typeAhead		: true							,editable		: true							,selectOnFocus 	: true							,forceSelection : false							,validator		: Ext.form.VTypes.email							,triggerAction 	: 'all'							,anchor			: '100%'							,name           : 'reminder_sendTo'							,hiddenName     : 'reminder_sendTo'							,value			: Eve.Preference.get('emailAddress')							,store          : new Ext.data.SimpleStore({								 data	: [[Eve.Preference.get('emailAddress')]]								,fields	: [ 'value' ]							})						}]					}]				}]			})]			,buttons		: [{				text			: 'Done'				,handler		: function(){					var form = Ext.getCmp('meeting_reminder_form');					var params = form.getForm().getValues();					params.relativeMinutes = Ext.getCmp('meetingreminderWhen').getValue();					params.event = 'modern.reminder.personal.createModify';					params.reminder_notes = "";					params.reminder_date = record.get('dateMeeting') ;					params.reminder_time = record.get('timeMeeting');					Ext.Ajax.request({						url: Eve.url						,params: params						,success: function(){						}					})					reminderWindow.close();				}			},{				text			: 'Cancel'				,handler		: function(){reminderWindow.close();}			}]		})		reminderWindow.show();}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/CustomView.js *//*--------------------------------------------------*/Ext.ns( 'Eve', 'Eve.widgets' );//-------------------------------------// Default Custom View with a default Template// For handling Dataview Events, use 'onContent' function// 		e.g --> this.onContent( 'click', Ext.emptyFn );//-------------------------------------Eve.widgets.CustomView = function( config ){	// Default template if no template is provided	config.template = config.template || new Ext.XTemplate(		   '<div class="eve-container" style="height: 150px; float:left;">',				'<div class="x-panel" style="width: 300px; height: 100px; margin: 25px;">',				'<div class="x-panel-header x-unselectable">',					'<span class="x-panel-header-text">',						'{header}',					'</span>',				'</div>',				'<div class="x-panel-body">',					'<div class="" style="height: 74px; width: 100%; font:10pt tahoma; padding: 5px 3px 4px 5px;">',						'<p>{content}</p>',					'</div>',				'</div>',			'</div></div>')		// Apply the default values for dataview configuration	Ext.applyIf( config.dvConfig, {		itemSelector : 'div.x-panel'	} );		// We have a child template, and a store	this.childTemplate  = config.template.compile();	this.store 			= config.store;	// Function	var func = (function( values ){		return this.childTemplate.apply( values );	}).createDelegate( this );		// The default XTemplate used in layout	this.xtpl = new Ext.XTemplate(		'<tpl for=".">',//			'<div class="' + config.dvConfig.itemSelector + '">',				'{[ this.compileSubTemplate( values ) ]}',//			'</div>',		'</tpl>'				, {			compileSubTemplate : func		}	);		// Compile the XTemplate for better performance	this.xtpl.compile();		// Initialize the Dataview properties	var cfg = {		tpl 	: this.xtpl		,store	: this.store		,style  : 'overflow-y: auto;'	}		for ( var i in config.dvConfig ){		if ( i.toLowerCase() !== 'tpl' )			cfg[i] = config.dvConfig[i];	}		// Hold a reference to the data view Configuration	this.dvConfig 	= config.dvConfig;	// Create the new Dataview	this.dataview	= new Ext.DataView( cfg );		// Set the layout	this.layout		= 'fit'		// Add the dataview to the container	config.items 	= [ this.dataview ];		Eve.widgets.CustomView.superclass.constructor.apply( this, arguments );}// The custom view for the widgetsExt.extend( Eve.widgets.CustomView, Ext.Panel, {		 onContent : function( ev, func, scope ){		this.dataview.on( ev, func, scope );	}	,initEvents : function(){		Eve.widgets.CustomView.superclass.initEvents.apply( this, arguments );	}		,getRecordByIndex : function( index ){		return this.dataview.getRecord( this.getNode( index ) );	}		,getRecordByNode : function( node ){		return this.dataview.getRecord( node )	}} )//-------------------------------------// Specialized Custom View for handling Toggling// New Events Are ://	1. expandNode//  2. beforeExpandNode//	3. collapseNode//  4. beforeCollapseNode//-------------------------------------Eve.widgets.DefaultCustomView = Ext.extend( Eve.widgets.CustomView, {	 toggled : null	 	// toggle the node with the given index	,expandItemByIndex : function( card ){		if ( this.fireEvent( 'beforeExpandNode', this, card ) ){			if ( typeof card != 'number' ){				return false;			}					// Check if we have a ghost, if we do remove the ghost			if ( this.ghost )				this.ghost.dom.parentNode.removeChild( this.ghost.dom );					var node = this.dataview.getNode( card );			var n	 = Ext.get(node);					this.toggled = node;				// Create a ghost for the node and append it to the body			var gh = this.createGhost( n );			this.ownerCt.getEl().dom.appendChild( gh );					gh = Ext.get(gh);			this.ghost   = gh;					// handle Ghost dblclick			gh.on('dblclick', this.onGhostDblClick, this );					gh.shift( this.getGhostFx( function(){ this.fireEvent( 'expandNode', this, card ) }, this ) );		}	}		// create a ghost from el	,createGhost : function( el ){		var ghost = document.createElement( 'div' );		var size  = el.getSize();		var position = [ el.dom.offsetLeft, el.dom.offsetTop ]				// Set the ghost style		ghost.style.left 	= position[0] + 'px';		ghost.style.top 	= position[1] + 'px';		ghost.style.width   = size['width'] + 'px';		ghost.style.height  = size['height'] + 'px';		ghost.style.opacity = .5;		ghost.style.border  = '1px solid black';		ghost.style.backgroundColor = 'gray';		ghost.style.position = 'absolute'		ghost.style.zIndex	= 9000;				return ghost;	}		// initialize the events	,initEvents : function(){		this.addEvents( 'expandNode', 'collapseNode', 'beforeExpandNode', 'beforeCollapseNode' );		Eve.widgets.DefaultCustomView.superclass.initEvents.apply( this, arguments );				this.on('resize', this.repositionGhost, this );		this.onContent( 'dblclick', this.onDblClick, this );				this.dd = new Eve.widgets.CustomView.DragZone( this, {} );	}		// handle the double click on one of the dataview nodes	,onDblClick : function( dv, idx, node, e ){		if ( this.handleDblClick )			this.expandItemByIndex( idx );		e.stopEvent();	}		// Handle the dblclick on the ghost	,onGhostDblClick : function( e, el ){		if ( this.fireEvent( 'beforeCollapseNode', this, this.dataview.indexOf( el ) ) ){					el.parentNode.removeChild( el );			e.stopEvent();					this.fireEvent( 'collapseNode', this, this.dataview.indexOf( el ) );			this.ghost = null;		}	}		// respositions the ghost	,repositionGhost : function(){		if ( !this.ghost )			return;					var oc = this.ownerCt.getEl();		var fx = this.getGhostFx();		fx.duration = .01;				this.ghost.shift( fx );	}		// Ghost FX options for resizing	,getGhostFx : function( callback, scope ){		var s 	 = this.getSize();		callback = callback || Ext.emptyFn;		scope	 = scope || this;				return { width: s.width, height: s.height		 		  , x: this.ownerCt.getEl().getLeft()		 		  , y: this.ownerCt.getEl().getTop()		 		  , duration: .2		 		  , callback : callback		 		  , scope : scope				};	}} );//-------------------------------------// Pagination Toolbar... Nothing special, just a normal pagination//-------------------------------------Eve.widgets.CVPagination = Ext.PagingToolbar;Ext.reg( 'customview', Eve.widgets.DefaultCustomView )Ext.reg( 'cv-paging' , Eve.widgets.CVPagination );//-------------------------------------// DragZone//-------------------------------------Eve.widgets.CustomView.DragZone = function( cv, config ){	this.cv = cv;		Eve.widgets.CustomView.DragZone.superclass.constructor.apply( this, [cv.el, config] );}Ext.extend( Eve.widgets.CustomView.DragZone, Ext.dd.DragZone, {	getDragData : function(e){		var its = this.cv.dataview.itemSelector;		var target = e.getTarget();				if ( !target )			return false;				target = Ext.get(target).up( its );		if ( !target )			return false;					var ghost = Ext.get( this.cv.createGhost( target ) );		ghost.setStyle('left', 'auto');		ghost.setStyle('top', 'auto');		var rec = this.cv.dataview.getRecord( target.dom );		var idx = this.cv.dataview.indexOf( target.dom );				var t = { ddel: target.dom, grid: this.cv, rowIndex: idx, selection: this.cv.dataview.getSelectedNodes(), record: rec }				return t;	}		,afterRepair : function(){		this.dragging = false;	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/ImpExpDialog.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.2 December 2008 * * khashayar@hyperoffice.com * ghazaleh@hyperoffice.com * * http://www.hyperoffice.com*/// * * * * * * * * * * * * * * * * * * * *// Import Dialog * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.widgets.ImportDlgBridge = Ext.extend(Eve.lib.Bridge,{	init: function(data)	{		Eve.widgets.ImportDlgBridge.superclass.init.call(this, data);				this.isMapStep = false;		this.invalidImportFile = false;		this.importFileChanged = true;			this.buildWizard()	}		,getActiveItem : function()	{		var lay = this.cards.getLayout();		var id = lay.activeItem.id;		return id;	}			,buildWizard : function()	{		this.uploadForm = new Eve.UploadFormPanel({			labelWidth	: 70			,fileUpload	: true			,frame		: false			,bodyStyle	: 'padding: 20px'			,width		: 700			,height		: 300			,items 		: [{				xtype		: 'textfield'				,inputType	: 'file'				,name      	: 'importFile'				,id        	: this.section + 'upload_field'				,fieldLabel	: 'Location'				,allowBlank	: false				,autoCreate	: {					tag				: 'input'					,type			: 'text'					,size			: '30'					,autocomplete	: 'off'				}				//,anchor		: '100%'				,validator : function(fileName){					var fileType = fileName.substring(fileName.length-3, fileName.length);					if(fileType == "csv"){						return true;					}					else{						Ext.tools.msg('Only .csv file is valid','', 5);						return false					}				}			}]		});		//Mapping Grid		var mapToField = new Ext.form.ComboBox({			store 			: new Ext.data.SimpleStore({fields:['id','title'], data:[]})			,id				: this.section + 'cboImportExisting'			,mode         	:'local'			,valueField		: 'id'			,displayField 	: 'title'			,typeAhead 		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'		});				this.fields = [			 {name: 'id', type : 'string'}			,{name: 'title', type : 'string'}			,{name : 'field', type : 'string'}		];		this.reader = new Ext.data.XmlReader( { id: 'id', record: 'row', totalRecords: 'total' }, Ext.data.Record.create( this.fields ) );		this.store = new Ext.data.Store({reader : this.reader});		//Declaration of combo reader 		this.recCbo	= Ext.data.Record.create([ 			 {name: 'id'}			,{name: 'title'}		]);					this.readerCbo= new Ext.data.XmlReader({			id		: 'id'			,record	: 'tableColumn'		}, this.recCbo);						this.column = new Ext.grid.ColumnModel([{			header : 'Field Name'			,dataIndex : 'title'			,width		: 200		},{			 header : 'Map To'			,dataIndex : 'field'			,width		: 150			,editor		: new Ext.grid.GridEditor(mapToField)			,renderer :  function (value, meta, record) {				var combo = mapToField;				var idx = combo.store.find(combo.valueField, value);				if(idx != -1){					var rec = combo.store.getAt(idx);					var txt = rec.get(combo.displayField);				}				return txt;			}		}]);				this.mapGrid = new Ext.grid.EditorGridPanel({			 id 		: this.section + 'mapGrid'			,height 	: 253			,clicksToEdit : 1			,autoScroll : true			,stripeRows : true			,anchor		: '100%'			,store		: new Ext.data.Store({fields:this.fields})			,sm			: new Ext.grid.RowSelectionModel({ singleSelect : true })			,cm			: this.column		});		this.cards = new Ext.Panel({			layout 	: 'card'			,frame	: true			,defaults   : {hideMode:'offsets'}						,items 	:[{ 				id		: this.section + 'Import-upload-panel'				,items	: [{					items:[	this.uploadForm, {						 xtype		: 'checkbox'						,boxLabel   : 'The first row contains header information'						,name       : 'header_info'						,id         : this.section + 'import_header'						,hideLabel	: true						,disabled	: true						,checked	: true						,labelStyle	: 'padding-left:25px'						,style		: 'margin: 5px 0px 5px 25px;'					}]				}]			}, {				id : this.section + 'mapping-panel'				,layout	:'fit'				,items :[this.mapGrid]			}]			,activeItem : 0			,buttons	: [{				text		: 'Abort'				,handler	: function() {					Ext.getCmp(this.section + "import_wizard").hide();				}				,scope		: this			}, {				text		: 'Previous'				,disabled	: true				,id			: this.section + 'move-prev'				,handler	: function() {					this.cards.getLayout().setActiveItem(0);					this.btnNext.setText('Next');									}				,scope		: this			}, {				text		: 'Next'				,disabled	: false				,id			: this.section + 'move-next'				,handler	: function() {					switch (this.getActiveItem()) {						case (this.section + 'Import-upload-panel'):						    var fileField = Ext.getCmp(this.section + 'upload_field');														if (fileField.getValue() != "" ) {																if (fileField.validate()) {									/* Majid: Wait : next lines was commented */    							Eve.mask.show(this.cards.el, {msg: "Uploading file, please wait..."});									this.uploadForm.getForm().submit({         								waitMessage	: "Uploading file, please wait..."          								,url		: Eve.url										,params		: {  											event	: 'modern.' + this.section + '.' + this.root + '.importUpload'	          								,fileName	: fileField.getValue() 											,m_shariat_m: true											,groupId	: this.groupId || '0'										}	          							,success: function(fr, res) {																						this.sourcePath = Ext.DomQuery.selectValue('sourceFilePath', res.response.responseXML);											this.importColumns = Ext.DomQuery.selectValue('importColumns', res.response.responseXML);											/* Majid: Wait : next lines was commented */											Eve.mask.hide();											if (this.sourcePath !== undefined && this.importColumns !== undefined) {												/* Majid: Wait : next lines was commented */												Eve.mask.show(this.cards.el, {msg:'Mapping....'});												this.fire('get_import_mapping', {													importColumns	: this.importColumns													,sourceFilePath : this.sourcePath													,root			: this.root													,groupId		: this.groupId													,section		: this.section												});											}											else {												var text = res.response.responseText;												Ext.Msg.alert('Error', text);											}										}										/*,failure: function(form, action) {											// Majid: Wait : next lines was commented 											Eve.mask.hide();											var text = action.response.responseText;											Ext.Msg.alert('Error', text);										}*/										,scope: this								  })								}	  											} else {							//	Ext.Msg.alert('', 'Please select a file');								Ext.tools.msg('Please select a file','', 5);								fileField.focus();							}														break;													case (this.section + 'mapping-panel'):						   //this.cards.getEl().mask('Mapping in progress...');							this.sendGridData();							break;					}				}				,scope		: this			}]		});		this.dialog = new Ext.Window({			id          : this.section + 'import_wizard'			,width 		: 400			,modal		: true			,layout 	: 'fit'			,height 	: 250			,y 			: 100			,border 	: false			,resizable	: false			,bodyBorder : false			,autoScroll : false			,closeAction: 'hide'			,items 		: this.cards			,title		: 'Import'		});				this.btnPrev = Ext.getCmp(this.section + 'move-prev');		this.btnNext = Ext.getCmp(this.section + 'move-next');	}	,loadGrid	: function(res){		this.cards.getEl().unmask();		var xml 	= res.responseXML;		var grid	= Ext.getCmp(this.section + 'mapGrid');		var store	= grid.getStore();		store.removeAll();		var data	= this.reader.readRecords(xml.getElementsByTagName('data')).records;		// Feed the inline combobox store.		var storeCbo= Ext.getCmp(this.section + 'cboImportExisting').store;		storeCbo.removeAll();		var dataCbo	= this.readerCbo.readRecords(xml.getElementsByTagName('tableColumns')).records;		// Feed the Combo		storeCbo.add( dataCbo );		// Feed the Grid.		store.add( data );		this.cards.getLayout().setActiveItem(this.section + 'mapping-panel');		Ext.getCmp(this.section + 'move-next').setText('Finish');		Ext.getCmp(this.section + 'move-prev').enable();	}		,sendGridData : function()	{		var grid	= Ext.getCmp(this.section + 'mapGrid');	    var store	= grid.getStore();		var id		= "";		var param = {};				store.each( function(rec){			id = rec.data.id;			param[id] = rec.data.field;			},this);				param.sourceFilePath = this.sourcePath;		param.importColumns = this.importColumns;		this.fire('complete_map_import', {			param	: param			,root	: this.root			,groupId: this.groupId			,path	: this.path			,secName: this.section		});	}		,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_open_import_dlg'):				this.secGrid	= obj.grid;				this.root		= obj.root;				this.groupId    = obj.groupId;				this.path       = obj.path || '\\';								try {					this.cards.getLayout().setActiveItem(this.section + 'Import-upload-panel');					this.uploadForm.getForm().reset();					this.btnPrev.setDisabled(true);					this.btnNext.setText('Next');				} catch(e) {}								this.dialog.show();				break;							case (this.section + '_success_get_map'):				this.loadGrid(obj);				/* Majid: Wait : next lines was commented */				Eve.mask.hide();				break;							case (this.section + '_success_import'):				//this.cards.getEl().unmask();				this.dialog.hide();				this.secGrid.getStore().reload();				break;		}	}});// * * * * * * * * * * * * * * * * * * * *// Task Export Dialog  * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.widgets.TaskExportDlgBridge = Ext.extend(Eve.lib.Bridge, {	init	: function(data)	{		Eve.widgets.TaskExportDlgBridge.superclass.init.call(this, data);		this.expDlg = new Ext.FormPanel({			labelWidth	: 75			,frame		: true			,bodyStyle	: 'padding: 20px'			,width		: 300			,items       : [{				xtype       : 'label'				,text       : 'Please choose your export file format:'				,style      : 'font: 12px tahoma'				,anchor     : '100%'			}, {				xtype       : 'radio'				,boxLabel   : 'Comma Seperated Value (.CSV)'				,name       : 'filetype'				,inputValue : 'csv'				,style      : 'font: 11px tahoma; margin-top: 10px'				,checked    : true				,hideLabel  : true				,anchor     : '100%'			}, {				xtype		: 'radio'				,boxLabel	: 'Microsoft Excel (.XLS)'				,name		: 'filetype'				,inputValue	: 'xls'				,style      : 'font: 11px tahoma'				,hideLabel  : true				,anchor		: '100%'			}, {				buttons: [{					text	: 'OK'					,handler: function() {						var fileType = document.getElementsByName('filetype');						fileType	 = (fileType[0].checked) ? "csv" : "xls";						var action = {							event    :['modern.',this.section ,'.', this.root, '.export'].join('')							,type    : fileType							,CFID    :Eve.CFId							,CFTOKEN :Eve.CFToken						}						if (this.id !== undefined){							action.parentid = this.id;						}						if (this.folderId !== undefined){							action.folderid = this.folderId;						}						if (this.root == 'group') {							action.groupId = this.groupId;						}													Eve.downloadFile(action);						this.expWindow.hide();					}					,scope : this					}, {						text	 : 'Cancel'						,handler : function(){							this.expWindow.hide();							}						,scope : this					}]				}]		});			this.expWindow = new Ext.Window({			width 		: 380			,modal		: true			,layout 	: 'fit'			,height 	: 170			,y 			: 100			,border 	: false			,resizable	: false			,bodyBorder : false			,autoScroll : false			,closable   : false			,items 		: this.expDlg			,title		: 'Export File Format'		});	}		,execute : function(callee, type, data)	{		switch(type) {			case ('task_do_export'):				this.root		= data.root;				this.id			= data.id;				this.folderId	= data.folderId;				this.groupId 	= data.groupId;								this.expWindow.show();				break;		}	}});// * * * * * * * * * * * * * * * * * * * *// Contact Export Dialog * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.widgets.ContactExportDlgBridge = Ext.extend(Eve.lib.Bridge, {	init	: function(data)	{		Eve.widgets.ContactExportDlgBridge.superclass.init.call(this, data);		var me = function() {			//Ext.get(\'dvContactExportCategories\').select(\'.chBoxContactExportCategories\').set({\'checked\':this.checked});		}		this.expDlg = new Ext.FormPanel({			labelWidth	: 75			,frame		: true			,bodyStyle	: 'padding: 10px'			,width		: 300			,items       : [{				region		: 'north'				,items		: [{					xtype       : 'label'					,text       : 'Please choose your export file format:'					,style      : 'font: 12px tahoma'					,anchor     : '100%'				}, {					xtype       : 'radio'					,boxLabel   : 'Comma Seperated Value (.CSV)'					,name       : 'contact_filetype'					,inputValue : 'csv'					,style      : 'font: 11px tahoma; margin-top: 10px'					,checked    : true					,hideLabel  : true					,anchor     : '100%'				}, {					xtype		: 'radio'					,boxLabel	: 'Microsoft Excel (.XLS)'					,name		: 'contact_filetype'					,inputValue	: 'xls'					,style      : 'font: 11px tahoma'					,hideLabel  : true					,anchor		: '100%'				}]			}, {				region		: 'center'				,layout		: 'fit'				,xtype		: 'dataview'				,id			: 'dvContactExportCategories'				,width		: 342				,height		: 140				,border		: true				,hideLabel	: true				,itemSelector: 'div.search-item'				,style		: 'margin-top:10px; overflow:auto; background-color:white; border:1px solid gray'				,store		: Eve.Contact.dsCategories				,tpl		: new Ext.XTemplate(					'<table id="contact-export-categories" cellspacing="0">',						'<thead>',						'<tr>',							'<th><input name="contactExportAllContacts" id="contactExportAllContacts" type="checkbox" onclick="var me=this; var cmp=Ext.get(\'dvContactExportCategories\').select(\'.chBoxContactExportCategories\'); cmp.each(function(c) { c.dom.checked = me.checked; });" /></th>',							'<th>All Contacts</th>',						'</tr>',						'</thead>',						'<tbody>',						'<tpl for=".">',							'{[this.getCheckbox(values, xindex)]}',						'</tpl>',						'</tbody>',					'</table>', {						getCheckbox: function(values, index) {							if (values.system != 2)							{								return '<tr class="search-item">' +										'<td><input id="cbContactExportCat_' + index + '" type="checkbox" class="chBoxContactExportCategories" /></td>' +										'<td>' + values.title + '</td>' + 									'</tr>';							}							else								return '';						}					}				)			}]		});		this.expWindow = new Ext.Window({			layout			: 'fit'			,title			: 'Export File Format'			,width			: 380			,height			: 300			,modal			: true			,border			: false			,resizable		: false			,bodyBorder		: false			,autoScroll		: false			,closable		: false			,constrainHeader: true			,items			: this.expDlg			,buttons		: [{				text	: 'OK'				,handler: function() {					var fileType = document.getElementsByName('contact_filetype');					fileType	 = (fileType[0].checked) ? "csv" : "xls";					var action = {						event :['modern.',this.section ,'.', this.root, '.export'].join('')						,type: fileType						,CFID    :Eve.CFId						,CFTOKEN :Eve.CFToken					}					if (this.id !== undefined) {						action.parentid = this.id;					}										// Called by ContextMenu or by ToolbarMenu										var exportUncategorized = false;					if (this.byCtxMenu) {						action.folderIds = this.folderId;					} else {						var dv		= Ext.getCmp('dvContactExportCategories');						var boxes	= dv.getEl().select('.chBoxContactExportCategories');						var ids		= [];												boxes.each( function(el) {							if (el.dom.checked) {								var idx = el.dom.id.split('_')[1];								var rec = dv.store.getAt(idx - 1);								ids.push(rec.id.split('_')[1]);								if (rec.get('system') == 1)									exportUncategorized = true;							}						})						action.folderIds = ids.join(',');					}																					if (this.root == 'group') {						action.groupId = this.groupId;					}										if (Ext.get('contactExportAllContacts').dom.checked)						action.exportAllContacts = true;					else if (exportUncategorized)						action.exportUncategorized = true;										Eve.downloadFile(action);					this.expWindow.hide();				}				,scope : this			}, {				text	 : 'Cancel'				,handler : function(){					this.expWindow.hide();				}				,scope : this			}]		});	}	,execute : function(callee, type, data)	{		switch(type) {			case ('contact_do_export'):				this.root		= data.root;				this.id			= data.id;				this.folderId	= data.folderId;				this.groupId 	= data.groupId;				this.byCtxMenu	= data.contextMenu;				var display = (this.byCtxMenu === true) ? false : true;				Ext.getCmp('dvContactExportCategories').setVisible(display);				this.expWindow.show();								var cmp=Ext.get('dvContactExportCategories').select('.chBoxContactExportCategories'); 				cmp.on('click', function(event, element) {					if (!element.checked)						Ext.get('contactExportAllContacts').dom.checked = false;				});								break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/FilterDialog.js *//*--------------------------------------------------*//** * *@author: Ghazaleh Famili * */Eve.widgets.FilterDlgBridge = Ext.extend(Eve.lib.Bridge,{	init	: function(data)	{		Eve.widgets.FilterDlgBridge.superclass.init.call(this, data);				// Contain Combo		this.cmbContain = new Ext.form.ComboBox({			store 			:  new Ext.data.SimpleStore({				fields   	: ['text', 'value']				,data    	: []			})			,mode         	:'local'			,valueField		: 'value'			,displayField 	: 'text'			,typeAhead 		: true			,value          : 0			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,scope          : this		});		//And|OR Combo	 	var cmbOpField = new Ext.form.ComboBox({			store 			:  new Ext.data.SimpleStore({				fields : ['text', 'value'],				data : [['And', '&AND&'],						['OR' , '&OR&'] ]			})			,mode         	:'local'			,valueField		: 'value'			,displayField 	: 'text'			,typeAhead 		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,scope          : this		});		// Search Field Combo		this.fieldSt = new Ext.data.SimpleStore({			fields : ['name', 'title', 'type']			,data : [ ]		});		this.reader = new Ext.data.XmlReader( {id: 'name', record: 'field'}, Ext.data.Record.create( ['name', 'title', 'type'] ) );	 	this.cboSearch = new Ext.form.ComboBox({			store 			: this.fieldSt			,mode         	:'local'			,valueField		: 'name'			,displayField 	: 'title'			,typeAhead 		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,scope          : this		});		this.cboSearch.on('change', this.columnModelHandler, this)		this.cboSearch.on('select', function() {					}, this);		//----------------		//    Grid Filter		this.filterGrid = new Ext.grid.EditorGridPanel({			id			: this.section + 'grid_filter'			,width		: 550			,height		: 250			,autoScroll	: true			,enableColumnMove   :false			,sm 		: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			,anchor		: '100%'			,columns	: [{				header			: "Search Field"				,width			: 150				,dataIndex		: 'searchField'				,fixed			: true				,menuDisabled	: true				,editor			: new Ext.grid.GridEditor(this.cboSearch)				,renderer		: Eve.comboRenderer(this.cboSearch)			}, {				header			: "Contains"				,width			: 150				,id             : 'filter-contains-field'				,dataIndex		: 'contains'				,fixed			: true				,menuDisabled	: true				,editor			: new Ext.grid.GridEditor(this.cmbContain)				,renderer		: Eve.comboRenderer(this.cmbContain)				,scope          : this			}, {				header			: "Text"				,width			: 140				,id             : 'filter-search-txt'				,dataIndex		: 'searchText'				,fixed			: true				,menuDisabled	: true				,editor 	:new Ext.grid.GridEditor(new Ext.form.TextField())				,renderer:function(value, meta, rec){					if( value == '' || value == undefined ) return '';					if( value.dateFormat ) return value.dateFormat(Eve.Preference.get('dateFormat'));					else return value;				}			}, {				header			: "and/or"				,width			: 70				,dataIndex		: 'operator'				,fixed			: true				,menuDisabled	: true				,editor			: new Ext.grid.GridEditor(cmbOpField)				,renderer		: Eve.comboRenderer(cmbOpField)			},{				header			: "&nbsp;"				,width			: 25				,fixed			: true				,menuDisabled	: true				,renderer		: function() {						return "<img height=14 src='" + Eve.Resource.getIcon("delete", "general") +"' onmouseover='this.style.cursor=&quot;pointer&quot; ' />"				}			}]			,store		: new Ext.data.Store({				reader		: new Ext.data.XmlReader({					record 		: 'row'					,success	: '@success'					,id			: 'id'					,totalRecords: 'total'				}, [					 {name: 'searchField'	, 		type: 'string'}					,{name: 'contains'		, 		type: 'string'}					,{name: 'searchText'	,		type: 'string'}					,{name: 'operator'		,		type: 'string'}					,{name: 'visible'		, 		type: 'boolean'}				])			})			,tbar		: new Ext.Toolbar({				items		: [{					text		: 'New'					,cls		: "x-btn-text-icon"					,icon		: Eve.imagePath+"general/new.png"					,handler	: function() {						var grid	= Ext.getCmp(this.section + 'grid_filter');						var ds		= grid.getStore();						var row 	= Ext.data.Record.create(['searchField', 'contains', 'visible', 'searchText', 'operator'])						var record = new row({							searchField		: ''							,contains		: ''							,searchText		: ''							,operator		: ''							,visible        : ''						})						record.id = 'new_' + ds.getCount();						ds.add(record);						grid.getSelectionModel().selectRecords([record]);						grid.startEditing(ds.getCount() - 1, 0, true);					}					,scope		: this				}]			})			,listeners	: {				cellclick	: function(grid, rIdx, cIdx, e) {					if (cIdx != '4')						return;					var ds	= grid.getStore();					var rec = ds.getAt(rIdx);					ds.remove(rec);				}			}		});		var cellHandler = function(grid, rowIndex, colIndex, e){			var rec = grid.store.getAt(rowIndex);			if(colIndex == 2){				var searchField = rec.get('searchField').toLowerCase();				//When searchField is empty				if(searchField == ''){					grid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(new Ext.form.TextField());					grid.colModel.getColumnById('filter-search-txt').renderer = function(val){return val};					return;				}					  			var type = this.fieldSt.getAt( this.fieldSt.find('name', searchField) ).get('type');				//For changing editor real time				if(type == 'date'){					grid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(						new Ext.form.DateField({							allowBlank : false							,format: Eve.Preference.get('dateFormat') })					)					grid.colModel.getColumnById('filter-search-txt').renderer = function(value){						if( value == '' || value == undefined ) return '';						if( value.dateFormat ) return value.dateFormat(Eve.Preference.get('dateFormat'));						else return value;					};				}				else if(type == 'integer' && searchField == 'status'){		    		var statusCombo = new Ext.form.ComboBox({					store 			: Eve.Dialogs.Task.statusStore					,mode         	:'local'					,valueField		: 'status'					,displayField 	: 'statusText'					,typeAhead 		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,renderer         : Eve.comboRenderer(statusCombo)		 			});    					grid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(statusCombo);    					grid.colModel.getColumnById('filter-search-txt').renderer = Eve.comboRenderer(statusCombo);				}				else if(type == 'integer' && searchField == 'priority'){						var priCombo = new Ext.form.ComboBox({							store 			: Eve.Dialogs.Task.priorityStore							,mode         	:'local'							,valueField		: 'priority'							,displayField 	: 'priorityText'							,typeAhead 		: true							,editable		: false							,selectOnFocus 	: true							,triggerAction 	: 'all'							,renderer       : Eve.comboRenderer(priCombo)				 		});    					grid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(priCombo);    					grid.colModel.getColumnById('filter-search-txt').renderer = Eve.comboRenderer(priCombo);    				}    							else{					grid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(new Ext.form.TextField());					grid.colModel.getColumnById('filter-search-txt').renderer = function(val){return val};				}			}			else if(colIndex == 1){				this.columnModelHandler(this.cboSearch, rec.get('searchField') );			}		}		this.filterGrid.on('cellclick', cellHandler, this);		this.filterGrid.on('afteredit', function(e) {			var record = e.record;			var column = e.column;			console.log(column)			if (column == 0) {				var val = this.cmbContain.store.data.items[0].data.value;				record.set('contains', val);			}		}, this);						this.filterDlg = new Eve.FormPanel({			labelWidth	: 70			,frame		: true			,bodyStyle	: 'padding: 20px'			,width		: 650			,height		: 350			,items 		:[ this.filterGrid]			,buttonAlign: 'right'			,buttons: [{				text	: 'Find'				,handler: function() {					var store = this.filterGrid.store;					var str,rec;					var isValid = true;					var strArray = [];					var len =  store.getCount();										if(len == 0)					    isValid = false;										for(var i=0; i< len; i++){						rec = store.getAt(i);	    				var txt = rec.get('searchText');						if(rec.get("searchField") == ''||							rec.get('contains')== ''||							rec.get('searchText')== ''){							isValid = false;						}						txt = (txt.format !== undefined)? txt.format('n/j/y'): txt;						if(txt.indexOf('@')!= -1 ||							txt.indexOf('&')!= -1 ||							txt.indexOf('|') !=-1){							Ext.Msg.show({				                title:'Error',				                msg: '\'&\' and \'@\' characters can not be used !',				                buttons: Ext.Msg.OK,				                modal: true				              });				              return						}									    			if(rec.get('operator')== '' &&							i != len-1){							isValid = false;					    }    					if(isValid == false){							Ext.Msg.show({				                title:'Error',				                msg: 'Fill The Required Fields!!',				                buttons: Ext.Msg.OK,				                modal: true				              });				              return				        }						var searchField = rec.get('searchField').toLowerCase();				    	var type = this.fieldSt.getAt( this.fieldSt.find('name', searchField) ).get('type');						if( type == 'boolean')						{							if(txt == 'true' || txt== '1')							    txt = '1';							else if ( txt == 'false' || txt=='0')							    txt='0';							else{                                Ext.Msg.show({				                title:'Error',				                msg: '\Text field was not recognized as a valid Boolean !',				                buttons: Ext.Msg.OK,				                modal: true				              });				              return							}													}						var field = rec.data.searchField;						if( field == 'PercentCompleted' && rec.data.searchText.match(/^(?:\d{1,2}|100)$/)== null){							Ext.Msg.show({				                title:'Error',				                msg: '\Validation error !',				                buttons: Ext.Msg.OK,				                modal: true				              });				              return						}						str = rec.get("searchField")+"|"+rec.get('contains')+"|"+txt+"|"+rec.get('operator');						strArray.push(str);											}					str = strArray.join("|");										this.fire(this.section + '_filter', { mode: { base: 'filter', branch: '' }, info: this.info, criteria: str}, true );					this.filterWindow.hide();				}				,scope : this				},{					text	 : 'Clear'					,handler : function() {						this.fire(this.section + '_filter', {							mode	: {								base	: 'filter'								,branch	: ''							}							,info	: this.info							,criteria: ""							}						,true);												this.filterWindow.hide();					}					,scope : this				}]		});				this.filterWindow = new Ext.Window({			width 		: 650			,modal		: true			,layout 	: 'fit'			,height 	: 350			,y 			: 100			,border 	: false			,resizable	: false			,bodyBorder : false			,autoScroll : false			,closeAction: 'hide'			,items 		: this.filterDlg			,title		: 'Filter'		});	}	,columnModelHandler : function(cmb, newVal, oldVal, value /*just use when load the grid*/)	{		var that = this;		var rec = cmb.store.getById(newVal);		//		var fakeRec = Ext.data.Record.create(['searchField']);		var value = value || new fakeRec({searchField : ''});		var store = that.cmbContain.store;		var data;		var cm = Ext.getCmp(that.section + 'grid_filter').getColumnModel();		if(!rec){	      cm.setEditable( 1 , false);	      return;		}		cm.setEditable( 1 , true);		switch(rec.get('type').toLowerCase()){			case 'string':			case 'smalltext':			case 'mediumtext':			case 'largetext':			case 'text':				data = [				  	['Starts With'	, 'startwith']	            	,['Ends With'	, 'endwith']	            	,['Contains'	, 'contains']				];			    break;			case 'integer':			case 'decimal':			case 'percent':			case 'currency':			case 'date':				data = [					['Greater than'				, 'greater']					,['Greater than OR Equal'	, 'greaterEqual']					,['Less than'				, 'less']					,['Less than OR Equal'		, 'lessEqual']					,['Equal'					, 'equal']					,['Not Equal'				, 'notEqual']				];			    break;			case 'boolean':			    data = [	                ['Equal'		, 'equal']	                ,['Not Equal'	, 'notEqual']				]		}		if (rec.get('type').toLowerCase() == 'date') {			that.filterGrid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(				new Ext.form.DateField({					allowBlank : false					,format: Eve.Preference.get('dateFormat') })			)			that.filterGrid.colModel.getColumnById('filter-search-txt').renderer = function(value){				if( value == '' || value == undefined ) return '';				if( value.dateFormat ) return value.dateFormat(Eve.Preference.get('dateFormat'));				else return value;			};		} else if (rec.get('type').toLowerCase() == 'integer' && value.get('searchField').toLowerCase() == 'status') {			var statusCombo = new Ext.form.ComboBox({				store 			: Eve.Dialogs.Task.statusStore				,mode         	:'local'				,valueField		: 'status'				,displayField 	: 'statusText'				,typeAhead 		: true				,editable		: false				,selectOnFocus 	: true				,triggerAction 	: 'all'				,renderer         : Eve.comboRenderer(statusCombo)			});			that.filterGrid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(statusCombo);			that.filterGrid.colModel.getColumnById('filter-search-txt').renderer = Eve.comboRenderer(statusCombo);		} else if(rec.get('type').toLowerCase() == 'integer' && value.get('searchField').toLowerCase()  == 'priority') {			var priCombo = new Ext.form.ComboBox({				store 			: Eve.Dialogs.Task.priorityStore				,mode         	:'local'				,valueField		: 'priority'				,displayField 	: 'priorityText'				,typeAhead 		: true				,editable		: false				,selectOnFocus 	: true				,triggerAction 	: 'all'				,renderer       : Eve.comboRenderer(priCombo)	 		});			that.filterGrid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(priCombo);			that.filterGrid.colModel.getColumnById('filter-search-txt').renderer = Eve.comboRenderer(priCombo);		} else {			that.filterGrid.colModel.getColumnById('filter-search-txt').editor = new Ext.grid.GridEditor(new Ext.form.TextField());			that.filterGrid.colModel.getColumnById('filter-search-txt').renderer = function(val){return val};		}				store.removeAll();	    store.loadData(data)	    store.commitChanges();	}	,execute : function(callee, type, object)	{		switch(type) {			case (this.section + '_filter_dlg'):				this.info = object.info;								this.filterWindow.show();				/* Majid: Wait : next lines was commented */				Eve.mask.show(this.filterWindow.getEl());				this.fire(this.section + '_filter_info', object);				break;							case (this.section + '_success_filter_info'):			    this.fillStore(object.response);			    break;			    		}	}		,fillStore : function(res)	{		this.fieldSt.removeAll();		var records = this.reader.readRecords(res).records;		this.fieldSt.add(records);				var st = this.filterGrid.store;		st.removeAll();		records = st.reader.readRecords(res).records;		var searchField, contains;		for(var i=0; i<records.length; i++){			searchField = records[i].get('searchField');			this.columnModelHandler(this.cboSearch, searchField, null, records[i]);			st.add(records[i])		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Masker.js *//*--------------------------------------------------*/Eve.Masker = (function(){	var Mask = new Ext.LoadMask( Ext.getBody(), 'In progress ...' );	var timeoutFunc = null;	var dlg  = new Ext.Window({		bodyStyle: 'background: white; padding: 10px; overflow-y: auto;',        width: 400,        height: 300,        title: 'Info',        closable: false,        closeAction: 'hide',        modal: true	});	return {		showMask: function( msg, timeout ){				Eve.Masker.hideAll();			timeout = timeout || 30000;		    timeoutFunc	= setTimeout( Eve.Masker.clearMaskTimeout, timeout );		    			// Set the Message text			Mask.show();		}				,clearMaskTimeout: function(){			try{				Eve.Masker.hideAll();				clearTimeout( timeoutFunc );				Ext.Msg.alert( 'Warning...', 'An operation took more than expected time, You can try to refresh the page or continue your work...' );			}catch(e){							}		}				,hideMask: function(){			clearTimeout( timeoutFunc );			Mask.hide();		}				,hideAll: function(){			clearTimeout( timeoutFunc );						try{				Mask.hide();				dlg.hide();			}catch(e){							}		}				,showDialog: function( timeout ){			Eve.Masker.hideAll();			timeout = timeout || 30000;			timeoutFunc = setTimeout( Eve.Masker.clearMaskTimeout, timeout );						var vs = dlg.isVisible();			dlg.show();			// if is not visible clear the content			if ( !vs ){				//dlg.body.dom.innerHTML = '';			}		}				,addToDialog: function( msg ){			dlg.body.dom.innerHTML = (msg + '<br />' ) + dlg.body.dom.innerHTML;		}				,hideDialog: function(){			clearTimeout( timeoutFunc );			dlg.hide();		}	}})();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/GroupSelect.js *//*--------------------------------------------------*/Eve.GroupSelect = function( config ){	config = config || {};	Ext.applyIf( config, {		closeAction: 'hide'		,modal	   : true		,title	   : 'Please choose a group to continue'		,layout	   : 'fit'		,width	   : 450		,height	   : 320		,y		   : 100	} );	this.requests = {		load: function() {			return {				url		: 'index.cfm'				,params	: {					event	: 'modern.group.personal.ModifyFilter'					,limit	: Eve.Preference.getInteger("itemsPerPage")					,start	: 0					,searchText: ""				}			}		} 		,select: function(id, name) {			return {				url		: 'index.cfm'				,params	: {					event		: 'modern.group.personal.selectGroup'					,groupId	: id					,groupName	: name				}			}		}	};	this.store = new Ext.data.Store( {		reader: new Ext.data.XmlReader( {			 record: 'row'			 ,totalRecords	: 'total'			 ,id: 'id'		}, [ 'fullName', 'title', 'id', 'owner', 'administrator', 'path','createdOn', 'memberSince', 'selected' ] )		, proxy: new Ext.data.HttpProxy( this.requests.load() )	} );	this.store.on('load', function(st, records, opt){		if(st.getCount() == 1){			this.dataView.select(st.indexOf(records[0]));			selectHdl();		}	}, this);	this.dataView =	new Ext.DataView( {			 tpl: new Ext.XTemplate(			'<tpl for=".">',		 	'<div style="margin:5px 5px;padding:9px 2px; width: 98.%;" class="x-group-select">',			 	'<div style="float:left;padding-right:7px">&nbsp;&nbsp;<img src="{[this.getImage("icon")]}" width=32></div>',			 	'<div style="float:left;width:80%;"><span style="font-weight:bold;line-height:22px">{fullName}</span>',     			'<tpl if="owner == 1">&nbsp;(Owner)</tpl>',     			'<tpl if="administrator == 1"> - (Administrator)</tpl>',				 '<br/>',                '<span style="font-size: 11px; font-style:italic; color: #3C3C3C;">',					'{createdOn} ',                '<br/>{memberSince} </span>',				'</div>',				'<tpl if="owner != 1"><div style="top:-30px;left:380px;position:relative;height:16px;width: 16px;">',				'<a href="#" title="Leave the group"><img class="group-leave" src="' + Ext.BLANK_IMAGE_URL + '" style="background:',				'transparent url({[this.getImage("leave-group")]}) no-repeat;height:16px;width: 16px;"/>',				'</a></div></tpl>',			 	'<div style="clear:both"></div>',		 	'</div>',		 	'</tpl>',		 	'</tpl>',		 	'</div>',{				getImage: function(img /*delete*/){                    	return Eve.Resource.getIcon(img, 'groupmembership');			}		 	})			,overClass: 'x-group-over'			,itemSelector: 'div.x-group-select'			,selectedClass: 'x-group-selected'			,emptyText: 'No Groups to Select'			,store: this.store			,singleSelect: true		});		var that = this;		this.dataView.on('contextmenu', function(dv, index, node, e){				e.stopEvent();				dv.select(node);				var rec = this.store.getAt(index);				var items = [];				items.push({		            text : 'Go To Group'					,icon	: Eve.Resource.getIcon('go-group', 'groupmembership')					,cls	: "x-btn-text-icon"		            ,handler: selectHdl				});				if(rec.get('administrator')== "1"){					items.push({						text : 'Administer Group'						,icon	: Eve.Resource.getIcon('administer-group', 'groupmembership')						,cls	: "x-btn-text-icon"						,handler: function(){							Eve.Resource.superbridge.broadcast(this,'load_section',{sectionName:'ManageUsersAndGroups', event:'administration.groups.initialize'})							that.hide();						}					});				}				if(rec.get('owner')!= "1"){					items.push({						text : 'Leave Group'						,icon	: Eve.Resource.getIcon('leave-group', 'groupmembership')						,cls	: "x-btn-text-icon"						,handler: leaveConfirm					});				}				if(rec.get('owner')== "1"){					items.push({						text : 'Delete Group'						,icon	: Eve.Resource.getIcon('delete-group', 'groupmembership')						,cls	: "x-btn-text-icon"						,handler: groupHdl.createDelegate('del')					});				}				var menu = new Ext.menu.Menu({					 items : items					,listeners : {						hide: function(menu){							menu.destroy();						}					}				});				menu.showAt(e.getXY());		});						this.dataView.on('render', function(){			this.dataView.el.on('click', function(e, item){				if( Ext.get(item).dom.className.split(' ')[0] == 'group-leave'){					var node = Ext.get(item).up(this.dataView.itemSelector).dom;    				var rec = this.dataView.getRecord( node );    				this.dataView.select(node);					leaveConfirm();				}			},this)		}, this);			//Quick search field	 var searchField = new Ext.form.TriggerField({		width			: '400'		,hideLabel      : true	 	,triggerClass	: 'x-form-search-trigger'	 	,id				: 'group_quick_search'	 	,emptyText 		: 'Search'	 	,listeners : {			specialKey : function(el, e){				if (e.getKey() == e.ENTER){				var store = that.dataView.store;				var params ={					searchText  : el.getValue()					,start 	: 0					,limit  : store.lastOptions.params.limit					,event  : store.lastOptions.params.event				}				store.reload({params: params});				}			}			,scope : this	 	}	 	,onTriggerClick : function(e){			var store = that.dataView.store;			var params ={				searchText  : this.el.getValue()				,start 	: 0				,limit  : store.lastOptions.params.limit				,event  : store.lastOptions.params.event			}			store.reload({params: params});	 	}	 });	config.items = [		{			xtype: 'panel'			,tbar:  new Ext.Toolbar({items: ['->',searchField]})			,items: this.dataView			,autoScroll: true			,frame: false            ,border: false			,bbar: new Ext.PagingToolbar( {store:  this.store} )		}	]	var that = this;// Handler	var  leaveConfirm = function(){		var msg = 'Are you sure you want to leave the group ?';		Ext.Msg.confirm('Leave Confirmation', msg,			function(btn) {				if (btn == 'yes') {					groupHdl('leave');				}		});	}	var groupHdl = function( type /*del, leave*/){		var rec =  that.dataView.getSelectedRecords()[0];				/* Majid: Wait : next lines was commented */		Eve.mask.show( that.dataView.el);		var successFn = function(){			that.loadStore( that.store.lastOptions, function(){}, window, true);				/* Majid: Wait : next lines was commented */			Eve.mask.hide( that.dataView.el);		}		var params ={				event  :(type == 'del')?'modern.group.personal.deleteUser': 'modern.group.personal.leaveUser'				,groupId: rec.get('id')				,userId: Eve.Preference.get('id')		};		Ext.Ajax.request({			url		: Eve.url			,params	: params			,success: successFn		});	}	var selectHdl = function(){		var recs = that.dataView.getSelectedRecords();				if ( recs.length == 0 ){			Ext.tools.msg( 'Invalid selection', 'You must select a group before proceeding to a shared section.' );			return false;		}		var params = that.requests.select( recs[0].get('id'), recs[0].get('title') );		that.selectedGroup	= recs[0].get('id');		that.selectedPath	= recs[0].get('path');				// Update the Preferences		Eve.Preference._prefs['landinggroupid']		= that.selectedGroup;		Eve.Preference._prefs['landinggrouppath']	= that.selectedPath;						params.success = function( response ){			var xml = response.responseXML;						var dq = Ext.DomQuery;			that.pageId =  dq.selectValue( 'pageId', xml );			that.isAdmin = dq.selectValue( 'isAdmin', xml );			that.homepage = dq.selectValue( 'homepage', xml);						that.hide();			Eve.GroupSelect.GroupId = that.selectedGroup;			Eve.GroupSelect.PageId  = that.pageId;			Eve.GroupSelect.IsAdmin	= that.isAdmin;			Eve.GroupSelect.Homepage = that.homepage;			// Set groupId						var data = {				selectedGroup: that.selectedGroup				,selectedPath: that.selectedPath				,pageId: that.pageId			};			Eve.Resource.superbridge.broadcast(that,'change_active_group', data);			that._functor( that.selectedGroup, that.selectedPath );		}		Ext.Ajax.request(params);	};	this.dataView.on('dblclick', selectHdl, this);	config.buttons = [{		text	: 'Select'		,handler: selectHdl	}, {		text	: 'Cancel'		,handler: function() { that.hide(); }	}]	Eve.GroupSelect.superclass.constructor.apply( this, [config] );}Ext.extend( Eve.GroupSelect, Ext.Window, {	loadStore: function( params, func, scope, rewrite ){		//For paging		this.store.params = {event	:  'modern.group.personal.changeStartItemNumber'};		this.store.load( params );		if ( !rewrite )			this._functor = func.createDelegate( scope );	}	,selectGroup: function( id, name, func, scope, path ){		func = func || Ext.emptyFn;		scope = scope || window;		var that = this;		this.selectedGroup	= id;		this.selectedPath	= path || Eve.Preference.get('landinggrouppath');				var params = this.requests.select( id, name );		params.success = function( response ){			var xml = response.responseXML;			var dq = Ext.DomQuery;			that.pageId =  dq.selectValue( 'pageId', xml );			that.isAdmin =  dq.selectValue( 'isAdmin', xml );			that.homepage = dq.selectValue('homepage', xml);						// Set groupId			Eve.GroupSelect.GroupId		=  that.selectedGroup;			Eve.GroupSelect.PageId		=  that.pageId;			Eve.GroupSelect.IsAdmin		= that.isAdmin;			Eve.GroupSelect.Homepage	= that.homepage;						Eve.Resource.superbridge.broadcast(that,'change_active_group',{selectedGroup: that.selectedGroup, selectedPath: that.selectedPath, pageId: that.pageId});			func.apply( scope, [that.selectedGroup, that.pageId, that.selectedPath] );		}				params.failure = function (res, options) {						var el	= Ext.getCmp('MainCardLayout')			var lt	= el.getLayout();						var panel = {				xtype		: 'panel'				,id			: 'TempLayout'				,layout		: 'fit'				,items		: [{					html		: res.responseText					,border		: false					,style		: 'text-align:center; font:12px Tahoma,Verdana; padding-top:100px;'				}]			};			el.remove(Ext.getCmp('TempLayout'));			el.add(panel);			lt.setActiveItem(el.items.items.length-1);			Ext.getBody().unmask();		}		Ext.Ajax.request( params );	}} );Eve.GroupSelectBridge = Ext.extend( Eve.lib.Bridge,{	init : function(obj)	{		this.view 			= new Eve.GroupSelect();		this.conn 			= obj.conn;		this.superbridge 	= obj.superbridge;	}	,execute: function( callee, type, object ){		switch( type ){			case 'show_group_select':			    object = object || {};			    object.force = object.force || false;				if( this.view.selectedGroup && !object.force ){					object.func.apply( object.scope || window, [this.view.selectedGroup, Eve.Preference.get("landingGroupPath")] );					return false;				}				var params = this.view.requests.load();				this.view.loadStore( params, object.func, object.scope || window );				Ext.getCmp('group_quick_search').setValue('');				this.view.show();				break;			case 'direct_group_select':			    this.view.selectGroup( object.id, object.name, object.func || Ext.emptyFn, object.scope || window, object.path );				break;		}	}} );/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Homepage Options Dialog*/Eve.Homepage.popOptionsDlg = function(){	if(!Eve.Homepage.OptionsDlg){		//		var modifyFilter = function(){			var homepage = Ext.getCmp('hompage-select-form').getForm().getValues().homepageOptions;			Ext.Ajax.request({			url: Eve.url,			params: {				event		: 'modern.group.personal.modifyHomepage'				,homepage	: homepage				,groupId	: Eve.GroupSelect.GroupId			},			success: function(response, options) {				Eve.GroupSelect.Homepage = homepage;								Eve.LayoutManager.sectionName = "";				Eve.LayoutManager.loadSection('Homepage')				Eve.Homepage.OptionsDlg.hide();			}		});		}		//				var selectHomepage_Handler = function(){			var selectedHomepage = Ext.getCmp('hompage-select-form').getForm().getValues().homepageOptions;						if( selectedHomepage == "2" && Eve.GroupSelect.PageId == "0"){				var msgWin = new Ext.Window({                    autoCreate : true                    ,title:''                    ,resizable:false                    ,constrain:true                    ,constrainHeader:true                    ,minimizable : false                    ,maximizable : false                    ,stateful: false                    ,modal: true                    ,shim:true                    ,buttonAlign:'center'                    ,width:400                    ,height:100                    ,minHeight: 80                    ,plain:true                    ,footer:true                    ,closable:true                    ,buttons: [{						text: 'Yes, make this the homepage'						,handler: function(){							msgWin.close();							modifyFilter();						}                    },{						text: 'No, Let me add content first'						,handler: function(){ msgWin.close();}                    }]                });               msgWin.render(document.body);               msgWin.getEl().addClass('x-window-dlg');			   var temp = [	'<div class="ext-mb-content">',							'<span class="ext-mb-text">',							'The section that you selected does not have any content in it yet. Are you sure you want to set it as your home page?',							'</span><br /></div>'						].join('');						                bodyEl = msgWin.body.createChild({html: temp});                msgWin.show();			}			else{				modifyFilter();			}		}					Eve.Homepage.OptionsDlg = new Ext.Window({				title		: 'Choose a homepage'				,resizable	: false				,layout     : 'fit'				,closeAction: 'hide'				,y          : 20				,width		: 450				,height		: 268				,modal  	:true				,items		: [{					layout: 'form'					,xtype: 'form'					,id	  : 'hompage-select-form'					,items:[{						layout		: "column"						,border		: false						,style		: 'border-bottom:1px dotted blue;padding:5px;'						,items		: [{							columnWidth	: .1							,layout		: "form"							,border		: false							,items		: [{								 xtype		: 'radio'								,hideLabel	: true								,name		: 'homepageOptions'								,itemCls	: 'homepage-options'								,checked	: true								,inputValue : '0'								}]						}, {							columnWidth	: .8							,border		: false							,items		: [{								border		: false								,html		: ['<div class="homepage-options-img">',								'<img src="'+Eve.Resource.getIcon('HomePage', 'navbar')+'">',								'</div><div style="margin-top:10px;"',								'<div class="homepage-options-header">Default Group Homepage</div>',								'<div>The default homepage </div>',								'</div>'].join('')								,autoHeight	: true							}]						}]					},{						layout		: "column"						,border		: false						,style		: 'border-bottom:1px dotted blue;padding:5px;'						,items		: [{							columnWidth	: .1							,layout		: "form"							,border		: false							,items		: [{								 xtype		: 'radio'								,hideLabel	: true								,name		: 'homepageOptions'								,itemCls	: 'homepage-options'								,inputValue		: '1'								}]						}, {							columnWidth	: .8							,border		: false							,items		: [{								border		: false								,html		: ['<div class="homepage-options-img">',								'<img src="'+Eve.Resource.getIcon('wiki', 'navbar')+'">',								'</div><div style="margin-top:10px;"',								'<div class="homepage-options-header">Wiki (Simple)</div>',								'<div></div>',								'</div>'].join('')								,autoHeight	: true							}]						}]					},{						layout		: "column"						,border		: false						,style		: 'border-bottom:1px dotted blue;padding:5px;'						,items		: [{							columnWidth	: .1							,layout		: "form"							,border		: false							,items		: [{								 xtype		: 'radio'								,hideLabel	: true								,name		: 'homepageOptions'								,itemCls	: 'homepage-options'								,inputValue		: '2'								}]						}, {							columnWidth	: .8							,border		: false							,items		: [{								border		: false								,html		: ['<div class="homepage-options-img">',								'<img src="'+Eve.Resource.getIcon('HomePage', 'navbar')+'">',								'</div><div style="margin-top:10px;"',								'<div class="homepage-options-header">Site Publisher (Advanced)</div>',								'<div></div>',								'</div>'].join('')								,autoHeight	: true							}]						}]					}					]				}]								,buttons:[{					text: 'Make this my homepage'					,handler: selectHomepage_Handler			}]		})	}	Eve.Homepage.OptionsDlg.show();}/**	END:	Homepage Options Dialog* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Container.js *//*--------------------------------------------------*///-------------------------------------------// @class: Calendar Container//-------------------------------------------Eve.calendar.Container = function(){	this._items = [];	this._wrapper = Eve.calendar.ItemWrapper;		this.addEvents( 'update' );}Ext.extend( Eve.calendar.Container, Ext.util.Observable, {		//-------------------------------------------	// adds a new item to the list of the container	// items	//-------------------------------------------	addItem: function( it ){				for ( var i = 0, len = this._items.length; i < len; ++i ){			if ( this._items[i].wrapped == it )				return false;		}				this._items.push( new this._wrapper(it) );	}		,removeAll: function(){		this._items = [];		this.fireEvent( 'update' );	}	//-------------------------------------------	// removes an item from the list of the container	// items	//-------------------------------------------	,removeItem: function( it ){		var q = this._items.indexOf( it );		if ( q !== -1 ){			this._items.splice( q, 1 );			return 0;		}				for ( var i = 0, len = this._items.length; i < len; ++i ){			if ( this._items[i].get() == it )				this._items.splice( i, 1 );		}	}		//-------------------------------------------	// Changes the wrapper that the container is using	//-------------------------------------------	,setWrapper: function( wrapper ){		this._wrapper = wrapper;	}		,getItems: function(){		return this._items;	}	//-------------------------------------------	// Recalculates the Number of columns that Items	// require to be displayed correctly	//-------------------------------------------	,refreshItems: function(){		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshItems 1): ",(new Date()).getRTime() % 100000);		for ( var i = 0, len = this._items.length; i < len; ++i ){			this._items[i].updateFriends( this._items );		}		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshItems 2): ",(new Date()).getRTime() % 100000);				for ( var i = 0, len = this._items.length; i < len; ++i ){			this._items[i].getNumberOfColumns();		}				//@@Benchmark		//console.log("@@Benchmark -- Time(refreshItems 3): ",(new Date()).getRTime() % 100000);		this._items.sort( this._wrapper.compFunc );				for ( var i = 0; i < this._items.length; ++i ){			delete this._items[i].columnPos;			this._items[i].getPos();		}				//@@Benchmark		//console.log("@@Benchmark -- Time(refreshItems 4): ",(new Date()).getRTime() % 100000);		this.fireEvent( 'update' );		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshItems 5): ",(new Date()).getRTime() % 100000);	}} );//-------------------------------------------// @class: ItemWrapper// @desc : Wraps an item so the container // 		   can use it properly//-------------------------------------------Eve.calendar.AbstractItemWrapper = function( it, ui ){	ui = ui || Eve.calendar.UI;	this.wrapped = it;	this.friends = [];	this.ui = new ui( this );}Eve.calendar.AbstractItemWrapper.compFunc = function( a1, a2 ){	if ( a1.getStart() > a2.getStart() )		return 1;		if ( a1.getStart() < a2.getStart() )		return -1;		if ( a1.getEnd() > a2.getEnd() )		return -1;			if ( a1.getEnd() < a2.getEnd() )		return 1;	return 0;}Eve.calendar.AbstractItemWrapper.prototype = {	//-------------------------------------------	// Returns true if two items 'see' each other	//-------------------------------------------	see: function( it ){ return false; }		,get: function(){		return this.wrapped;	}	//-------------------------------------------	// Returns the start of the wrapped Item	//-------------------------------------------	,getRStart: function(){		return this.wrapped.getRStart();	}		//-------------------------------------------	// Returns the end of the wrapped Item	//-------------------------------------------	,getREnd: function(){		return this.wrapped.getREnd();	}	//-------------------------------------------	// Returns the start of the wrapped Item	//-------------------------------------------	,getStart: function(){		return this.wrapped.getStart();	}		//-------------------------------------------	// Returns the end of the wrapped Item	//-------------------------------------------	,getEnd: function(){		return this.wrapped.getEnd();	}		//-------------------------------------------	// Updates the list of friends	//-------------------------------------------	,updateFriends: function( items ){		// Clear the friends list		this.friends = [];				for ( var i = 0, len = items.length; i < len; ++i ){			var it = items[i];						if ( it == this )				continue;			if ( this.see( it ) )				this.friends.push( it );		}				this.update();	}		//-------------------------------------------	// Calculates the minColLength of the item	//-------------------------------------------	,update: function(){		var fList  = [];		var length = 1;				for ( var i = 0 , len = this.friends.length; i < len; ++i ){			var b = 1;			var friend = this.friends[i];						for ( var j = 0, jlen = fList.length; j < jlen; ++j ){				if ( !friend.see( fList[j] ) ){					b = 0;					break;				}			}						fList.push( friend );			length += b;		}				this.minColLength = length;		this.colLength    = length;		this.colList 	  = {};	}		//-------------------------------------------	// returns the number of columns	//-------------------------------------------	,getNumberOfColumns: function(){		var m = this.minColLength;				for ( var i = 0, len = this.friends.length; i < len; ++i ){			m = Math.max( m, this.friends[i].colLength );		}				if ( m != this.colLength ){							this.colLength = m;						for ( var i = 0, len = this.friends.length; i < len; ++i ){				this.friends[i].getNumberOfColumns();			}			this.colList 	  = {};		}				return this.colLength;	}	,markColumn: function( colNum ){		this.colList[colNum] = 1;	}		,findPos: function(){		for ( var i = 0; i < this.colLength; ++i ){			if ( !this.colList[i] ){				return i;			}		}				alert( 'To QC: Some of your items might be lost... Please report if something is missing' );		return 0;	}		,getPos: function(){		if ( ! this.columnPos ){			this.columnPos = this.findPos();						this.notifyFriendsColumnOccupy( this.columnPos );		}				return this.columnPos;	}	,notifyFriendsColumnOccupy: function( colNum ){		for ( var i = 0, len = this.friends.length; i < len; ++i ){						this.friends[i].markColumn( colNum );		}	}		,getAttributes: function(){		var o = {			start: this.getStart()			,end: this.getEnd()		};		Ext.applyIf( o, this.wrapped.extra );				return o;	}}//-------------------------------------------// @class: ItemWrapper// @desc : Wraps an item so the container // 		   can use it properly//-------------------------------------------Eve.calendar.ItemWrapper = new Ext.extend( Eve.calendar.AbstractItemWrapper, {	//-------------------------------------------	// Returns true if two items 'see' each other	//-------------------------------------------	see: function( it ){		var ss = this.getRStart(), se = this.getREnd(),			ds = it.getRStart()	, de = it.getREnd();					if ( ( ( ds >= ss ) && ( ds < se ) ) ||		     ( ( de > ss ) && ( de <= se ) ) || 		     ( ( ss >= ds ) && ( se <= de ) ) 		   )			return true;				return false;	}	} );Eve.calendar.ItemWrapper.compFunc = function( a1, a2 ){	if ( a1.getStart() > a2.getStart() )		return 1;		if ( a1.getStart() < a2.getStart() )		return -1;		if ( a1.getEnd() > a2.getEnd() )		return -1;			if ( a1.getEnd() < a2.getEnd() )		return 1;//if a1=a2 then we suppose the orginal order is correct.//return 0 mess up the array in Chrome.	return -1;}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/CalendarDrag.js *//*--------------------------------------------------*/Eve.calendar.CalendarDragZone = function(calendarView, config){    this.view = calendarView;	config.ddGroup = config.ddGroup || 'CalendarDD';    Eve.calendar.CalendarDragZone.superclass.constructor.apply(this, [this.view.getItemLayer().dom/* calendarView.dom*/, config || {} ]);	    this.scroll = false;//    this._cal   = calendar;    this.ddel 	= document.createElement('div');    this.ddel.className = 'x-grid-dd-wrap';	this.ddel.style.height = '40px';	this.ddel.style.width  = '125px';	this.ddel.style.overflow = 'hidden';//	this.dropNotAllowed = "x-dd-drop-ok";	};Ext.extend(Eve.calendar.CalendarDragZone, Ext.dd.DragZone, {    getDragData : function(e){        var t = Ext.lib.Event.getTarget(e);		var u = Ext.get(t).up( 'div.x-calendar-item' );		if ( !u )			return false;					var it = this.view.getItemByDom( Ext.fly(u).dom );		if ( it.wrapped.extra.editPer !== "1" )			return false;				this.ddel.innerHTML = u.dom.getElementsByTagName('div')[2].innerHTML;//u.dom.innerHTML;				return { ddel: this.ddel, oldCal: this.view.getCalendar(), 'item': it, fromMultiday: false };    },	    onInitDrag : function(e){        var data = this.dragData;        //this.ddel.innerHTML = 'Being Dragged';//this.grid.getDragDropText();        this.proxy.update(this.ddel);        // fire start drag?    },		onBeforeDrag: function(){		return true;	},	    afterRepair : function(){        this.dragging = false;    },	    getRepairXY : function(e, data){        return false;    },    onEndDrag : function(data, e){        // fire end drag?		return true;    },    onValidDrop : function(dd, e, id){        // fire drag drop?        this.hideProxy();    },    beforeInvalidDrop : function(e, id){    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/CalendarDrop.js *//*--------------------------------------------------*/Eve.calendar.CalendarDropZone = function(calendarView, config){    this.view = calendarView;	config.ddGroup = config.ddGroup || 'CalendarDD';//	debugger;    Eve.calendar.CalendarDropZone.superclass.constructor.apply(this, [this.view.container.dom, config || {}]/* calendarView.dom*/);//	this.ddGroup = "CalendarDD";};Ext.extend(Eve.calendar.CalendarDropZone, Ext.dd.DropTarget, {    //ddGroup : "CalendarDD",        onDragEnter : function(n, dd, e, data){    },    onDragOut : function(n, dd, e, data){    },	onDrag: function(){	},	    onDragDrop : function(n, dd, e, data){        return false;    },		notifyDrop : function( proxy, e, dd ){		var c = e.getXY()[1] - this.view.getBackgroundLayer().getTop();				if ( c < 0 || c > 960 )			return false;					if ( !dd.item )			return false;		var startDate = dd.item.wrapped.extra['start_real'];		var hour = parseInt(startDate.format('G'));		var min = parseInt(startDate.format('i'));		var y1 =  hour * 40 + (min / 60) * 40  ;		var deltaY = c - y1 ;		deltaY  = Math.floor( (deltaY + 10) / 20) * 20;  		c = y1 + deltaY;		var d = this.view.getPositionTranslator().decipher( c );		var c = this.view.getCalendar().getDate();		clearTimeout( this.moveItemTimeout );				this.moveItemTimeout = setTimeout( (function(){this.view.moveItem( dd.item, new Date( c.getFullYear(), c.getMonth(), c.getDate(), d.h,  d.m , 0 ), dd.oldCal )}).createDelegate( this ), 100 );				return false;	},		notifyOver: function( source, e, date ){		var c = e.getXY()[1] - this.view.getBackgroundLayer().getTop();		if ( c < 0 || c > 960 )			return this.dropNotAllowed;					return this.dropAllowed;	}	/*	getTargetFromEvent: function( e ){	}*/});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/View.js *//*--------------------------------------------------*///-------------------------------------------// @class: Eve.calendar.UI// @desc: The UI component that the view will render//-------------------------------------------Eve.calendar.UI = function( it, config ){	this._item = it;		config = config || {};	Ext.applyIf( this, config );		this.init();}Eve.calendar.UI.prototype = {	//-------------------------------------------	// initializes the UI component for rendering	//-------------------------------------------	init: function(){		if ( !this.template ){			if ( !Eve.calendar.UI.Template ){				Eve.calendar.UI.Template = new Ext.XTemplate( '<div style="height: 100%; border: 1px solid #aaa; margin: 1px;"><div style="padding: 5px">Task</div></div>' );			}						this.template = Eve.calendar.UI.Template;		}	}		//-------------------------------------------	// should return a dom or Ext.Element item	//-------------------------------------------	,render: function( container ){		return this.template.apply( this._item.getAttributes() );	}}// Wierdo Drag-Selector, why they think of these things so late....Eve.calendar.DragCreator = function(cfg){    cfg = cfg || {};    var view, regions, proxy, tracker;    var rs, bodyRegion, dragRegion = new Ext.lib.Region(0,0,0,0);    var dragSafe = cfg.dragSafe === true;    var core;    this.init = function(dataView){        core = dataView;        view = dataView.bgLayer;        onRender(view);    };    function fillRegions(){        rs = [];        /*view.all.each(function(el){            rs[rs.length] = el.getRegion();        });        */        bodyRegion = view.getRegion();    }    function cancelClick(){        return false;    }    function onBeforeStart(e){        return !dragSafe || e.target == view.el.dom;    }    function onStart(e){        view.on('containerclick', cancelClick, view, {single:true});        if(!proxy){            proxy = view.createChild({cls:'x-view-selector'});        }else{            proxy.setDisplayed('block');        }        fillRegions();    }    function onDrag(e){        var startXY = tracker.startXY;        var xy = tracker.getXY();        var x = Math.min(startXY[0], xy[0]);        var y = Math.min(startXY[1], xy[1]);        var w = Math.abs(startXY[0] - xy[0]);        var h = Math.abs(startXY[1] - xy[1]);        dragRegion.left = x;        dragRegion.top = y;        dragRegion.right = x+w;        dragRegion.bottom = y+h;        dragRegion.constrainTo(bodyRegion);        proxy.setRegion(dragRegion);/*        for(var i = 0, len = rs.length; i < len; i++){            var r = rs[i], sel = dragRegion.intersect(r);            if(sel && !r.selected){                r.selected = true;                view.select(i, true);            }else if(!sel && r.selected){                r.selected = false;                view.deselect(i);            }        }        */    }    function onEnd(e) {		try {			var c       = core.getCalendar();			var date    = c.getDate();			var pt      = core._pt; // Position translator			var height  = proxy.getHeight();			var top     = proxy.getTop( true );			var start = pt.decipher( top );			var end   = pt.decipher( top + height );			var that = Eve.calendar.Broadcaster;			Eve.calendar.Bubble.showBubble( 				e.getXY(), 				that.createEvent, 				that, { 					date: new Date( date.getFullYear(), date.getMonth(), date.getDate(), start.h, start.m, 0 ) 				}, start, end );			if(proxy){				proxy.setDisplayed(false);			}				} catch(e) {			console.log('e:',e)		}    }    function onRender(view){        tracker = new Ext.dd.DragTracker({            onBeforeStart: onBeforeStart,            onStart: onStart,            onDrag: onDrag,            onEnd: onEnd        });        tracker.initEl(view);    }};//-------------------------------------------// Tha View//-------------------------------------------Eve.calendar.View = function( cal, bgTemplate, positionTranslator, config ){	config = config || {};	Ext.applyIf( this, config );	if ( typeof this.renderTime == 'undefined' )		this.renderTime = true;		this._cal = cal;	this._cal.on( 'refresh', this.refreshView, this );		// set the backgroundTemplate	this._bgTpl = bgTemplate || new Ext.XTemplate( 'Hello world...' );		// set the position Translator of items...	this._pt = positionTranslator;		// Store for the item attributes	this.store = new Ext.data.SimpleStore( { fields: [ 'cnt' ] } );		this.record = Ext.data.Record.create( ['cnt'] );	var that = this;		// The View Template	if ( ! Eve.calendar.View.Template ){		Eve.calendar.View.Template = new Ext.XTemplate( 			'<tpl for=".">',				'<div style="{[this.position( values )]}" class="x-calendar-item">',					'{[this.ui( values )]}',				'</div>',			'</tpl>',			{				calcTip: function( values ){										var t = values.cnt.wrapped;					var extra = t.extra;										return ["<b>Details:</b><br />"						  , "<br />Notes : ",  extra.notes						  , "<br />Calendars : ",  extra.calendars						  , "<br />Created By : ",  extra.createdBy						  , "<br />Modified By : ",  extra.modifiedBy ].join( '' );				}								,position: function( vals ){					it = vals.cnt;					var y 		= that._pt.translate( it.getStart() );					var height 	= that._pt.translate( it.getEnd() ) - that._pt.translate( it.getStart() );										// This task continues in the next day as well					if ( height < 0 ){						//						height = 960 - y;					}										var width	= (95.0 / it.getNumberOfColumns());					var pos		= it.getPos();					var length  = 1;										// Check if the next columns are empty					for ( var i = pos+1; i < it.colLength; ++i ){						if ( !it.colList[i] )							++length;						else							break;					}										return ['position:absolute;',							'overflow: hidden;',							'height:', height, 'px;',							'top:', y, 'px;',							'left:', pos * width, '%;',							'z-index:', '100;',							'width:', length * width, '%;'].join('');				}								,ui: function( vals ){					it = vals.cnt;										return it.ui.render();				}			}		);	}	// Dataview used for showing items	this.dv = new Ext.DataView( {		 itemSelector	: 'div.x-calendar-item'		,tpl			: Eve.calendar.View.Template		,store			: this.store		,singleSelect	: true		,trackOver		: true		,cls			: 'calendar-body'	} );		if ( config.nodeMenu )		this.dv.on( 'contextmenu', config.nodeMenu );		config = {		 titlebar: false		,autoEl	 : { tag: 'div', style: 'position:relative; overflow: auto;' }	}		Eve.calendar.View.superclass.constructor.apply( this, [config] );}Ext.extend( Eve.calendar.View, Ext.Container, {	renderItems: function(){		var arr = this._cal.container.getItems();				// get the sorted array and start to render the items		this.store.removeAll();				for ( var i = 0, len = arr.length; i < len; ++i ){			this.store.add( new this.record( { cnt: arr[i] } ) );		}				this.store.commitChanges();				if ( !this.dv.rendered ){			this.dv.render( this.el );		}				// Add the Red Line...		var y 		= this._pt.translate( new Date() );		var d		= this.getBackgroundLayer().dom;				if ( d.lastChild.tagName.toLowerCase() == 'hr' )			d.removeChild( d.lastChild );		d.innerHTML += '<hr style="z-index: 2; position: absolute; top: ' + y + 'px; border-top: 1px solid red; border-bottom: 0px none; width: 100%" />';	}		,getCalendar: function(){		return this._cal;	}	,getItemByDom: function( u ){		var rec = this.dv.getRecord( u );		return rec ? rec.get('cnt') : false;	}		,getPositionTranslator: function(){		return this._pt;	}		,getItemLayer: function(){		return this.itemLayer;	}		,getBackgroundLayer: function(){		return this.bgLayer;	}		,refreshView: function(){		this.renderItems();	}		,moveItem: function( it, date, oldCal, fromMultiday ){		if ( this._cal.fireEvent( 'beforemove', it, date, oldCal ) ){			// Normal procedure would be			// Delete item from the old Calendar			// Add it to the new View			// refresh items in container			// and rerender the whole thing			oldCal.getContainer().removeItem( it );						if ( oldCal != this._cal ){				oldCal.container.refreshItems();				oldCal.getView().refreshView();			}			// It's not an allday event anymore...			it.get().extra.allDay = false;				it.get().moveTo( date );			this._cal.addItem( it.get() );						// Refresh the items			this._cal.container.refreshItems();			this.refreshView();						this._cal.fireEvent( 'move', it, date, oldCal );		}	}		,resizeItem: function( it, startDate, endDate ){		if ( this._cal.fireEvent( 'beforeresize', it, startDate, endDate ) ){					// Normal procedure would be			// Delete item from the old Calendar			// Add it to the new View			// refresh items in container			// and rerender the whole thing						this._cal.removeItem( it );						it.get().resizeTo( startDate, endDate );			this._cal.addItem( it.get() );						// Refresh the items			this._cal.container.refreshItems();			this.refreshView();						this._cal.fireEvent( 'move', it, startDate, endDate );		}	}		,resizeItemResizableAdapter: function( rz, w, h, e, index, node ){			var c = this.getCalendar().getDate();		var aa = rz.getEl().getXY()[1] - this.getBackgroundLayer().getTop();		aa = (aa < 0) ? 0 : aa;		aa = (aa > 960) ? 960 : aa;		aa = Math.floor((aa + 10 )/20)* 20;		var bb = aa + h;		bb = (bb < 0) ? 0 : bb;		bb = (bb > 960) ? 960 : bb;        bb = Math.floor((bb + 10 )/20)* 20;		start = this.getPositionTranslator().decipher( aa );		end   = this.getPositionTranslator().decipher( bb );				start = new Date( c.getFullYear(), c.getMonth(), c.getDate(), start.h, this._pt.gapTime( start.m ), 0 );		end   = new Date( c.getFullYear(), c.getMonth(), c.getDate(), end.h  , this._pt.gapTime( end.m ), 0 );				// get the record;		var it = this.dv.getRecord( node ).get('cnt');		this.resizeItem( it, start, end );		/*		var c = this.getCalendar().getDate();		// Calculate the length of the event		h = this.getPositionTranslator().decipher( h );				var d = ( h.h * 3600 + h.m * 60 ) * 1000;				// get the record;		var it = this.dv.getRecord( node ).get('cnt');				var start = 0, end = 0;		if ( rz.activeHandle.position.indexOf( 'north' ) !== -1 ){			start = it.getEnd() - d;			end   = it.getEnd();		}else{			start = it.getStart();			end   = it.getStart() + d;		}		start = this.getPositionTranslator().getHMS( start );		end   = this.getPositionTranslator().getHMS( end );				start = new Date( c.getFullYear(), c.getMonth(), c.getDate(), start.h, this._pt.gapTime( start.m ), 0 );		end   = new Date( c.getFullYear(), c.getMonth(), c.getDate(), end.h  , this._pt.gapTime( end.m ), 0 );				this.resizeItem( it, start, end );		*/	}		,afterRender: function(){		Eve.calendar.View.superclass.afterRender.apply( this, arguments );		Ext.DomHelper.append( this.el, '<div class="calendar-body" style="position:absolute; width: 100%"></div>' );				this.bgLayer   = new Ext.Element( this.el.dom.firstChild );		this._bgTpl.append( this.getBackgroundLayer(), { renderTime: this.renderTime } );				this.renderItems();		this.itemLayer = this.dv.el;				this.ddDrag = new Eve.calendar.CalendarDragZone( this, { hasOuterHandles: true, ddGroup: this.ddGroup } );		this.ddDrop = new Eve.calendar.CalendarDropZone( this, { ddGroup: this.ddGroup}/*{ hasOuterHandles: true }*/ );		//this.dv.on('render', function(){				this.getEl().dom.style.height = "960px";		        //var dc = new Eve.calendar.DragCreator();        //dc.init( this );		this.dv.on('mouseenter', this.showResizable, this );		this.dv.on('dblclick', this.fireNodeDblClick, this );		this.el.on('click', this.fireBodyClick, this );	}		,fireBodyClick: function( e, ele ){		this._cal.fireEvent( 'click', e, ele, this._cal );        return true;	}		,fireNodeDblClick: function( dv, index, node, e ){		e.stopEvent();		this._cal.fireEvent( 'nodedblclick', dv, dv.getRecord( node ).get('cnt'), index );	}		,_hideResizable: function(){		if ( this._rz )			this._rz.destroy();					this._rz = null;	}	,showResizable: function( dv, index, node, e ){		this._hideResizable();				this._rz = new Ext.Resizable( node, { handles: 'n s', minHeight: 20, transparent: true, pinned: true  } );		this._rz.on( 'resize', this.resizeItemResizableAdapter.createDelegate( this, [ index, node ], true ) );	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Calendar.js *//*--------------------------------------------------*///// JavaScript DocumentExt.override(Ext.ToolTip,{	dismissDelay:0});Date.prototype.getRTime = function(){	Date.OFFSET = Date.OFFSET || ( (new Date()).getTimezoneOffset() * 60 * 1000 );	return (this.getTime() - Date.OFFSET);}//-------------------------------------------// @author: Omid Alipour Fard//-------------------------------------------// -----------------------------------------------------------------------// Wierdo Calendar Menu// -----------------------------------------------------------------------/* commented by ghazal , moved to calendarGridImp.jsEve.calendar.iCalendarMenu = new Ext.menu.Menu({	items: [{		text: 'Edit'		,icon	: Eve.Resource.getIcon('edit', 'general')		,handler: function(){ Eve.calendar.iCalendarMenu.popNodeDialog(); }	}, {		text: 'Delete'		,icon	: Eve.Resource.getIcon('delete', 'general')		,handler: function(){ Eve.calendar.iCalendarMenu.popDeleteDialog(); }	}]} );*///-------------------------------------------// A sample item for viewing//-------------------------------------------/*Eve.calendar.Sample = function( start, end ){	this.start = start;	this.end   = end;}Eve.calendar.Sample.prototype = {	getStart: function(){		return this.start;	}		,getEnd: function(){		return this.end;	}}*/Eve.calendar.Registery = { 	Tasks: {		WhichDate: 'startDate'	}	, 	Calendar: {		CheckedNodes: ""	} };//------------------------------------------------------------------------------------------------------// Will be wrapped by ItemWrapperEve.calendar.DateTimeItem = function( start, end, extra ){	this.extra = extra;	this.startDate = start;	this.endDate = end;	if ( !Eve.calendar.DateTimeItem.offset ){		Eve.calendar.DateTimeItem.offset = (new Date()).getTimezoneOffset() * 60 * 1000;	}	this.offset = Eve.calendar.DateTimeItem.offset;}Eve.calendar.DateTimeItem.prototype = {	getRStart: function(){		return this.startDate.getRTime();	}		,getStart: function(){		return this.startDate.getTime();	}		,getREnd: function(){		return this.endDate.getRTime();	}		,getEnd: function(){		return this.endDate.getTime();	}	,moveTo: function( date ){		var diff = this.endDate.getRTime() - this.startDate.getRTime();		var ss   = date.getTime();		var off  = 0;//3600 * 1000; //date.getTimezoneOffset() * 60 * 1000;				this.startDate = new Date( ss - off );		this.endDate   = new Date( Math.min( (new Date( this.startDate.getFullYear(), this.startDate.getMonth(), this.startDate.getDate() + 1, 0, -5 )).getTime(), ss + diff - off ) );		var diff_real  = this.extra.end_real.getRTime() - this.extra.start_real.getRTime();		this.extra.start_real = new Date( ss - off );		this.extra.end_real   = new Date( Math.min( (new Date( this.extra.start_real.getFullYear(), this.extra.start_real.getMonth(), this.extra.start_real.getDate() + 1, 0, -5 )).getTime(), ss + diff_real - off ) );	}		,resizeTo: function( start, end ){		this.startDate = start;		this.endDate   = end;				this.extra.start_real = start;		this.extra.end_real   = end;			}};Ext.ns('Eve.calendar.Daily');Eve.calendar.Sample = Eve.calendar.DateTimeItem;//Eve.calendar.//-------------------------------------------// Daily Calendar Wrapper//-------------------------------------------Eve.calendar.Daily = function( config ){	config = config || {};	// Overwrite this element with the supplied configuration	Ext.apply( this, config );		this.activeDate = new Date();	this.addEvents( 'date_changed', 'refresh_calendar', 'move', 'beforemove', 'dblclick' );		this.init();};Eve.calendar.Daily.PositionTranslator = {	translate: function( x ){		//( x % 14400000 )		var u = Eve.calendar.Daily.PositionTranslator.getHMS( x );		return ( u.h * 40 + u.m * 40 / 60 - ((Ext.isIE) ? 0 : 0) );	}		/*,getHMS: function( x ){				this.offset = this.offset || (new Date()).getTimezoneOffset() * 60 * 1000;				x -= this.offset;		// Ignore the millisecond part		x /= 1000;				x = x % 86400;				var hour 	= Math.floor( x / 3600 );		var minute  = Math.floor( (x % 3600) / 60 );		var sec  	= Math.floor( x % 60 );				return { h: hour, m: minute, s: sec };	}*/	//majid	,getHMS: function( x ){						this.offset = this.offset || 0;						x -= this.offset;			var date = new Date( x );			return { h: date.getHours(), m: date.getMinutes(), s: date.getSeconds() };	}	//majid		,decipher: function( y, extra ){		y += ((Ext.isIE) ? 0 : 0);		var hour = Math.floor( y / 40 );		var minute = Math.floor(( y % 40 ) * 60 / 40);				if ( hour >= 24 ){			hour = 24;			minute = 0;		}		return { h: hour, m: minute };	}		,gapTime: function( min ){		return Math.floor( min / 5 ) * 5;	}};// Default BackgroundEve.calendar.Daily.BackgroundTemplate =  new Ext.XTemplate( '{[this.generateBg( values )]}', {	generateBg: function( values ){		var dc = '';		var rt = values.renderTime || false;				for ( var i = 0; i < 48; ++i ){			if ( i == 0 ){				dc = '<div style="width: 100%; border-top: 1px solid #fff; background-color: ' + ( (i % 4 < 2 ) ? '#eee' : '#fff') + '; height: 19px;font: 10pt tahoma; color: #aaa; ">&nbsp;</div>';				continue;			}			if ( i % 2 )				dc += '<div style="width: 100%; border-top: 1px dashed #ddd; background-color: ' + ( (i % 4 < 2  ) ? '#eee' : '#fff') + '; height: 19px;font: 10pt tahoma; color: #aaa; ">&nbsp;</div>';			else				dc += '<div style="width: 100%; border-top: 1px solid #ccc; background-color: ' + ( (i % 4 < 2 ) ? '#eee' : '#fff') + '; height: 19px;font: 10pt tahoma; color: #aaa; ">&nbsp;</div>';					}		return dc;	}} );Eve.calendar.Daily.DefaultNodeUI = Ext.extend( Eve.calendar.UI, {	init: function(){		this.template = new Ext.XTemplate(	'<b class="c-corner" style="position:absolute;top:0px;width: 100%; overflow:visible;">',	    '<b class="c-corner1" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner2" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner3" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner4" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner5" style="background-color:#{color}; border-color:#{color}"></b>',	'</b>',		'<div style="padding: 0px; width: 100%; position: absolute; top: 2px; bottom: 4px;">',		'<div style="position:absolute; height:100%; width:100%;">',		'<div style="border-width: 1px; border-style:solid; border-color: #{color}; padding: 0px 2px 0px 5px;color: white; background: #{color}; left: 0px; width: 100%; height:100%; font: 8pt \'Tahoma\'"  ext:qtip="{[this.qtip( values )]}">',		'<div  ext:qtip="{[this.qtip( values )]}" style="font-weight:bold;">',		//'{[ this.wrapUp( values, "subject", "" )]}<br />',		'<span ext:qtip="{[this.qtip( values )]}" style="color: {[ this.getTextColor(values.color) ]}">{[ this.getSubject( values)]}</span><br />',		//'<b>{[ this.toTimeString( values, 0 ) ]}-{[ this.toTimeString( values, 1 ) ]}</b><br />',		'{[ this.wrapUp( values, "location", "()" )]}<br />',		'{[ this.wrapUp( values, "group", "[]" )]}',		'</div></div></div></div>',	'<b class="c-corner" style="position:absolute; bottom: 0px;width:100%;">',	    //'<b class="c-corner5" style="background-color:#{color}; border-color:#{color}"></b>',	    //'<b class="c-corner4" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner3" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner2" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner1" style="margin:0px 2px;background-color:#{color}; border-color:#{color}"></b>',	'</b>'		   ,{			getTextColor : function(bgColor) {				var lightColors = ['FFFFFF', 'CCFFFF', 'CCFFCC', 'FFFF99', 'FFCC99', '00CCFF', '00FFFF', '00FF00', 'FFFF00', 'FFCC00']				bgColor			= bgColor.toUpperCase();				if ( lightColors.indexOf(bgColor) != -1 ) {					return '#000000';				}				return '#FFFFFF';			}, 		   toTimeString: function( values, isEnd ){			   var s = (new Date( isEnd ? ( values.end_real ) : ( values.start_real )));			   /*			   var h = s.getHours();			   var m = s.getMinutes();			   if ( m == 0 ){				   m = '';			   }else if( m < 10 ){				   m = ':0' + m;			   }else{				   m = ':' + m;			   }			   			   var sign = (h > 11) ? 'pm' : 'am';			   h -= ( h > 12 ) ? 12 : 0;			   			   return h + m + sign;			   */			   return s.format(Eve.Preference.get('timeFormat')/*"g:i A"*/);		   }		   		   ,qtip: function( values ){						   var extra = values;			   var qtip_ready = function(val){				   val = val || '';				   return val.replace(/"/g, '&quot;' );			   }			   var end = new Date(values.end );			   var start = new Date(values.start);			   var tip = ["<b>Details:</b><br />"				  , "Title : "			, qtip_ready(extra.subject) || ''				  , "<br />Location : "	, qtip_ready(extra.location) || ''				  , "<br />Start : ",  extra.start_real.format([Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y g:i A'*/)				  , "<br />End : ",   extra.end_real.format([Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y g:i A'*/)				  , "<br />Notes : ",  qtip_ready(extra.notes) || ''				  , "<br />Calendars : ",  qtip_ready(extra.calendars) || ''				  , "<br />Created By : ",  qtip_ready(extra.createdBy) || ''				  , "<br />Last Modified : ",  qtip_ready(extra.modifiedBy) || '' ].join( '' );			   return tip;		   }		   ,wrapUp: function( values, item, wrapper ){				if ( values[item] != undefined && values[item].length > 0 ){					switch( wrapper ){						case '()':							return '(' + values[item] + ')';						case '[]':							return '[' + values[item] + ']';						case '{}':							return '{' + values[item] + '}';						case "":							return values[item];					}				};								return '';		   }		   ,getSubject: function( values){   				var end = new Date(values.end );			   	var start = new Date(values.start);				if((values.end - values.start) < 3600000)					return [start.format(Eve.Preference.get('timeFormat')/*'g:ia'*/), ' - ', values.subject].join('')				else					return [start.format(Eve.Preference.get('timeFormat')/*'g:ia'*/), ' - ', end.format(Eve.Preference.get('timeFormat')/*'g:ia'*/), '<br/>', values.subject].join('');		   }		   ,darkenColor: function( values ){				var color = values.color;								var c 	  = parseInt( color, 16 );				var r = c >> 16;				var g = ( c >> 8 ) % 256;				var b = ( c % 256 );								var threshold = 50;								r = ( r < threshold ) ? 0 : (r - threshold);				g = ( g < threshold ) ? 0 : (g - threshold);				b = ( b < threshold ) ? 0 : (b - threshold);								return ['rgb(', r, ',', g, ',', b, ')'].join('');		   }		});			}} );	// New Wrapper in order to use the UIEve.calendar.Daily.DefaultWrapper = function( it ){	Eve.calendar.Daily.DefaultWrapper.superclass.constructor.apply( this, [it, Eve.calendar.Daily.DefaultNodeUI] );}// Dont change the comparision function...Eve.calendar.Daily.DefaultWrapper.compFunc = Eve.calendar.ItemWrapper.compFunc;Ext.extend( Eve.calendar.Daily.DefaultWrapper, Eve.calendar.ItemWrapper );Ext.extend( Eve.calendar.Daily, Ext.util.Observable, {	init: function(){		if ( !this.container )			this.container = new Eve.calendar.Container();		this.viewConfig = this.viewConfig || {};				Ext.apply( this.viewConfig, { nodeMenu: this.nodeMenu } );		this.container.setWrapper( this.wrapper || Eve.calendar.Daily.DefaultWrapper );		if ( !this.view )			this.view = new Eve.calendar.View( this, this.bgTemplate || Eve.calendar.Daily.BackgroundTemplate, this.positionTranslator || Eve.calendar.Daily.PositionTranslator, this.viewConfig );					this.activeDate = new Date();				// Multiday Calendar		this.multiday = new Eve.calendar.Multiday({			parent				: this			,handleNodeDblClick	: this.handleNodeDblClick			,handleDblClick		: this.handleDblClick			,nodeMenu			: this.nodeMenu			,viewConfig			: {				ddGroup		: this.viewConfig.ddGroup				,section	: 'daily'				,titleClick	: this.titleClick				,nodeMenu	: this.nodeMenu			}		});	}		,getMultidayCalendar: function(){		return this.multiday;	}		,releaseDD: function(){		this.multiday.getView().releaseDD();	}		,initDD: function(){		this.multiday.getView().initDD();	}	// Sets the *Calendar Date* to the new Date	,setDate: function( date ){		this.activeDate = date;		this.multiday.setDate( date );				this.fireEvent( 'date_changed', this, date );	}		,getDate: function( date ){		return this.activeDate;	}		,getView: function(){		return this.view;	}		,getHeader: function(){		return this.multiday.getView();	}		,getContainer: function(){		return this.container;	}		,addItem: function( it ){		this.getContainer( it ).addItem( it );	}		,removeItem: function( it ){		this.getContainer( it ).removeItem( it );	}		,removeAll: function(){		if( this.multiday )			this.multiday.getContainer().removeAll();		this.getContainer().removeAll();	}} );// New Item BubbleEve.calendar._Bubble = function(){	this.addEvents( 'newItem' );		this._bbTpl = new Ext.XTemplate( 		'<div class="x-calendar-bubble" id="tt__1337">',			'<div class="x-calendar-bg" >',				'<div class="x-calendar-left" ></div>',				'<div class="x-calendar-middle2"></div>',				'<div class="x-calendar-middle" ></div>',				'<div class="x-calendar-right"></div>',			'</div>',			'<div class="x-calendar-content">',					'<div style="width: 100%"><div style="float: left;font-weight: 900; padding-bottom: 10px">Create new Event:</div><div style="float: right; padding:0px 2px; border: 1px solid gray; cursor: pointer;" id="tt__close__1337">X</div></div>',					'<div style="padding: ' + (( Ext.isIE ) ? '10px' : '35px') + ' 10px;">',						'<div>',							'<label for="tt__input__1337">Subject : &nbsp;&nbsp;&nbsp;</label><input id="tt__input__1337" type="text" style="width: 200px" width="50"/>',						'</div>',						'<div style="padding-top: 10px">',							'<label for="tt__input__1337_calendar">Calendar : &nbsp;&nbsp;</label><select id="tt__input__1337_calendar" style="width: 100px"></select>',						'</div>',						'<div style="padding-top: 10px">',							'<label for="tt__input__1337_start">Start : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><select id="tt__input__1337_start" style="width: 60px"></select>',							'&nbsp;&nbsp;<label for="tt__input__1337_end">End : &nbsp;&nbsp;&nbsp;</label><select id="tt__input__1337_end" style="width: 60px"></select>',						'</div>',						'<div style="margin: 20px 0px 0px 15px; bottom: 0px; color: #39F; width: 80px; float: left;"><a href="#" onclick="Eve.calendar.Bubble.commitBubble()"><b>Create Event</b></a></div>',						'<div style="margin: 20px 0px 0px 15px; bottom: 0px; color: #39F; width: 80px; float: left;"><a href="#" onclick="Eve.calendar.Bubble.showDetails()"><b>Details</b></a></div>',					'</div>',			'</div>',		'</div>'	);}Ext.extend( Eve.calendar._Bubble, Ext.util.Observable, {	showBubble: function( where, callback, scope, extra, startTime, endTime ){		this.__cc = callback;		this.__extra = extra;		this.__scope = scope;				// Ehem... Hide the other junk		Eve.calendar.MonthlyBubble.hide();						var getSizes = function(){			var myWidth = 0, myHeight = 0;			if ( typeof (window.innerWidth) !== 'undefined' ){				return [ window.innerWidth, window.innerHeight ];			}else if ( document.documentElement &&				( document.documentElement.clientWidth ||				  document.documentElement.clientHeight ) ){				return [ document.documentElement.clientWidth, document.documentElement.clientHeight ];			}else if ( document.body &&				( document.body.clientWidth ||				  document.body.clientHeight ) ){				return [ document.body.clientWidth, document.body.clientHeight ];			}						return [0,0];		};				if ( !this.el ){			this.el = this._bbTpl.append( Ext.getBody(), {}, true );			this.el.setXY( [ Math.min( where[0] - 297, getSizes()[0] - 324 ), where[1] - 247] );			//this.el.show();						this.elTextBox = Ext.get('tt__input__1337' );//event=modern.calendar.personal.edit&id=0			this.elCloseBox = Ext.get('tt__close__1337');			this.calBox	    = Ext.get('tt__input__1337_calendar');			this.startBox   = Ext.get('tt__input__1337_start');			this.endBox		= Ext.get('tt__input__1337_end');						this.fillTimeBox();			this.elCloseBox.on('click', this.closeBubble, this );						// Load CalBox			this.loadCalBox();		}				if ( this.isLoading ){			this.reloadArgs = arguments;			return false;		}		        var stf = startTime || { h: extra.date.getHours(), m: extra.date.getMinutes() };        var etf = endTime   || { h: extra.date.getHours() + 1, m: extra.date.getMinutes() };		var sth  = stf.h || extra.date.getHours();		var stm  = stf.m || extra.date.getMinutes();		var eth  = etf.h || extra.date.getHours() + 1;		var etm  = etf.m || extra.date.getMinutes();		this.elTextBox.dom.value    = '';				if ( sth == 23 && stm > 45 )			this.startBox.dom.value = this.formatTime( 23, 30 );		else			this.startBox.dom.value = this.formatTime( sth, stm );				if ( sth == 23 && ( !startTime || !endTime ) )			this.endBox.dom.value = this.formatTime( 23, 45 );		else			this.endBox.dom.value = this.formatTime( eth, etm );						this.el.setXY( [ Math.min( where[0] - 297, getSizes()[0] - 324 ), where[1] - 247] );		this.el.show();		this.elTextBox.dom.focus();	}		,formatTime: function( hour, min ){		min = Math.floor( min / 15 ) * 15;		var format = "";		if ( hour < 10 ){			format += "0" + hour;		}else{			format += hour;		}				format += ":";				if ( min < 10 ){			format += "0" + min;		}else{			format += min;		}				return format;	}		,extractTime: function( format ){		var t = format.split( ":" );				var h = parseInt( t[0], 10 );		var m = parseInt( t[1], 10 );				return { h: h, m: m };	}	,fillTimeBox: function(){		var t 		= 24 * 60;		var tGap 	= 15.0;		var dh 			= Ext.DomHelper;		var numGaps = t / tGap;				for ( var i = 0; i < numGaps; ++i ){			var time = (i * tGap);			var hour = Math.floor( time / 60 );			var min  = time % 60;			var format = this.formatTime( hour, min );						if ( !Ext.isIE ){				dh.append( 'tt__input__1337_start', {					tag: 'option', value: format, html: format				} );				dh.append( 'tt__input__1337_end', {					tag: 'option', value: format, html: format				} );			}else{			    var opt1 = Ext.get('tt__input__1337_start').dom;			    var opt2 = Ext.get('tt__input__1337_end').dom;			    opt1.options.add( new Option( format, format ) );			    opt2.options.add( new Option( format, format ) );			}		}	}		,loadCalBox: function(){		this.isLoading = true;	    this.filterBubble();		Ext.Ajax.request( {			params: {				event:'modern.calendar.personal.edit',id:0			}			,url: Eve.url			,success: this.doneLoading			,scope: this		} );	}		,doneLoading: function( response ){		var xml = response.responseXML;		var dq  = Ext.DomQuery;		var dh = Ext.DomHelper;		var f  = dq.select('calendars', xml);		var sE = dq.select('row', f );				for ( var i = 0; i < sE.length; ++i ){			var id = dq.selectValue( 'id'	, sE[i] );			var title = dq.selectValue( 'title', sE[i] );			if ( !Ext.isIE	){				dh.append( 'tt__input__1337_calendar', {					tag: 'option', value: id, html: title				} );			}else{				var opt = Ext.get('tt__input__1337_calendar').dom;				opt.options.add( new Option( title, id ) );			}		}				this.isLoading = false;		this.showBubble.apply( this, this.reloadArgs );	}	    ,filterBubble: function(){        var opt1 = Ext.get('tt__input__1337_start');        var opt2 = Ext.get('tt__input__1337_end');        opt1.on( 'change', function(){            if ( opt2.dom.value < opt1.dom.value )                opt2.dom.value = opt1.dom.value;        } );        opt2.on( 'change', function(){            if ( opt2.dom.value < opt1.dom.value )                opt1.dom.value = opt2.dom.value;        } );    }	,closeBubble: function(){		if ( !this.el )			return false;				this.el.hide();		this.resetBubble();	}		,commitBubble: function(){		if ( this.elTextBox.dom.value.trim().length == 0 )			return false;				if ( this.startBox.dom.value >= this.endBox.dom.value )			return false;				this.__extra.startTime = this.extractTime( this.startBox.dom.value );		this.__extra.endTime   = this.extractTime( this.endBox.dom.value );				if ( this.__cc )			this.__cc.apply( this.__scope, [ this.__extra, this.elTextBox.dom.value.trim(), this.calBox.dom.options[this.calBox.dom.selectedIndex].value ] );					this.el.hide();		this.resetBubble();	}		,showDetails: function(){		var startTime = this.extractTime( this.startBox.dom.value );		var endTime   = this.extractTime( this.endBox.dom.value );				this.el.hide();		this.resetBubble();		Eve.Resource.superbridge.broadcast( window, 'calendar_create_item_dlg', 			{ 				info : { groupId: 0, parentId: 0, id: 0, path: "\\", root: "Personal", 					startTime: startTime, endTime: endTime, 					title: this.elTextBox.dom.value.trim(),					calendar: this.calBox.dom.options[this.calBox.dom.selectedIndex].value 				} 			}		);	}	,resetBubble: function(){		this.__cc = null;		this.__extra = null;		this.__scope = null;	}} );Eve.calendar.Bubble = new Eve.calendar._Bubble();Eve.calendar.TopToolbar = function(){	this.tpl = new Ext.XTemplate( 		'<div class="x-calendar-toptoolbar" style="width: 400px; float: left; height: 40px;">',			'<div class="x-calendar-toolbar-spacer"></div>',			'<div class="x-calendar-back"></div>',			'<div class="x-calendar-toolbar-spacer"></div>',			'<div class="x-calendar-forward"></div>',			'<div class="x-calendar-toolbar-spacer"></div>',			'<div class="x-calendar-toolbar-title">&nbsp;</div>',		'</div>'	);		this.addEvents( 'back', 'forward' );		Eve.calendar.TopToolbar.superclass.constructor.apply( this, arguments )}Ext.extend( Eve.calendar.TopToolbar, Ext.util.Observable, {	getEl: function( extra ){		if ( !this.el ){			this.el = Ext.get(document.createElement( 'div' ));			this.cnt = this.tpl.append( this.el, {}, true );			extra = extra || {};						Ext.apply( this.el, extra  );			this.registerEvents();		}				return this.el;	}		,registerEvents: function(){		if ( !this.el )			return false;								this.el.on('click', this.handleClick, this );	}		,handleClick: function( e ){		var target = Ext.get( e.getTarget() );				if ( target.hasClass('x-calendar-back') ){			this.fireEvent( 'back' );		}else if ( target.hasClass('x-calendar-forward' ) ){			this.fireEvent( 'forward' );		}	}		,setText: function( text ){		if ( !this.el )			return false;					var p = this.cnt.down('.x-calendar-toolbar-title');				if ( !p )			return false;					p.dom.innerHTML = text;	}} );/*// New UI for Task Items	var MyUI = Ext.extend( Eve.calendar.UI, {		init: function(){			this.template = new Ext.XTemplate( //'<div style="margin: 0px 5px 0px 5px; border: 1px solid #99BBe8; overflow: hidden; background: #d9e8fb; color: black; height: 100%" >',											   //'<div class="x-calendar-header" ext:qtip="<b>Start:</b> {[ this.toTimeString( values, 0 ) ]}</br><b>End&nbsp;&nbsp;&nbsp;: </b>{[ this.toTimeString( values, 1 ) ]}">', 											   <div style="padding: 5px"><div style="border: 1px solid #aaa; padding: 5px; -moz-border-radius: 10px; background: ',											   'white; margin-bottom: 5px; height: 80%; font: 8pt \'Tahoma\'">Start :{[ this.toTimeString( values, 0 ) ]}<br />End&nbsp;&nbsp;&nbsp;:',											   '{[ this.toTimeString( values, 1 ) ]}</div></div>',{												   toTimeString: function( values, isEnd ){													   var s = (new Date( isEnd ? ( values.end ) : ( values.start )));													   													   return ' [ '  + s.getHours() + ':' + s.getMinutes() + ' ] ';												   }											   });					}	} );		// New Wrapper in order to use the UI	var DefaultWrapper = function( it ){		DefaultWrapper.superclass.constructor.apply( this, [it, MyUI] );	}		// Dont change the comparision function...	DefaultWrapper.compFunc = Eve.calendar.ItemWrapper.compFunc;		Ext.extend( DefaultWrapper, Eve.calendar.ItemWrapper );		// A simple position translator	// The real thing should be from DATE to XY position	// and vica versa...	Eve.calendar.PositionTranslator = {		translate: function( x ){			return x * 40;		}				,decipher: function( y ){			return y / 40.0;		}	}		a.setWrapper( DefaultWrapper );	// A simple stripe Background Template for the Calendar	var bgTemplate = new Ext.XTemplate( '{[this.generateBg()]}', {													generateBg: function(){														var dc = '';														for ( var i = 0; i < 24; ++i ){															dc += '<div style="width: 100%; border-top: 1px solid #ccc; background-color: ' + (( i % 2  ) ? '#eee' : '#fff') + '; height: 38px;"></div>';														}																												return dc;													}												} );			// A View...	window.v = new Eve.calendar.View( { on: function(){}, container: window.a }, bgTemplate, Eve.calendar.Daily.PositionTranslator );		*//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Weekly.js *//*--------------------------------------------------*/// JavaScript DocumentEve.calendar.Weekly = function( config ){	config = config || {};	// Overwrite this element with the supplied configuration	Ext.apply( this, config );		this.numberOfDays = config.numberOfDays || 7;	this.activeDate = new Date();	this.addEvents( 'date_changed', 'refresh_calendar', 'move', 'beforemove', 'dblclick' );	this.randomId = 'id_' + Math.random() * 4000;	this.init();};Ext.extend( Eve.calendar.Weekly, Ext.util.Observable, {	init: function(){		if ( !this.container )			this.container = new Eve.calendar.Container();				this.container.setWrapper( this.wrapper || Eve.calendar.Daily.DefaultWrapper );		if ( !this.view ){						this.views = [];			this.cals  = [];			for ( var i = 0; i < this.numberOfDays; ++i ){				this.cals.unshift( new Eve.calendar.Daily( { viewConfig: { ddGroup: this.viewConfig.ddGroup, renderTime: ( i == (this.numberOfDays-1) )}, nodeMenu: this.nodeMenu, titleClick: this.titleClick } ) );								this.cals[0].getView().columnWidth = (1 / this.numberOfDays);				this.cals[0].getView().style	   = 'height: 100%; overflow:hidden; border-right: 1px dashed #cccccc';								this.cals[0].on( 'move'	, this.fireMove, this );				this.cals[0].on( 'nodedblclick', this.fireNodeDblClick, this );				this.cals[0].on( 'click', this.fireClick, this );												this.views.unshift( { 								      columnWidth: (1 / this.numberOfDays)								    //, style: 'height: 100%; '//overflow-y:auto' 									, layout: 'anchor'									, xtype: 'container'									, autoEl: { tag: 'div' }									, items: [ this.cals[0].getView() ] 								  } );				//this.views[0].setDate();			}			this.views.push( { width: 20 + ( ( Ext.isIE ) ? 18 : 0 ), xtype:'container', autoEl: { tag: 'div', style:'height: 3px;' } } );						this.view = /*new Ext.Container(*/ { autoEl: { tag: 'div' }										  	,layout: 'column'											,items : this.views											,style : 'overflow-y: auto'											,xtype : 'container'											,listeners: {												'render': {													'fn': function( comp ){																											}												}											}										  };// );//new Eve.calendar.View( this, this.bgTemplate || Eve.calendar.Daily.BackgroundTemplate, this.positionTranslator || Eve.calendar.Daily.PositionTranslator );		}				this.activeDate = new Date();		this.multiday = new Eve.calendar.Multiday( {			parent: this			, nodeMenu: this.nodeMenu			, handleNodeDblClick: this.handleNodeDblClick			,handleDblClick		: this.handleDblClick			, viewConfig:{ ddGroup: this.viewConfig.ddGroup, titleClick: this.titleClick, nodeMenu: this.nodeMenu}  } );		this.multiday.setNumberOfDays( 7 );	}		,fireClick: function(){		Array.prototype.unshift.apply( arguments, ['click'] );		this.fireEvent.apply( this, arguments );	}	,fireMove: function(){		Array.prototype.unshift.apply( arguments, ['move'] );		this.fireEvent.apply( this, arguments );	}		,fireNodeDblClick: function(){		Array.prototype.unshift.apply( arguments, ['nodedblclick'] );		this.fireEvent.apply( this, arguments );	}					,fireBeforeMove: function(){		Array.prototype.unshift.apply( arguments, ['beforemove'] );		this.fireEvent.apply( this, arguments );	}		,getMultidayCalendar: function(){		return this.multiday;	}		,releaseDD: function(){		this.multiday.getView().releaseDD();	}		,initDD: function(){		this.multiday.getView().initDD();	}	// Sets the *Calendar Date* to the new Date	,setDate: function( date ){		this.activeDate = date;		this.multiday.setDate( date );		// Change the date on the items				for ( var i = 0; i < this.numberOfDays; ++i ){			/*var sdate =  new Date( date.getTime() + 3600 * 24 * 1000 * i );*/			//majid			var sdate = new Date(date);			sdate.setDate( sdate.getDate() + i );			//majid						this.cals[i].setDate( sdate );			//Ext.getCmp(this.randomId + '_' + (this.numberOfDays - i - 1)).getEl().dom.innerHTML = '<b>' + sdate.format('<\\b>j</\\b> F') + '</b>';		}				this.fireEvent( 'date_changed', this, date );	}		,getDate: function( date ){		return this.activeDate;	}		,getView: function(){		return this.view;	}		,getHeader: function(){		return this.multiday.getView();	}			,getContainer: function(){		return this.container;	}		/*,getCalendar: function( date ){		if ( typeof date == 'object' ){			date = date.getTime();		}				var cc = this.activeDate.getTime();		var off = (3600*24*1000);		var q   = cc;				for ( var i = 0; i < this.numberOfDays; ++i ){			if ( q <= date && date < q + off ){				return this.cals[i];			}						q += off;		}				return null;			}*/	//majid	,getCalendar: function( date ){		if ( typeof date == 'object' ){			//date = date.getTime();		}		else{			date = new Date( date );		}		var sdate = new Date( this.activeDate );		var edate = new Date( this.activeDate );		edate.setDate( edate.getDate() + 1 );		for ( var i = 0; i < this.numberOfDays; ++i ){					if (sdate <= date && date < edate)				return this.cals[i];			sdate.setDate( sdate.getDate() + 1 );			edate.setDate( edate.getDate() + 1 );						}				return null;			}	//majid		,addItem: function( it ){		var s = this.getCalendar( it.getStart() );				if ( s )			s.getContainer( it ).addItem( it );	}		,removeItem: function( it ){		var s = this.getCalendar( it.getStart() );				s.getContainer( it ).removeItem( it );	}		,removeAll: function(){		for ( var i = 0; i < this.numberOfDays; ++i ){			this.cals[i].removeAll();		}		this.multiday.removeAll();		//this.getContainer().removeAll();	}		,refreshView: function(){		for ( var i = 0; i < this.numberOfDays; ++i ){			this.cals[i].getView().refreshView();		}	}		,refreshItems: function(){		for ( var i = 0; i < this.numberOfDays; ++i ){			this.cals[i].getContainer().refreshItems();		}	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/MonthlyBubble.js *//*--------------------------------------------------*/// New Item BubbleEve.calendar._MonthlyBubble = function() {    this._bbTpl = new Ext.XTemplate(		'<div class="x-calendar-bubble">',			'<div class="x-calendar-bg">',			'<table width="100%" cellpadding="0" cellspacing="0">',			 '<tr>',				'<td class="x-calendar-left"></td>',				'<td class="x-calendar-middle2"></td>',				'<td class="x-calendar-middle"></td>',				'<td class="x-calendar-right"></td>',			 '</tr>',			'</table>',			'</div>',			'<div class="x-calendar-content">',				'<div class="mbubble-mm"></div>',			'</div>',		'</div>'    );		Eve.calendar._MonthlyBubble.superclass.constructor.apply( this, arguments );	this.shown = false;}Ext.extend( Eve.calendar._MonthlyBubble, Ext.util.Observable, {	show: function( date, callback, e )	{		if (! this.el) {			this.createBubble();		}		        this.el.setDisplayed('block');				var x = e.clientX || e.getXY()[0];		var y = e.clientY || e.getXY()[1];		var height	= this.el.getHeight();		var width	= this.el.getWidth();				var dq = Ext.DomQuery;				if (y < height) {			var calHeight = y						try {				Ext.fly( dq.selectNode('.x-calendar-left') ).addClass('x-calendar-bg-bottom');				Ext.fly( dq.selectNode('.x-calendar-middle2') ).addClass('x-calendar-bg-bottom');				Ext.fly( dq.selectNode('.x-calendar-right') ).addClass('x-calendar-bg-bottom');							Ext.fly( dq.selectNode('.x-calendar-middle') ).replaceClass('x-calendar-middle', 'x-calendar-middle-bottom');								Ext.fly( dq.selectNode('.x-calendar-content') ).setTop('64');			} catch(e) {}		}		else {			var calHeight = y - height;						try {				Ext.fly( dq.selectNode('.x-calendar-left') ).removeClass('x-calendar-bg-bottom');				Ext.fly( dq.selectNode('.x-calendar-middle2') ).removeClass('x-calendar-bg-bottom');				Ext.fly( dq.selectNode('.x-calendar-right') ).removeClass('x-calendar-bg-bottom');				Ext.fly( dq.selectNode('.x-calendar-middle-bottom') ).replaceClass('x-calendar-middle-bottom', 'x-calendar-middle');								Ext.fly( dq.selectNode('.x-calendar-content') ).setTop('7');			} catch(e) {}		}				        this.el.setXY( [x - width + 20, calHeight ] );		this.el.fadeIn();				this.callback = callback || Ext.emptyFn;		var cal	 = Ext.getCmp('mbubble-calendar');		if (Eve.calendar.Registery.Calendar.CheckedNodes.split(",").length == 1) {			// Set Calendar ComboBox Value to current checked node in tree			var nid	 = parseInt(Eve.calendar.Registery.Calendar.CheckedNodes.split(",")[0]/*node.id.split('_')[1]*/);			if (cal.store.getById(nid)) {				cal.setValue(nid);			}		} else {			try{				cal.clearValue();			} catch(e) { console.log("e",e) }		}				var subject		= Ext.getCmp('mbubble-subject');		var startDate	= Ext.getCmp('mbubble-start');		var startTime	= Ext.getCmp('mbubble-starttime');		var endDate		= Ext.getCmp('mbubble-end');		var endTime		= Ext.getCmp('mbubble-endtime');				// Focus on subject		subject.focus();				// Ext.getCmp('mbubble-subject').setValue( null );		startDate.setValue( date.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) );		startTime.setValue( date.format(Eve.Preference.get('timeFormat')/*'g:i A'*/) );		var eDate = new Date(date);		eDate.setMinutes( date.getMinutes() + 30 );				endDate.setValue( eDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) );		endTime.setValue( eDate.format(Eve.Preference.get('timeFormat')/*'g:i A'*/) );				// Remove validator error on show		subject.clearInvalid();		startDate.clearInvalid();		startTime.clearInvalid();		endDate.clearInvalid();		endTime.clearInvalid();				// Hide the other Junk		Eve.calendar.Bubble.closeBubble();				this.shown = true;	}		,hide: function()	{		if (this.shown) {			this.el.fadeOut({				remove		: false				,callback	: function() {					this.el.setDisplayed( false );					this.fp.getForm().reset();				}				,scope		: this			});        }				this.shown = false;		this.callback = Ext.emptyFn;			}		,create: function()	{		if ( !( Ext.getCmp('mbubble-start').validate() && 			Ext.getCmp('mbubble-starttime').validate() &&			Ext.getCmp('mbubble-end').validate() && 			Ext.getCmp('mbubble-endtime').validate() &&			Ext.getCmp('mbubble-subject').validate() &&			Ext.getCmp('mbubble-calendar').validate() ) ) {				return true;		}				this.callback({			startDate	: Ext.getCmp('mbubble-start').getValue()			,startTime	: Ext.getCmp('mbubble-starttime').getValue()			,endDate	: Ext.getCmp('mbubble-end').getValue()			,endTime	: Ext.getCmp('mbubble-endtime').getValue()			,subject	: Ext.getCmp('mbubble-subject').getValue()			,calendar	: Ext.getCmp('mbubble-calendar').getValue()		});				this.hide();	}		,showDetails: function()	{		var cal = parseInt( Ext.getCmp('mbubble-calendar').getValue(), 10 );				Eve.Resource.superbridge.broadcast( window, 'calendar_create_item_dlg', {			info : {				groupId		: cal				,parentId	: 0				,id			: 0				,path		: "\\"				,root		: ((!cal) ? 'personal' : 'group') 				,title		: Ext.getCmp('mbubble-subject').getValue()				,calendar	: Ext.getCmp('mbubble-calendar').getValue() 				,startDate	: Ext.getCmp('mbubble-start').getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/)				,endDate	: Ext.getCmp('mbubble-end').getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/)				,startTime	: Ext.getCmp('mbubble-starttime').getValue()				,endTime	: Ext.getCmp('mbubble-endtime').getValue()			}		});				this.hide();	}		,createBubble: function()	{		// Date/Time Validator		var validator = function() {			var startDate	= Ext.getCmp('mbubble-start').getValue();			var startTime	= Ext.getCmp('mbubble-starttime').getValue();			var endDate		= Ext.getCmp('mbubble-end').getValue();			var endTime		= Ext.getCmp('mbubble-endtime').getValue();						if (startDate == '' || startTime == '' || endDate == '' || endTime == '' )				return true;						var startValue = startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + startTime;			startDate = Date.parseDate(startValue,[Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('') /*"n/j/y g:i A"*/);						if (startDate === undefined || startDate == 'undefined') {				return "Please select a valid date.";			}						var endValue = endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + endTime;			endDate = Date.parseDate(endValue, [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);						if (endDate === undefined || endDate == 'undefined') {				return "Please select a valid date.";			}						if (startDate > endDate) {				return "Start date should be before the end date."			}						return true;		};						// Select Date/Time Handler		var hdlSelect = function() {			var startDate	= Ext.getCmp('mbubble-start');			var startTime	= Ext.getCmp('mbubble-starttime');			var endDate		= Ext.getCmp('mbubble-end');			var endTime		= Ext.getCmp('mbubble-endtime');						var startValue	= startDate.getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + startTime.getValue();			startValue		= Date.parseDate(startValue, [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);						var endValue	= endDate.getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + endTime.getValue();			endValue		= Date.parseDate(endValue, [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);						if (startValue > endValue) {				var dt = new Date( startValue.setMinutes(startValue.getMinutes()+30) );				endDate.setValue( dt );				endTime.setValue( dt );								startDate.clearInvalid();				startTime.clearInvalid();				endDate.clearInvalid();				endTime.clearInvalid();			}		}						this.el = this._bbTpl.append( document.body, {}, true );				this.fields = [ 'itemid', 'title' ];		this.rec = Ext.data.Record.create( [ 'itemid', 'title' ] );		this.store = new Ext.data.SimpleStore({			fields: this.fields			,data : []		});				var that = this;		var fillStore = function( response ){			var xml		= response.responseXML;			var dq		= Ext.DomQuery;			var node	= dq.selectNode('calendars', xml);			var nodes	= dq.select( 'row', node );			var recs	= [];						for ( var i = 0; i < nodes.length; ++i ){				var title = dq.selectValue( 'title', nodes[i] );				var id 	  = dq.selectValue( 'id', nodes[i] );								var rec = new that.rec( { itemid: id, title:title } );				rec.id	= parseInt(id);								recs.push( rec );			}						that.store.add( recs );									// Code Duplicated!!!			var cal	 = Ext.getCmp('mbubble-calendar');			if (Eve.calendar.Registery.Calendar.CheckedNodes.split(",").length == 1) {				// Set Calendar ComboBox Value to current checked node in tree				var nid	 = parseInt(Eve.calendar.Registery.Calendar.CheckedNodes.split(",")[0]/*node.id.split('_')[1]*/);				if (cal.store.getById(nid)) {					cal.setValue(nid);				}			} else {				try{					cal.clearValue();				} catch(e) { console.log("e",e) }			}			// Focus on subject			Ext.getCmp('mbubble-subject').focus();		}				Ext.Ajax.request({			params	: {				event	: 'modern.calendar.personal.edit'				,id		: 0			}			,url	: Eve.url			,success: fillStore			,scope	: this		});				this.fp = new Ext.FormPanel({			border		: false			,bodyBorder	: false			,shim		: false			,shadow		: false            ,bodyStyle	: 'background-color:white; padding:5px 15px 5px 5px; border:1px solid #CCC;'			,title		: 'New Event'			,cls		: 'mbubble-panel'			,labelWidth	: 61			,width		: 350			,tools		: [{				id			: 'close'				,handler	: function() {					Eve.calendar.MonthlyBubble.hide();				}			}]			,toolTemplate: new Ext.Template('<div class="x-tool x-tool-{id}" style="border:1px solid gray;">&#160;</div>')			,keys		: [{				key			: Ext.EventObject.ENTER				,fn			: function() { Eve.calendar.MonthlyBubble.create() }			}]			,items: [{				xtype			: 'textfield'				,fieldLabel		: 'Subject'				,id				: 'mbubble-subject'				,emptyText		: 'Subject e.g. meeting with Dave'				,allowBlank		: false				,anchor			: '100%'			}, {				xtype				: 'combo'				,fieldLabel			: 'Calendar'				,defaultSelection	: false				,fieldClass			: 'calendar-combo-bg'				,id					: 'mbubble-calendar'				,store				: this.store				,tpl				: Eve.indentComboXTemplate('title')				,displayField		: 'title'				,valueField			: 'itemid'				,mode				: 'local'				,emptyText			: 'Pick a Calendar...'				,typeAhead			: true				,allowBlank			: false				,selectOnFocus		: true				,forceSelection		: true				,triggerAction		: 'all'				,anchor				: '100%'			}, {				layout			: 'column'				,xtype			: 'container'				,autoEl			: { tag: 'div'}				,defaults		: {					layout			: 'form'					,labelWidth		: 61				}				,items			: [{					columnWidth		: .52					,border			: false					,items			: [{						xtype			: 'datefield'						,id				: 'mbubble-start'						,allowBlank		: false						,format			: Eve.Preference.get('dateFormat')//'n/j/y'						,fieldLabel		: 'Start Date'						,validator		: validator						,validateOnBlur	: false						,listeners		: {							select	: hdlSelect						}						,anchor			: '95%'					}]				}, {					columnWidth		: .48					,border			: false					,items			: [{						xtype			: 'datefield'						,id				: 'mbubble-end'						,allowBlank		: false						,format			: Eve.Preference.get('dateFormat')//'n/j/y'						,fieldLabel		: 'End Date'						,validator		: validator						,validateOnBlur	: false						,listeners		: {							select	: hdlSelect						}						,anchor			: '100%'					}]				}]			}, {				layout			: 'column'				,xtype			: 'container'				,autoEl			: { tag: 'div'}				,defaults		: {					layout			: 'form',					labelWidth		: 62				}				,items			: [{					columnWidth		: .52					,border			: false					,items			: [{						xtype			: 'timefield'						,id				: 'mbubble-starttime'						,allowBlank		: false						//,regex			: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/						,format			: Eve.Preference.get('timeFormat')						,fieldLabel		: 'Start Time'						,validator		: validator						,validateOnBlur	: false						,listeners		: {							select	: hdlSelect						}						,anchor			: '95%'					}]				}, {					columnWidth		: .48					,border			: false					,items			: [{						xtype			: 'timefield'						,id				: 'mbubble-endtime'						,allowBlank		: false						//,regex			: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/						,format			:Eve.Preference.get('timeFormat')						,fieldLabel		: 'End Time'						,validator		: validator						,validateOnBlur	: false						,listeners		: {							select	: hdlSelect						}						,anchor			: '100%'					}]				}]			}/*, {				layout			: 'column'				,xtype			: 'container'				,autoEl			: { tag: 'div'}				,defaults		: {					layout			: 'form',					labelWidth		: 50				}				,items			: [{					width			: 60					,border			: false					,items			: [{						xtype			: 'container'						,autoEl			: { 							tag				: 'div'							,style			: 'width:60px; font: 10pt tahoma; padding-top:10px;'							,html			: '<a href="#" onclick="Eve.calendar.MonthlyBubble.create()">Create</a>'						}					}]				}, {					width			: 60					,border			: false					,items			: [{						xtype			: 'container'						,autoEl			: {							tag				: 'div'							,style			: 'width:60px; font: 10pt tahoma; padding-top:10px;'							,html			: '<a href="#" onclick="Eve.calendar.MonthlyBubble.showDetails()">Details</a>'						}					}]				}, {					width			: 60					,border			: false					,items			: [{						xtype			: 'container'						,autoEl			: {							tag				: 'div'							,style			: 'width:60px; font: 10pt tahoma; padding-top:10px;'							,html			: '<a href="#" onclick="Eve.calendar.MonthlyBubble.hide();">Close</a>'						}					}]				}]			}*/]			,buttons	: [{				text		: 'Create'				,handler	: function() { Eve.calendar.MonthlyBubble.create() }			}, {				text		: 'Detail'				,handler	: function() { Eve.calendar.MonthlyBubble.showDetails() }			}]			,buttonAlign: 'right'		});				setTimeout( (function(){ 			this.fp.render( Ext.DomQuery.selectNode( ".mbubble-mm", this.el.dom ) );		}).createDelegate( this ), 100 );	}});Eve.calendar.MonthlyBubble = new Eve.calendar._MonthlyBubble();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/MonthlyCal.js *//*--------------------------------------------------*/Eve.calendar.MonthlyCalendar = function( config ){	config = config || {};	Ext.apply( config, {  		 border : 'anchor'		,autoEl : { tag: 'div', style:'width: 100%; overflow-y: auto; overflow-x: hidden; position: relative;'}		,layout: 'fit'	} );	this._cnt = new Eve.calendar.Container();	this.activeDate = new Date();	// Set the multidayItemWrapper	this._cnt.setWrapper( this.wrapper || Eve.calendar.MultidayItemWrapper );	this.nodeMenu = config.nodeMenu;		Eve.calendar.MonthlyCalendar.superclass.constructor.apply( this, [config] );}Ext.extend( Eve.calendar.MonthlyCalendar, Ext.Container, {	getView: function(){		return this;	}		,getNumberOfRequiredRows: function(){		var fDate = this.getStartDate();		var rDate = this.getDate();		var eDate = new Date( rDate.getFullYear(), rDate.getMonth() + 1, rDate.getDate(), rDate.getHours(), rDate.getMinutes() );				var minReqRows = (eDate.getTime() - fDate.getTime()) / 86400000;				return { min: minReqRows, real: Math.ceil( minReqRows/7 ) * 7 };	}		,handleNodeDblClick: function(){	}		,collectNotifications: function(){	console.log('collectNotifications')		/*var not = [];		var cals = this.calendars || [];		for( var i = 0, len = cals.length; i < len; ++i ){			not.push( cals[i].getNotifications() );		}				return not;*/	}		,begin: function(){	console.log('begin')		//this._wait = 1;	}		,commit: function(){	console.log('commit')		//this._wait = 0;	}		,setNotifications: function( not ){	console.log('setNotifications')		/*var cals = this.calendars;		for( var i = 0, len = cals.length; i < len; ++i ){			cals[i].setNotifications( not[i] || {} );		}*/	}		/*,recreateRows: function(){		var nor = this.getNumberOfRequiredRows();		var rows = nor.real / 7;		var height = 100.0 / rows;				if ( this.items ){			this.items.each( function( it ){				this.remove( it, true );				it.destroy();			}, this );		}				var not = [];		//if ( !this._wait )			not = this.collectNotifications();		this.calendars = [];				var sTime = this.getStartDate().getTime();		window.buffer = [];		this.add({xtype:'container',autoEl : { tag: 'div'},layout:'anchor',id:'multiday-container',border:false});		for ( var i = 0; i < rows; ++i ){			var cal = new Eve.calendar.Multiday( { 				handleNodeDblClick: this.handleNodeDblClick				,handleDblClick		: this.handleDblClick			  , container  : this.getContainer()			  , monthlyCal : this			  , viewConfig : { ddGroup: this.viewConfig.ddGroup, xleft: 1, dvAnchor: '-5 0', anchor: '0 0', section: 'monthly', sectionId: i, baseDate: this.getDate(), titleClick : this.titleClick , activeContext: 'monthly', rowNumber: i+1}			  , nodeMenu   : this.nodeMenu			} );						cal.setNumberOfDays( 7 );						//majid			var sd = new Date(this.getStartDate());			sd.setDate( sd.getDate() + i * 7 );			cal.setDate( sd );			//majid						this.calendars.push( cal );			Ext.getCmp('multiday-container').add({				xtype:'container'				,autoEl : { tag: 'div'}				,items:[cal.getView()]				,layout:'anchor'				,anchor:'100% '+100/rows+'%'				,border:false			});		}				//if ( !this._wait )			this.setNotifications( not );	}*/	,recreateRows: function(){		var nor = this.getNumberOfRequiredRows();		var rows = nor.real / 7;		var height = 100.0 / rows;				if (this.calendars === undefined || this.calendars.length == 0){			this.calendars = [];					this.add({				xtype:'container'				,autoEl : { tag: 'div'}				,layout:'anchor'				,id:'multiday-container'				,listeners:{					afterLayout: function(cmp){						var nor = this.getNumberOfRequiredRows();						var rows = nor.real / 7;						var items = cmp.items.items;						var h = cmp.getSize().height;						h = h/rows;						for(var i = 0; i < 6; ++i){							if (i < rows){								items[i].suspendEvents();								items[i].setHeight(h);								//console.log('Item Height Set: ', items[i], i);								items[i].resumeEvents();							}							else{								items[i].suspendEvents();								items[i].setHeight(0);								//console.log('Item Height Set to Zero: ', items[i], i);								items[i].resumeEvents();							}						}					}					,scope:this			}});			for ( var i = 0; i < 6; ++i ){				var cal = new Eve.calendar.Multiday( { 					handleNodeDblClick: this.handleNodeDblClick					,handleDblClick		: this.handleDblClick				  	,container  : this.getContainer()				  	,monthlyCal : this				  	,viewConfig : { style:'overflow:hidden;',ddGroup: this.viewConfig.ddGroup, xleft: 1, dvAnchor: '-5 0', anchor: '0 0', section: 'monthly', sectionId: i, baseDate: this.getDate(), titleClick : this.titleClick , activeContext: 'monthly', rowNumber: i+1}				  	,nodeMenu   : this.nodeMenu				} );				cal.setNumberOfDays( 7 );				var sd = new Date(this.getStartDate());				sd.setDate( sd.getDate() + i * 7 );				cal.setDate( sd );				this.calendars.push( cal );				Ext.getCmp('multiday-container').add({					xtype:'container'					,autoEl : { tag: 'div'}					,items:[cal.getView()]					,layout:'anchor'					,anchor:'100% '+100/rows+'%'					,border:false				});			}		}				var sTime = this.getStartDate().getTime();		var multidayContainer = Ext.getCmp('multiday-container')		var items = multidayContainer.items.items;		for ( var i = 0; i < 6; ++i ){			var cal = this.calendars[i];			cal.setBaseDate ( this.getDate() );			var sd = new Date(this.getStartDate());			sd.setDate( sd.getDate() + i * 7 );			cal.setDate( sd );			if (i < rows){				items[i].setVisible(true);				//items.anchor = '100% '+100/rows+'%';			}			else{				items[i].setVisible(false);				//items.anchor = '100% 1%';			}		}//		multidayContainer.doLayout();	}		,refreshView: function(forcedCreateRows){		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshView 1): ",(new Date()).getRTime() % 100000);		if(forcedCreateRows){			//@@Benchmark			//console.log("@@Benchmark -- Time(refreshView 1-1): ",(new Date()).getRTime() % 100000);			this.recreateRows();			this.removeTasks();			//@@Benchmark			//console.log("@@Benchmark -- Time(refreshView 1-2): ",(new Date()).getRTime() % 100000);		}		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshView 2): ",(new Date()).getRTime() % 100000);		this.getContainer().refreshItems();		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshView 3): ",(new Date()).getRTime() % 100000);		this.doLayout();		//@@Benchmark		//console.log("@@Benchmark -- Time(refreshView 4): ",(new Date()).getRTime() % 100000);	}		,setDate: function( date ){		this.activeDate = date;	}		,getHeader: function(){		return { xtype: 'container', autoEl: { tag: 'div' } };	}			,getDate: function(){		return this.activeDate;	}		,getStartDate: function( date ){		/*return new Date( this.activeDate.getTime() - this.activeDate.getDay() * 86400000 );*/		//majid		var d = new Date(this.activeDate);		d.setDate( d.getDate() - this.activeDate.getDay() );		return d;		//majid	}		,addTask: function( task, date ){		var cals = this.calendars;		for ( var i = 0; i < cals.length; ++i ){			cals[i].getView().addTask( date, [task,date] );		}	}		,renderTasks: function(){		var cals = this.calendars;		for ( var i = 0; i < cals.length; ++i ){			cals[i].getView().renderTasks();		}	}		,removeTasks: function(){    		var cals = this.calendars;		for ( var i = 0; i < cals.length; ++i ){			cals[i].getView().resetColProp();			cals[i].getView().updateTasksIcon(i);		}	}		,getContainer: function(){		return this._cnt;	}		,addItem: function( it ){		this.getContainer( it ).addItem( it );	}		,removeItem: function( it ){		this.getContainer( it ).removeItem( it );	}		,removeAll: function(){		this.getContainer().removeAll();	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Decorator.js *//*--------------------------------------------------*/Eve.calendar.decorator = Eve.calendar.decorator || {};Eve.calendar.AbstractDecorator = function( view ){}Eve.calendar.AbstractDecorator.prototype = {	decorate: function( view ){		return view;	}}Eve.calendar.DailyDecorator = Ext.extend( Eve.calendar.AbstractDecorator, {	decorate: function( view ){		var c = this.getColumn();		c.width = 60;		view.columnWidth = 1;				var spacer = {			 xtype: 'container'			,width: 21			,autoEl: { tag: 'div', style: 'height:3px; width: 10px' }		};				return { xtype: 'container', autoEl: { tag: 'div', style: 'height:960px;overflow-y:auto;' }			   , layout:'column'			   , items: [ c, view, spacer ] };	}		,getColumn: function(){		if ( !this.tpl ){			this.tpl = new Ext.XTemplate( '{[this.generateBg( values )]}', {				generateBg: function( values ){					var time;					var dc = '';					var rt = values.renderTime || false;										for ( var i = 0; i < 24; ++i ){						if(Eve.Preference.get('timeFormat')!= "G:i"){						var space = '';						var t	  = i;						var am	  = '<sup>&nbsp;am</sup>';												if ( t >= 12 ){							t -= 12;							am = '<sup>pm</sup>';						}						if ( t == 0 )							t = 12;													if ( t < 10 )							space = '&nbsp;';												if ( t !== 0 && t !== 12 && t !== 24 )							am = '<sup>00</sup>';														time = [ space, t, am ].join( '&nbsp;' );						}						else{							time = i;						}						if ( i == 0 )							dc += '<div class="x-calendar-side-style" style="height:39px">&nbsp;' + ( rt ? time : '' ) + '</div>';						else							dc += '<div class="x-calendar-side-style" style="height:38px">&nbsp;' + ( rt ? time : '' ) + '</div>';					}					return dc;				}			} );		}		return {			 xtype: 'container'			,listeners: {				'render': {					fn: function( cmp ){						this.tpl.overwrite( cmp.el, { renderTime: true } );					}					,scope: this				}			}			,autoEl: {tag: 'div', style: 'height:960px'}		}	}} );Eve.calendar.WeeklyDecorator = Ext.extend( Eve.calendar.DailyDecorator, {	decorate: function( view ){		var c = this.getColumn();		c.width = 60;		c.autoEl.style = 'height:960px;padding-top: 0px;border-top: 0px solid #8DAED9;'		view.items.unshift( c );				return view;	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/SliderPanel.js *//*--------------------------------------------------*///-------------------------------------------// @class: Eve.calendar.UI// @desc: The UI component that the view will render//-------------------------------------------Eve.SliderPanel = function( config ){	if ( !this.tpls ){		if ( !Eve.SliderPanel.tpls ){			Eve.SliderPanel.tpls = {topHeader : new Ext.XTemplate(	'<div class="slider-panel-header-content">'	,'<div   style="float:left; cursor: pointer;">Show Tasks on:&nbsp;&nbsp;&nbsp;{text}</div>'	,'<div id="cal-task-menu" style="float:left;margin-top:-3px"></div>'	,'<div class="slider-panel-header-toggle" style="float:right;cursor:pointer;"><b>Expand</b></div></div>')	,sideHeader : new Ext.XTemplate('<div class="slider-panel-header-content"></div>')	,body	: new Ext.XTemplate('<div class="slider-panel-body-content"></div>')			}		}				this.tpls = Eve.SliderPanel.tpls;	}		Eve.SliderPanel.superclass.constructor.apply( this, arguments );		this.initConfig = config;}Ext.extend( Eve.SliderPanel, Ext.Container, {	initEvents: function(){		Eve.SliderPanel.superclass.initEvents.apply( this, arguments );	}	//Added by Ghazale	,initComponent: function() {		this.html = this.startingText;		Eve.Portlet.superclass.initComponent.call(this);	 	this.addEvents('contextmenu');	}		,afterRender: function(){		Eve.SliderPanel.superclass.afterRender.apply( this, arguments );		Ext.DomHelper.append( this.el, { tag: 'div', 'class': 'slider-panel-root', 				children: [					{ tag: 'div', html: this.tpls.sideHeader.apply( this.initConfig.header || {} ), 'class': 'slider-panel-side-header slider-panel-no-background' },					{ tag: 'div', html: this.tpls.topHeader.apply( this.initConfig.header || {} )	, 'class': 'slider-panel-top-header' },					{ tag: 'div', html: this.tpls.body.apply( this.initConfig.body )		, 'class': 'slider-panel-body' }				]			}		);				//(new Ext.Panel( { title: 'Testing', height: 100, width: 400 } ))		this.initConfig.bodyItem.render( this.getBody().dom );		this.initConfig.bodyItem.setSize( this.getBody().getSize() );				var res = new Ext.Resizable( this.el, { handles: 'n', minHeight: 22 } );				res.on( 'resize', function( r, w, h, e ){			this.doLayout();			this.ownerCt.doLayout();			this.initConfig.bodyItem.setSize( this.getBody().getSize() );			if ( h < 70 ){				this.getSideHeader().addClass('slider-panel-no-background');			}else{				this.getSideHeader().removeClass('slider-panel-no-background');			}            this.setCorrectToggleTitle( h );		}, this);				this.on('resize', function(){			this.initConfig.bodyItem.setSize( this.getBody().getSize() );			//By Ghazaleh				var items = this.bodyItem.weeklyTask.view.items;				for(var i=0; i< items.length; i++)					if(items[i].setHeight)					items[i].setHeight(this.getBody().getSize().height);			//debugger;			if(this.getBody().getSize().height > 20)			this.setTaskHeight (this.getBody().getSize().height + 20);		}, this );		this.el.on({	        "contextmenu": this.onContextMenu,	        scope:this	    });		this.on('show', function(){			this.ownerCt.doLayout();		});		this.on('hide', function(){			this.ownerCt.doLayout();		});		this.setTopHeaderText( );        this.initTopHeaderEvents();		this.menu = new Ext.SplitButton({				text 		: 'Start Date []'				,renderTo   : 'cal-task-menu'				,menu		: new Ext.menu.Menu({					items		: [						new Ext.menu.CheckItem({							text	: 'Start Date'							,checked: true							,group	: 'fi'							,scope	: this						})						,new Ext.menu.CheckItem({							text	: 'Due Date'							,group	: 'fi'							,scope	: this						})					]				})			})				this.fireEvent( 'afterrender', this );	}	 ,onContextMenu : function(e){		if(e.getTarget('div.slider-panel-body'))			this.fireEvent("contextmenu", this, e);	 }	     ,setCorrectToggleTitle: function( h ){        if ( h < 25 )            this.getTopHeaderToggle().dom.innerHTML = '<b>Expand</b>';        else            this.getTopHeaderToggle().dom.innerHTML = '<b>Collapse</b>';    }	,slideToggle: function(){        var h = this.el.getHeight();        if ( h < 25 ){            this.setHeight( 86 );			this.setTaskHeight (86);        }else{            this.setHeight( 24 );			this.setTaskHeight (24);        }        this.setCorrectToggleTitle( ( h < 25 ) ? 86 : 24 );        this.doLayout();        this.ownerCt.doLayout();        this.initConfig.bodyItem.setSize( this.getBody().getSize() );        if ( h > 70 ){            this.getSideHeader().addClass('slider-panel-no-background');        }else{            this.getSideHeader().removeClass('slider-panel-no-background');        }    }	,setTaskHeight : function(height){		var monthlyBtn = Ext.getCmp('calendar-topbar-monthly')		var weeklyBtn = Ext.getCmp('calendar-topbar-weekly')		var dailyBtn = Ext.getCmp('calendar-topbar-daily')		if (monthlyBtn.pressed) {			monthlyBtn.taskHeight = height;		} else if (weeklyBtn.pressed) {			weeklyBtn.taskHeight = height;		} else if (dailyBtn.pressed) {			dailyBtn.taskHeight = height;		}	}	    ,initTopHeaderEvents: function(){		this.getTopHeaderToggle().on('click', this.slideToggle, this );        var h = this.el.getHeight();        this.setCorrectToggleTitle( h );    }    ,getTopHeaderToggle: function(){        return this.getTopHeader().down('div.slider-panel-header-content' ).down( 'div.slider-panel-header-toggle');    }	,getSideHeader: function(){		if ( !this.sh ){			this.sh = this.getRoot().down( 'div.slider-panel-side-header' );		}				return this.sh;	}		,getRoot: function(){		if ( !this.root ){			this.root = this.el.down( 'div.slider-panel-root' );		}				return this.root;	}		,setTopHeaderText: function( d1, text ){		//this.getTopHeader().dom.innerHTML = this.tpls.topHeader.apply( { text: text } );        //this.initTopHeaderEvents();        if(this.menu && this.menu.menu && this.menu.menu){			this.menu.setText(d1 + text);			this.menu.menu.items.items[0].setText('Start Date' + text);			this.menu.menu.items.items[1].setText( 'Due Date'+ text);			        }        	}		,getTopHeader: function(){		if ( !this.th ){			this.th = this.getRoot().down( 'div.slider-panel-top-header' );		}				return this.th;	}		,getBody: function(){		if ( !this.body ){			this.body = this.getRoot().down( 'div.slider-panel-body' );		}				return this.body;	}} );Ext.reg( 'sliderpanel', Eve.SliderPanel );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/TaskView.js *//*--------------------------------------------------*/Eve.calendar.DailyTaskView = function( parent, context ){	var that = this;	this.tpl = new Ext.XTemplate(		'<div style="padding-left: 10px; padding-right: 10px;" >&nbsp;<tpl for=".">',			'{[this.shouldRender(values)]}',		'</tpl></div>'		,{			formatDate: function( values, item ){				var date = values[item];				if ( date == '' || typeof date == "undefined" )					return " None";				return date;			},						formatFinalDate: function( values ){				var reg = Eve.calendar.Registery.Tasks.WhichDate;				var dd = values['dueDate'];				var sd = values['startDate'];				if(Eve.calendar.Registery.Tasks.activeContext == "weekly" )				    return '';				    				if ( reg.toLowerCase() == 'startdate' ){					return [ ' ( start: ',(sd ? sd : '&nbsp;None'), ' )', '( due: ' , (dd ? dd : '&nbsp;None'), ')' ].join('');				}else{					return ['( start: ' , (sd ? sd : '&nbsp;None') , ')', ' (due ', (dd? dd: '&nbsp;None'), ' )'].join('');				}							},						shouldRender: function( values ){				var formatFinalDate = function( values ){					var reg = Eve.calendar.Registery.Tasks.WhichDate;					var dd = values['dueDate'];					var sd = values['startDate'];										if ( reg.toLowerCase() == 'startdate' ){						return "( due: " + (dd ? dd : '&nbsp;None )');					}else{						return "( start: " + (sd ? sd : '&nbsp;None )');					}									};								var date = Date.parseDate(values[Eve.calendar.Registery.Tasks.WhichDate], Eve.Preference.get('dateFormat')).format('n/j/y');								var month = parseInt( date.split('/')[0], 10 );				var year  = parseInt( date.split('/')[2], 10 );				var day   = parseInt( date.split('/')[1], 10 );								var smonth = that.getDate().getMonth() + 1;				var syear  = that.getDate().getYear() % 100;				var sday   = that.getDate().getDate();				if ( ( month == smonth && year == syear) )				    if(Eve.calendar.Registery.Tasks.activeContext == "monthly" )						return ['<div class="x-calendar-task-element ',values[Eve.calendar.Registery.Tasks.WhichDate],								'" style="clear:both"><div style="float:left;width:40%;"><b>',								'<input class="x-calendar-task-box" type="checkbox" ',								'style="margin-right:3px;margin-bottom:2px;float:left;"',								'>','<span class="x-calendar-task-title">' ,values.title,'</span>',							 	'</b></div><div style="float:left;width:35%;">',values.textPath,'</div><div style="float:right;width:25%;"><i>',							  	this.formatFinalDate( values ), '</i></div></div>'].join('');					else if(sday == day)						return ['<div class="x-calendar-task-element" style="clear:both"><div style="float:left;',								(Eve.calendar.Registery.Tasks.activeContext == "daily")? "width:40%;": "",'"><b>',								'<input class="x-calendar-task-box" type="checkbox" style="margin-right:3px;margin-bottom:2px;float:left"',								,'>','<span class="x-calendar-task-title">' ,values.title,'</span>',							 	'</b></div><div style="float:left;width:35%;">',								 (Eve.calendar.Registery.Tasks.activeContext == "daily")? values.textPath: ""								 ,'</div>',								 '<div style="float:right;width:25%;"><i>', this.formatFinalDate( values ), '</i></div></div>'].join('');				return '<div class="x-calendar-task-element" style="display: none; visibility: hidden"></div>';			}		} 	);		this.parent = parent;		Eve.TID = Eve.TID || 0;	this.dv = new Ext.DataView( {		store: this.parent.getStore()		,tpl: this.tpl		,singleSelect: true		,itemSelector: 'div.x-calendar-task-element'		,emptyText: ''		,style: (context == 'weekly')? 'overflow-y: auto;border-right:1px dashed #CCC;': 'overflow-y: auto;'		,id	  : 'Sample_Test_' + (++Eve.TID)	} );		//this.dv.on('click', this.popTaskDialog, this );	this.dv.on('render',function(){		this.dv.el.on('click', function(e, item){		if( Ext.get(item).up(this.dv.itemSelector)){			var rec = this.dv.getRecord( Ext.get(item).up(this.dv.itemSelector).dom );			this.popTaskDialog(rec, item);		}	}, this );},this);this.dv.on('resize', function(){	 this.ownerCt.doLayout();	});}Eve.calendar.DailyTaskView.prototype = {	setDate: function( date ){		this.activeDate = date;	}		,getDate: function(){		return this.activeDate;	}		,getView: function(){		return this.dv;	}		,refresh: function(){		this.dv.refresh();	}		,popTaskDialog: function( rec, item ){		//var rec = dv.getRecord( node );		var sb = Eve.Resource.superbridge;			var that = this;				switch(Ext.get(item).dom.className.split(' ')[0]){			case( 'x-calendar-task-title' ) :					var obj  = {						info: {							id: rec.get('id').split('_')[1]							,path: rec.get('path')							,root: rec.get('mode')							,groupId: rec.get('groupId').split("_")[1]						}					};					var func = function() { Eve.Resource.superbridge.broadcast(that, 'task_edit_item_dlg', obj ) }					Eve.Resource.superbridge.broadcast(this, 'proxy_dialog', { type: 'task', func: func });			    break;			case ('x-calendar-task-box'):				var event = 'modern.task.'+rec.get('mode')+'.updateCustomFields';				var obj = {					info:{						id: rec.get('id').split('_')[1]						,groupId: rec.get('groupId').split("_")[1]						,root: rec.get('mode')					}					,params:{completed: true, enforcedPredecessors: rec.get('enforcedPredecessors')}				 	,section: 'task'				 	, event: event				};				var func = function(){ Eve.Resource.superbridge.broadcast( that, 'task_update_item', obj ); };				Eve.Resource.superbridge.broadcast(this, 'proxy_dialog', { type: 'task', func: func });			    break;		}	}}Eve.calendar.WeeklyTaskView = function( parent,  numberOfDays ){	this.numberOfDays = numberOfDays;	this.parent = parent;}Eve.calendar.WeeklyTaskView.prototype = {	getView: function(){		if ( this.view )			return this.view;				this.views = [];		this.res   = [];				var nod = this.numberOfDays;		for ( var i = 0; i < nod; ++i ){			var a = new Eve.calendar.DailyTaskView( this.parent, 'weekly' );			a.columnWidth = ( 1.0 / nod );						this.views.unshift( a );			this.res.unshift( a.getView() );			this.res[0].columnWidth = (1.0 / nod);			this.res[0].style += "height:100%;"					}				// Place holder		this.res.push( { width: 37, xtype:'container', autoEl: { tag: 'div', style:'height: 3px;' } } );						this.view = {			 autoEl: { tag: 'div' }			,layout	: 'column'			,items : this.res			,style : 'overflow-y: auto;'			,xtype : 'container'		};				return this.view;	}		,setDate: function( date ){		var nod = this.numberOfDays;				this.activeDate = date;		for ( var i = 0; i < nod; ++i ){			/*this.views[i].setDate( new Date( date.getTime() + i * 86400000 ) );*/			//majid			var d = new Date(date);			d.setDate( d.getDate() + i )			this.views[i].setDate( d );			//majid		}	}		,getDate: function(){		return this.activeDate;	}		,refresh: function(){		var nod = this.numberOfDays;				for ( var i = 0; i < nod; ++i ){			this.views[i].refresh();		}	}}Eve.calendar.TaskView = function( config ){		this.reader = new Ext.data.XmlReader( {		record: 'row'	}, [ 'id','title','groupId','startDate','dueDate','path','mode', 'textPath', 'enforcedPredecessors'] );		this.store = new Ext.data.Store( { reader: this.reader, url: Eve.url } );		this.dailyTask = new Eve.calendar.DailyTaskView( this );	this.weeklyTask = new Eve.calendar.WeeklyTaskView( this, 7 );		config = config || {};	config.layout 		= 'card';	config.items  		= [this.dailyTask.getView(), this.weeklyTask.getView()];	config.activeItem 	= 0;	config.autoEl		= { tag: 'div', style:"width: 100%;height:100%;" };		Eve.calendar.TaskView.superclass.constructor.apply( this, [config] );		this.lastParams = {};}Ext.extend( Eve.calendar.TaskView, Ext.Container, {	updateStore: function( startDate, endDate, ids ){		if ( !startDate ){			return false;		}				this.lastParams = {			startDate	: startDate			,endDate	: endDate			,ids		: ids		};		this.store.load( { 							params: { 								startDate: startDate.format('n/j/y')							  , endDate: endDate.format('n/j/y')							  , ids: ids							  , whichDate: Eve.calendar.Registery.Tasks.WhichDate							  , event: 'modern.task.personal.getAllByDate' 							 }							  , callback: this.getContextCallback|| Ext.emptyFn							  ,scope    : this						} );	}//Added By Ghazal	,setParameters : function( object, xml ){		this.lastParams = object.lastParams;		this.activeContext = Eve.calendar.Registery.Tasks.activeContext = object.activeContext;		this.store.removeAll();		this.dailyTask.setDate( object.lastParams.startDate );		this.weeklyTask.setDate( object.lastParams.startDate );		switch( this.activeContext ){			case 'daily':				this.getLayout().setActiveItem( 0 );				this.dailyTask.refresh();				break;			case 'weekly':				this.getLayout().setActiveItem( 1 );				this.dailyTask.refresh();				break;			case 'monthly':				this.getLayout().setActiveItem( 0 );				this.monthlyCal = object.monthlyCal;				break;		}	}//	,refresh: function(){		this.updateStore( this.lastParams.startDate, this.lastParams.endDate, this.lastParams.ids );	}		,changeActiveContext: function( context, startDate, endDate, ids, monthlyCal ){		this.activeContext = context;		Eve.calendar.Registery.Tasks.activeContext = context;		this.dailyTask.setDate( startDate );		this.weeklyTask.setDate( startDate );				switch( context ){			case 'daily':				this.getLayout().setActiveItem( 0 );				this.dailyTask.refresh();				break;			case 'weekly':				this.getLayout().setActiveItem( 1 );				this.dailyTask.refresh();				break;			case 'monthly':				this.getLayout().setActiveItem( 0 );				this.monthlyCal = monthlyCal;				break;		}		this.updateStore( startDate, endDate, ids );	}		,getActiveContext: function(){		switch( this.activeContext ){			case 'daily':				return this.dailyTask;			case 'weekly':				return this.weeklyTask;			case 'monthly':				return this.dailyTask;		}	}		,onChange: Ext.emptyFn		,getDate: function(){		return this.getActiveContext().getDate();	}		,getStore: function(){		return this.store;	}			,getContextCallback: function(r){		this.onChange( true );		switch( this.activeContext ){			case 'daily':			case 'weekly':				this.dailyTask.refresh();				break;			case 'monthly':        	this.monthlyCal.fillMonthlyTasks(r);				break;		}	}	} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Multiday/MultidayCalendar.js *//*--------------------------------------------------*///// JavaScript Document//-------------------------------------------// @author: Omid Alipour Fard//-------------------------------------------//Eve.calendar.//------------------------------------------------------------------------------------------------------// Will be wrapped by ItemWrapperEve.calendar.MultidayTimeItem = function( start, end, extra ){	this.extra = extra;	this.startDate = start;	this.endDate = end;}Eve.calendar.MultidayTimeItem = Ext.extend( Eve.calendar.DateTimeItem, {	getStart: function(){		return this.startDate.getTime();	}		,getEnd: function(){		return this.endDate.getTime();	}		,moveTo: function( date ){		var diff = this.extra.end.getTime() - this.extra.start.getTime();		var ss   = ( new Date( date.getFullYear(), date.getMonth(), date.getDate(), this.extra.start.getHours(), this.extra.start.getMinutes() )).getTime();		var off  = 0;//3600 * 1000; //date.getTimezoneOffset() * 60 * 1000;				var sd = new Date( ss - off );		var ed = new Date( ss + diff - off );				this.extra.start = sd;		this.extra.end   = ed;				this.startDate = new Date( sd.getFullYear(), sd.getMonth(), sd.getDate(), 12, 0, 0 );		this.endDate   = new Date( ed.getFullYear(), ed.getMonth(), ed.getDate(), 0 , 0, 0 );	}		,resizeTo: function( start, end ){		this.startDate = start;		this.endDate   = end;	}} );//-------------------------------------------// Daily Calendar Wrapper//-------------------------------------------Eve.calendar.Multiday = function( config ){	config = config || {};	// Overwrite this element with the supplied configuration	Ext.apply( this, config );		this.activeDate = new Date();	this.addEvents( 'date_changed', 'refresh_calendar', 'move', 'beforemove', 'dblclick' );		this.init();};// Default BackgroundEve.calendar.Multiday.BackgroundTemplate =  new Ext.XTemplate( '{[this.generateBg( values )]}', {	generateBg: function( values ){		var nod = values.nod;		var percentage = 100 / nod;		var text = '';		for ( var i = 0; i < nod; ++i ){			text += ['<div style="position: absolute; width:',percentage,'%;left:', i * percentage,'%;height: 100%; border-right: 1px dashed #ccc;"></div>'].join('')		}				return text;	}});Eve.calendar.Multiday.DefaultNodeUI = Ext.extend( Eve.calendar.UI, {	init: function(){		this.template = new Ext.XTemplate( //'<div style="margin: 0px 5px 0px 5px; border: 1px solid #99BBe8; overflow: hidden; background: #d9e8fb; color: black; height: 100%" >',										   //'<div class="x-calendar-header" ext:qtip="<b>Start:</b> {[ this.toTimeString( values, 0 ) ]}</br><b>End&nbsp;&nbsp;&nbsp;: </b>{[ this.toTimeString( values, 1 ) ]}">', 	'<b class="c-corner" style="position:absolute;top:1px;width: 100%;">',	    '<b class="c-corner3" style=";background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner4" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner5" style="background-color:#{color}; border-color:#{color}"></b>',	'</b>',	'<div style="padding: 0px; bottom: 2px; position: absolute; width: 100%; top: 2px;overflow: visible;">',	'<div style="padding:0px 5px; color:white; overflow:visible; background:#{color}; margin-bottom:5px; height:100%; font:8pt \'Tahoma\'" ext:qtip="{[this.qtip( values )]}">',	'<span ext:qtip="{[this.qtip( values )]}" style="white-space:nowrap;color: {[ this.getTextColor(values.color) ]}">{[this.getSubject(values)]}</span>',	'<br /></div></div>',	'<b class="c-corner" style="position:absolute; bottom: 1px;width:100%;">',	    '<b class="c-corner5" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner4" style="background-color:#{color}; border-color:#{color}"></b>',	    '<b class="c-corner3" style="background-color:#{color}; border-color:#{color}"></b>',	'</b>', {			getTextColor : function(bgColor) {				var lightColors = ['FFFFFF', 'CCFFFF', 'CCFFCC', 'FFFF99', 'FFCC99', '00CCFF', '00FFFF', '00FF00', 'FFFF00', 'FFCC00']				bgColor			= bgColor.toUpperCase();				if ( lightColors.indexOf(bgColor) != -1 ) {					return '#000000';				}				return '#FFFFFF';			}			,toTimeString: function( values, isEnd ){			   var s = (new Date( isEnd ? ( values.end_real ) : ( values.start_real )));			   return s.format( ' F j ' );			   //return h + m + sign;			}		   ,wrapUp: function( values, item, wrapper ){				if ( values[item] != undefined && values[item].length > 0 ){					switch( wrapper ){						case '()':							return '(' + values[item] + ')';						case '[]':							return '[' + values[item] + ']';						case '{}':							return '{' + values[item] + '}';						case "":							return values[item];					}				};								return '';		   }		   ,getSubject: function(values) {			   	var start	= values.start_real;				var ret		= (!values.allDay) ? '(' + start.format(Eve.Preference.get('timeFormat')/*'g:ia'*/) + ') ' + values.subject : values.subject;				console.log(values);				return ret;		   }		   		   ,qtip: function( values ){			   var extra = values;			   var qtip_ready = function(val){				   val = val || '';				   return val.replace(/"/g, '&quot;' );			   }			   var tip = ["<b>Details:</b><br />"				  , "Title : "			, qtip_ready(extra.subject) || ''				  , "<br />Location : "	, qtip_ready(extra.location) || ''				  , "<br />Start : ",  extra.start_real.format( [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y  g:i A'*/ )				  , "<br />End : ",  extra.end_real.format( [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y  g:i A'*/ )				  , "<br />Notes : ",  qtip_ready(extra.notes) || ''				  , "<br />Calendars : ",  qtip_ready(extra.calendars) || ''				  , "<br />Created By : ",  qtip_ready(extra.createdBy) || ''				  , "<br />Last Modified : ",  qtip_ready(extra.modifiedBy) || '' ].join( '' );			   return tip;		   }		   ,darkenColor: function( values ){				var color = values.color;								var c 	  = parseInt( color, 16 );				var r = c >> 16;				var g = ( c >> 8 ) % 256;				var b = ( c % 256 );								var threshold = 50;								r = ( r < threshold ) ? 0 : (r - threshold);				g = ( g < threshold ) ? 0 : (g - threshold);				b = ( b < threshold ) ? 0 : (b - threshold);								return ['rgb(', r, ',', g, ',', b, ')'].join('');		   }	   });			}} );Eve.calendar.MultidayItem = Eve.calendar.MultidayTimeItem;// New Wrapper in order to use the UIEve.calendar.MultidayItemWrapper = function( it ){	Eve.calendar.MultidayItemWrapper.superclass.constructor.apply( this, [it, Eve.calendar.Multiday.DefaultNodeUI] );}Ext.extend( Eve.calendar.MultidayItemWrapper, Eve.calendar.AbstractItemWrapper, {	//-------------------------------------------	// Returns true if two items 'see' each other	//-------------------------------------------	see: function( it ){				var ss = this.getRStart(), se = this.getREnd(),			ds = it.getRStart()	, de = it.getREnd();		/*		ss = Math.floor( ss / 86400000 );		se = Math.floor( (se / 86400000) );		ds = Math.floor( ds / 86400000 );		de = Math.floor( (de / 86400000) );				if ( ds == se || de == ss )			return false;		*/		//majid		if ( ( ( ds >= ss ) && ( ds < se ) ) || 		     ( ( de > ss ) && ( de <= se ) ) || 		     ( ( ss >= ds ) && ( se <= de ) ) )			return true;				return false;	}} );Eve.calendar.MultidayItemWrapper.compFunc = Eve.calendar.ItemWrapper.compFunc;Ext.extend( Eve.calendar.Multiday, Ext.util.Observable, {	init: function(){		if ( !this.container )			this.container = new Eve.calendar.Container();				this.container.setWrapper( this.wrapper || Eve.calendar.MultidayItemWrapper );		Ext.applyIf( this.viewConfig, { nodeMenu: this.nodeMenu, titleClick: this.titleClick } );		if ( !this.view )			this.view = new Eve.calendar.MultidayEventView( this, this.bgTemplate || Eve.calendar.Multiday.BackgroundTemplate, this.positionTranslator || Eve.calendar.Multiday.PositionTranslator, this.viewConfig );				this.on('nodedblclick', this.handleNodeDblClick, this );		this.on('dblclick', this.handleDblClick, this);		this.activeDate = new Date();		this.setNumberOfDays( this.getNumberOfDays() || 1 );	}		,setNumberOfDays: function( nod ){		this._nod = nod;		this.view.setNumberOfDays( nod );		return false;	}		,resetColProp: function(){		this.view.resetColProp();	}	,getNotifications: function(){		var not = this.view._colProp;		var res = {};		for ( var i in not ){			if ( not[i]['tasks'] ){				res[i] = {};				res[i]['tasks'] = not[i]['tasks'];			}		}		return  res;	}		,setNotifications: function( not ) {		this.view._colProp = not;	}		,handleNodeDblClick: function() {		// Default behaviour is to do nothing	}		,handleDblClick: function() {		// Default behaviour is to do nothing	}		// Sets the *Calendar Date* to the new Date	,setDate: function( date ){		this.activeDate = date;		this.view.setDate( date );		this.fireEvent( 'date_changed', this, date );	}	,setBaseDate: function( _date ){		if (this.view)			this.view.setBaseDate( _date );	}		,getDate: function( date ){		return this.activeDate;	}		,getView: function(){		return this.view;	}		,getNumberOfDays: function(){		return this._nod || 1;	}		,getContainer: function(){		return this.container;	}		,addItem: function( it ){		this.getContainer( it ).addItem( it );	}		,removeItem: function( it ){		this.getContainer( it ).removeItem( it );	}		,removeAll: function(){		this.getContainer().removeAll();	}		,refreshView: function(){		this.getView().refreshView();	}		,refreshItems: function(){		this.getContainer().refreshItems();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Multiday/MultidayEvent.js *//*--------------------------------------------------*//*Eve.calendar.MultidayEventArea = function(){}Ext.extend( Eve.calendar.MultidayEventArea, Eve.calendar.View, {	} );*///-------------------------------------------// @class: Eve.calendar.UI// @desc: The UI component that the view will render//-------------------------------------------Eve.calendar.Multiday.PositionTranslator = {	translate: function( x, cal, fromGMT ){		//( x % 14400000 )		var dstDiff = ( new Date(x).getTimezoneOffset() - cal.getDate().getTimezoneOffset() ) * 60 * 1000;		var u = 0;				if ( fromGMT )			u = Eve.calendar.Multiday.PositionTranslator.getDay(  x - cal.getDate().getRTime() - dstDiff );		else			u = Eve.calendar.Multiday.PositionTranslator.getDay(  x - cal.getDate().getTime() - dstDiff );			var left = cal.getView().getLeft( u );				return left; //( (u / cal.getNumberOfDays()) * width );	}		,getDay: function( x ){		/*return Math.floor( (x / 86400000) + .49 );*/		//majid : omid !!!		return Math.floor( (x / 86400000)); // what the hell is this... .49		//majid	}		,decipher: function( x, cal ){		/*return new Date( cal.getDate().getTime() + Math.floor( x * cal.getNumberOfDays() ) * 86400000 );*/		//majid		var d = new Date(cal.getDate());		d.setDate( d.getDate() + x * cal.getNumberOfDays() )		return d;		//majid	}		,gapTime: function( min ){	//	return Math.floor( min / 5 ) * 5;	}};//-------------------------------------------// Tha View//-------------------------------------------Eve.calendar.MultidayEventView = function( cal, bgTemplate, positionTranslator, config ){	config = config || {};	config.anchor = config.anchor || '-39 0';	config.dvAnchor = config.dvAnchor || '-44 0';	config.xleft = config.xleft || 60;	Ext.apply( this, config );	if ( typeof this.renderTime == 'undefined' )		this.renderTime = true;	this._cal = cal;	this._cal.on( 'refresh', this.refreshView, this );		// set the backgroundTemplate	this._bgTpl = bgTemplate || new Ext.XTemplate( 'Hello world...' );		// set the position Translator of items...	this._pt = positionTranslator;		// Store for the item attributes	this.store = new Ext.data.SimpleStore( { fields: [ 'cnt' ] } );		this.record = Ext.data.Record.create( ['cnt'] );	var that = this;		// The View Template	this.MultidayTemplate = new Ext.XTemplate( 		'<tpl for=".">',			'<div style="{[this.position( values )]}" class="x-calendar-item {[this.getClass( values )]}">',				'{[this.ui( values )]}',			'</div>',		'</tpl>',		{			 getClass: function( vals ){				it = vals.cnt;				var posS	= that._pt.translate( it.getRStart(), that.getCalendar(), true);				var posE	= that._pt.translate( it.getREnd(), that.getCalendar(), true );				if ( posS.col == -1 && (posE.col > 0) )					return " x-calendar-shift-item";				return "";			 }			 			,position: function( vals ){				it = vals.cnt;				var posS	= that._pt.translate( it.getStart(), that.getCalendar() );				var posE	= that._pt.translate( it.getEnd(), that.getCalendar() );				var x 		= posS.pos + 1; 				var width 	= (posE.pos - 1) - (posS.pos + 1) - 1;				var height	= 19;				var pos		= it.getPos();				var size = that.getCalendar().getView().getEl().getSize().height - 19;				var numOfDispaledEvent = Math.floor(size/19);				var display = "block";				if(that.activeContext == "monthly")					display = (numOfDispaledEvent > pos) ? 'block': 'none';				if ( pos >= numOfDispaledEvent)					that.incExtraColumns( posS.col, posE.col );				return ['position: absolute;',					'overflow: hidden;',					'width:', width, 'px;',					'left:', x, 'px;',					'top:', pos * height, 'px;',					'z-index:', '100;',					'height:', '19px;',					'display:', display].join('');			}			,ui: function( vals ){				var it = vals.cnt;				return it.ui.render();			}		}	);		this.background = new Ext.Container( {		 autoEl : { tag: 'div', cls: 'multiday-calendar-body' }		,x	: config.xleft || 60		,y	: 0		,anchor : config.anchor || '-39 0'		,layout : 'column'	} );		// Dataview used for showing items	this.dv = new Ext.DataView( {		 itemSelector	: 'div.x-calendar-item'		,tpl			: this.MultidayTemplate		,store			: this.store		,singleSelect		: true		,trackOver		: true		,cls			: 'calendar-body'		,anchor			: config.dvAnchor || '-44 0'		,x			: config.xleft || 60		,y			: 20		,style			: 'position: absolute;overflow-x: hidden;overflow-y: ' + ( ( this.section == 'monthly' ) ? 'hidden' : 'auto' ) + ';'	} );		if ( config.nodeMenu )		this.dv.on( 'contextmenu', config.nodeMenu );			config = {		 titlebar: false		,autoEl	 : { tag: 'div', style: 'position:relative; overflow: auto' }		,layout  : 'absolute'		,items	 : [ this.background, this.dv  ]	}		this._timeOffset = 0; //( new Date() ).getTimezoneOffset() / 60;		Eve.calendar.MultidayEventView.superclass.constructor.apply( this, [config] );}Ext.extend( Eve.calendar.MultidayEventView, Ext.Container, {	renderItems: function(){				if ( !this.dv.rendered ){			this.restoreStore = (function(){				for ( var i = 0; i < this._nod; ++i ){					this.setColProp( i, "invisible", 0 );					this.updateExtraIcon ( i );				}								var arr = this._cal.container.getItems(); //majid hey!!!!!!!!!!!!!!!!!!!!!!!!!!!				// get the sorted array and start to render the items				this.store.removeAll();				var records = [];				var size = this.getCalendar().getView().getEl().getSize().height - 19;				var numOfDispaledEvent = Math.floor(size/19);				var height = Math.floor(size/19);				for ( var i = 0, len = arr.length; i < len; ++i ){					var posS = this._pt.translate( arr[i].wrapped.getRStart(), this.getCalendar(), true);					var posE = this._pt.translate( arr[i].wrapped.getREnd(), this.getCalendar(), true );					var pos		= arr[i].getPos();					if (!((posS.col<0 && posE.col<0) || (posS.col<0 && posE.col==0) || (posS.col>=this._nod && posE.col>=this._nod))){					   if (this.activeContext != "monthly" || pos < numOfDispaledEvent)						records.push( new this.record( { cnt: arr[i] } ) );					   else						this.incExtraColumns( posS.col, posE.col );					}				}				this.store.add( records );				// init drag and drop if not already done...				this.initDD();			}).createDelegate( this );						this.on('afterlayout', function(){				this.restoreStore();			} , this );							this.store.on('add', this.renderTasks, this );		}	}	,destroy: function(){		if ( this.ddDrag ){			this.ddDrag.getProxy().el.remove();						this.ddDrag.unreg();			delete this.ddDrag;		}				if ( this.ddDrop ){			this.ddDrop.unreg();			delete this.ddDrop;		}		Eve.calendar.MultidayEventView.superclass.destroy.apply( this, arguments );	}		,resetColProp: function(){		this._colProp = {};	}		,getColProp: function( i, prop ){		this._colProp = this._colProp || {};		this._colProp[i] = this._colProp[i] || {};				return this._colProp[i][prop] || 0;	}		,setColProp: function( i, prop, val ){		this._colProp = this._colProp || {};		this._colProp[i] = this._colProp[i] || {};				this._colProp[i][prop] = val;		return val;	}	,addTask: function( day, task ){		if ( typeof day != 'number')			day = this.getColumnByDate( day );				if ( day < 0 || day >= this._nod )			return false;					if ( this.getColProp( day, "tasks" ) == 0 )			this.setColProp( day, "tasks", [] );					this.getColProp( day, "tasks").push( task );	}		,renderTasks: function(){		for( var i = 0; i < this._nod; ++i ){			this.updateTasksIcon( i );		}	}	,updateTasksIcon: function( col ){		var tasksIcon = Ext.getCmp(this.randomId + '_' + col + '_tasks');		var tasks = this.getColProp( col, 'tasks' );		tasksIcon.setVisible(!( tasks == 0 || tasks.length == 0 || tasks[0][0] == 0 ))		//var tip = '<b>Tasks</b><br />You\'ve got ' + tasks[0][0] + ' task' + (( parseInt(tasks[0], 10) > 1 ) ? 's.' : '.') ;		if (tasks == 0 || tasks.length == 0 || tasks[0][0] == 0){			tasksIcon.setVisible(false)			if (tasksIcon.getEl() && tasksIcon.getEl().dom.attributes['ext:qtip'])				tasksIcon.getEl().dom.attributes['ext:qtip'].value = ['<b>Tasks</b><br/> You\'ve got no task.' ].join('');			else (tasksIcon.autoEl)				tasksIcon.autoEl['ext:qtip'] = ['<b>Tasks</b><br/> You\'ve got no task.' ].join('');		}		else{			tasksIcon.setVisible(true)			if (tasksIcon.getEl() && tasksIcon.getEl().dom.attributes['ext:qtip'])				tasksIcon.getEl().dom.attributes['ext:qtip'].value = ['<b>Tasks</b><br/> You\'ve got ' , tasks[0][0] , ' task' , (( parseInt(tasks[0], 10) > 1 ) ? 's.' : '.')].join('');			else (tasksIcon.autoEl)				tasksIcon.autoEl['ext:qtip'] = ['<b>Tasks</b><br/> You\'ve got ' , tasks[0][0] , ' task' , (( parseInt(tasks[0], 10) > 1 ) ? 's.' : '.')].join('');		}			}		,incExtraColumns: function( start, end ){		if ( this.section != 'monthly')			return false;		if ( start >= this.getNumberOfDays()  || end <= 0 )			return false;		start = Math.max( 0, start );		end   = Math.min( this._nod, end );		for ( var i = start; i < end; ++i ){			this.setColProp( i, "invisible", this.getColProp( i, "invisible" ) + 1 );			this.updateExtraIcon( i );		}	}	,updateExtraIcon: function( col ){		var extraIcon = Ext.getCmp(this.randomId + '_' + col + '_extra');		var num = this.getColProp( col, "invisible" );		if (num !== undefined && num > 0){			extraIcon.setVisible(true)			if (extraIcon.getEl() && extraIcon.getEl().dom.attributes['ext:qtip'])				extraIcon.getEl().dom.attributes['ext:qtip'].value = ['You have ', num , ' more events on this day.<br/> Click on this icon to view all of your events in a daily view.'].join('');			else (extraIcon.autoEl)				extraIcon.autoEl['ext:qtip'] = ['You have ', num , ' more events on this day.<br/> Click on this icon to view all of your events in a daily view.'].join('');		}		else{			extraIcon.setVisible(false)			if (extraIcon.getEl() && extraIcon.getEl().dom.attributes['ext:qtip'])				extraIcon.getEl().dom.attributes['ext:qtip'].value = ['You have no more events on this day.<br/> Click on this icon to view all of your events in a daily view.'].join('');			else (extraIcon.autoEl)				extraIcon.autoEl['ext:qtip'] = ['You have no more events on this day.<br/> Click on this icon to view all of your events in a daily view.'].join('');		}	}		,getColumnByDate: function( date ){		 var i = Math.floor( this._pt.getDay( date.getTime() - this.getCalendar().getDate().getTime() ) );		 return ( i < 0 ) ? -1 : ( ( i >= this._nod ) ? this._nod : i );	}		,getCalendar: function(){		return this._cal;	}	,getItemByDom: function( u ){		var rec = this.dv.getRecord( u );		return rec ? rec.get('cnt') : false;	}		,getPositionTranslator: function(){		return this._pt;	}		,getItemLayer: function(){		if ( !this.itemLayer )			this.itemLayer = this.dv.getEl();		return this.itemLayer;	}		,getBackgroundLayer: function(){		return this.background.getEl();	}		,refreshView: function(){		this.doLayout();	}		,getNumberOfDays: function(){		return this._nod;	}		,getDate: function(){		return this._date;	}		,getLeft: function( day ){		day -= Math.floor(( this.getDate().getTime() - this.getCalendar().getDate().getTime() ) / 86400000);				var ret = this.background.items.last().getEl().dom.offsetLeft + this.background.items.last().getEl().getWidth() + 50;		var colRet = this._nod;		if ( day == this._nod ){			ret -= 50;		}				if ( day >= 0 && day < this._nod ){			ret = this.background.items.get( day ).getEl().dom.offsetLeft;			colRet = day;		}else if ( day < 0 ){			ret = -15;			colRet = -1;		}				return { pos: ret, col: colRet };	}		,isToday: function( cell ){		//var date = this._date;		var date = cell.date;		if ( !date )			return false;					/*return (Math.floor( (( (new Date()).getTime() - date.getTime() )/86400000) - cell ) == 0)*/		//majid		var d = new Date();		return (d.getFullYear() == date.getFullYear() && d.getMonth() == date.getMonth() && d.getDate() == date.getDate());		//return (d.getFullYear() == date.getFullYear() && d.getMonth() == date.getMonth() && d.getDate() - date.getDate() == cell);		//majid	}		,isInThisMonth: function( cell ){		if ( !this.baseDate )			return true;					if (!this._date )			return false;		/*var cellDate = new Date(this._date.getTime() + cell * 86400000);*/		//majid		var cellDate = new Date(this._date);		cellDate.setDate( cellDate.getDate() + cell );		//majid		return ( cellDate.getMonth() == this.baseDate.getMonth() );	}	,getColor: function( cell, cmpCell ){		if ( this.isToday( cmpCell ) )			return "#fdd;";					if ( this.isInThisMonth( cell ) )			return "#fff;";				return '#dfd;';	}		,createTitleClick: function( i ){	    	if ( this.section == 'daily' ){		    return 'Eve._handleCalendarClick = false;';		}		return ['Eve.Resource.superbridge.broadcast( window, \'change_calendar_section\',',		'{ section: \'daily\', from: \'' + (this.section || 'weekly')+ '\', index:' + (i + ( 7 * ( this.sectionId || 0 ) ) ) + ' } ); Eve._handleCalendarClick = false;'].join('');	}		,calcDate: function( index ){		/*return ( new Date( this.getDate().getTime() + 86400000 * index ) );*/		//majid		var d = new Date(this.getDate());		d.setDate( d.getDate() + index );		return d;		//majid			}		,titleClick: Ext.emptyFn		,parseClick: function( i, ev ){	    if ( Eve._handleCalendarClick )			this.titleClick( this.calcDate( i ), ev );		Eve._handleCalendarClick = true;	}		,setNumberOfDays: function( nod ){		this._nod = nod;		if ( this.background.items ){			this.background.items.clear();		}				this.randomId = 'b_' + Math.random() * 65536;		var width = 1.0 / nod;		var that = this;		for ( var i = 0; i < nod; ++i ){			//debugger;						this.background.add( { xtype: 'container'						, columnWidth: ( i == (nod-1) ) ? (1 - (width * ( nod-1 ))): width, id: (this.randomId + '_' + i)						, layout : 'table'						, autoEl : { 							tag: 'div'							, cls: 'x-calendar-weekly-title' + (( i == (nod-1) )? ' x-calendar-weekly-title-last' : (( i == 0 )?' x-calendar-weekly-title-first' : '' )) 							, html   : ''							, onclick: this.parseClick.createTextFunction( this, i )						} 						,layoutConfig: {						        columns: 4						}					} );			var cell = Ext.getCmp(this.randomId + '_' + i);						cell.add( { xtype: 'container'					, id: (this.randomId + '_' + i + '_title')					, cellCls: 'x-calendar-notify-title'					, autoEl: { tag: 'div', html: '', style: 'white-space: nowrap;' }					, dayIndex: i					, listeners: {						'render': function( cmp ){							cmp.getEl().on('click', function(e){								if ( that.section == 'daily' ){									e.stopEvent();									return false;								}								Eve.Resource.superbridge.broadcast( window, 'change_calendar_section', 								{ section: 'daily', from: that.section || 'weekly', index: ( cmp.dayIndex + ( 7 * ( that.sectionId || 0 ) ) ) });								e.stopEvent();							});							cmp.getEl().on('dblclick', function(e){								e.stopEvent();							});						}					 }									} );			cell.add( { xtype: 'container'					, id: (this.randomId + '_' + i + '_blank')					, cellCls: 'x-calendar-notify-blank'					, autoEl: { tag: 'div', html: '&nbsp;' }				} );			cell.add( { xtype: 'container'					, id: (this.randomId + '_' + i + '_tasks')					, cellCls: 'x-calendar-notify-tasks'					, autoEl: { tag: 'div', html: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'ext:qtip': 'TASKS' }					, hidden: true					, dayIndex: i					, listeners: {						'render': function( cmp ){							cmp.getEl().on('click', function(e){								e.stopEvent();								Eve.Resource.superbridge.broadcast( window, 'calendar_scroll_tasks',								{ index : ( cmp.dayIndex + ( 7 * ( that.sectionId || 0 ) ) ) });							});							cmp.getEl().on('dblclick', function(e){								e.stopEvent();							});						}					 }									} );			cell.add( { xtype: 'container'					, id: (this.randomId + '_' + i + '_extra')					, cellCls: 'x-calendar-notify-extra'					, autoEl: { tag: 'div', html: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'ext:qtip': 'EXTRA' }					, hidden: true					, dayIndex: i					, listeners: {						'render': function( cmp ){							cmp.getEl().on('click', function(e){								Eve.Resource.superbridge.broadcast( window, 'change_calendar_section', 								{ section: 'daily', from: 'monthly', index: ( cmp.dayIndex + ( 7 * ( that.sectionId || 0 ) ) ) });								e.stopEvent();							});							cmp.getEl().on('dblclick', function(e){								e.stopEvent();							});						}					 }									} );		}				if ( this.background.rendered ){			this.background.doLayout();		}	}		,moveToMultiday: function( it, date, oldCal, fromMultiday ){	    	// preserve the time difference when moving to another multiday calendar		var diff = it.get().extra.end_real.getTime() - it.get().extra.start_real.getTime();		if ( it.get().extra.allDay ){		    console.log( 'first', it.get().extra.start_real );		    console.log( 'first', it.get().extra.end_real );		}		// set the new start		it.get().extra.start_real = new Date( 			date.getFullYear(), 			date.getMonth(), 			date.getDate(), 			it.get().extra.start_real.getHours(), 			it.get().extra.start_real.getMinutes() 		);		// set the new end date		var eDate = new Date(it.get().extra.start_real.getTime() + diff);		it.get().extra.end_real	  = eDate;				it.get().startDate = new Date( 			date.getFullYear(), 			date.getMonth(), 			date.getDate(), 			12 + this._timeOffset, 			0 );		it.get().endDate   = new Date( 			eDate.getFullYear(), 			eDate.getMonth(), 			eDate.getDate() + 1, 			0 + this._timeOffset, 			0 );				if ( it.get().extra.allDay ){		    console.log( 'second', it.get().extra.start_real );		    console.log( 'second', it.get().extra.end_real );		}		if ( oldCal.getView().section == "monthly" ){			// if its from monthly just move the item and refresh the whole thing			this._cal.monthlyCal.getContainer().refreshItems();			this._cal.monthlyCal.refreshView();			this._cal.monthlyCal.fireEvent( 'move', it, date, oldCal, true, it.get().extra.allDay || false );		}else{			// if its from multiday to multiday( itself ) just move the item and refresh the whole thing			oldCal.getContainer().removeItem( it );						// since oldCal == this._cal			this._cal.addItem( it.get() );			this._cal.container.refreshItems();			this._cal.refreshView();						this._cal.fireEvent( 'move', it, date, oldCal, true, it.get().extra.allDay || false );						if ( this._cal.parent )				this._cal.parent.fireEvent( 'move', it, date, oldCal, true, it.get().extra.allDay || false );		}	}	// If its from a multiday Calendar... we need to behave differently ...	,moveItem: function( it, date, oldCal, fromMultiday ){		if ( this._cal.fireEvent( 'beforemove', it, date, oldCal ) ){			if ( fromMultiday ){				//				this.moveToMultiday.apply( this, arguments );			}else{				// Normal procedure would be				// Delete item from the old Calendar				// Add it to the new View				// refresh items in container				// and rerender the whole thing								// if we are in monthly section all we need to do is to move it in the container and we ll be done.				oldCal.getContainer().removeItem( it );								//if ( oldCal != this._cal ){					oldCal.container.refreshItems();					oldCal.getView().refreshView();				//}				it.get().startDate 	= new Date( 					date.getFullYear(), 					date.getMonth(), 					date.getDate(), 					12, 0 				);								it.get().endDate 	= new Date( 					date.getFullYear(), 					date.getMonth(), 					date.getDate() + 1, 					0, 0				);								it.get().extra.start_real 	= date;				it.get().extra.end_real 	= new Date( 					date.getFullYear(), 					date.getMonth(), 					date.getDate(), 					date.getHours(), 					date.getMinutes() + 1 				);								// Mark the event as an allday event				it.get().extra.allDay = true;				this._cal.addItem( it.get() );								// Refresh the items				this._cal.container.refreshItems();				this.refreshView();									// if it isn't from another multiday calendar change its type to all day event				this._cal.parent.fireEvent( 'move', it, date, oldCal, false, true /* all day event */ );			}		}	}		,setDate: function( date ){		this._date = date;		for ( var i = 0; i < this._nod; ++i ){			/*var sdate =  new Date( date.getTime() + 3600 * 24 * 1000 * i );*/			//majid			var sdate = new Date(date);			sdate.setDate( sdate.getDate() + i );			//majid			//var cmp   = Ext.getCmp(this.randomId + '_' + i ) ;			//var el	  = cmp.getEl();			var format = '<\\b>j</\\b> l';            if ( typeof this.sectionId != 'undefined' && this.sectionId == 0 && sdate.getDate() == 1){                format = '<\\b>j</\\b> M - l';            }            if ( this.sectionId && this.sectionId != 0 ){                format = '<\\b>j</\\b>';            }            if ( this.sectionId && sdate.getDate() == 1 && this.sectionId != 0 ){                format = '<\\b>j</\\b> M';            }		/*if ( !el ){				cmp.autoEl.html = '<div><div><a href="#" onclick="' + this.createTitleClick( i ) + '">' + sdate.format(format) + '</a></div><div class="x-calendar-notifyy-br"></div><div class="x-calendar-notifyy-task"></div></div>';		}else{				el.dom.innerHTML = '<div><a href="#" onclick="' + this.createTitleClick( i ) + '">' + sdate.format(format) + '</a>Ali</div>';		}*/			//var bodyCmp = Ext.getCmp('body_' + this.randomId + '_' + i);			//debugger;			var cell = Ext.getCmp(this.randomId + '_' + i);			cell.date = sdate;			if ( cell.getEl() ){				cell.getEl().setStyle('backgroundColor', this.getColor( i, cell ).match(/(.*?);$/)[1] );			}else{				cell.autoEl.style = 'position: relative; background-color: ' + this.getColor( i, cell );			}						var cellTitle = Ext.getCmp(this.randomId + '_' + i + '_title');						if ( cellTitle.getEl() ){				cellTitle.getEl().dom.innerHTML = sdate.format(format).replace(/ /g,'&nbsp;');			}else{				cellTitle.autoEl.html = sdate.format(format).replace(/ /g,'&nbsp;');			}						/*if ( cellTitle.getEl() ){				cellTitle.getEl().dom.innerHTML = '<a href="#" onclick="' + this.createTitleClick( i ) + '">' + sdate.format(format) + '</a>';			}else{				cellTitle.autoEl.html = '<a href="#" onclick="' + this.createTitleClick( i ) + '">' + sdate.format(format) + '</a>';			}*/					}	}	,setBaseDate: function( _date ){		this.baseDate = _date;	}	,resizeItem: function( it, startDate, endDate ){		if ( this._cal.fireEvent( 'beforeresize', it, startDate, endDate ) ){					// Normal procedure would be			// Delete item from the old Calendar			// Add it to the new View			// refresh items in container			// and rerender the whole thing						this._cal.removeItem( it );						it.get().resizeTo( startDate, endDate );			this._cal.addItem( it.get() );						// Refresh the items			this._cal.container.refreshItems();			this.refreshView();						this._cal.fireEvent( 'move', it, startDate, endDate );		}	}		,resizeItemResizableAdapter: function( rz, w, h, e, index, node ){		var c = this.getCalendar().getDate();				// Calculate the length of the event		h = this.getPositionTranslator().decipher( h );				var d = ( h.h * 3600 + h.m * 60 ) * 1000;					// get the record;		var it = this.dv.getRecord( node ).get('cnt');				var start = 0, end = 0;		if ( rz.activeHandle.position.indexOf( 'north' ) !== -1 ){			start = it.getEnd() - d;			end   = it.getEnd();		}else{			start = it.getStart();			end   = it.getStart() + d;		}		start = this.getPositionTranslator().getHMS( start );		end   = this.getPositionTranslator().getHMS( end );				start = new Date( c.getFullYear(), c.getMonth(), c.getDate(), start.h, this._pt.gapTime( start.m ), 0 );		end   = new Date( c.getFullYear(), c.getMonth(), c.getDate(), end.h  , this._pt.gapTime( end.m ), 0 );				this.resizeItem( it, start, end );			}		,releaseDD: function(){		this.ddDrag.unreg();		this.ddDrop.unreg();				delete this.ddDrag;		delete this.ddDrop;	}		,initDD: function(){		if ( this.ddDrag )			return true;					this.ddDrag = new Eve.calendar.MultidayCalendarDragZone( this, { hasOuterHandles: true, ddGroup: this.ddGroup } );		this.ddDrop = new Eve.calendar.MultidayCalendarDropZone( this, { ddGroup: this.ddGroup }/*{ hasOuterHandles: true }*/ );			}		,afterRender: function(){		Eve.calendar.MultidayEventView.superclass.afterRender.apply( this, arguments );		this.renderItems();						this.dv.on('mouseenter', this.showResizable, this );		this.dv.on('dblclick', this.fireNodeDblClick, this );		this.el.on('dblclick', this.fireBodyDblClick, this );		this.el.on('click', this.fireBodyClick, this );	}		,fireBodyClick: function( e, ele ){		this._cal.fireEvent( 'click', e, ele, this._cal );	}	,fireBodyDblClick: function( e, ele ){		this._cal.fireEvent( 'dblclick', e, ele, this._cal );	}		,fireNodeDblClick: function( dv, index, node, e ){		e.stopEvent();		this._cal.fireEvent( 'nodedblclick', dv, dv.getRecord( node ).get('cnt'), index );	}		,_hideResizable: function(){		if ( this._rz )			this._rz.destroy();					this._rz = null;	}	,showResizable: function( dv, index, node, e ){		/*		this._hideResizable();				this._rz = new Ext.Resizable( node, { handles: 'e w' } );		this._rz.on( 'resize', this.resizeItemResizableAdapter.createDelegate( this, [ index, node ], true ) );		*/	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Multiday/MultidayCalendarDrop.js *//*--------------------------------------------------*/Eve.calendar.MultidayCalendarDropZone = function(calendarView, config){    this.view = calendarView;    this.cal  = calendarView.getCalendar();	config.ddGroup = config.ddGroup || 'CalendarDD';    Eve.calendar.MultidayCalendarDropZone.superclass.constructor.apply(this, [this.view.getItemLayer().dom, config || {}]/* calendarView.dom*/);//	this.ddGroup = "CalendarDD";};Ext.extend(Eve.calendar.MultidayCalendarDropZone, Ext.dd.DropTarget, {    //ddGroup : "CalendarDD",        onDragEnter : function(n, dd, e, data){    },    onDragOut : function(n, dd, e, data){    },	onDrag: function(){	},	    onDragDrop : function(n, dd, e, data){        return false;    },		notifyDrop : function( proxy, e, dd ){		var dv = this.view.dv;		var el = dv.getEl();/*		var cal = Ext.get(e.getTarget());				if ( !cal.hasClass( 'calendar-body' ) )			cal = cal.up('calendar-body' );				if ( !cal ) return;				cal = Ext.getCmp(cal.id);		if ( !cal ) return;				cal = cal.ownerCt;					*/		if ( !dd.item )			return false;			/*		if ( this.view.ddGroup !== cal.ddGroup )			return false;			*/		var cal = this.cal;		var c = e.getXY()[0] - el.getLeft();		var d = this.view.getPositionTranslator().decipher( (c / el.getSize().width), this.cal );		var c = this.view.getCalendar().getDate();					var it = dd.item.wrapped.extra;				var start = it.start_real;		var end   = it.end_real				if ( !dd.fromMutliday ){			start = dd.item.wrapped.startDate;			end   = dd.item.wrapped.endDate;		}				clearTimeout( this.moveItemTimeout );				this.moveItemTimeout = setTimeout( 			(function( from ){				console.log( start, end );				this.view.moveItem( dd.item, new Date( d.getFullYear(), d.getMonth(), d.getDate(), start.getHours(), start.getMinutes(), 0 ), dd.oldCal, from );			}).createDelegate( this, [ dd.fromMultiday ] ), 100 		);				return false;	},		notifyOver: function( source, e, data ){/*		var cal = Ext.get(e.getTarget());		if ( !cal.hasClass( 'calendar-body' ) )			cal = cal.up('calendar-body' );		if ( !cal ) return this.dropNotAllowed;		*/		//cal = this.cal;//Ext.getCmp(cal.id);		//console.log( cal, this.view );		//console.log( this.view.ddGroup, cal.ownerCt.ddGroup );			//if ( this.view.ddGroup !== cal.ddGroup )		//	return this.dropNotAllowed;		return this.dropAllowed;	}	/*	getTargetFromEvent: function( e ){	}*/});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Calendar/Multiday/MultidayCalendarDrag.js *//*--------------------------------------------------*/Eve.calendar.MultidayCalendarDragZone = function(calendarView, config){    this.view = calendarView;	config.ddGroup = config.ddGroup || 'CalendarDD';	    Eve.calendar.MultidayCalendarDragZone.superclass.constructor.apply(this, [this.view.getItemLayer().dom/* calendarView.dom*/, config || {} ]);	    this.scroll = false;//    this._cal   = calendar;    this.ddel 	= document.createElement('div');    this.ddel.className = 'x-grid-dd-wrap';	this.ddel.style.height = '100px';	this.ddel.style.width  = '125px';	this.ddel.style.overflow  = 'hidden';//	this.dropNotAllowed = "x-dd-drop-ok";	};Ext.extend(Eve.calendar.MultidayCalendarDragZone, Ext.dd.DragZone, {    getDragData : function(e){        var t = Ext.lib.Event.getTarget(e);		var u = Ext.get(t).up( 'div.x-calendar-item' );		if ( !u )			return false;				var it = this.view.getItemByDom( Ext.fly(u).dom );		if ( it.wrapped.extra.editPer !== "1" )			return false;					this.ddel.innerHTML = u.dom.getElementsByTagName('div')[1].innerHTML;//u.dom.innerHTML;u.dom.innerHTML;				return { ddel: this.ddel, oldCal: this.view.getCalendar(), 'item': it, fromMultiday: true };    },	    onInitDrag : function(e){        var data = this.dragData;        // this.ddel.innerHTML = 'Being Dragged';		// this.grid.getDragDropText();        this.proxy.update(this.ddel);        // fire start drag?    },		createFrame: function(){		var proxy = Eve.calendar.MultidayCalendarDragZone.superclass.createFrame.apply( this, arguments );		return proxy;	},	onBeforeDrag: function(){		return true;	},	    afterRepair : function(){        this.dragging = false;    },	    getRepairXY : function(e, data){        return false;    },    endDrag: function(data, e){		this.proxy.hide();        // fire end drag?		return true;    },    onValidDrop : function(dd, e, id){        // fire drag drop?        this.hideProxy();    },    beforeInvalidDrop : function(e, id){    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/sitetree/sitetree.js *//*--------------------------------------------------*/// JavaScript DocumentExt.ns( 'SiteTree' );Ext.onReady( function(){    SiteTree.MoveStoreRecord = Ext.data.Record.create([        'path', 'text', 'id'    ]);    SiteTree.MoveStore = new Ext.data.Store({		url: Eve.url,		reader: new Ext.data.XmlReader( { record: 'node' } ,SiteTree.MoveStoreRecord )    });    SiteTree.MoveCombo = new Ext.form.ComboBox( {	   fieldLabel		: 'Move Page'	   ,id        		: 'sitetree_move'	   ,triggerAction	: 'all'	   ,anchor    		: '90%'	   ,displayField	: 'text'	   ,valueField		: 'id'	   ,store     		: SiteTree.MoveStore	   ,listeners 		: {			'expand' : function( cp ){				cp.doQuery(Math.random() * 65536, true);			}		}	});    SiteTree.MoveCombo.getParams = function(q){        var activeNode = SiteTree.ContentPanel.activeNode;        var id = undefined;        if ( activeNode ){            id = activeNode.id.split('_')[1];        }        return Pub.Connector.routeTo( 'fetchAllMovablePages', { filterPage: id } );    };});SiteTree.TreeHolder = function( config ){	config = config || {};		var defConfig = {		layout	: 'accordion'		,region	: 'center'		,items	: [					new SiteTree.Tree({				title		: 'Pages'				,collapsible: true			}),			new SiteTree.TemplateTree({				title		: 'Templates'				,collapsible: true				,collapsed	: true			})		]	}		Ext.applyIf( config, defConfig );	SiteTree.TreeHolder.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.TreeHolder, Ext.Panel, {	initEvents: function(){		SiteTree.TreeHolder.superclass.initEvents.apply( this, arguments );				this.items.each (function(r){			r.on('expand', this.swapBehaviour, this );		}, this);				this.reinitChildren();	}		,swapBehaviour: function() {        this.items.each( function( r ){             var node = r.getSelectionModel().getSelectedNode();             if ( node )                 node.unselect();        } , this );		// If it is the pages that has been expanded fire		if ( this.layout.activeItem == this.items.get(0) ){			this._obs.fireEvent( 'swap_behaviour', 'page' );		}else{			this._obs.fireEvent( 'swap_behaviour', 'template' );		}				// Dumb IE		if (Ext.isIE) {			this.setHeight(this.getHeight() - 100);		}	}		,setMenu: function(menu){		this.menu = menu;		this.reinitChildren();	}		,setObserver: function( obs ){		this._obs = obs;		this.reinitChildren();		}		,reinitChildren : function(){		if ( this.items ){			this.items.each( function( r ){				// LoL ... Dont wanna bother to make it look better... Drew would change it anyway...				if ( this.panel ) {					r.setPanel( this.panel );				}								if ( this.menu ) {					r.setMenu( this.menu );				}								if ( this._obs ) {					r.setObserver( this._obs );				}			}, this );		}	}		,setPanel: function( panel ){		this.panel = panel;		this.reinitChildren();	}} )//---------------------------------------------////---------------------------------------------SiteTree.Menu = function( config ){	config = config || {};	config.items = [{		text: 'New'		,icon	: Eve.imagePath + 'publisher2/add.png'		,handler: function( e ){			// Show the new Page Window without anything			this._obs.fireEvent( 'page_wizard', e.target );			//this._obs.fireEvent( 'show_new_page', '', this.activeNode.getNodePath(), '0', this.activeNode );		}		,scope: this	},{		text: 'Delete'		,icon	: Eve.imagePath + 'publisher2/Delete.png'		,handler: function(){			this.deleteNode();		}		,scope: this	}];		this.isPage = true;	SiteTree.Menu.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.Menu, Ext.menu.Menu, {	setNode: function( node ){		this.activeNode = node;	}		,setObserver: function( obs ){		this._obs = obs;				obs.on('swap_behaviour', this.swapBehaviour, this );	}		,swapBehaviour: function( p ){		if ( p  == 'page' ){			this.isPage = true;		}else{			this.isPage = false;		}	}	,deleteNode: function(){		if ( !this.activeNode )			return false;					// We can't delete the root node		if ( !this.activeNode.parentNode )			return false;					var id = this.activeNode.id.split('_')[1];		var func = (function( a ){			var node = a;											 			return function(){				node.remove();			}					})( this.activeNode );				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, event: 'modern.publisher.' + (this.isPage ? 'page' : 'template' )+ '.delete', groupId: Eve.GroupSelect.GroupId }, success: func, scope: this } );	}} );//---------------------------------------------////---------------------------------------------SiteTree.Tree = function( config ){	config = config || {};		config.region = config.region || 'west';	config.width  = config.width  || 125;		config.root	  = config.root   || new Ext.tree.AsyncTreeNode( { id: '0' } );	config.rootVisible = false;	config.split  = true;	config.tbar   = new Ext.Toolbar( { items: [      { 		 icon: Eve.imagePath + 'publisher2/add.png'		,cls: "x-btn-icon"		,tooltip: 'Create a new page'		,handler: function() {			var node = this.getSelectionModel().selNode || this.root; 			this.augment( node );			//this._obs.fireEvent( 'show_new_page', '', node.getNodePath(), '0', node ); 			this._obs.fireEvent( 'page_wizard', null);						// Couldn't find any better option, sorry			if (Eve._store) {				Eve._store.reload();			}		}		,scope: this	}, {		 icon: Eve.imagePath + 'publisher2/delete.png'		,tooltip: 'Delete a page'		,cls: "x-btn-icon"		,handler: function(){ 			var node = this.getSelectionModel().selNode; 			if (!node)				return false;							this.augment(node);			var id = node.id.split('_')[1];			var func = (function(a) {				var node = a;								 				return function() {					node.remove();				}			})(node);			Ext.Ajax.request({				url: Pub.Connector.baseUrl()				,params: { id: id, event: 'modern.publisher.page.delete', groupId: Eve.GroupSelect.GroupId }				,success: func				,scope: this			});		}		,scope: this	}]});		config.loader = {		url : Pub.Connector.baseUrl()		,baseParams : this.fetchData.createDelegate(this)	};				SiteTree.Tree.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.Tree, Eve.Tree, {	setPanel: function( panel ){		this.panel = panel;	}		,fetchData: function(node){		if ( !node ){		    return { event: 'modern.publisher.page.getsubtree', groupId: Eve.GroupSelect.GroupId, id: 0 }		}		id = node.id;		id.split && ( id = id.split('_')[1] );		( id == "-1" ) && ( id = '0' );		return { event: 'modern.publisher.page.getsubtree', groupId: Eve.GroupSelect.GroupId, id: id }	}		,setMenu: function( menu ){		this.menu = menu;	}		,setObserver: function( obs ){		this._obs = obs;				obs.on('create_new_page', this.handleNewPage, this );		obs.on('reload_tree', this.reloadTree, this );	}		,reloadTree: function(){		this.root.reload();		SiteTree.ContentPanel.activeNode = null;	}	,shallAddPage: function( id ){        return ( id.split( '_' )[0] == 'PG' );    }	,handleNewPage: function( params, node, xml ){        var dq = Ext.DomQuery;        if ( !this.shallAddPage( dq.selectValue( 'id', xml ) ) )            return true;		var arr = params.path.split( '\\' );		var parentId = '';				if ( arr.length > 1 ){			parentId = 'PG_' + arr[arr.length-2];		}				var node 	 = this.getNodeById( parentId );				if ( params.path == '\\' )			node = this.root;					if ( !node ){			return true;		}				node.leaf 	 = false;		var id = Ext.DomQuery.selectValue( 'id', xml );		node.appendChild( new Ext.tree.TreeNode( { text: params.title, id: id, leaf: true, cls: 'page-node', path: params.path, icon: Eve.imagePath + 'publisher2/leaf.gif' } ) );	}		,initEvents: function(){		SiteTree.Tree.superclass.initEvents.apply( this, arguments );				// Register Events		this.getSelectionModel().on( 'selectionchange', this.handleClick, this );		this.on( 'dblclick', this.handleDblClick, this );		this.on( 'contextmenu', this.handleContextMenu, this );		this.body.on('contextmenu', this.handleBodyContextMenu, this );	}		,handleBodyContextMenu: function( e ){		e.stopEvent();				if ( this.contextMenuHandled )			return;					this.root.getNodePath = function(){ return '\\'; };				this.menu.setNode( this.root );		this.menu.showAt( e.getXY() );	}		,handleContextMenu: function( node, e ){		if ( node ){			this.menu.setNode( this.augment( node ) );			this.menu.showAt( e.getXY() );						this.contextMenuHandled = true;			setTimeout( (function(){ this.contextMenuHandled = false }).createDelegate( this ), 100 );			e.stopEvent();		}	}		,augment: function( node ){		node.getNodePath = function(){			var path = this.getPath().replace( /(PG_|TM_)/g, '' ).replace( /\/0/, '' ).replace( /\//g, '\\' ) + '\\';			path = ( (path == '\\') ? '\\' : '' ) + path;			return path;		}				return node;	}	,handleDblClick: function( tree, e ){		// We should pop the publisher with proper parameters		// should pop the publisher for the passed node		this.panel.popPublisher();	}		,handleClick: function( selModel, node ){		if ( !this.panel )			return;					this.panel.setActiveContent( node );	}} );//---------------------------------------------////---------------------------------------------SiteTree.TemplateTree = function(config){	config = config || {};		config.region 		= config.region || 'west';	config.width  		= config.width  || 125;	config.root	  		= config.root   || new Ext.tree.AsyncTreeNode( { id: '0' } );	config.rootVisible	= false;	config.split  		= true;	config.border		= false;	config.tbar   		= new Ext.Toolbar({		items: [{ 			xtype: 'button'			,text :'&nbsp;&nbsp;&nbsp'			,icon: Eve.imagePath + 'publisher2/add.png'			,width: 16			,tooltip: 'Create a new page'			,handler: function(){				var node = this.getSelectionModel().selNode || this.root; 				this.augment( node );				//this._obs.fireEvent( 'show_new_page', '', node.getNodePath(), '0', node ); 				this._obs.fireEvent( 'page_wizard', null);			}			,scope: this		}, {			xtype	: 'button'			,text	:'&nbsp;&nbsp;&nbsp'			,icon	: Eve.imagePath + 'publisher2/delete.png'			,width	: 16			,tooltip: 'Delete a page'			,handler: function() {				var node = this.getSelectionModel().selNode;								if ( !node )					return false;								this.augment( node );				var id = node.id.split('_')[1];				var func = (function( a ){					var node = a;											 					return function(){					node.remove();					}				})(node);								Ext.Ajax.request({					url: Pub.Connector.baseUrl()					,params: {						id		: id						,event	: 'modern.publisher.template.delete'						,groupId: Eve.GroupSelect.GroupId					}					,success: func					,scope: this				});			}			, scope: this		}]	});				config.loader = {		url : Pub.Connector.baseUrl()		,baseParams : this.fetchData.createDelegate(this)	};				// And yes again.. it is Tree not TemplateTree	SiteTree.Tree.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.TemplateTree, Eve.Tree, {	shallAddPage: function( id ){        return ( id.split( '_' )[0] == 'TM' );    },	setPanel: function( panel ){		this.panel = panel;	},		fetchData: function( node ){		if ( !node ){		    return { event: 'modern.publisher.template.getsubtree', groupId: Eve.GroupSelect.GroupId, id: 0 }		}		id = node.id;		id.split && ( id = id.split('_')[1] );		( id == "-1" ) && ( id = '0' );		return { event: 'modern.publisher.template.getsubtree', groupId: Eve.GroupSelect.GroupId, id: id }	}	,setMenu: function( menu ){		this.menu = menu;	}		,setObserver: function( obs ){		this._obs = obs;				obs.on('create_new_page', this.handleNewPage, this );		obs.on('reload_tree', this.reloadTree, this );	}		,reloadTree: function(){		this.root.reload();	}	,handleNewPage: function( params, node, xml ){        var dq = Ext.DomQuery;        if ( !this.shallAddPage( dq.selectValue( 'id', xml ) ) )            return true;		var arr = params.path.split( '\\' );		var parentId = '';				if ( arr.length > 1 ){			parentId = 'PG_' + arr[arr.length-2];		}				var node 	 = this.getNodeById( parentId );				if ( params.path == '\\' )			node = this.root;					if ( !node ){			return true;		}				node.leaf 	 = false;		var id = Ext.DomQuery.selectValue( 'id', xml );		node.appendChild( new Ext.tree.TreeNode( { text: params.title, id: id, leaf: true, cls: 'page-node', path: params.path, icon: Eve.imagePath + 'publisher2/leaf.gif' } ) );	}		,initEvents: function(){		SiteTree.Tree.superclass.initEvents.apply( this, arguments );				// Register Events		this.getSelectionModel().on( 'selectionchange', this.handleClick, this );		this.on( 'dblclick', this.handleDblClick, this );		this.on( 'contextmenu', this.handleContextMenu, this );		this.body.on('contextmenu', this.handleBodyContextMenu, this );	}		,handleBodyContextMenu: function( e ){		e.stopEvent();				if ( this.contextMenuHandled )			return;					this.root.getNodePath = function(){ return '\\'; };				this.menu.setNode( this.root );		this.menu.showAt( e.getXY() );	}		,handleContextMenu: function( node, e ){		if ( node ){			this.menu.setNode( this.augment( node ) );			this.menu.showAt( e.getXY() );						this.contextMenuHandled = true;			setTimeout( (function(){ this.contextMenuHandled = false }).createDelegate( this ), 100 );			e.stopEvent();		}	}		,augment: function( node ){		node.getNodePath = function(){			var path = this.getPath().replace( /(PG_|TM_)/g, '' ).replace( /\/0/, '' ).replace( /\//g, '\\' ) + '\\';			path = ( (path == '\\') ? '\\' : '' ) + path;			return path;		}				return node;	}	,handleDblClick: function( tree, e ){		// We should pop the publisher with proper parameters		// should pop the publisher for the passed node		this.panel.popPublisher();	}		,handleClick: function( selModel, node ){		if ( !this.panel )			return;					this.panel.setActiveContent( node );	}} );//---------------------------------------------////---------------------------------------------SiteTree.Panel = function( config ){	config = config || {};	var that = this;	var defaultItemConfig = [{		xtype		: 'textfield'		,fieldLabel	: 'Title'		,anchor		: '90%'		,id			: 'sitetree_title'	}, {		xtype		: 'textfield'		,fieldLabel	: 'Keywords'		,anchor		: '90%'		,id			: 'sitetree_keywords'	}, {		xtype		: 'textarea'		,fieldLabel	: 'Description'		,anchor		: '90%'		,id			: 'sitetree_description'	}, {		xtype		: 'panel'		,border		: false		,layout		: 'form'		,disable		: function(){			this.items.each(function(p){						if ( p.disable )							p.disable();			})		}		,enable		: function(){			this.items.each(function(p){						if ( p.enable)							p.enable();			})		}		,items		: [{			xtype		: 'datefield'			,fieldLabel	: 'Expires'			,id			: 'sitetree_expires'			,anchor		: '90%'		}]	}, {		html		: '<br /><hr style="border-width: 1px 0px 0px 0px; border-color: #ccc; border-style: solid;">'		,disable	: Ext.emptyFn	}, {		xtype		: 'panel'		,layout		: 'column'		,id			: 'sitetree_move_container'		,disable	: function() {			this.items.each(function(r){				if ( r.items ) {					r.items.each( function(p) {						if ( p.disable )							p.disable();					})				}			})		}		,enable		: function(){			this.items.each(function(r){				if ( r.items ){					r.items.each( function(p){						if ( p.enable )							p.enable();					})				}			})		}		,items		: [{			columnWidth: .8, 			border:false, 			layout: 'form', 			items: [ SiteTree.MoveCombo ] 		}, { 			columnWidth: .2, 			border: false, 			layout: 'form', 			items: [{				xtype	: 'button'				,text	: 'Move'				,scope	: that				,handler: function() {					// Fire a move Event					var cb = Ext.getCmp('sitetree_move');					if ( !cb.view || !cb.view.getSelectedIndexes() || cb.getValue() == '' )					   return false;					var index = cb.view.getSelectedIndexes()[0];					var record = cb.store.getAt( index );					var pId = cb.getValue().split( '_' )[1];					var newPath = record.get('path');					cb.setRawValue( '' );					Ext.Ajax.request( Pub.Connector.routeTo( 'movePage', {						extras: { 							parentId: pId,							pageId: this.activeNode.id.split('_')[1],							newPath: newPath,							path: this.activeNode.attributes['path']						}						// Refersh the Sitetree						,success: function() {							this._obs.fireEvent('reload_tree');						}						,scope: that					})); 				}			}]		}]	}, {		html	: '<br /><hr style="border-width: 1px 0px 0px 0px; border-color: #ccc; border-style: solid;">'		,disable: Ext.emptyFn	}, { 		layout	: 'form', labelWidth: 5, anchor: "100%", id: 'Testing'		,disable: function() {			this.items.each( function(p){				if ( p.disable )					p.disable();			});		}		,enable	: function() {			this.items.each( function(p){				if ( p.enable )					p.enable();			});		}		,items: [{			xtype: 'checkbox'			,boxLabel : 'Set this page as Published'			,id		  : 'sitetree_published'			,labelSeparator: ''		}, {			xtype: 'checkbox'			,boxLabel: 'Set this page as home page'			,labelSeparator: ''			,id: 'sitetree_homepage'		}, {			xtype: 'checkbox'			,boxLabel: 'List this page in the system generated menus'			,labelSeparator: ''			,id: 'sitetree_listed'		}] 	}];		var defaultButtonConfig = [{		text	: 'Design'		,handler: function(){ this.popPublisher(); }		,scope	: this	}, {		text	: 'Preview'		,handler: function(){ this.popPreview(); }		,scope	: this	}, {		text	: 'Save'		,handler: function(){ this.saveContentToActiveNode( Ext.emptyFn ); }		,scope	: this	}, {		text	: 'Delete'		,handler: function(){ this.deleteActiveNode( Ext.emptyFn ); }		,scope	: this	}, {		text	: 'Upload'		,handler: function(){ this.showUploadForm(); }		,scope	: this	}]		// Apply the default Styles if not overriden	config.items  = config.items  || defaultItemConfig;	config.region = config.region || 'east';	config.width  = 420;	config.buttons= config.buttons || defaultButtonConfig;	config.bodyStyle 	= 'padding: 10px 0px 0px 10px';	config.frame		= true;		this.isPage = true;	SiteTree.Panel.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.Panel, Ext.FormPanel, {		// Changes the panel active content	setActiveContent: function( node ){		this.activeNode = node;				if ( node == null ){			this.disableItems();			return false;		}				this.enableItems();				var id = node.id.split('_');		id = ( id.length > 1 )? id[1]: id[0];				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, groupId: Eve.GroupSelect.GroupId, event: 'modern.publisher.' + 																						(this.isPage ? 'page' : 'template') + 																						'.edit' }																				, success: this.successSetContent, scope: this } );	}		,enableItems: function(){		this.items.each( function( r ){			if ( r.enable )				r.enable();		});	}		,disableItems: function(){		this.items.each(function(r){			if( r.disable ){				r.disable();			}		});	}		,reset: function(){		this.disableItems();	}		,popPublisher: function( node ){		node = node || this.activeNode;		if ( !node ) return;		        // Disable hiding this window T.T *Sigh*/*		this._obs.fireEvent( 'hide_window' ); */				window.open( Pub.Connector.baseUrl({						event: 'modern.publisher.publisher'						,pageId: node.id.split('_')[1]						,isTemplate: (this.isPage ? 'false' : 'true')					} ) );	}		,setObserver : function( obs ){		this._obs = obs;				obs.on('swap_behaviour', this.swapBehaviour, this );	}		,swapBehaviour: function( b ){		if ( b == 'page' ){			Ext.getCmp('sitetree_homepage').show();			Ext.getCmp('sitetree_listed').show();			Ext.getCmp('sitetree_published').show();            Ext.getCmp('sitetree_move_container').show();						this.isPage = true;		}else{			Ext.getCmp('sitetree_homepage').hide();			Ext.getCmp('sitetree_listed').hide();			Ext.getCmp('sitetree_published').hide();            Ext.getCmp('sitetree_move_container').hide();			this.isPage = false;		}	}		,popPreview: function( node ){		node = node || this.activeNode;		if ( !node ) return;				window.open( Pub.Connector.baseUrl({						event: 'modern.publisher.preview'						,pageId: node.id.split('_')[1]						,isTemplate: (this.isPage ? 'false' : 'true')					} ) );	}		// Delete the Active Node	,deleteActiveNode: function(){		if ( !this.activeNode )			return false;					// We can't delete the root node		if ( !this.activeNode.parentNode )			return false;					var id = this.activeNode.id.split('_')[1];		var func = (function( a ){			var node = a;											 			return function(){				node.remove();			}					})( this.activeNode );		Ext.MessageBox.confirm( 'Confirmation', 			['Are you sure you want to delete [',this.activeNode.text,'] ?'].join(''),			function(msg){				if ( msg != 'yes' )					return false;				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, event: 'modern.publisher.' + (this.isPage ? 'page' : 'template' )+ '.delete', groupId: Eve.GroupSelect.GroupId }, success: func, scope: this } );			}, this );	}	,saveContentToActiveNode: function( func ){		func = func || Ext.emptyFn;		if ( this.activeNode ){			var title 		= Ext.getCmp('sitetree_title').getValue();			var keywords 	= Ext.getCmp('sitetree_keywords').getValue();			var description = Ext.getCmp('sitetree_description').getValue();			var homepage	= Ext.getCmp('sitetree_homepage').getValue();			var listed		= Ext.getCmp('sitetree_listed').getValue();			var published   = Ext.getCmp('sitetree_published').getValue();			var expr		= Ext.getCmp('sitetree_expires').getValue();										 			var nodeId		= this.activeNode.id.split( '_' );						nodeId 			= (nodeId.length > 1) ? nodeId[1] : nodeId[0];						if ( ! this.windowElement )				this.windowElement = this.el.up('.x-window-mc');							// Start Masking the window			Pub.Masker.showMask( this.windowElement, 'Saving changes', 5000 );						Ext.Ajax.request({ 				url		: Pub.Connector.baseUrl()				,params	: {					event: 'modern.publisher.'+ (this.isPage ? 'page' : 'template')+ '.createModify'					,id				: nodeId					,groupId		: Eve.GroupSelect.GroupId					,title			: title					,keywords		: keywords					,description	: description					,listed			: listed					,homepage		: homepage					,published		: published					,expirationdate: expr.format ? expr.format('m/d/y'): ''				}				,success: func.createInterceptor( function(){ this.setNodeContent( this.activeNode, title ); Pub.Masker.hideMask( this.windowElement ); }, this ), scope: this } );		} else {			func();		}	}	,setNodeContent: function( node, title ){		node.setText( title );	}		,restoreContent: function(){		Ext.getCmp('sitetree_title').setValue();		Ext.getCmp('sitetree_keywords').setValue();		Ext.getCmp('sitetree_description').setValue();		Ext.getCmp('sitetree_homepage').setValue();		Ext.getCmp('sitetree_listed').setValue();	}		,successSetContent: function( response, params ){		var xml = response.responseXML;		var dq	= Ext.DomQuery;				Ext.getCmp('sitetree_title').setValue( dq.selectValue( 'title', xml ) );		Ext.getCmp('sitetree_keywords').setValue( dq.selectValue( 'keywords', xml ) );		Ext.getCmp('sitetree_description').setValue( dq.selectValue( 'description', xml ) );		Ext.getCmp('sitetree_homepage').setValue( dq.selectValue( 'homepage', xml ) );		Ext.getCmp('sitetree_listed').setValue( dq.selectValue( 'listed', xml ) );		Ext.getCmp('sitetree_published').setValue( dq.selectValue( 'published', xml ) );		Ext.getCmp('sitetree_expires').setValue( dq.selectValue( 'expirationDate', xml ) );	}		,showUploadForm : function() {			var that = this;				// If no node selected		if (!this.activeNode) {			Ext.Msg.alert('', 'Please select a Template');			return;		}				// If Page node selected		var pre = this.activeNode.id.split('_')[0]		var id	= this.activeNode.id.split('_')[1]				if (pre == "PG") {			Ext.Msg.alert('Select a Template', 'Upload feature only available in templates');			return;		}						var fp = new Eve.UploadFormPanel({			fileUpload	: true			,frame		: true			,border		: false			,autoHeight	: true			,bodyStyle	: 'padding: 10px 10px 0 10px;'			,labelWidth	: 50			,defaults	: {				anchor		: '95%'			//	,allowBlank	: false				,msgTarget	: 'side'			}			,items		: [{				xtype		: 'fileuploadfield'				,emptyText	: 'Select an image'				,fieldLabel	: 'Photo'				,name		: 'uploaded_data'				,buttonCfg	: {					text		: ''					,iconCls	: 'upload-icon'				}			}]			,buttons	: [{				text		: 'Save'				,handler	: function(){					if (fp.getForm().isValid()) {						fp.getForm().submit({							url		: Eve.url							,waitMsg: 'Uploading photo...'							,params	: {								event		: 'modern.publisher.template.uploadScreenshot'								,template_id: id								,groupId	: Eve.GroupSelect.GroupId							}							,success: function(fp, o) {								var val = Ext.DomQuery.selectValue('path', o.response.responseXML)								if (val !== undefined) {									if (!val || val.trim() == '' ) {										Ext.Msg.alert("Error", "There's an error while uploading image!");										val = Eve.Resource.getIcon('item-icon');									}																		that.winImage.hide();								}								else{									var text = o.response.responseText;									Ext.Msg.alert('Error', text);								}							}						});					}				}			}]		});				that.winImage = new Ext.Window({			layout		: 'form'			,width		: 400			,title		: 'Template Image Upload'			,resizable	: false			,modal		: true			,items		: [ fp ]		});				that.winImage.show();			}} );//---------------------------------------------////---------------------------------------------SiteTree.Window = function( config ){    SiteTree.ContentPanel = new SiteTree.Panel();	Ext.applyIf( config, {		layout	: 'border'		,items	: [ new SiteTree.TreeHolder(), SiteTree.ContentPanel ]	});		config.height = config.height || 380;    config.title = 'Site Tree';	this.menu = new SiteTree.Menu();	SiteTree.Window.superclass.constructor.apply( this, arguments );}Ext.extend( SiteTree.Window, Ext.Window, {	// Initializes the connection between the tree and the panel	initEvents: function(){		SiteTree.Window.superclass.initEvents.apply( this, arguments );				this.tree 	= this.items.get(0);		this.panel 	= this.items.get(1);				this.tree.setPanel( this.panel );		this.tree.setMenu( this.menu );				if ( this._obs ){			this.tree.setObserver( this._obs );			this.panel.setObserver( this._obs );		}				this.on('show', this.reset, this );	}		,reset: function(){		this.items.each( function(r){			if ( r.reset )				r.reset();		});	}		,setObserver: function( obs ){		this._obs 		= obs;		this.menu.setObserver( obs );				if ( this.tree ){			this.tree.setObserver( obs );			this.panel.setObserver( obs );		}				this._obs.on('hide_window', function(){ 			this.hide(); 		}, this );				this.on('show', function(){ this._obs.fireEvent('reload_tree') }, this );	}		,showSiteTree: function( arg ){		if ( this.isVisible() ){			this.hide( arg );		}else{			this.show( arg );		}	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/sitetree/page.js *//*--------------------------------------------------*/// JavaScript DocumentExt.ns( 'SiteTree.Page' );SiteTree.Page.New = function( config ){	var defConfig = {		 width	: 400		,height	: 300		,layout	: 'fit'		,closeAction: 'hide'		,title	: 'Create new Page'		,closable: false		,border	: false		,items	: [{			 xtype	: 'form'			,layout	: 'form'			,frame	: true			,border	: false			,items	: [{				 xtype: 'textfield'				,fieldLabel: 'Title'				,anchor: '90%'				,id		: 'st_page_title'			},{				 xtype: 'textfield'				,fieldLabel: 'Keywords'				,anchor: '90%'				,id		: 'st_page_keywords'			},{				 xtype: 'textarea'				,fieldLabel: 'Description'				,anchor: '90%'				,id		: 'st_page_description'			}]		}]		,bbar: [{			xtype	: 'button'			,text	: 'Create'			,handler: this.createNewPage			,scope	: this		},{			xtype	: 'button'			,text	: 'Cancel'			,handler: this.cancelCreate			,scope	: this		}]	}		config = config || {};		Ext.applyIf( config, defConfig );	SiteTree.Page.New.superclass.constructor.apply( this, [config] );}Ext.extend( SiteTree.Page.New, Ext.Window, {	showPageWindow: function( root, path, templateId, node ){		this.setTitle( 'Create new Page' );		this.show();		this._root = root;		this._path = path;		this._tid  = templateId || '0';		this._activeContent = 'page';		this.activeNode = node;	}		,showTemplateWindow: function( root, path, templateId, node ){		this.setTitle( 'Create new Template' );		this.show();		this._root = root;		this._path = path;		this._tid  = templateId || '0';		this._activeContent = 'template';		this.activeNode = node;	}		,resetWindow: function(){		this._path = '\\';		this._root = '';		this._tid  = '0';		this._activeContent = '';		this.activeNode = null;		Ext.getCmp('st_page_title').setValue('');		Ext.getCmp('st_page_keywords').setValue('');		Ext.getCmp('st_page_description').setValue('');	}		,cancelCreate: function(){		this.resetWindow();		this.hide();	}		,createNewPage: function(){		// E		var params = {			 title		: Ext.getCmp('st_page_title').getValue()			,keywords	: Ext.getCmp('st_page_keywords').getValue()			,description: Ext.getCmp('st_page_description').getValue()			,templateId	: this._tid			,path		: this._path			,event		: 'modern.publisher.' + this._activeContent + '.createModify'			,groupId	: Eve.GroupSelect.GroupId		}				// Trim the text...		params.title = params.title.replace( /^\s*/g, '' ).replace( /\s*$/g, '' );				if ( params.title == '' ){			return false;		}				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: params, success: this.successCreateNewPage, scope: this } );		// TODO: Waiting Message	}		,successCreateNewPage: function( response, sent ){		var params = sent.params;		params.id	   = Ext.DomQuery.selectValue( 'id', response.responseXML );		this._obs.fireEvent( 'create_new_' + this._activeContent, params, this.activeNode );		this.resetWindow();		this.hide();	}		,setObserver: function( obs ){		this._obs = obs;				this._obs.on('show_new_page'	, this.showPageWindow, this);		this._obs.on('show_new_template', this.showTemplateWindow, this);	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/template/template.js *//*--------------------------------------------------*/// JavaScript DocumentExt.ns( 'Template' );Template.Menu = function( config ){	config = config || {};		var defConfig = {		items: [{					text	: 'New Template'					,handler: this.createNewTemplate					,scope  : this				},{					text	: 'Delete'					,handler: this.deleteNode					,scope	: this				}]	}		Ext.applyIf( config, defConfig );		Template.Menu.superclass.constructor.apply( this, [config]);}Ext.extend( Template.Menu, Ext.menu.Menu, {	setObserver: function( obs ){		this._obs = obs;	}		,setActiveNode: function( node ){		this.activeNode = node;	}		,createNewTemplate: function(){		this._obs.fireEvent( 'show_new_template', '', this.activeNode.getNodePath(), '', this.activeNode );	}		,deleteNode: function(){		if ( !this.activeNode )			return false;					var id = this.activeNode.id.split('_')[1];		var func = (function( a ){			var node = a;											 			return function(){				node.remove();				this._obs.fireEvent( 'update_active_node' );			}					})( this.activeNode );				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, event: 'modern.publisher.template.delete', groupId: Eve.GroupId }, success: func, scope: this } );	}} );//---------------------------------------------////---------------------------------------------Template.Tree = function( config ){	config = config || {};		var defConfig = {		root		: new Ext.tree.AsyncTreeNode( {id: 0} )		,rootVisible: false		,region		: 'west'		,split		: true		,width		: 200		,loader		: { url: Pub.Connector.baseUrl(), baseParams: this.fetchTree.createDelegate( this ) }		,tbar		: new Ext.Toolbar( { items: [ { xtype: 'button'												  , text :'&nbsp;&nbsp;&nbsp'												  , icon: Eve.imagePath + 'default/extra/add.png'												  , width: 16												  ,	tooltip: 'Create a new page'												  , handler: function(){ var node = this.getSelectionModel().selNode || this.root; 																		 this.augment( node );																		 this._obs.fireEvent( 'show_new_template', '', node.getNodePath(), '0', node ); }												  , scope: this},												  												  { xtype: 'button'												  , text :'&nbsp;&nbsp;&nbsp'												  , icon: Eve.imagePath + 'default/extra/delete.png'												  , width: 16												  ,	tooltip: 'Delete a page'												  , handler: function(){ var node = this.getSelectionModel().selNode; 																		 if ( !node )																			return false;																		 this.augment( node );																		 var id = node.id.split('_')[1];																		 																		 var func = (function( a ){																			var node = a;											 																			return function(){																				node.remove();															    				this._obs.fireEvent( 'update_active_node' );																			}																																					})( node );																																				Ext.Ajax.request( { url: Pub.Connector.baseUrl()																						  ,	params: { id: id, event: 'modern.publisher.template.delete', groupId: Eve.GroupId }																						  , success: func																						  , scope: this } ); }												  , scope: this}, '->', 												  												  { xtype: 'button'												  , text : 'Change View'												  , handler: function(){													  			this._obs.fireEvent( 'change_view', 'dataview' );															 }												  , scope: this }] } )	}		Ext.applyIf( config, defConfig );		Template.Tree.superclass.constructor.apply( this, [config] ); }Ext.extend( Template.Tree, Eve.Tree, {	fetchTree: function(){		return { event: 'modern.publisher.template.getsubtree', groupId: Eve.GroupId };	}		,setPanel: function( panel ){		this.panel = panel;	}		,setMenu: function( menu ){		this.menu = menu;	}		,initEvents: function(){		this.getSelectionModel().on('selectionchange', this.setActiveNode, this );		this.el.don		this.on('contextmenu', this.handleContextMenu, this );		this.on('dblclick', this.handleDblClick, this );		this.body.on('contextmenu', this.handleBodyContextMenu, this );				Template.Tree.superclass.initEvents.apply( this, arguments );	}		,augment: function( node ){		node.getNodePath = function(){						return this.getPath().replace( /TM_/g, '' ).replace( /\/0/, '' ).replace( /\//g, '\\' ) + '\\';		}	}			,handleBodyContextMenu: function( e ){		e.stopEvent();				if ( this.contextMenuHandled )			return;					this.root.getNodePath = function(){ return '\\'; };				this.menu.setActiveNode( this.root );		this.menu.showAt( e.getXY() );	}		,handleContextMenu: function( node, e ){ 		if ( node ){			this.augment( node );						this.contextMenuHandled = true;			setTimeout( (function(){ this.contextMenuHandled = false }).createDelegate( this ), 100 );						this.menu.setActiveNode( node );			this.menu.showAt( e.getXY() ); 		}	}		,handleDblClick: function( node ){		// Pop publisher for this template	}		,setActiveNode: function( tree, node ){		this.activeNode = node;		this.panel.setActiveNode( node );	}		,setObserver: function( obs ){		this._obs = obs;		obs.on('create_new_template', this.handleNewTemplate, this );		obs.on('update_active_node', this.updateActiveNode, this );	}		,updateActiveNode: function(){		this.setActiveNode( this, this.getSelectionModel().getSelectedNode() );	}		,handleNewTemplate: function( params, node ){		node = node || this.root;		node.leaf = false;		node.appendChild( new Ext.tree.TreeNode( { text: params.title, id: params.id, leaf: true, cls: 'page-node', path: params.path } ) );	}} );//---------------------------------------------////---------------------------------------------Template.Panel = function( config ){	config = config || {};		if ( !Template.ViewTemplate ){		Template.ViewTemplate = new Ext.XTemplate( '<div class="details">',				//'<tpl for=".">',					'<div style="height: 220;"><center><div style="height: 100%; width: 200px; border: 1px solid gray">Place Holder for Images</div></center></div>',					'<b>Name:&nbsp;</b>',					'<span>{name}</span>',					'<br /><br />',					'<b>Keywords:</b><br />',					'<span>{keywords}</span>',					'<br /><br />',					'<b>Description:</b><br />',					'<span>{description}</span></div>',				//'</tpl>',			'</div>' );	}		var defConfig = {		tplView : Template.ViewTemplate		,region : 'center'		,tbar	: [{				   		text: 'Create new Page'						,handler: this.createNewPage						,scope	: this						,id		: 'tt_create_new_page'						,disabled: true				   },{					   text		: 'Design'					   ,handler	: this.designTemplate					   ,scope	: this					   ,id		: 'tt_design_template'					   ,disabled: true				   },{					   text		: 'Preview'					   ,handler	: this.previewTemplate					   ,scope	: this					   ,id		: 'tt_preview_template'					   ,disabled: true				   }]	}		Ext.applyIf( config, defConfig );		Template.Panel.superclass.constructor.apply( this, [config] );}//---------------------------------------------////---------------------------------------------Ext.extend( Template.Panel, Ext.Panel, {	update: function( arr ){		this.tplView.overwrite( this.body, arr );	}		,setObserver: function( obs ){		this._obs = obs;	}		,designTemplate: function( node ){		var node = this.activeNode;		if ( !node ) return;				window.open( Pub.Connector.baseUrl({						event: 'modern.publisher.publisher'						,pageId: node.id.split('_')[1]						,isTemplate: 'true'					} ) );	}		,previewTemplate: function( node ){		var node = this.activeNode;		if ( !node ) return;				window.open( Pub.Connector.baseUrl({						event: 'modern.publisher.preview'						,pageId: node.id.split('_')[1]						,isTemplate: 'true'					} ) );	}		,createNewPage: function(){		if ( this.activeNode && this._pagePath ){			this._obs.fireEvent( 'show_new_page', '', this._pagePath, this.activeNode.id.split('_')[1] );		}	}		,resetPanel: function(){		this._pagePath = null;		if ( Ext.getCmp('tt_create_new_page' ) )			Ext.getCmp('tt_create_new_page').disable();		else			this.topToolbar[0].disabled = true;	}		,setPagePath: function( path ){		this._pagePath = path;		if ( Ext.getCmp('tt_create_new_page' ) ){			Ext.getCmp('tt_create_new_page').enable();		}else{			delete this.topToolbar[0].disabled;		}	}		,setActiveNode: function( node ){		this.activeNode = node;		var func = (node)?'enable':'disable';				Ext.getCmp('tt_preview_template')[func]();		Ext.getCmp('tt_design_template')[func]();		if ( !node )			return false;					var id = node.id.split( '_' );		id = ( id.length > 1 )?id[1]:id[0];						var parseXML = function( rp ){			var dq = Ext.DomQuery;			var xml = rp.responseXML;						this.update( { name			: dq.selectValue( 'title', xml )						 , description	: dq.selectValue( 'description', xml )						 , keywords		: dq.selectValue( 'keywords', xml )} );		}				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, groupId: Eve.GroupId, event: 'modern.publisher.template.edit' }, success: parseXML, scope: this } );	}} );Template.Window = function( config ){	config = config || {};		this.menu = new Template.Menu();	var defConfig = {		width	: 600		,height	: 450		,title	: 'Templates'		,layout : 'card'		,activeItem: 0		,items	: [ /* Tree View */ { xtype: 'panel', border: false, layout: 'border', items: [new Template.Tree(), new Template.Panel() ] }					/* Drew View */,{ xtype: 'panel', border: false, layout: 'fit'   , tbar : new Ext.Toolbar( { items: [ { text	: 'Change View', 																														 	handler : function(){																																this._obs.fireEvent( 'change_view', 'tree' );																															},																															scope	: this }] } ), html: 'Templates Come here', buttons: [ { text: 'Create' } ] } ]		,closeAction: 'hide'		,border	: false	}		Ext.applyIf( config, defConfig );		Template.Window.superclass.constructor.apply( this, [config] );}Ext.extend( Template.Window, Ext.Window, {	setObserver: function( obs ){		this.menu.setObserver( obs );				if ( this.panel ){			this.panel.setObserver( obs );			this.tree.setObserver( obs );		}				obs.on('change_view', this.changeView, this );		this._obs = obs;	}		,changeView: function( type ){				if ( type == 'dataview' ){			this.layout.setActiveItem( 1 );		}else{			this.layout.setActiveItem( 0 );		}	}	,initEvents: function(){		Template.Window.superclass.initEvents.apply( this, arguments );		this.tree = this.items.get(0).items.get(0);		this.panel = this.items.get(0).items.get(1);				this.tree.setPanel( this.panel );		this.tree.setMenu( this.menu );				this.panel.setObserver( this._obs || null );		this.tree.setObserver( this._obs || null );				this.on('hide', this.resetWindow, this );	}		,resetWindow: function(){		if ( this.panel )			this.panel.resetPanel();				this._root = '';		this._path = '';	}		,showTemplateTree: function( arg, root, path ){		this.resetWindow();		this.show( arg );				if ( !path )			return true;				this._hasPage = true;		this._root = root;		this._path = path;		this.panel.setPagePath( this._path );	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/plugins/combobox.js *//*--------------------------------------------------*/Ext.namespace( 'Pub.form' );Pub.form.ComboBox = Ext.extend( Ext.form.ComboBox, {	initComponent : function(){				Pub.form.ComboBox.superclass.initComponent.apply( this, arguments );				if ( !this.store )			return;				this.store.on('add', function(a,b,c){ 			if( this.store.data.length <= 1 ){ this.setValue( b[0].data[this.valueField]); }		}, this );	}} );Ext.form.SimpleCombo = Ext.extend(Ext.form.ComboBox, {	mode : 'local',	triggerAction : 'all',	typeAhead : true,	valueField : 'value',	displayField : 'name',	forceSelection : true,	editable : true,	minChars : 0,	initComponent : function(){		Ext.form.ComboBox.superclass.initComponent.call(this);		if(!this.store && this.data){			this.store = new Ext.data.SimpleStore({				fields: ['value','name','cls'],				data : this.data			});		}		this.tpl = '<tpl for="."><div class="x-combo-list-item {cls}">{' + this.displayField + '}</div></tpl>';	}});Ext.reg('simplecombo', Ext.form.SimpleCombo);/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/plugins/connector.js *//*--------------------------------------------------*///--------------------------------------------------// Connects to the backend and//--------------------------------------------------Pub._Connector = function(){	this.setHandler( Pub.ColdFusionExtractor );	this.params = {};	this.params_string = '';}Pub._Connector.prototype = {	 setHandler : function( object ){		 this.xt = object;	 }	 	 // Config Format	 // @params --> Gets all the possible Ajax Request method + 'extras' which is	 //			possible object required to create the params	,exec: function( cmd, config ){		if ( !this.xt[cmd] )			return false;		Ext.Ajax.request( this.xt[cmd]( config ) ); 	}		// Parameters that are sent with each request	,setBaseParams: function( params ){		Ext.apply( this.params, params );		this.params_string = [];		for ( var i in this.params ){			if ( this.params[i] )				this.params_string.push( i + '=' + this.params[i] );		}				this.params_string = this.params_string.join('&');	}		,baseUrl : function(){		var args = this.params_string;		var joined = '';				if ( arguments.length == 1 && typeof arguments[0] == "object" ){			var arr = [];			for ( var i in arguments[0] ){				arr.push( i + '=' + arguments[0][i] );			}						joined = arr.join('&');		}else{			joined = Array.prototype.join.apply( arguments, ['&'] );		}				if ( joined )			args += ( args != '' ) ? ('&' + joined) : joined;				if ( args != '' ){			return Eve.url + '?' + args;		}				return Eve.url;	}		,routeTo : function( cmd, config ){		return this.xt[cmd]( config );	}		,urlTo: function( cmd ){		return this.xt[cmd]().url;	}}//--------------------------------------------------// A Ruby Constructor//--------------------------------------------------Pub._RubyExtractor = function(){}Pub._RubyExtractor.prototype = {	 pathTo: function( address ){		 return '/publisher/' + ((address.constructor == Array)?address.join('/'):address)	 }	 	,extractReturn : function( config ){		var ret = {};		Ext.apply( ret, config );		delete ret.extras;		return ret	}		,fetchTemplate: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'fetch/' + config.extras.pageId ), params: {} } );				return ret;	}	// Fetches the list of templates	,fetchTemplates: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'list_templates' )					 ,params: {} } );				return ret;	}		,fetchPages: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'list_pages' )					 ,params: {} } );				return ret;	}		,fetchImages: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'list_images' )					 ,params: {} } );				return ret;	}		,imageUpload: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'save_image' )					 ,params: {} } );				return ret;	}	,savePage: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'save/' + config.extras.pageId ), params: {template: config.extras.template																					 , is_template: config.extras.is_template																					 , name: config.extras.name																					 , description: config.extras.description																					 , 'extends': config.extras['extends'] } } );				return ret;	}		,moduleContent: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: this.pathTo( 'module_content' )					 ,params: config.params, method: 'GET' } );				return ret;	}	}//--------------------------------------------------// A ColdFusion Constructor//--------------------------------------------------Pub.ColdFusionExtractor = {	 pathTo: function( address ){		 return Pub.Connector.baseUrl();	 }	 	,hyperofficeSection: function( config ){        return 'javascript:Pub.changeSection( &quot;' + config.section + '&quot; )';    }    	,hyperofficeRoot: function( config ){        return 'javascript:Pub.goRoot( &quot;' + config.section + '&quot; )';    }        ,hyperofficePage: function( config ){        return 'javascript:Pub.showPage( &quot;' + config.section + '&quot; )';    }    ,hyperofficeItem: function( config ){        var isFolder = ( config.isFolder ) ? 'true' : 'false';        if (typeof config.parentId != 'undefined')        	var parentIdString = ', &quot;' + config.parentId + '&quot;';        else        	var parentIdString = '';                return 'javascript:Pub.showItem( &quot;' + config.id + '&quot; , &quot;' + config.section + '&quot;, ' + isFolder + parentIdString + ')';    }    ,movePage: function( config ){        var ret = this.extractReturn( config );        return Ext.apply( ret, { url: Pub.Connector.baseUrl( { id: config.extras.pageId,                        newParentId: config.extras.parentId,                        groupId: Eve.GroupSelect.GroupId,                       event: 'modern.publisher.page.moveAll',                       partial: true,                       path: config.extras.path,                       newPath: config.extras.newPath                       } ) }, config );    }	,extractReturn : function( config ){		var ret = {};		Ext.apply( ret, config );				delete ret.extras;		return ret	}		,fetchTemplate: function( config ){		var ret = this.extractReturn( config );		config.extras.IsTemplate = (config.extras.IsTemplate == undefined)?Eve.IsTemplate:config.extras.IsTemplate;				var ev	= config.extras.IsTemplate? 'modern.publisher.template.edit' : 'modern.publisher.page.edit';		Ext.apply( ret, { url: Pub.Connector.baseUrl( { id: config.extras.pageId, event: ev, groupId: Eve.GroupSelect.GroupId } ) } );				return ret;	}	// Fetches the list of templates	,fetchTemplates: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.template.getsubtree', groupId: Eve.GroupSelect.GroupId } ) } );				return ret;	}		,fetchAllTemplates: function( config ){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.template.gettree', 'groupId': Eve.GroupSelect.GroupId} ) } );				return ret;	}		,fetchAllPages: function( config ){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.gettree', 'groupId': Eve.GroupSelect.GroupId} ) } );		return ret;	}	    ,fetchAllMovablePages: function( config ){       config = config || {};       return Ext.apply( config, { event: 'modern.publisher.page.gettree', 'groupId': Eve.GroupSelect.GroupId } );    }    	,fetchAllMenus: function( config ){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.getMenu', 'groupId': Eve.GroupSelect.GroupId, 'pages' : 'all'} ) } );				return ret;	}	,fetchPublishedMenus: function( config ){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.getMenu', 'groupId': Eve.GroupSelect.GroupId, 'pages' : 'published'} ) } );				return ret;	}	,fetchListedMenus: function( config ){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.getMenu', 'groupId': Eve.GroupSelect.GroupId, 'pages' : 'listed'} ) } );				return ret;	}		,fetchPages: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: Pub.Connector.baseUrl( {event: 'modern.publisher.page.getsubtree', groupId: Eve.GroupSelect.GroupId} ) } );				return ret;	}		// We can't handle images right now	,fetchImages: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.findallimages', groupId: Eve.GroupSelect.GroupId } ) } );		return ret;	}		,imageUpload: function( config ){		var ret = this.extractReturn( config );				Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.uploadImage', groupId: Eve.GroupSelect.GroupId } ) } );				return ret;	}		,deleteImage: function( config ){		var ret = this.extractReturn( config );		var params = {			event:'modern.publisher.page.deleteObject'			,name: config.imageName			,type: config.type			,groupId	: Eve.GroupSelect.GroupId		}		Ext.apply( ret, { url: Pub.Connector.baseUrl(), params: params} );		return ret;	}	,savePage: function( config ){		var ret = this.extractReturn( config );				id = false;		if ( config.extras.pageId )			id = config.extras.pageId.replace( /(TM_|PG_)/g, '' );							var params = {			 data		: config.extras.template			,title		: config.extras.name			,description: config.extras.description			,templateId	: config.extras['extend'] || config.extras['extends'] || 0			,groupId	: Eve.GroupSelect.GroupId		}				if (id)			params['id'] = id;		//------------------------------------------		// Set the correct Event		//------------------------------------------		if ( Eve.IsTemplate){			params.event = 'modern.publisher.template.createModify'		}else{			params.event = 'modern.publisher.page.createModify'		}		//		for(var i in ret){			if(ret.hasOwnProperty(i) && i.indexOf('template_')!= -1)				params[i] = ret[i]		}		//		Ext.apply( ret, { url: Pub.Connector.baseUrl(), params: params } );				return ret;	}		,moduleContent: function( config ){		var ret = this.extractReturn( config );		var o	= { event: 'modern.publisher.template.viewmodule', groupId: Eve.GroupSelect.GroupId };				Ext.apply( o, config.params );				Ext.apply( ret, { url: this.pathTo()					 ,params: o, method: 'POST' } );				return ret;	}		,fetchButtonUrl : function( config){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.getButton'} ) } );		return ret;	}	,fetchFolders : function( config){		var ret = this.extractReturn( config );		Ext.apply( ret, { url: Pub.Connector.baseUrl( { event: 'modern.publisher.page.getSectionFolders'} ) } );		return ret;	}		}//--------------------------------------------------// Create the Singleton Objects//--------------------------------------------------Pub.RubyExtractor = new Pub._RubyExtractor();Pub.Connector	  = new Pub._Connector();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/wizards/page.js *//*--------------------------------------------------*///---------------------------------// A Wizard for creating new Pages//---------------------------------Pub._PageWizard = function( config ){		config = config || {};		//------------------------------------------------------------------------------------------------	// The Basic configuration for a PageWizard		var siteTreeReader = new Ext.data.XmlReader( { record: 'node' }, [ 'id', 'text', 'path' ] );	this.siteTreeStore = new Ext.data.Store( { url: Pub.Connector.urlTo( 'fetchAllPages' ), reader: siteTreeReader } );	this.sharedStore   = new Ext.data.SimpleStore( { fields: [ 'path', 'text' ] } );	this.sharedRecord  = Ext.data.Record.create( [ 'path', 'text' ] );		this.siteTreeStore.on('load', function(){		this.sharedStore.removeAll();		var rec = Ext.data.Record.create( ['id', 'path', 'text']);		this.siteTreeStore.add( new rec( { id:'TM_0', path:'\\', text:'Root'} ) );				this.siteTreeStore.each ( function( r ){			var tab = r.get('path').replace(/[^\\]*/g, '' ).length - 2;			var text = '';						for ( var i = 0; i < tab; ++i ){				text += '--';			}						text += r.get('text');			this.sharedStore.add( new this.sharedRecord( { path: r.get('path'), text: text } ) );		}, this );				//this.sharedStore.commit();	}, this);		this.siteTreeStore.reload();	var defConfig = {		 title	: 'Page Wizard'		,width	: 600		,height	: 400		,layout : 'card'		,border	: false		,closeAction: 'hide'		,activeItem: 0		,items	: [			new Pub.PageTemplateView()			,new Pub.PageProperties()		]		,bbar	: [{			text: 'Parent :'		}, {			xtype			: 'combo'			,displayField	: 'text'			,valueField		: 'path'			,store			: this.sharedStore			,mode			: 'local'			,triggerAction	: 'all' 			,forceSelection	: true			,emptyText		: 'Root'			,id				: 'page_wizard_parent'		}, '->', {			xtype		: 'button'			,style		: 'border:1px solid #b1b2b3;background:url(/hyperoffice2nd/views/Styles/ModernStyle/images/EN_US/publisher2/btn-next.png)'			,handler	: function(){								var p = this.layout.activeItem;				// If we can't validate a form pop an error message				if ( !p.validate() ){					Ext.Msg.alert( 'Error', p.validationError );					return false;				}										// Save the configuration				Ext.apply( this._configToSend, p.collect() );										// Get the index of the next layout				var nextIndex = this.items.indexOf( p ) + 1;										if ( nextIndex >= this.items.getCount() ){					// FireSomething					var val = Ext.getCmp('page_wizard_parent').getValue();					val = val || '\\';										Ext.apply( this._configToSend, { path: val } );										var commandToSend = {};					var cfg = this._configToSend;					cfg.data = '';					// This caused trouble in hierarchies since data was null 					if ( cfg.parentId == 0 ){						if ( cfg.mode == 'freeform' || cfg.mode == '' ){							cfg.data = 'template@<!config@<#type@<$widget@>$tempateItem@<$false@>$oldSize@<$width@<%1075@>%height@<%320@>#position@<#4444@>#size@<#width@<$1075@>$height@<$320@>#depth@<#0@>#id@<#rootainer@>#type@<#portal@>#domIndex@<#0@>#columns@<#1@>"config@<#type@<$widget@>$tempateItem@<$false@>$oldSize@<$height@<%900@>#position@<#4444@>#size@<#width@<$1061@>$height@<$876@>#depth@<#1@>#id@<#widget_1@>#type@<#freeform@>#domIndex@<#0@>#childOf@<#rootainer@>#index@<#0@>#order@<#0@>"@>!extends@<!-1@>!css@<!';						}											else {							if (cfg.columns >= 1 && cfg.columns <= 5)								cfg.data = 'template@<!config@<#type@<$widget@>$tempateItem@<$false@>$oldSize@<$width@<%1075@>%height@<%320@>#position@<#4444@>#size@<#width@<$1075@>$height@<$320@>#depth@<#0@>#id@<#rootainer@>#type@<#portal@>#domIndex@<#0@>#columns@<#'+cfg.columns+'@>"@>!extends@<!-1@>!css@<!';							else								cfg.data = 'template@<!config@<#type@<$widget@>$tempateItem@<$false@>$oldSize@<$width@<%1075@>%height@<%320@>#position@<#4444@>#size@<#width@<$1075@>$height@<$320@>#depth@<#0@>#id@<#rootainer@>#type@<#portal@>#domIndex@<#0@>#columns@<#1@>"@>!extends@<!-1@>!css@<!';						}													//orignal freeform:	//cfg.data = 'template12config34type45widget44tempateItem45false44oldSize45width5610075055height563020033position34444433size34width451007544height453020033depth34033id34rootainer33type34portal33domIndex34033columns341022config34type45widget44tempateItem45false44oldSize45height5690033position34444433size34width4510061044height4587633depth341033id34widget_1033type34freeform33domIndex34033childOf34rootainer33index34033order3402211extends12-1011css12';						//original columnar:	//cfg.data = 'template12config34type45widget44tempateItem45false44oldSize45width5610075055height563020033position34444433size34width451007544height453020033depth34033id34rootainer33type34portal33domIndex34033columns34102211extends12-1011css12';/*						if (cfg.columns >= 1 && cfg.columns <= 3)						cfg.data = 'template12config34type45widget44tempateItem45false44oldSize45width5610075055height563020033position34444433size34width451007544height453020033depth34033id34rootainer33type34portal33domIndex34033columns34'+cfg.columns+'02211extends12-1011css12';						else if (cfg.columns <= 5)						cfg.data = 'template12config34type45widget44tempateItem45false44oldSize45width5610075055height563020033position34444433size34width451007544height453020033depth34033id34rootainer33type34portal33domIndex34033columns34'+cfg.columns+'22211extends12-1011css12';						else						cfg.data = 'template12config34type45widget44tempateItem45false44oldSize45width5610075055height563020033position34444433size34width451007544height453020033depth34033id34rootainer33type34portal33domIndex34033columns34102211extends12-1011css12';						cfg.data = cfg.data.replace(/11/g,String.fromCharCode(64,128,33));						cfg.data = cfg.data.replace(/22/g,String.fromCharCode(64,128,34));						cfg.data = cfg.data.replace(/33/g,String.fromCharCode(64,128,35));						cfg.data = cfg.data.replace(/44/g,String.fromCharCode(64,128,36));						cfg.data = cfg.data.replace(/55/g,String.fromCharCode(64,128,37));												cfg.data = cfg.data.replace(/12/g,String.fromCharCode(192,127,33));						cfg.data = cfg.data.replace(/23/g,String.fromCharCode(192,127,34));						cfg.data = cfg.data.replace(/34/g,String.fromCharCode(192,127,35));						cfg.data = cfg.data.replace(/45/g,String.fromCharCode(192,127,36));						cfg.data = cfg.data.replace(/56/g,String.fromCharCode(192,127,37));						cfg.data = cfg.data.replace(/10/g,'1');						cfg.data = cfg.data.replace(/20/g,'2');						cfg.data = cfg.data.replace(/30/g,'3');						cfg.data = cfg.data.replace(/40/g,'4');						cfg.data = cfg.data.replace(/50/g,'5');*/												console.log('-------');						console.log(cfg.data);					}					if ( cfg.is_template ){						commandToSend = {							 title		: cfg.title							,description: cfg.description							,keywords	: cfg.keywords							,templateId	: cfg.parentId							,groupId	: Eve.GroupSelect.GroupId							,event		: 'modern.publisher.template.createModify'							,path		: cfg.template_path							,data       : cfg.data						}					}else{						commandToSend = {							 title		: cfg.title							,description: cfg.description							,keywords	: cfg.keywords							,templateId	: cfg.parentId							,groupId	: Eve.GroupSelect.GroupId							,event		: 'modern.publisher.page.createModify'							,path		: cfg.path							,data       : cfg.data						}					}										Ext.apply( commandToSend, this.getFetchData( commandToSend ) );					this.getEl().mask('loading...');					// Now we need to fire and Event for creating new Page					Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: commandToSend, method: 'POST'									  , success: function( response ){											this.submitSuccess( response.responseXML, cfg );											this.getEl().unmask();										}										, failure: function(){											this.getEl().unmask();										}, scope: this } );					return false;				}										var nextItem = this.items.get( nextIndex );								this.setSize( nextItem.width, nextItem.height );								// Go to the next section				this.layout.setActiveItem( nextIndex );			}			,text: 'Next'			,scope: this		}]	}		//------------------------------------------------------------------------------------------------		Ext.applyIf( config, defConfig );	Pub._PageWizard.superclass.constructor.apply( this, [config]);}Ext.extend( Pub._PageWizard, Ext.Window, {	submitSuccess: function( xml, cfg ){		var dq	= Ext.DomQuery;		var id  = dq.selectValue( 'id', xml );				document.location =  Pub.Connector.baseUrl( {			event : 'modern.publisher.publisher'			,pageId: id.replace(/(TM_|PG_)/g, '')			,isTemplate: cfg.is_template			,Freeform: (cfg.mode == 'freeform' || cfg.mode == '')		});		//document.location = Eve.url + '?event=modern.publisher.publisher&pageId=' + id.replace(/(TM_|PG_)/g, '') +'&isTemplate='+ cfg.is_template;	}	// Register the events we need to watch for	,initEvents: function(){				Pub._PageWizard.superclass.initEvents.apply( this, arguments );						this.on('show', this.reset, this );	}		,setFetchData: function( func ){		this._fetchFunc = func;	}		,getFetchData: function( config ){		data = this._fetchFunc ? this._fetchFunc( config ) : {};				return data;	}	// Reset the items in this form	,reset: function(){		this.items.each( function( r ){ if ( r.reset ) r.reset() } );		this._fetchFunc = null;		// reset the collected page properties		this._configToSend = {};		Ext.getCmp('page_wizard_parent').setRawValue( '' );		Ext.getCmp('page_wizard_parent').setValue ( '\\' );		// reset the size and width of the component		var firstItem = this.items.get( 0 );		this.setSize( firstItem.width, firstItem.height );				// go to the first layout;		this.layout.setActiveItem( 0 );		this.siteTreeStore.reload();	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/wizards/page/template.js *//*--------------------------------------------------*/Pub.PageTemplateView = function( config ){	config = config || {};		this.templateView = new Pub.PageTemplate();	this.treeView	  = new Pub.MainPanelTemplate();		var defConfig = {		  width 	: 600		 ,height	: 400		 ,activeItem: 0		 ,titlebar	: false		 ,layout	: 'card'		 ,border	: false		 ,items		: [ this.templateView, this.treeView ]	}		this._obs = new Ext.util.Observable();		this._obs.addEvents( { 'change_view': true, 'reload_store': true } );	this._obs.on('change_view', function( type ){		if ( type == 'tree' ){			this.layout.setActiveItem( 0 );		} else {			this.layout.setActiveItem( 1 );		}	}, this );		this.treeView.setObserver( this._obs );	this.templateView.setObserver( this._obs );		Ext.applyIf( config, defConfig );	Pub.PageTemplateView.superclass.constructor.apply( this, [config] );}Ext.extend( Pub.PageTemplateView, Ext.Panel, {	initEvents: function(){		Pub.PageTemplateView.superclass.initEvents.apply( this, arguments );		this.on('show', function(){ this._obs.fireEvent( 'reload_store' ) }, this );	}		,collect: function(){		return this.layout.activeItem.collect();	}		,validate: function(){		return this.layout.activeItem.validate();	}		,reset: function(){		if ( !this.items )			return false;				if ( this.layout.setActiveItem )			this.layout.setActiveItem( 0 );					this.items.each( function( it ) { it.reset(); } );	}		,validationError: 'Please select one of the templates below and then click \'next\' to begin designing your page.'} );Pub.PageTemplate = function( config ){	config = config || {};		//------------------------------------------------------------------------------------------------	// VIEW CONFIGURATION		var itemTemplate = config.itemTemplate || new Ext.XTemplate( 		'<tpl for=".">',			'<div class="page-template-item" id="{id}">',				'<div class="page-template-image">{[ this.setImage(values.imageUrl) ]}</div>',				'<div class="page-template-text">{text}</div>',			'</div>',		'</tpl>', {		setImage : function(img) {			if (img) {				return '<img src="' + img + '" />';			}						return '';		}	});		this.itemTemplate = itemTemplate;		// compile the item Template	itemTemplate.compile();		// The base template that handles sub templates	this.contentTpl = new Ext.XTemplate( 		'{[this.reset()]}', 			// Reset the template internal objects		'<tpl for=".">',						// Loop through each item and identify the type of the component			'{[this.classify( values )]}',		// Classify the current object		'</tpl>',		'<div class="page-template"><div style="padding: 5px"><div class="page-template-title">System Templates</div>',		'<div class="page-template-content">{[this.renderTemplates( "system" )]}</div>',		'<div class="page-template-title">Your Templates</div>',		'<div class="page-template-content">{[this.renderTemplates( "normal" )]}</div></div></div>'	,{		// Reset the internal objects		reset: function(){			this.SystemTemplates = [];			this.Templates		= [];						return '';		}				// Find the type of the object		,classify: function( values ){			if ( values.system == '1' ){				this.SystemTemplates.push( values );			}else{				this.Templates.push( values );			}						return '';		}				,renderTemplates: function( type ){			var tpls = type == 'system' ? this.SystemTemplates : this.Templates;						return itemTemplate.apply( tpls );		}	});		// Compile the templates	this.contentTpl.compile();		// The fields we expect to get from server	this.fields = [ 'id', 'text', 'system', 'leaf', 'parent', 'path', 'imageUrl' ];			// Template Reader	this.reader  = new Ext.data.XmlReader( { record: 'node' }, this.fields );	this.recordObject = Ext.data.Record.create( this.fields );		// Create a blankPageRecord	this.blankPageRecord = new this.recordObject( {		 id 	: 'TM_0'		,text	: 'Blank Page'		,system	: '1'		,leaf	: true		,parent	: ''		,path	: ''	} );		// The store that we use to hold the data	this.store	 = new Ext.data.Store({		url		: Pub.Connector.urlTo( 'fetchAllTemplates' )		,reader	: this.reader	});		// Since we are always going to have A blank page template, we can add it here or ...	this.store.on('load', function(){		this.store.add( this.blankPageRecord ); 		this.dataView.refresh(); 		this.dataView.select( 0 );	}, this );	//------------------------------------------------------------------------------------------------		this.dataView = new Ext.DataView( { 		tpl				: this.contentTpl		,store			: this.store		,selectedClass	: 'page-template-selected'		,overClass		: 'page-template-over'		,itemSelector	: 'div.page-template-item'		,singleSelect	: true		,region			: 'center'		,style			: 'overflow: auto; background: white;'	} ); 	//------------------------------------------------------------------------------------------------	// Default Config of the panel	var defConfig = {		 height		: 400		,width		: 800		,layout		: 'border'		,titlebar	: false		,items		: [ { xtype: 'container', region: 'north', height: 57, autoEl: {                                 tag: 'div',                                 'class': 'page-template-title',                                'html' : 'Please select one of the templates below and then click \'next\' to begin designing your page'                         } }, this.dataView ]        // I've disabled the change view for now//		,tbar		: new Ext.Toolbar( { items: [{ text: 'Change View', handler: function(){ { this._obs.fireEvent( 'change_view', 'template' ); } }, scope: this }] } )	}		Ext.applyIf( config, defConfig );	//------------------------------------------------------------------------------------------------		Pub.PageTemplate.superclass.constructor.apply( this, [config] );}Ext.extend( Pub.PageTemplate, Ext.Panel, {	//	// register the events we need to watch	//	setObserver: function( obs ){		this._obs = obs;	}		,initEvents: function()	{		Pub.PageTemplate.superclass.initEvents.apply( this, arguments );				// TODO: Correct position?		// We are going to refresh the template view on showing the panel?		this.on('show', this.reloadStore, this);		this.reloadStore();				this._obs.on('reload_store', this.reloadStore, this);	}		,validate: function(){		// Something should be selected...		return this.dataView.getSelectedNodes().length !== 0;	}		,validationError: 'You need to select a template to continue.'		,collect: function(){		var rec = this.dataView.getSelectedNodes()[0];		if ( !rec )			return {};				this.rec_id = rec.id;				var func = function( r ){ 			if ( r.get('id') == this.rec_id ) {				this.activeRec = r;				return false;			}		};				this.store.each( func, this );				var p = this.activeRec;		if ( p )			return { parentId: p.get('id').replace(/TM_/g, '' ), template_path: p.get('path') };				return {};	}		// Reloads the store	,reloadStore: function(){		this.store.reload();		Eve._store = this.store;	}		,reset: function(){		// Just clears the selected Nodes		this.dataView.clearSelections();        this.dataView.select( 0 );		this.rec_id		= null;		this.activeRec 	= null;	}} );//--------------------------------------------------------------------// The other template View//---------------------------------------------// The Center Panel//---------------------------------------------Pub.MainPanelTemplate = function( config ){	config = config || {};		this.tree = new Pub.WestPageTemplate();	this.panel = new Pub.CenterPageTemplate();		this.tree.setPanel( this.panel );		var defConfig = {		 width	: 600		,height	: 450		,titlebar: false		,layout : 'border'		,border	: false		,items	: [ this.tree, this.panel ]	}		Ext.applyIf( config, defConfig );	Pub.MainPanelTemplate.superclass.constructor.apply( this, [config] );}Ext.extend( Pub.MainPanelTemplate, Ext.Panel, {   collect: function(){	   return this.tree.collect();   }      ,validate: function(){	   return this.tree.validate();   }      ,reset: function(){	   this.tree.reset();	   this.panel.reset();   }      ,setObserver: function(obs){	   this._obs = obs;	   	   this.tree.setObserver( obs );	   this.panel.setObserver( obs );   }   ,validationError: 'Please select one of the templates to begin with.'} );//---------------------------------------------////---------------------------------------------Pub.CenterPageTemplate = function( config ){	config = config || {};		if ( !Pub.CenterViewTemplate ){		Pub.CenterViewTemplate = new Ext.XTemplate( '<div class="details">',					'<div style="height: 220;"><center><div style="height: 100%; width: 200px; border: 1px solid gray">Place Holder for Images</div></center></div>',					'<b>Name:&nbsp;</b>',					'<span>{name}</span>',					'<br /><br />',					'<b>Keywords:</b><br />',					'<span>{keywords}</span>',					'<br /><br />',					'<b>Description:</b><br />',					'<span>{description}</span></div>',			'</div>' );	}		var defConfig = {		tplView : Pub.CenterViewTemplate		,region : 'center'	}		Ext.applyIf( config, defConfig );		Pub.CenterPageTemplate.superclass.constructor.apply( this, [config] );}//---------------------------------------------// The DataView//---------------------------------------------Ext.extend( Pub.CenterPageTemplate, Ext.Panel, {	update: function( arr ){		if ( this.body )			this.tplView.overwrite( this.body, arr );	}		,setObserver: function( obs ){		this._obs = obs;	}		,collect: function(){		return {};	}		,validate: function(){		return true;	}		,validationError: 'Please select one of the templates to begin with.'		,reset: function(){		this.update( {} );	}		,setActiveNode: function( node ){		this.activeNode = node;				if ( !node )			return false;					var id = node.id.split( '_' );		id = ( id.length > 1 )?id[1]:id[0];						var parseXML = function( rp ){			var dq = Ext.DomQuery;			var xml = rp.responseXML;						this.update( { name			: dq.selectValue( 'title', xml )						 , description	: dq.selectValue( 'description', xml )						 , keywords		: dq.selectValue( 'keywords', xml )} );		}				Ext.Ajax.request( { url: Pub.Connector.baseUrl(), params: { id: id, groupId: Eve.GroupSelect.GroupId, event: 'modern.publisher.template.edit' }, success: parseXML, scope: this } );	}} );//---------------------------------------------// The Tree//---------------------------------------------Pub.WestPageTemplate = function( config ){	config = config || {};		var defConfig = {		root		: new Ext.tree.AsyncTreeNode( {id: 0} )		,rootVisible: false		,region		: 'west'		,split		: true		,width		: 200		,loader		: { url: Pub.Connector.baseUrl(), baseParams: this.fetchTree.createDelegate( this ) }		,tbar		: new Ext.Toolbar( { items: [ { xtype: 'button'												  , text : 'Change View'												  , handler: function(){													  			this._obs.fireEvent( 'change_view', 'tree' );															 }												  , scope: this }] } )	}		Ext.applyIf( config, defConfig );		Pub.WestPageTemplate.superclass.constructor.apply( this, [config] ); }Ext.extend( Pub.WestPageTemplate, Eve.Tree, {	fetchTree: function(){		return { event: 'modern.publisher.template.getsubtree', groupId: Eve.GroupSelect.GroupId, id: 0 };	}		,setPanel: function( panel ){		this.panel = panel;	}		,setMenu: function( menu ){		this.menu = menu;	}		,initEvents: function(){		this.getSelectionModel().on('selectionchange', this.setActiveNode, this );				Pub.WestPageTemplate.superclass.initEvents.apply( this, arguments );	}		,augment: function( node ){		node.getNodePath = function(){						return this.getPath().replace( /TM_/g, '' ).replace( /\/0/, '' ).replace( /\//g, '\\' ) + '\\';		}	}		,setActiveNode: function( tree, node ){		this.activeNode = node;		this.panel.setActiveNode( node );	}		,setObserver: function( obs ){		this._obs = obs;				obs.on('update_active_node', this.updateActiveNode, this );	}		,updateActiveNode: function(){		this.setActiveNode( this, this.getSelectionModel().getSelectedNode() );	}		,reset: function(){			}		,validate: function(){		return this.getSelectionModel().selNode;	}	,collect: function(){		var node = this.getSelectionModel().selNode;		this.augment(node);				return { parentId: node.id.replace( /TM_/g, '' ), template_path: node.getNodePath() };	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/wizards/page/properties.js *//*--------------------------------------------------*/// JavaScript DocumentPub.PageProperties = function( config ){	config = config || {};	//------------------------------------------------------------------------------------------------	// Default Config of the panel		this.prefix = 'page_prop_';		var defConfig = {		width		: 400		,height 	: 300		,titlebar	: false		,layout		: 'form'		,frame		: true		,labelWidth : 100		,items		: [{			xtype		: 'textfield'			,fieldLabel	: 'Title'			,id			: this.prefix + 'title'			,anchor     : '90%'			,validator : function( value ){ return ( value.match( /\\/ ) == null ) ? true : false; }		}, {			xtype		: 'textfield'			,fieldLabel	: 'Keywords'			,id			: this.prefix + 'keywords'			,anchor     : '90%'		}, {			xtype		: 'textarea'			,fieldLabel	: 'Description'			,id			: this.prefix + 'description'			,anchor     : '90%'		}, {			xtype		:  'simplecombo'			,mode		:  'local'			,emptyText	: 'Freeform Mode'			,fieldLabel	: 'Layout Mode'			,data		: [['freeform', 'Freeform Mode'], ['columnar', 'Columns Mode']]			,value		: 'freeform'			,id			: this.prefix + 'mode'			,anchor     : '90%'		}, {			xtype		: 'uxspinner'			,id			: this.prefix + 'columns'			,fieldLabel	: 'Columns'			,value		: '2'			,strategy	: new Ext.ux.form.Spinner.NumberStrategy({minValue:'1', maxValue:'5', incrementValue: 1})			,disabled	: true			,anchor     : '90%'		}, {			xtype		: 'checkbox'			,fieldLabel	: 'Collapse Nav-bar'			,id			: this.prefix + 'collapse'			,anchor     : '90%'		}, {			 xtype		: 'checkbox'			,fieldLabel : 'Mark as Template'			,id			: this.prefix + 'is_template'			,anchor     : '90%'		}]	}	//------------------------------------------------------------------------------------------------		Ext.applyIf( config, defConfig );		Pub.PageProperties.superclass.constructor.apply( this, [config] );	var cbMode = Ext.getCmp(this.prefix + 'mode');	cbMode.on('select', function(combo,record,index){		if (record.get('value') == 'freeform' || record.get('value') == '')			Ext.getCmp( this.prefix + 'columns' ).disable();		else			Ext.getCmp( this.prefix + 'columns' ).enable();  }  ,this)}Ext.extend( Pub.PageProperties, Ext.Panel, {		   	// Validates if all the required fields have text	validate: function(){		var validate = ( Ext.getCmp( this.prefix + 'title' ).getValue().replace( /^\s*/g, '' ).replace( /\s*$/g, '' ) !== '');        return validate && ( ( Ext.getCmp( this.prefix + 'title' ).getValue().match( /\\/ ) == null ) ? true : false );	}		,validationError : 'You need to pick a valid title for your page. ( Shouldn\'t contain \'\\\' and it can\'t be whitespaces )'		// Returns the values from the form	,collect: function(){		var collect = { title: '', keywords: '', description: '', collapse: '', mode: '', columns: '', is_template: '' }				for ( var i in collect ){			collect[i] = Ext.getCmp( this.prefix + i ).getValue();		}				return collect;	}		,reset: function(){		var collect = { title: '', keywords: '', description: '', collapse: '', mode: '', columns: '', is_template: '' }				for ( var i in collect ){			if (i == 'columns'){				Ext.getCmp( this.prefix + i ).setValue( '2' );				Ext.getCmp( this.prefix + i ).disable();			}			else				Ext.getCmp( this.prefix + i ).setValue( '' );		}	}} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\NicolasStyle\javascript/Publisher/plugins/masker.js *//*--------------------------------------------------*/Pub.Masker = (function(){	//var Mask = new Ext.LoadMask( Ext.getBody(), 'In progress ...' );	var timeoutFunc = null;	var dlg  = new Ext.Window({		bodyStyle: 'background: white; padding: 10px; overflow-y: auto;',        width: 400,        height: 300,        title: 'Info',        closable: false,        closeAction: 'hide',        modal: true	});	return {		showMask: function( ele, msg, timeout ){				ele.unmask();						timeout = timeout || 30000;		    timeoutFunc	= setTimeout( Pub.Masker.clearMaskTimeout.createDelegate( Pub.Masker, [ele] ), timeout );		    ele.mask( msg );		}				,clearMaskTimeout: function( ele ){			try{				//Pub.Masker.hideAll();				ele.unmask();				clearTimeout( timeoutFunc );				Ext.Msg.alert( 'Warning...', 'An operation took more than expected time, You can try to refresh the page or continue your work...' );			}catch(e){							}		}				,hideMask: function( ele ){			clearTimeout( timeoutFunc );			ele.unmask();			//Mask.hide();		}				,hideAll: function(){			clearTimeout( timeoutFunc );						try{				Mask.hide();				dlg.hide();			}catch(e){							}		}				,showDialog: function( timeout ){			Pub.Masker.hideAll();			timeout = timeout || 30000;			timeoutFunc = setTimeout( Pub.Masker.clearMaskTimeout, timeout );						var vs = dlg.isVisible();			dlg.show();			// if is not visible clear the content			if ( !vs ){				//dlg.body.dom.innerHTML = '';			}		}				,addToDialog: function( msg ){			dlg.body.dom.innerHTML = (msg + '<br />' ) + dlg.body.dom.innerHTML;		}				,hideDialog: function(){			clearTimeout( timeoutFunc );			dlg.hide();		}	}})();/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/BasicDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.TabDialogController = Ext.extend( Eve.lib.Bridge, {	id 			: 0	,parentId	: 0	,groupId	: 0	,root		: 'personal'	,path		: '\\'	,dialog		: {}	,portlet    : ''		,init: function(data)	{		Eve.lib.TabDialogController.superclass.init.call(this, data);				this.panels 	 = this.panels || [];		this.origin		 = data.origin;		this.ignoreMe    = data.ignoreMe;				// Initialize panels		for (var i = 0, len = this.panels.length; i < len; ++i){			this.panels[i].init(data, this);		}				}		// Check if dialog pops in interlinking mode	,isIL : function()	{		// In case section is not defined		if (!this.section)			return false;				return (this.section.match(/(.+)_il/) == null) ? false : true	}		,addPanel : function(panel)	{		this.panels = this.panels || [];		this.panels.push(panel);	}		,getIndex : function(panel)	{		var it = this.getTabPanel().items.items;		for( var i = 0, len = it.length; i < len; ++i )		{			if (panel && panel.id == it[i].id)				return i;	 	}	 			return -1;	}		// Enable/Disable tab by sending its index.	,setDisabled : function(idx, flag)	{		items = this.getTabPanel().items.items;					if (items[idx] === undefined)			return;				items[idx].setDisabled(flag);	}		,createDialog : function(config)	{		var tabConfig		= config.tab;		var dialogConfig	= config.dialog;		var that			= this;				this.buttonAlign = config.buttonAlign || 'right';				/*		 *	Start: Creating TabPanel		 */				var tp = {			activeTab			: 0			,layoutOnTabChange	: true			,deferredRender		: false		}				Ext.apply(tp, tabConfig);				tp.items = this.pushPanels(tabConfig.items, tabConfig.related, tabConfig.main);						// If there's more than one form, create a tabpanel and put each form on a tab.		if (tabConfig.items.length > 1) {			// Add Listeners			tp.listeners = {				'beforetabchange'	: {					'fn'	: function(tPanel, newTab, tab) {						var prefValue	= Eve.Preference._prefs.showalertonnewitemtabchange;						var idx 		= this.getIndex(newTab);												if (this.mode == 'create' && (idx == this.idxComments || idx == this.idxInterlink)) {														var hdlProceed = function() {								var fp	= tab.items.itemAt(0);								var win = this.ownerCt;																if (win) {									var box = win.items.itemAt(0).items.itemAt(1);																		// Checked									if (box.getValue()) {										Eve.Preference._prefs.showalertonnewitemtabchange = true;									}								}																// Before sumbit, check if the form is valid								if (! fp.getForm().isValid()) {									Ext.tools.msg('Validation Error', 'Please fill all required fields to proceed.');																		if (win) {										win.hide();									}																		return;								}																// Submit previous tab								that.submitForm(that.getIndex(tab), false, newTab);																if (win) {									win.hide();								}							}																					if (prefValue == true) {								hdlProceed();								return false;							}																					var win = new Ext.Window({								width		: 400								,height		: 120								,modal		: true								,border		: false								,resizable	: false								,closable	: false								,constrain	: true								,buttonAlign: 'center'								,closeAction: 'hide'								,items		: [{									layout		: 'form'									,border		: false									,bodyStyle	: 'padding:5px; background-color:#E5E5E5;'									,items		: [{										xtype		: 'label'										,text		: 'The item you are editing will be saved if you proceed to this tab so you can add comments or interlink items to it. Are you sure you wish to proceed and save your changes?'										,hideLabel	: true										,style		: 'font-size:12px; text-align:justify;'									}, {										xtype		: 'checkbox'										,boxLabel	: 'Do not show this again'										,hideLabel	: true									}]								}]								,buttons	: [{									text		: 'Proceed'									,handler	: hdlProceed								}, {									text		: 'Cancel'									,handler	: function() {this.ownerCt.hide();}								}]							});														win.show(tab.getEl().dom.id);							/*							Ext.Msg.show({								title	: ''								,msg	: 								,modal	: true								,animEl	: tab.getEl().dom.id								,buttons: Ext.Msg.OKCANCEL								,icon	: Ext.MessageBox.QUESTION								,fn		: function(btn) {																		if (btn == 'ok') {										// Before sumbit, check if the form is valid										var fp = tab.items.itemAt(0);										if (! fp.getForm().isValid()) {											Ext.tools.msg('Validation Error', 'Please fill all required fields to proceed.');											return;										}																				// Submit previous tab										this.submitForm(this.getIndex(tab), false, newTab);										//tPanel.setActiveTab(newTab);									}								}								,scope	: this							});							*/							return false;						}											}					,scope	: this				}				,'tabchange'		: {					'fn'	: this.onTabChange					,scope	: this				}			}						var items = new Ext.TabPanel(tp);					} else {					// If its single tab.			var items = tp.items[0];			delete items.title;		}				/*		 *	End: Creating TabPanel		 */								/*		 *	Start: Creating Dialog Window		 */				var dw = {			layout 			: 'fit'			,modal			: true			,border			: false			,resizable		: false			,bodyBorder 	: false			,autoScroll 	: false			,constrainHeader: true			,closeAction	: 'hide'			,items 			: items			,listeners		: {				'beforehide'	: {					'fn'			: this.onDialogBeforeHide					,scope			: this				}				,'hide'			: {					'fn' 			: this.onDialogHide					,scope			: this				}				,'show'			: {					'fn'			: this.onDialogShow					,scope			: this				}			}		}				Ext.apply(dw, dialogConfig);		this.noPrompt = dialogConfig.noPrompt		var t = (dialogConfig.panel) ? "Panel" : "Window";		this.dialog = new Ext[t](dw);			/*	if( !this.ignoreMe ){			this.dialog.on('show', Eve.Resource.loadDialogResource.createDelegate( Eve.Resource , [this.section]));			this.dialog.on('hide', Eve.Resource.popDialogResource.createDelegate(  Eve.Resource , [this.section]));		}*/			if(config.preRender){				try{					this.mode = 'create';					this.dialog.show();					if (this.staticLoad) {						var xml = Eve.Preference.get('popups');						this.staticLoad(xml);					}					this.dialog.suspendEvents();					try{						this.dialog.hide();					}catch(e){console.log('Error! while hiding dialog')}						this.dialog.resumeEvents();				}catch(e){console.log('Error!during dialogue rendering ')}			}		return this.dialog;				/*		 *	End: Creating Dialog Window		 */	}		,getTabPanel : function()	{		// Return the only item in dialog window		if (this.dialog.items) {			return this.dialog.items.itemAt(0);		}	}		,addButtons : function(i, mainTabs)	{		// Buttons Holder		var buttons		= [];		// Temporary Holder for making the sort easy		var tmpBtns		= [];				var submitFunc	= function(id, close) {		return this.submitForm.createDelegate(this, [id, close]);		}		var deleteFunc	= function(id)	{return this.deleteForm.createDelegate(this, [id]);}		var closeFunc	= function()	{this.dialog.hide();}				if (!this.isIL()) {			// Save buttons			tmpBtns[0] = {				text	: 'Save'				,tag	: 'save'				,hidden	: true	// Don't Want it				,handler: submitFunc.call(this, i) 			}		}				// Save & Close buttons		tmpBtns[1] = {			text	: 'Save'			,tag	: 'saveclose'			,handler: submitFunc.call(this, i, true) 		}				// Cancel buttons		tmpBtns[3] = {			text	: 'Cancel'			,tag	: 'cancel'			,handler: closeFunc			,scope	: this		}				// There's some diffrence in 'Comments' & 'Interlinking'		if (i == this.idxComments || i == this.idxInterlink) {			// Rewrite the Cancel button			tmpBtns		= [];			tmpBtns[3]	= {				text	: 'Cancel'				,tag	: 'cancel'				,handler: closeFunc				,scope	: this			};		}				// Add Special Buttons		if (mainTabs && mainTabs.indexOf(i) != -1) {			if (!this.isIL()) {				tmpBtns[2] = {					text		: 'Delete'					,tag		: 'delete'					,disabled	: true					,handler	: deleteFunc.call(this, i)				};			}		}				// Sorting the Buttons		for (var i = 0; i < tmpBtns.length; ++i) {			if (tmpBtns[i])				buttons.push(tmpBtns[i]);		}				// Hook		var btns = this.afterAddButtons(buttons, this);		return (btns) ? btns : buttons;	}		// Push each tab to Tab Panel	,pushPanels : function(arr, related, mainTabs)	{		var items = [];				for (var i = 0, len = arr.length; i < len; ++i)		{			// - - - - - - - - - - - - - - - - - - - - - - - - -			// Start: Comment & Interlinking Tab Index Detection			// - - - - - - - - - - - - - - - - - - - - - - - - -			switch (arr[i].toLowerCase())			{				case "comment":				case "comments":					this.idxComments = i;					break;								case "interlinking":				case "linked items":					this.idxInterlink = i;					break;			}			// - - - - - - - - - - - - - - - - - - - - - - - - -			// End:	Comment & Interlinking Tab Index Detection			// - - - - - - - - - - - - - - - - - - - - - - - - -									var form = this.panels[i].get().getForm();						items.push({				frame	: true				,layout	: 'fit'				,title	: arr[i]				,items	: this.panels[i].get()				,buttons: this.addButtons(i, mainTabs)				,buttonAlign: this.buttonAlign			});									// - - - - - - - - - - - - - - -			// Start: Tab/Form Relation			// - - - - - - - - - - - - - - -			if (related) {				for (var j = 0; j < related.length; ++j) {					// If current form has any relations					var idx = related[j].indexOf(i);					if (idx != -1) {						form.related = [];						for (var k = 0; k < related[j].length ; ++k) {							// Don't want to push loopback refrence.							if (related[j][k] != i)								form.related.push(this.panels[ related[j][k] ].get().getForm())						}					}				}			}			// - - - - - - - - - - - - - - -			// End: Tab/Form Relation			// - - - - - - - - - - - - - - -		}				return items;	}		// Set load flag based on passed index.	,setLoaded : function(idx)	{		// If there's no idx, set loaded to true for all forms		if (idx === undefined) {			for (var i=0; i < this.panels.length; ++i)				this.panels[i].get().getForm().loaded = true;						return;		}				var form = this.panels[idx].get().getForm();		form.loaded = true;	}		// Clear the panels load flag based on passed index.	,clearLoaded : function(idx)	{		// If there's no idx, set loaded to false for all forms		if (idx === undefined) {			for (var i=0; i < this.panels.length; ++i)				this.panels[i].get().getForm().loaded = false;						return;		}				var form = this.panels[idx].get().getForm();		form.loaded = false;	}		// Return current panels' flag status.	,getLoaded : function(idx)	{		if (idx === undefined)			return;		     		return this.panels[idx].get().getForm().loaded;	}		// Return if the dialog content has been cached?	,isCached : function()	{		return (! this.cached) ? false : true;	}		// Reset the cache, so in the next show will send a request to backend to fetch the data	,resetCache : function()	{		this.cached = false;	}		,staticHasChanged: function(idx)	{		var form	= this.panels[idx].get().getForm();		var result	= false;				form.items.each( function(el) {			if (el.getXType() == 'textfield' ||				el.getXType() == 'textfield' ||				el.getXType() == 'htmleditor')			{				var val = el.getValue().trim();				val = val.replace(String.fromCharCode(8203), '');				val = val.replace('<br>', '');				// hasDefValue: custom property to ignore this checking				if (!el.hasDefValue && val != "") {					result = true;					return;				}			}		});				return result;	}		,disableDeleteButtons : function()	{			//@@Benchmark		//console.log("@@Benchmark -- Time(N3): ",(new Date()).getRTime() % 100000);		var me = this;		this.getTabPanel().items.each( function(el) {			var btns = el.buttons || me.dialog.items.items[0].buttons;						if (btns) {				for (var i = 0; i < btns.length; ++i) {					if(btns[i].tag == 'delete')						btns[i].disable();				}			}		})	}		,onDialogBeforeHide : function()	{		//@@Benchmark		//console.log("@@Benchmark -- Time(M3): ",(new Date()).getRTime() % 100000);		if (this.noPrompt) {			return true;		}				if (this.noPromptNeeded) {			// First: reset flag			this.noPromptNeeded = undefined;			return true;		}				// Get active tab's index		try {			var idx = this.getIndex(this.getTabPanel().getActiveTab());		} catch(e) {			var idx = 0;		}				if (this.mode == 'create' && !this.getLoaded(idx)) {			// Decide if we should show the exit message to user or not?			var changed = this.staticHasChanged(idx);		}				if (this.panels[idx].get().getForm().hasChanged() || changed) {			Ext.Msg.show({			   title	: 'Are you sure?'			   ,msg		: 'Once you close this dialog you may lose your unsaved data! Are you sure you want to continue?'			   ,buttons	: Ext.Msg.YESNO			   ,icon	: Ext.MessageBox.QUESTION			   ,fn		: function(btn) {					if (btn == 'yes') {						this.noPromptNeeded = true;						this.dialog.hide();					}			   }			   ,scope	: this			});						return false;		}				// Disable Delete Buttons		this.disableDeleteButtons();		//@@Benchmark		//console.log("@@Benchmark -- Time(M4): ",(new Date()).getRTime() % 100000);		return true;	}		,onDialogShow : function()	{		//@@Benchmark		//console.log("@@Benchmark -- Time(M5): ",(new Date()).getRTime() % 100000);		for (var i = 0; this.panels.length; ++i) {			var panel = this.panels[i];						// If there's no tab or tab is Comments Tab or Interlinking Tab, leave it.			if (!panel || i == this.idxComments || i == this.idxInterlink) {				return;			}						// Get first item that has 'setFocus' property.			var item = panel.get().find('setFocus', true)[0];						// If there was an item with 'setFocus' property in the form, do it ;)			if (item) {				item.focus(false, 1000);			}			this.applyPermissions({responseXML:{}});			this.updateCountOfTitle({responseXML:{}});		}				//@@Benchmark		//console.log("@@Benchmark -- Time(M6): ",(new Date()).getRTime() % 100000);	}		// Invoked when tab changes (each DialogControl can override this method)	,onTabChange : function(tPanel, tab)	{		var idx = this.getIndex(tab);				// If this tab previously loaded, prevent it from loading agian.		if (this.getLoaded(idx))			return				if (this.mode != 'create') {			this.loadForm(idx);			this.setLoaded(idx);		}	}		// Enable/Disable dialog's buttons, based on permissions	,applyPermissions: function(r)	{		// If it's Multi Tab		if (this.getTabPanel().getActiveTab) {			var idx = this.getIndex(this.getTabPanel().getActiveTab());			if (idx == this.idxComments || idx == this.idxInterlink) {				return;			}		}				var dq			= Ext.DomQuery;		var prmEdit		= dq.selectValue('editPermission', r.responseXML, true);		var prmDelete	= dq.selectValue('deletePermission', r.responseXML, true);				prmEdit		= (prmEdit   == 'false') ? false : true;		prmDelete	= (prmDelete == 'false') ? false : true;				// If there no tabpanel it means the dialog has single tab so we should get it from dialog		var tp = this.getTabPanel();		var me = this;				// Search through the buttons on each TabPanel		tp.items.each( function(tab) {			var buttons = tab.buttons						// If there's no tabpanel			if (!buttons)				buttons = tp.buttons;						for (var i = 0; i < buttons.length; ++i) {				var btn = buttons[i];								switch (btn.tag) {					case 'save':					case 'saveclose':						btn.setDisabled(!prmEdit);						break;											case 'delete':						if (me.mode == 'create')							btn.setDisabled(true);						else							btn.setDisabled(!prmDelete);						break;				}				}		})	}		// Change Dialog Mode from 'Create' to 'Edit'	,changeMode : function(r, a)	{		/*		// If mode is 'create', its time to enable the Delete button		if (this.mode == 'create' && this.id == '0') {			var tp	= this.tabPanel || this.dialog;						tp.items.each( function(tab) {				for (var i = 0; i < tab.buttons.length; ++i) {					var btn = tab.buttons[i];										if (btn.tag == 'delete')						btn.setDisabled(false);				}			});		}		*/				if (this.isIL()) {			return;		}						// There's some diffrence between Ext & Eve forms!		var xml		= r.responseXML || a.response.responseXML;		var id		= Ext.DomQuery.selectValue('id', xml);				if (id) {			id	= id.split("_")[1];		} else {			console.warn("Back-end didn't pass any ID!", xml);		}						// In Comment and Interlinking, passed id doesn't have Prefix,		// so we can determine that and skip to update the id.		if (id !== undefined) {			// Update the new assigned id.			this.id	 	= id;			this.mode 	= 'edit';						var info = {				id 			: this.id				,root 		: this.root				,path		: this.path				,typeId		: this.typeId				,groupId 	: this.groupId				,parentId 	: this.parentId			}			// Feed Comment & Interlinking with new id			Eve._cm.main.params = {info: info};			Eve._il.main.params = {info: info, dialog: this};						// Call after setting info object (comes here by Ghazaleh)			this.showHideCmp();			this.applyPermissions(r);		}	}	,updateCountOfTitle : function(r, count)	{		// Update Count Values for Comment & Interlinking		var tabComment	 = this.getTabPanel().items.itemAt( this.idxComments );		var tabInterlink = this.getTabPanel().items.itemAt( this.idxInterlink );		if (typeof r == 'object') {			// Update with ResponseXML			var c, dq = Ext.DomQuery;			if (tabComment) {				c = dq.selectValue('commentCount', r.responseXML, '0');				tabComment.setTitle('Comments (' + c + ')');			}			if (tabInterlink) {				c = dq.selectValue('linkedCount', r.responseXML, '0');				tabInterlink.setTitle('Linked Items (' + c + ')');			}		} else {			// Update with current Count			var c, idx	= this.getIndex( this.getTabPanel().activeTab );						if (idx == this.idxComments) {				c = tabComment.title.match(/\(([^\)]*)/)[1];				c = (count) ? count : eval(c.trim() + r + '1');				tabComment.setTitle('Comments ( ' + c + ' )');			}			if (idx == this.idxInterlink) {				c = tabInterlink.title.match(/\(([^\)]*)/)[1];				c = (count) ? count : eval(c.trim() + r + '1');				tabInterlink.setTitle('Linked Items ( ' + c + ' )');			}		}			}	,getLoadParams : function(i)	{		// Create a new Load Mask		var lm = new Ext.LoadMask( /*this.panels[id].get().body*/ this.dialog.body || document.body, {msg: 'Loading...'} );		lm.show();		var event = this.panels[i].loadEvent().replace('{root}', this.root);				var options	= {			url		: Eve.url			,params	: {event :event}			//,failure: function() { lm.hide(); }			,scope	: this		};				// Hide the load mask in any case		options.success = function(r) {			lm.hide();						var sec = this.section;			// Call to reset the email textbox on demand.			if ( ( sec == 'reminder' || sec == 'task') && event.toLowerCase().indexOf('folder') == -1 ) {				this.setCmpValue();			}						// Update the cache status			this.cached = true;			this.loadSuccess(r);				this.applyPermissions(r);			// Update the Comments & Interlinking Counts			if (i != this.idxComments && i != this.idxInterlink) {				this.updateCountOfTitle(r);			}		}				this.mask = lm;		options.failure = this.failureCallback; 				// Create extra params and append it.		var temp = {params:{}};		this.augment( temp, i, 'load' );		Ext.apply(options.params, temp.params);				return options;	}	,failureCallback: function() {		// Reset the cache status;		this.resetCache();		this.mask.hide();	} 	,loadForm : function(id)	{		var params = this.getLoadParams(id);				// Load the form		this.panels[id].load(params, id);	}	 	,getSubmitParams : function(i, partial, close, changeTo)	{		// Create a new Submit Mask		// var lm = new Ext.LoadMask(this.dialog.body || document.body, {msg: 'Saving...'} );		// lm.show();				var options = {			url		: Eve.url			,params : this.panels[i].getParams()			,success: function(r, a) {				// Added By Ghazal for when selected node is personal				if (a && a.params) {					var obj = Ext.urlDecode( a.params );					obj.groupId  = obj.groupId || 0;					a.params = Ext.urlEncode( obj )				}				/* Changed by Majid: Move to End */				// this.submitSuccess(r, a);								// Added By Khashayar				this.changeMode(r, a);								// If its Save & Close				if (close) {					/* Changed by Majid : Remove Defer */					/* Majid: Wait : next lines was commented */					/**/					/*var that = this;					(function() {						that.noPromptNeeded = true;						that.dialog.hide();						that.onDialogHide();						that.disableDeleteButtons();					}).defer(1000);*/					/**/										/* Changed by Majid */					this.noPromptNeeded = true;					this.dialog.hide();					//this.disableDeleteButtons();					//this.onDialogHide();				}								// If we got here, it means a new interlink item created,				// so it needs to refresh interlink tab, and the srouce grid too (for paperclip icon)				if (this.isIL()) {					var i = Eve.Resource.getSecInfoByTypeId(this.typeId);					i.type = i.type || 'item';										var data = {						origin	: i.type						,info	: {							response: r						}					}										this.fire(i.section + '_reload_interlink_grid', data, true);				}								// lm.hide();								/* Changed by Majid: Move from Start */				// Khashayar:				// IMPORTANT: this should be called before 'changeTo'				this.submitSuccess(r, a);				// Khashayar:				// IMPORTANT: this should be called after 'sumitSuccess'				if (!close && changeTo) {					this.getTabPanel().setActiveTab(changeTo);				}							}				/* Majid: Wait : next lines was commented */			,failure: function() { /*lm.hide();*/ }			,scope	: this		};						// Make event and append it to params.		if (!partial || partial === undefined) {			var event = this.panels[i].submitEvent(this.root, this.mode).replace('{root}', this.root);			Ext.apply(options.params, {event: event});		}				// Create extra params and append it.		var temp = {params:{}};		this.augment( temp, i, 'submit' );		Ext.apply(options.params, temp.params);				if (this.isIL()) {			// New Item			if (this.linkBack !== undefined) {				options.params.forwardURL =  ["modern.interlink.personal.prepareToCreate",												"&objTypeId=",	this.typeId,												"&objId=", 		this.objId,												"&toGroupId=",	this.groupId,												"&toObjTypeId=", Eve.Resource.getTypeId(this.root, this.origin, this.section.split('_')[0]),												"&linkback=",	this.linkBack,												"&doGetGrid=true"].join('')			}			// Existing Item			else {				// TODO:			}		}				// Hook		var extraParams = this.afterSubmitParams(i);		Ext.apply(options.params, extraParams);		return options;	}	 	,submitForm : function(id, close, changeTo)	{		if ( !this.panels[id].get().getForm().isValid() )			return false;				var that = this;		var params = this.getSubmitParams(id, false, close, changeTo);		//changed by Ghazal/*		if (params != false) {			setTimeout (function(){that.panels[id].submit(params);}, 500);		}*/		if(params != false)			this.panels[id].submit(params);				if (close) {			that.noPromptNeeded = true;			that.dialog.hide();			that.onDialogHide();			that.disableDeleteButtons();		}				// Update Tab's Title		if (id == this.idxComments) {			this.updateCountOfTitle('+');		}	}	,deleteForm : function(id)	{		var data = {			info	: {				id			: this.id				,groupId	: this.groupId				,parentId	: this.parentId				,root		: this.root				,path		: this.path || '\\'				,singleEvent: this.singleEvent			}			,title		: this.title			,dialog 	: this.dialog			,me			: this		}					this.noPromptNeeded = true;		this.fire(this.section + '_delete_' + this.origin + '_dlg', data);		//this.dialog.hide();	}			// * * * * * * * * * * * * * * *	// Comments Related Methods 	// * * * * * * * * * * * * * * *		,addComment : function(xml)	{		// Reset form to remove the value in textarea		this.panels[this.idxComments].reset();		var ds	 = this.getDataView().store;		var dq	 = Ext.DomQuery;		var root = dq.selectNode('row', xml);		var id	 = dq.selectValue('id', root);		var idx	 = dq.selectValue('index', root);		var row = Ext.data.Record.create(['userId', 'writtenBy', 'writtenOn'])		var record = new row({			id			: id			,userId		: dq.selectValue('userId', root)			,writtenBy	: dq.selectValue('writtenBy', root)			,writtenOn	: dq.selectValue('writtenOn', root)			,comments	: dq.selectValue('comments', root)		})		record.id = id;		ds.insert((idx - 1), record);	}		,deleteComment : function(data)	{		var dv	= this.getDataView();		var ds  = dv.store;		var dq	= Ext.DomQuery;		var id	= dq.selectValue('id', data) || data.info.id;		var rec = ds.getById(id);		if (rec === undefined) {return}		ds.remove(rec);		dv.view.refresh();		// Update Tab's Title		this.updateCountOfTitle('-');	}		// To get Comment's dialog dataview.	,getDataView : function()	{		var p = this.getTabPanel().items.items[this.idxComments]; 		return p.items.items[0].items.items[0].items.items[0];	}			// * * * * * * * * * * * * * * *	// Interlinking Related Methods 	// * * * * * * * * * * * * * * *		// Special function to load the Interlinking Grid.	,loadLinkingGrid : function(r)	{		var store	= Eve._il.main.store;		var result	= store.reader.read(r);		store.removeAll();		store.loadRecords(result, {add: true}, true);	}		,augment 			: Ext.emptyFn	,afterAddButtons	: Ext.emptyFn	,loadSuccess		: Ext.emptyFn	,submitSuccess		: Ext.emptyFn	,setCmpValue		: Ext.emptyFn	,showHideCmp		: Ext.emptyFn	,onDialogHide		: Ext.emptyFn	,afterSubmitParams	: Ext.emptyFn	});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Widgets/Resource.js *//*--------------------------------------------------*/// A Singleton Bridge// A Null resourceEve.resource.Null = function(){}Eve.resource.Null.prototype = {	 cmdSelectFolder 		: Ext.emptyFn	,cmdListView        	: Ext.emptyFn	,cmdChangePage			: Ext.emptyFn	,cmdChangeSort			: Ext.emptyFn	,cmdDelete		  		: Ext.emptyFn	,cmdCreateModify 		: Ext.emptyFn	,cmdGetSubTree			: Ext.emptyFn	,cmdCreateBranch		: Ext.emptyFn	,cmdMove				: Ext.emptyFn	,getRootTitle			: Ext.emptyFn	,getFolderCls			: Ext.emptyFn	,getGroupCls			: Ext.emptyFn	//,getLinkingId			: Ext.emptyFn	//,getToolTip			: Ext.emptyFn	,getDDMsg				: Ext.emptyFn	,getGridGroup			: Ext.emptyFn	,getTreeGroup			: Ext.emptyFn};Eve.resource.Default = function() {}Eve.resource.Default = Ext.extend( Eve.resource.Null, {	emblem	: 'modern.' 	,cmdGetSubTree	: function(sec, root)		{ return [this.emblem, sec, 'Folder.', root, '.getSubTree'].join('') }		,cmdSelectFolder: function(sec, root)		{ return [this.emblem, sec, '.', root, '.selectFolder'].join('') }	,cmdChangePage	: function(sec, root) 		{ return [this.emblem, sec, '.', root, '.changeStartItemNumber'].join('') }	,cmdChangeSort	: function(sec, root)		{ return [this.emblem, sec, '.', root, '.changeOrderBy'].join('') }	,cmdDelete		: function(sec, root, iF) 	{ return [this.emblem, sec, (iF)?'Folder':'', '.', root, '.delete'].join('') }	,cmdMultiDelete : function(sec, root, iF)	{ return [this.emblem, sec, (iF)?'Folder':'', '.', root, '.deleteAll'].join('') }	,cmdCreateModify: function(sec, root, iF) 	{ return [this.emblem, sec, (iF)?'Folder':'', '.', root, '.createModify'].join('') }	,cmdMove		: function(sec, root, iF) 	{ return [this.emblem, sec, (iF)?'Folder':'', '.', root, '.moveAll'].join('') }	,cmdCreateBranch: function(sec, root, br)	{ return [this.emblem, sec, '.', root, '.modifyFilter'].join('') }	 	,cmdAttachFile	: function(sec, root) 		{ return [this.emblem, sec, '.', root, '.attachFile'].join('') }	,cmdListView	: function(root) 			{ return [this.emblem, 'document', '.', root, '.getList'].join('')	}	,getFolderCls	: function() { return 'folder-node'; }	,getGroupCls	: function() { return 'group-node'; }	,getGridGroup	: function() { return 'Test'; }	,getTreeGroup	: function() { return 'Test'; }		//For Calendar section	,gotoDate: function( date, subsec ){		subsec = subsec || 'personal';		return { event: 'modern.calendar.' + subsec + '.goDate', date: date };	}	,cmdSelectMode: function( mode, subsec ){		subsec = subsec || 'personal';		return { event: 'modern.calendar.' + subsec + '.selectViewMode', viewMode: mode };	}			// Returns the Record's TypeId	,getTypeId : function(root, type, section)	{		var idx = 0;		type = type || 'item';		root = root || 'personal';				if (root == 'personal') {			idx = (type == 'item') ? 0 : 2;		}		else {			idx = (type == 'item') ? 1 : 3;		}				// For Sections that dont have Interlinking.		try {			return this.getInterlinkId(section)[idx];		} catch(e) {}	}		,getSecInfoByTypeId : function(tid)	{		var section, type = "item";				switch (parseInt(tid)) {			case 1:			case 11:				section = "calendar";				break;							case 2:			case 12:				section = "task";				break;							case 3:			case 13:				section = "contact";				break;							case 4:			case 14:				section = "link";				break;							case 5:			case 15:				section = "document";				break;							case 6:				section = "mail";				break;							case 7:			case 17:				section = "task";				type	= "folder";				break;							case 8:			case 18:				section = "document";				type	= "folder";				this._dialogRes.pop()				break;							case 9:			case 19:				section = "link";				type	= "folder";				break;							case 16:				section = "voting";				break;							case 21:				section = "forum";				break;			/*				case 22:				section = "thread";				break;			*/		}				return {section: section, type: type};	}		,getRootTitle	: function() {		return 'All';	}		,getDDMsg		: {		ddTitle			: 'Error in Drag & Drop'		,parentFolder	: "The dragged node dropped on its parent folder!"		,itself			: "Nodes can't be dropped on itself!"		,personalGroups	: "Drag & Drop between 'Personal' and 'Groups' nodes are forbidden!"		,betweenGroups	: "Drag & Drop between Group nodes are not allowed!"		,itsChildren	: "Nodes don't suppose to drop on its own children!"		,diffrentType   : "Drag items must have same type"	}		,getIcon: function(icon, folder) {		if (!folder){			console.log('icon:', icon, ',folder:', folder)			throw ['Icon folder [',folder,'] is missed!'].join('');		}				return Eve.imagePath + folder + '/' + icon.toLowerCase() + '.png';	}});// Global resource bundleEve.lib._Resource = Ext.extend( Eve.lib.Bridge, {	active_res : {}		,loadedJSFiles : []	,interlinkSections : {		 calendar		: [ 1, 11 ]		,task			: [ 2, 12, 7, 17 ]		,taskfolder		: [ 7, 17 ]		,contact		: [ 3, 13 ]		,link			: [ 4, 14 ]		,document		: [ 5, 15, 8, 18 ]		,documentfolder	: [ 8, 18 ]		,mail			: [ 6, 6  ]		,voting			: [ 16, 16]		,account		: [ 20, 20]		,forum          : [ 0, 21, 0, 22]		//,forum          : [ 0, 21, 0, 22]	}	,init : function(data)	{		Eve.lib._Resource.superclass.init.call(this, data);	}		,load : function( res, isDialog )	{		if ( !isDialog ){			this.activeSectionResource = res;			this._dialogRes = [ res ];		}				try{			if ( typeof res == "string" ){				res = new Eve.resource[res];			}						// Active Resource			this.active_res = res;			for ( var i in res ){				this[i] = res[i];			}		}catch(e){			//throw new TypeError( res );		}	}		,getInterlinkId : function(sec)	{		sec = sec.toLowerCase();		return this.interlinkSections[sec];	}		,mapXml : function(xml, fields, record)	{		var exists		= {}; // Store Values that exists in store's fields.		var notExists	= {}; // Store Values that doesn't exists in store's fields.		var existsArr		= [];		var notExistsArr	= [];				var record		= record || 'row';		var dq			= Ext.DomQuery;		var root		= dq.select(record, xml);				if (root === undefined || root.length == 0)			return false;		for (var j=0; j<root.length; ++j){			notExists = {};			exists = {}			for (var i=0; i < root[j].childNodes.length; ++i) {				if (root[j].childNodes[i].nodeType != 1)					continue;				var nodeName	= root[j].childNodes[i].nodeName;				var nodeValue	= dq.selectValue(nodeName, root[j]);				if (fields.indexOf(nodeName) == -1) {					notExists[nodeName] = nodeValue;				}				else {					exists[nodeName]	= nodeValue;				}				// Fix for the Errors?				Ext.applyIf( notExists, {id : exists.id} );			}			notExistsArr.push(notExists);			existsArr.push(exists);		}				//		var ret = {			fields	: existsArr			,extra	: notExistsArr		}				return ret;	}		,execute : function(callee, type, object)	{		switch(type) {			// Load the new resource			case (Eve.Resource.section + '_change_resource'):				var res = object.res;								this.load( res );				break;		}	}		,logout: function()	{		// Prepare Preferences to Sync		var sections = Eve.Preference.get('tree');		var cols	 = {			event	: 'modern.user.personal.modifyPreferences'		};		var counter	 = 1;		for (var i in sections) {			var section = i;			var nodes	= sections[i].nodes;						for (var j = 0; j < nodes.length; ++j) {				var n = nodes[j];								if ( n.get('columnsChanged') ) {					cols['id_' + counter]		= n.get('id').split('_')[1];					cols['columns_' + counter]	= n.get('columns');					cols['section_' + counter]	= section;					counter++;				}			}		}		//For mail section	   	cols.mailFolderSidebar = Eve.Preference.get('mailFolderSidebar');		cols.mailPopSidebar = Eve.Preference.get('mailPopSidebar');		cols.mailViewingStyle = Eve.Preference.get('mailViewingStyle');		if (counter > 1) {			Ext.Ajax.request({				url		: Eve.url				,params	: cols				,success: function() {					document.location = Eve.url + "?event=security.logout&cid=" + Eve.Preference.getInteger("cobrandId") + "&CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;				}				,failure: function() {					Ext.Msg.alert('Oops!', "There was an error while trying to logout.");				}			});		} else {			document.location = Eve.url + "?event=security.logout&cid=" + Eve.Preference.getInteger("cobrandId") + "&CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;		}	}		,showHelp: function()	{		window.open('http://collaborationsoftware.hyperoffice.com/index.php?LOGINURL='+Eve.loginUrl+'&isssl='+Eve.isSSL+'&CFID='+Eve.CFId+'&CFTOKEN='+Eve.CFToken,'helpengine','width=1000, height=680, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes');	}		,changeStyle: function()	{		document.location = 'index.cfm?cid=' + Eve.Preference.getInteger("cobrandId") + '&event=modern.userPreferences.personal.changeStyle&directory=nicolasstyle' + '&CFID='+Eve.CFId+'&CFTOKEN='+Eve.CFToken;	}		,showIM: function()	{		v1 = skypeCheck();				if (v1) {			document.location.href = 'skype:';		}	}	,showChat: function()	{		window.open('http://chat.application.com:81/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=1&queueID=2&redirectOffline=http://www.hyperoffice.com/hypermain/contactInfo.cfm', 'chatwindow', 'width=710,height=550,scrollbars=yes,resizable=yes,titlebar=yes,menubar=no,toolbar=no');	}	,showBuyNow: function(userId,cobrandId)	{		document.location.href = 'https://secure.hyperoffice.com/billing/setup-billing.cfm?currentcobrandid='+cobrandId+'&currentuserid='+userId+'&isinternal=1&mainwidth=640';	}		,openAnnouncement : function(url){		var el	= Ext.getCmp('MainCardLayout');		var lt	= el.getLayout();		var panel = {			xtype		: 'panel'			,id			: 'TempLayout'			,layout		: 'fit'			,items		: [ new Ext.ux.IFrameComponent({ url: url }) ]		};		el.remove(Ext.getCmp('TempLayout'));		el.add(panel);		lt.setActiveItem(el.items.items.length-1)		Eve.LayoutManager.sectionName = "";	}	,showAnnouncement: function(){		var x = Ext.get(this).getLeft()- 400;		var y = Ext.get(this).getTop()+ 30;		var that = this;		if(!this.announceWin){		this.announceWin = new Ext.Window({			//title		: 'Announcement'			 x			: x			,y			: y			,width      :510			,height     :200			,closeAction: 'hide'			,resizable	: false			,layout	: 'fit'			,items	: [new Eve.FormPanel({				layout	: 'fit'				,id   : 'popout-announcement'				,width	: 500				,height	: 200				,frame	: true				,border	: false				,items	: [{ xtype	: 'panel'							,height			: 180							//,border			: true							,autoScroll		: true							,style			: 'background-color:#fff; ; border: 1px solid;'							,items			: [ new Ext.ux.xDataView({									 id					: 'popout_announce_dv'									,xtype				: 'xdataview'									,name				: 'announcements'									,singleSelect       : true									,hideLabel			: true									,itemSelector		: 'div.x-doc-select'									,overClass          : 'x-doc-over'									,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Announcments.</i></div>'									,selectedClass      : 'x-doc-selected'									,store				: new Ext.data.Store({										reader	: new Ext.data.XmlReader({											record	: 'row'											,id		: 'id'										}, ['id', 'message', 'templateName', 'size','url'])										,url    : Eve.url									})									,tpl	: new Ext.XTemplate(										'<div class="x-form-item">',					 					'<tpl for=".">',									 	'<div style="margin:0px;padding:3px 4px; width: 98%;font-size:8pt" class="x-doc-select">',									 	    '<table style="font-size:8pt" width=100%>',									 	    '<tr>',												'<td >{message}</td>',										 	'</tr>',									 	    '<tr><td  height=20 align="right">',											//'<tpl if="this.hasUrl(values.url)"><a href="{url}" target="_blank">Learn more</a> </tpl>',											'<tpl>{[this.getLearnMore(values)]} </tpl>',											'<span class="btn-dismiss">Dismiss</span></td></tr>',									 	    '</table>',									 	'</div>',									 	'</tpl>',									 	'</div>',{											/*hasUrl : function(url){												if(url.trim() == "")													return false;												return true;											}*/											getLearnMore : function(values){												if(values.url.trim() == ""){													return '';												}												else if (values.size == ""){													return '<a href="#" onclick="Eve.Resource.openAnnouncement(\''+values.url+'\')">Learn more</a>';												}												else if (values.size.indexOf('target=') != -1){													return ['<a href="',values.url,'" ',values.size,'>Learn more</a>'].join('');												}												else{													return ["<a href='javascript:void(0)' ", "onclick=\"window.open('", values.url,"', 'LearnMore', '", values.size, "')\">", "Learn more</a>"].join('');																									}											}										})                                    	,listeners		:{											click: function(dv, index, node, e){													try{														var rec = dv.getRecord(node);													}catch(e){console.log('Error! announcement up')}													if(rec === undefined)													    return;															if (e.target.className == 'btn-dismiss'){																Eve.mask.show(popOut.el);																Ext.Ajax.request({																		url			: Eve.url																		,params		: {																			event:'modern.announcement.personal.dismiss'																			,id: rec.get('id')																		}																		,success	: function(response, opt){																			Eve.mask.hide(popOut.el);																			var id = Ext.DomQuery.selectValue('id', response.responseXML, 'undefind');																																						if(id){																				var st = dv.store;																				st.remove(st.getById(id));																				Eve.announcements = st.getCount();																				if(Eve.announcements == 0){																					Ext.get('announceTD').setVisible(false);																					that.announceWin.hide();																				}																				else if (Eve.announcements > 0){																					Ext.get('announceTD').setVisible(true);																				}																				Ext.get("announce_count").dom.innerHTML = '('+Eve.announcements+')';																			}																			Eve.mask.hide(popOut.el);																		}																		,scope  	: this																	});														}																							}									}							})]}						]			})]		});		}		if(!this.announceWin.isVisible())			this.announceWin.setPosition(x, y);		this.announceWin.show('announceTD');		var popOut	= Ext.getCmp('popout-announcement');		Eve.mask.show(popOut.el);		var options	= {			url		: Eve.url			,params	: {event :'modern.announcement.personal.viewAll'}			,failure: function() { }			,scope	: this			,success : function(r){				Eve.mask.hide(popOut.el);			}		};				if (popOut!== undefined) {			popOut.getForm().load(options);		}		}});Ext.onReady(function(){	// Load the default value for the resource manager	Eve.Resource = new Eve.lib._Resource();	Eve.Resource.load( new Eve.resource.Default() );});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\interlink/InterlinkDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Interlink section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/Eve._il = Eve.Dialogs.Interlink;// Namespace to store properties of this dialog.Eve._il.main = {};// ColumnModelEve._il.main.columnModel = [{		header			: ""		,width			: 30		,dataIndex		: 'objType'		,fixed			: true		,menuDisabled	: true		,renderer		: function(val, options, rec) {			var icon = rec.get('objIcon') || 'no-pic.png';			return "<img src='" + icon + "' />";		}	}, {		header			: "Group"		,width			: 10		,dataIndex		: 'objCategory'		,fixed			: true		,menuDisabled	: true		,hidden			: true	}, {		header			: "Title"		,width			: 60		,dataIndex		: 'objTitle'		,sortable		: true		,menuDisabled	: true		,renderer		: function(val) { 			return "<span onmouseover='this.style.cursor=\"pointer\"'>" + val + "</span>";		}	}, {		header			: "Details"		,width			: 60		,dataIndex		: 'details'		,menuDisabled	: true		,renderer		: function(val) { 			return "<span onmouseover='this.style.cursor=\"pointer\"'>" + val + "</span>";		}	}, {		header			: "&nbsp;"		,width			: 30		,fixed			: true		,menuDisabled	: true		,renderer		: function() { 			return "<img src='" + Eve.Resource.getIcon('delete', 'general') + "' onmouseover='this.style.cursor=&quot;pointer&quot; ' />"		}	}]// StoreEve._il.main.store = new Ext.data.GroupingStore({	sortInfo	: { field: 'subject', direction: "ASC" }	,groupField	: 'objCategory'	,reader		: new Ext.data.XmlReader({		record 		: 'row'		,success	: '@success'		,id			: 'id'		,totalRecords: 'total'	}, ['objCategory', 'objId', 'objMode', 'objGroupId', 'objTypeId', 'objType', 'objTitle', 'objPath', 'objIcon', 'SpawnNewWindow', 'url', 'autoLogin', 'details'])})// Handler for Grid's toolbar buttons.Eve._il.main.handler = function(el, e) {	var data = {		info	: Eve._il.main.params		,mode	: 'interlink'	}		data.info.section = el.modex;	Eve.Resource.superbridge.broadcast(Eve._il.main.handler, "interlink_edit_item_dlg", data);}// Handler for Grid's toolbar buttons.Eve._il.main.newHandler = function(el, e) {	var type = el.mode;		var data = Eve._il.main.params;	data.info.section = el.mode;	Ext.getCmp('il_group_combo_new').setLinkTo(el.modex);		Eve.Resource.superbridge.broadcast(this, 'interlink_link_new_item_dlg', {info: data.info, linkTo: el.modex });		//// Eve.Resource.superbridge.broadcast( this, 'proxy_dialog', { type: type, info: data.info, mode:'interlink' });	//Eve.Resource.superbridge.broadcast(this, type, {info: data.info, mode: 'interlink'});}Eve._il.main.registerView = {	rowdblclick	: function(grid, rowIndex, e) {		var rec			= grid.store.getAt(rowIndex);		var id		 	= rec.get("objId");		var objTypeId	= rec.get("objTypeId");		var root		= rec.get("objMode");		var groupId		= rec.get("objGroupId").split('_')[1];		var path		= rec.get("objPath");		var title		= rec.get("objTitle");				// Get Section info by its type id		var i = Eve.Resource.getSecInfoByTypeId(objTypeId);				if (!i.section)			return				var section = i.section;		var type	= i.type;				var data = {			info	: {				id		: id.split('_')[1]				,rawId	: id				,root	: root				,path	: path				,groupId: groupId				,typeId	: Eve._il.main.params.info.typeId				,rec	: rec			}			,mode	: 'interlink'			,title	: title		}						// Decide what we should fire next!		switch (section) {			case 'contact':				var func = function() {					Eve.Resource.superbridge.broadcast(grid, 'contact_load_icon_popup', data);				}				break;							case 'document':				var func = function() {					Eve.Resource.superbridge.broadcast(grid, 'document_download_file', data);				}				break;						case 'link':				var func = function() {					Eve.Resource.superbridge.broadcast(grid, 'link_open_link', data);				}				break;			/*			case 'forum':				var func = function() {					Eve.Resource.superbridge.broadcast(grid, 'forum_edit_item_dlg', data);				}				break;			*/			default:				var event = [section, "_il_edit_", type, "_dlg"].join('');				var func  = function() {					Eve.Resource.superbridge.broadcast(grid, event, data)				}		}				Eve.Resource.superbridge.broadcast(grid, 'proxy_dialog', { type: section, func: func });	}		,cellclick : function(grid, rowIndex, colIndex, e) {		if (colIndex != 4)			return;				var params	= Eve._il.main.params				var rec		= grid.store.getAt(rowIndex);		var i		= Eve.Resource.getSecInfoByTypeId(params.info.typeId);				var data	= {			id			: rec.id			,type		: i.type			,info		: {				id			: params.info.id				,root		: params.info.root				,groupId	: params.info.groupId				,parentId	: params.info.parentId				,path		: params.info.path				,dialog		: params.dialog				,section	: i.section			}		}				Eve.Resource.superbridge.broadcast(grid, "interlink_delete", data);	}}// * * * * * * * * * * * * * * * * * * * * // Interlinking	 * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve._il.Main = function() { return new Eve.FormPanel({    labelWidth	: 75	,layout		: 'border'    ,frame		: false    ,border		: false    ,bodyStyle	: 'padding:5px 5px 0'    ,width		: 400    ,items 		: [{		layout		: 'column'		,region		: 'north'		,margins	: '5 5 5 5'		,items		: [{			columnWidth	: .22			,items		: [{				xtype		: 'splitbutton'				,text		: 'Link a new Item'				,cls 		: 'x-btn-text-icon'				,icon		: Eve.Resource.getIcon('new', 'general')				,handler	: function() { this.showMenu() }				,menu		: [{					text		: 'Email Message'					,mode		: 'mail'					,modex		: 'mail'					,icon		: Eve.Resource.getIcon('item-mail', 'mail')					,handler	: Eve._il.main.newHandler				}, {					text		: 'Contact'					,mode		: 'contact'					,modex		: 'contacts'					,icon		: Eve.Resource.getIcon('item-contact', 'contact')					,handler	: Eve._il.main.newHandler					,hidden		: (!Eve.Preference.getBoolean('mycontacts') && !Eve.Preference.getBoolean('sharedcontacts'))				}, {					text		: 'Task'					,mode		: 'task'					,modex		: 'tasks'					,icon		: Eve.Resource.getIcon('item-task', 'task')					,handler	: Eve._il.main.newHandler					,hidden		: (!Eve.Preference.getBoolean('mytasks') && !Eve.Preference.getBoolean('sharedtasks'))				}, {					text		: 'Event'					,mode		: 'calendar'					,modex		: 'calendar'					,icon		: Eve.Resource.getIcon('item-event', 'calendar')					,handler	: Eve._il.main.newHandler					,hidden		: (!Eve.Preference.getBoolean('mycalendar') && !Eve.Preference.getBoolean('sharedcalendar'))				}, {					text		: 'Document'					,mode		: 'document'					,modex		: 'documents'					,handler	: Eve._il.main.newHandler					,hidden		: (!Eve.Preference.getBoolean('mydocument') && !Eve.Preference.getBoolean('shareddocument'))				}, {					text		: 'Link'					,mode		: 'link'					,modex		: 'links'					,icon		: Eve.Resource.getIcon('item-link', 'link')					,handler	: Eve._il.main.newHandler					,hidden		: (!Eve.Preference.getBoolean('mylinks') && !Eve.Preference.getBoolean('sharedlinks'))				}, {					text		: 'Voting'					,mode		: 'voting'					,modex		: 'voting'					,icon		: Eve.Resource.getIcon('item-vote', 'voting')					,handler	: Eve._il.main.newHandler				}, {					text		: 'Discussion Thread'					,mode		: 'forum'					,modex		: 'topics'					,handler	: Eve._il.main.newHandler				}]			}]		}, {			columnWidth	: .5			,items		: [{				xtype		: 'splitbutton'				,text		: 'Link an existing Item'				,cls 		: 'x-btn-text-icon'				,icon		: Eve.Resource.getIcon('find', 'general')				//,handler	: Eve._il.main.handler				,handler	: function() { this.showMenu() }				,menu		: [{					text		: 'Email Message'					,mode		: 'mail'					,modex		: 'mail'					,icon		: Eve.Resource.getIcon('item-mail', 'mail')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mail'))				}, {					text		: 'Contact'					,mode		: 'contact'					,modex		: 'contacts'					,icon		: Eve.Resource.getIcon('item-contact', 'contact')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mycontacts') && !Eve.Preference.getBoolean('sharedcontacts'))				}, {					text		: 'Task'					,mode		: 'task'					,modex		: 'tasks'					,icon		: Eve.Resource.getIcon('item-task', 'task')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mytasks') && !Eve.Preference.getBoolean('sharedtasks'))				}, {					text		: 'Event'					,mode		: 'calendar'					,modex		: 'calendar'					,icon		: Eve.Resource.getIcon('item-event', 'calendar')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mycalendar') && !Eve.Preference.getBoolean('sharedcalendar'))				}, {					text		: 'Document'					,mode		: 'document'					,modex		: 'documents'					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mydocuments') && !Eve.Preference.getBoolean('shareddocuments'))				}, {					text		: 'Link'					,mode		: 'link'					,modex		: 'links'					,icon		: Eve.Resource.getIcon('item-link', 'link')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('mylinks') && !Eve.Preference.getBoolean('sharedlinks'))				}, {					text		: 'Voting'					,mode		: 'voting'					,modex		: 'voting'					,icon		: Eve.Resource.getIcon('item-vote', 'voting')					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('voting'))				}, {					text		: 'Discussion Thread'					,mode		: 'forum'					,modex		: 'topics'					,handler	: Eve._il.main.handler					,hidden		: (!Eve.Preference.getBoolean('forum'))				}]			}]		}]	}, {		layout		: 'fit'		,region		: 'center'		,items		: [{			xtype			: 'grid'			,store			: Eve._il.main.store			,layout			: 'fit'			,columns		: Eve._il.main.columnModel			,width			: 600			,frame			: true			,autoScroll 	: true			,listeners		: Eve._il.main.registerView			,view			: new Ext.grid.GroupingView({				forceFit		: true				,groupTextTpl	: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'			})		}]	}]})};// Used in TasksEve._il.main.toolbar = function() { return new Ext.Panel({	layout		: 'column'	,margins	: '5 5 5 5'	,border		: false	,items		: [{		columnWidth	: .13		,border		: false		,items		: [{			xtype		: 'splitbutton'			,text		: "Link a new Item"			,menu		: [{				text		: 'Email Message'				,mode		: 'mail'				,modex		: 'mail'				,icon		: Eve.Resource.getIcon('item-mail', 'mail')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('mail'))			}, {				text		: 'Contact'				,mode		: 'contact'				,modex		: 'contacts'				,icon		: Eve.Resource.getIcon('item-contact', 'contact')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('mycontacts') && !Eve.Preference.getBoolean('sharedcontacts'))			}, {				text		: 'Task'				,mode		: 'task'				,modex		: 'tasks'				,icon		: Eve.Resource.getIcon('item-task', 'task')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('mytasks') && !Eve.Preference.getBoolean('sharedtasks'))			}, {				text		: 'Event'				,mode		: 'calendar'				,modex		: 'calendar'				,icon		: Eve.Resource.getIcon('item-event', 'calendar')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('mycalendar') && !Eve.Preference.getBoolean('sharedcalendar'))			}, {				text		: 'Link'				,mode		: 'link'				,modex		: 'links'				,icon		: Eve.Resource.getIcon('item-link', 'link')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('mylinks') && !Eve.Preference.getBoolean('sharedlinks'))			}, {				text		: 'Voting'				,mode		: 'voting'				,modex		: 'voting'				,icon		: Eve.Resource.getIcon('item-vote', 'voting')				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('voting'))			}, {				text		: 'Discussion Thread'				,mode		: 'forum'				,modex		: 'topics'				,handler	: Eve._il.main.newHandler				,hidden		: (!Eve.Preference.getBoolean('forum'))			}]		}]	}, {		columnWidth	: .2		,border		: false		,items		: [{			xtype		: 'button'			,text		: 'Link an existing Item'			,handler	: Eve._il.main.handler		}]	}]})}// * * * * * * * * * * * * * * * * * * * * // Interlinking	 (Link Existing Item)* * * // * * * * * * * * * * * * * * * * * * * *// Namespace to store properties of this dialog.Eve._il.linkitem = {};// Handler for all 'Find' buttons.Eve._il.linkitem.handler = function(el, e) {	// Validate	var cboType = Ext.getCmp('il_linkto_combo');	if (cboType.getValue().trim() == '') {		cboType.markInvalid();		return;	}		cboType.clearInvalid();	/* Majid: Wait : next lines was commented */	// Show the Mask	Eve.mask.show();		var form = Ext.getCmp("ilLinkForm");	var vals = form.getForm().getValues();	var info = {		linkTo		: vals.linkTo		,groupId	: vals.groupId		,folderId	: vals.folderId || '0'	}		switch(el.mode) {		case "mail":			Ext.apply(info , {				from		: vals.from				,toCc		: vals.toCc				,subject	: vals.subject				,startDate	: vals.startDate				,endDate	: vals.endDate			})			break;				case "calendar":			Ext.apply(info , {				searchText	: vals.calendarSearchText				,startDate	: vals.calendarStartDate				,endDate	: vals.calendarEndDate			})			break;				default:			Ext.apply(info , {				searchFieldText	: vals.searchFieldText				,searchOperator	: vals.searchOperator				,searchText		: vals.searchText			})						if (vals.linkTo == 'links' || vals.linkTo == 'documents')				info.itemsOnly = true;			else				info.itemsOnly = false;	}		Eve.Resource.superbridge.broadcast(this, "interlink_search", {info: info});}// Type ComboBoxEve._il.linkitem.cboType = new Ext.form.ComboBox({	xtype			: 'combo'	,id				: 'il_linkto_combo'	,fieldLabel		: 'Type'	,hiddenName		: 'linkTo'	,valueField 	: 'value'	,displayField 	: 'text'	,lazyInit		: false	,allowBlank 	: false	,typeAhead		: true	,anchor			: '95%'	,emptyText		: 'Please select a type'	,defaultSelection: false	,listeners		: {		select	: function(cmp, rec, idx) {			var lt = Ext.getCmp('il_linkto_combo');			var gt = Ext.getCmp('il_group_combo_edit');			var lb = Ext.getCmp('ilExistingLinkBack');			var dv = Ext.getCmp('interlinkingDataView');			var info = {				items: [{					name  : lt.hiddenName					,value: lt.getValue()					,cbo  : Eve._il.linkitem.cboGroup				},{					name  : gt.hiddenName					,value: gt.getValue()					,cbo  : Eve._il.linkitem.cboGroup				}]			}						info.sender = 'type';			Eve.Resource.superbridge.broadcast(Eve._il.LinkItem, "interlink_reload_combo", info);						var form = Ext.getCmp('ilLinkForm');						var common	= Ext.getCmp('il_Common_Elements');			var mail	= Ext.getCmp('il_Mail_Elements');			var calendar= Ext.getCmp('il_Calendar_Elements');						// Hide all section-based elements.			common.hide();			mail.hide();			calendar.hide();						// Based on type, show corresponding elements			var ilcboLocation	= Ext.getCmp('il_location_combo_edit');			gt.setValue('Loading...');			ilcboLocation.setValue('Loading...');						switch(rec.data.value) {				case "mail":					mail.show();					gt.setValue(0);					gt.disable();					ilcboLocation.enable();										// Set the Dataview's Height					dv.setHeight(150);										// LinkBack Checkbox					lb.setValue(false);					lb.disable();					break;									case "calendar":					calendar.show();					gt.enable();					ilcboLocation.disable();										// Set the Dataview's Height					dv.setHeight(200);										// LinkBack Checkbox					lb.setValue(true);					lb.enable();					break;									case "contacts":				case "voting":					common.show();					gt.enable();					ilcboLocation.disable();										// Set the Dataview's Height					dv.setHeight(230);										// LinkBack Checkbox					lb.setValue(true);					lb.enable();					break;								case "topics":					common.show();					gt.enable();					ilcboLocation.enable();										// Set the Dataview's Height					dv.setHeight(230);										// LinkBack Checkbox					lb.setValue(false);					lb.disable();					break;									default:					common.show();					gt.enable();					ilcboLocation.enable();										// Set the Dataview's Height					dv.setHeight(230);										// LinkBack Checkbox					lb.setValue(true);					lb.enable();			}						form.doLayout();		}	}})// Group ComboBoxEve._il.linkitem.cboGroup = function(name) {	// We used this Combo twice, and for each we need to assign an id, so we initialize it this way.	return new Ext.form.ComboBox({		xtype			: 'combo'		,id				: ('il_group_combo_' + name)		,tpl			: Eve.indentComboXTemplate()		,fieldLabel		: 'Group'		,hiddenName		: 'groupId'		,valueField 	: 'value'		,displayField 	: 'text'		,allowBlank 	: false		,typeAhead		: true		,anchor			: '95%'		,listeners		: {			select	: function(cmp, rec, idx) {				var lt = Ext.getCmp('il_linkto_combo');				var gt = Ext.getCmp('il_group_combo_' + name);								var info = {					items: [{						name  : lt.hiddenName						,value: lt.getValue()						,cbo  : Eve._il.linkitem.cboGroup					},{						name  : gt.hiddenName						,value: gt.getValue()						,cbo  : Eve._il.linkitem.cboGroup					}]				}								Ext.getCmp('il_location_combo_' + name).setValue('Loading...');				// If its called from 'Link a New Item'				info.linkTo = (name == 'new') ? cmp.linkTo : null;				info.sender = 'group';				Eve.Resource.superbridge.broadcast(this, "interlink_reload_combo", info);			}		}		,setLinkTo		: function(lt) { this.linkTo = lt }	})}// Location ComboBoxEve._il.linkitem.cboLocation = function(name) {	return new Ext.form.ComboBox({		xtype			: 'combo'		,id				: ('il_location_combo_' + name)		,tpl			: Eve.indentComboXTemplate()		,fieldLabel		: 'Location'		,hiddenName		: 'folderId'		,displayField 	: 'text'		,valueField		: 'value'		,mode			: 'local'		,disabled		: true		,typeAhead		: true		,anchor			: '95%'		/*		,store			: new Ext.data.Store({			reader		: new Ext.data.XmlReader({				record 		: 'row'				,success	: '@success'				,id			: 'id'			}, ['value', 'text', 'depth'])		})		*/	})}Eve._il.linkitem.Common = {	layout			: "column"	,id				: "il_Common_Elements"	,bodyStyle		: "padding-top: 10px"	,items			: [{		columnWidth		: .3		,layout			: "form"		,items			: [{			xtype			: 'combo'			,xxtype			: 'combo'			,hiddenName		: 'searchFieldText'			,mode			: 'local'			,displayField 	: 'text'			,valueField		: 'value'			,triggerAction 	: 'all'			,editable 		: false			,hideLabel		: true			,anchor			: "90%"			,store			: new Ext.data.SimpleStore({				fields	: ['value', 'text']				,data	: [ ['subject', 'Subject'] ]			})			,value			: 'subject'		}]	}, {		columnWidth		: .3		,layout			: "form"		,items			: [{			xtype			: 'combo'			,xxtype			: 'combo'			,hiddenName		: 'searchOperator'			,mode			: 'local'			,displayField 	: 'text'			,valueField		: 'value'			,triggerAction 	: 'all'			,editable 		: false			,hideLabel		: true			,anchor			: '90%'			,store			: new Ext.data.SimpleStore({				fields	: ['value', 'text']				,data	: [ ['contains', 'Contains'], ['startWith', 'Start With'], ['endWith', 'End With'] ]			})			,value			: 'contains'		}]	}, {		columnWidth		: .28		,layout			: "form"		,items			: [{			xtype			: "textfield"			,name			: "searchText"			,hideLabel		: true			,anchor			: "90%"		}]	}, {		columnWidth		: .1		,layout			: "form"		,items			: [{			xtype			: "button"			,text			: "Find"			,handler		: Eve._il.linkitem.handler			,mode			: 'common'		}]	}]}Eve._il.linkitem.Mail = {	layout			: "form"	,id				: "il_Mail_Elements"	,cls			: "x-hide-display"	,bodyStyle		: "padding-top: 10px;"	,items			: [{		xtype			: "textfield"		,fieldLabel		: "From"		,name			: "from"		,anchor			: "95%"	}, {		xtype			: "textfield"		,fieldLabel		: "To / CC"		,name			: "toCc"		,anchor			: "95%"	}, {		xtype			: "textfield"		,fieldLabel		: "Subject"		,name			: "subject"		,anchor			: "95%"	}, {		layout			: "column"		,items			: [{			columnWidth		: .4			,layout			: "form"			,items			: [{				xtype			: "datefield"				,fieldLabel		: "Date Range"				,name			: "startDate"				,anchor			: "95%"			}]		}, {			columnWidth		: .48			,layout			: "form"			,items			: [{				xtype			: "datefield"				,name			: "endDate"				,style			: "margin-left: -80px;"				,anchor			: "95%"				,labelSeparator	: ""			}]		}, {			columnWidth		: .1			,layout			: "form"			,items			: [{				xtype			: "button"				,text			: "Find"				,handler		: Eve._il.linkitem.handler				,mode			: 'mail'			}]		}]	}]}Eve._il.linkitem.Calendar = {	layout			: "form"	,id				: "il_Calendar_Elements"	,cls			: "x-hide-display"	,bodyStyle		: "padding-top: 10px;"	,items			: [{		xtype			: "textfield"		,fieldLabel		: "Subject"		,name			: "calendarSearchText"		,anchor			: "95%"	}, {		layout			: "column"		,items			: [{			columnWidth		: .4			,layout			: "form"			,items			: [{				xtype			: "datefield"				,fieldLabel		: "Date Range"				,name			: "calendarStartDate"				,anchor			: "95%"			}]		}, {			columnWidth		: .48			,layout			: "form"			,items			: [{				xtype			: "datefield"				,name			: "calendarEndDate"				,style			: "margin-left: -80px;"				,anchor			: "95%"				,labelSeparator	: ""			}]		}, {			columnWidth		: .1			,layout			: "form"			,items			: [{				xtype			: "button"				,text			: "Find"				,handler		: Eve._il.linkitem.handler				,mode			: 'calendar'			}]		}]	}]}Eve._il.linkitem.store = new Ext.data.Store({	reader : new Ext.data.XmlReader({		record	: 'row'		,id		: 'id'	}, ['id', 'typeId', 'title', 'details'])});Eve._il.LinkExistingItem = function() { return new Eve.FormPanel({	labelWidth	: 75	,id			: "ilLinkForm"	,frame		: false	,border		: false	,bodyStyle	: 'padding:5px 5px 0'	,width		: 400    ,items 		: [		 Eve._il.linkitem.cboType		,Eve._il.linkitem.cboGroup('edit')		,Eve._il.linkitem.cboLocation('edit')				,Eve._il.linkitem.Common		,Eve._il.linkitem.Mail		,Eve._il.linkitem.Calendar		, {			xtype			: 'panel'			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF; border:1px solid;'			//,bbar			: new Ext.PagingToolbar( { store:  Eve._il.linkitem.store} )			,items			: [{				html : 	'<div class="x-grid3-header">'							+ '<table style="width:100%;">'							+ '<tr class="x-grid3-hd-row">'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-0" style="width:15px"><div class="x-grid3-hd-inner x-grid3-hd-2">&nbsp;</div></td>'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-1" style="width:235px"><div class="x-grid3-hd-inner x-grid3-hd-2">Title</div></td>'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-2"><div class="x-grid3-hd-inner x-grid3-hd-2">Details</div></td>'							+ '</tr>'							+ '</table>'						+ '</div>'			}, {				xtype			: 'xdataview'				,name			: 'searchItems'				,id				: 'interlinkingDataView'				,hideLabel		: true				,itemSelector	: 'div.search-item'				,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Item.</i></div>'				,height			: 230				,store			: Eve._il.linkitem.store				,tpl			: new Ext.XTemplate(					'<div class="x-grid3-body" style="width:545px;">',					'<tpl for=".">',						'<div class="x-grid3-row x-grid3-row-collapsed" style="padding:5px 0px;">',							'<table class="x-grid3-row-table" style="width:95%;">',							'<tr>',								'<td style="width:20px"><input type="checkbox" id="{id}" class="ev-il-checkbox" /></td>',								'<td style="width:200px" >{title}</td>',								'<td style="width:220px" >{details}</td>',							'</tr>',							'</table>',						'</div>',						'</tpl>',					'</div>'				)			}]		}, {			xtype			: 'checkbox'			,id				: 'ilExistingLinkBack'			,boxLabel		: 'Make the link visible in both directions?'			,name			: 'linkBack'			,checked		: true			,hideLabel		: true			,shout			: true			,anchor			: '90%'		}	]})};// * * * * * * * * * * * * * * * * * * * * // Interlinking	 (Link New Item) * * * * * // * * * * * * * * * * * * * * * * * * * *Eve._il.LinkNewItem = function() { return new Eve.FormPanel({	labelWidth	: 75	,frame		: false	,border		: false	,bodyStyle	: 'padding:5px 5px 0'	,width		: 400    ,items 		: [		 Eve._il.linkitem.cboGroup('new')		,Eve._il.linkitem.cboLocation('new')		,{			xtype			: 'checkbox'			,id				: 'ilNewLinkBack'			,boxLabel		: 'Make the link visible in both directions?'			,name			: 'linkBack'			,hideLabel		: true			,anchor			: '90%'		}	]})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       InterlinkDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */// Link New ItemEve.vc.createFormPanel( 'ilLinkExistingItem'	, Eve.Dialogs.Interlink.LinkExistingItem );// Link Existing ItemEve.vc.createFormPanel( 'ilLinkNewItem'			, Eve.Dialogs.Interlink.LinkNewItem);Ext.override( Eve.vc.ilLinkExistingItem, {		 loadEvent		: function() { return 'modern.interlink.{root}.edit'; }		,submitEvent	: function() { return 'modern.interlink.personal.createModify'; }});Ext.override( Eve.vc.ilLinkNewItem, {		 loadEvent		: function() { return 'modern.interlink.{root}.edit'; }		,submitEvent	: Ext.emptyFn});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\interlink/InterlinkDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// * * * * * * * * * * * * * * * * * * * * // 	Link a Existing Item// * * * * * * * * * * * * * * * * * * * * Eve.lib.Interlink.LinkExistingItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Interlink.LinkExistingItemDialogBridge.superclass.init.call(this, data);				var tab		= {			items : ["Link an item"]		}				var dialog	= {			width 	: 600			,height : 480			,title	: 'Link an Item'		}				this.createDialog({tab: tab ,dialog: dialog});	}		// Returns Interlinking's DataView	,getDV : function() {		if (this.dv === undefined)			this.dv = Ext.getCmp('interlinkingDataView');				return this.dv;	}		// Reset Interlinking's Store	,resetDV : function() {		this.getDV().store.removeAll();	}		,afterAddButtons : function(buttons, scope)	{		var btn = [buttons[1], buttons[2]];		return btn;	}		// Reloads Location (Folders) ComboBox	,setComboValue : function(data) {		var dq 	= Ext.DomQuery;		var xml = data.response.responseXML;				// If Type Combo Changed. Reload Group Combo		if (data.sender == 'type') {			var grp	= Ext.getCmp('il_group_combo_edit');						if (grp.store === undefined)				return;						grp.store.removeAll();			var grpRoot	= dq.selectNode(grp.getName(), xml);						if (grpRoot) {				grp.store.add(grp.store.reader.readRecords(grpRoot).records);				var sv = dq.selectValue('selectedValue', grpRoot);				grp.setValue(sv);			}		}				// Reload Location Combo.		var loc	= Ext.getCmp('il_location_combo_edit');		if (loc.store === undefined)			return;				loc.store.removeAll();		var locRoot	= dq.selectNode(loc.getName(), xml);				if (locRoot) {			loc.store.add(loc.store.reader.readRecords(locRoot).records);			var dv = dq.selectValue('selectedValue', locRoot);			loc.setValue(dv);		}		console.log(sv, dv);	}		,augment : function(callee) {		var obj = callee.params;				// Validate checkboxes.		var chBoxes  = Ext.query('.ev-il-checkbox');				if (chBoxes.length > 0) {							var store	= Ext.getCmp('interlinkingDataView').store;			var id		= '';			var result  = [];			this.toIds	= [];						for (var i=0; i < chBoxes.length; ++i) {				if (chBoxes[i].checked) {					id = chBoxes[i].id;					var tid = store.getById(id).data.typeId;					result.push([id.split('_')[1], "|", tid].join(''));										// will use this on submitSuccess for reloading destination grid.					this.toIds.push(id.split('_')[1]);					this.toTypeId = tid;				}							}						obj.toObjects = result.join(',');		}				if (this.mode == 'edit') {			obj.objId 		= this.objId;			obj.objTypeId	= this.typeId;		}				if (this.root == 'group')			obj.groupId	= this.groupId;				return callee;	}		,showHideCmp : function() {		Ext.getCmp('il_Common_Elements').show();		Ext.getCmp('il_Mail_Elements').hide();		Ext.getCmp('il_Calendar_Elements').hide();				this.getDV().setHeight(230);				// Enable LinkBack Checkbox		var lb = Ext.getCmp('ilExistingLinkBack');		lb.setValue(true);		lb.setDisabled(false);	}		,controller : function(obj) {		var params = Eve._il.main.params;				this.id 		= params.objId;		this.objId 		= params.info.id;		this.typeId		= params.info.typeId;		this.parentId 	= params.info.parentId;		this.groupId 	= params.info.groupId;		this.root 		= params.info.root;		this.path		= params.info.path;		this.section    = params.section;		this.referer	= params.dialog;				this.panels[0].reset();		// Check Elements.		this.dialog.show();		this.showHideCmp();	}		,execute : function(callee, type, data) {		switch(type) {			case ('interlink_edit_item_dlg'):				this.mode	= 'edit';				this.controller(data);								this.resetDV();				this.loadForm(0);				break;							case ('success_interlink_reload_combo'):				this.setComboValue(data);				break;						case ('success_interlink_search'):				this.resetDV();								var dv		= this.getDV();				var result	= dv.store.reader.read(data.response);				dv.store.loadRecords(result, {add: true}, true);								/* Majid: Wait : next lines was commented */				// Hide the Mask				Eve.mask.hide();				break;						case ('success_interlink_delete'):				var ilGrid	= data.grid;								if (ilGrid.store) {					var rec	= ilGrid.getStore().getById(data.id);					ilGrid.getStore().remove(rec);					ilGrid.getView().refresh();					delete data.grid;					// Update affected grids					if (data.info.section != 'forum') {						this.fire('interlink_update_section', data);					} else {						this.fire('forum_reload_discussion_view', data);					}				}				// Update counter of Interlink Tab				if (data.info.dialog) {					data.info.dialog.updateCountOfTitle('-');				}								break;						case ("object_global_change"):				this.mode	= "";				var store	= Eve._il.main.store;				var record	= null;								store.each( function(rec) {					if (rec.data.objId == data.info.rawId) {						record = rec;						return false;					}				}, this)								if (record) {					var name = data.params.subject || data.params.title;					record.data.objTitle = name;				}				break;		}	}		// Added by Ghazal	,loadSuccess: function(resp, action)	{		var cmp		= Ext.getCmp('il_linkto_combo');		var index	= cmp.store.find('value', this.section);		var rec		= cmp.store.getAt(index);				cmp.setValue(this.section);		cmp.fireEvent('select', cmp ,rec, index);	}		,submitSuccess : function( resp, action )	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue('code', xml);				var info = {			id 			: dq.selectValue('id', xml)			,response	: resp		}				if (code == '0') {			//this.fire('interlink_success_create', { info: info, obj: obj }, true );						// In case of user is in project summary			this.fire('task_reload_project_summary', {info: info, obj: obj});			this.loadLinkingGrid(resp);						// Get name of current main section			var i = Eve.Resource.getSecInfoByTypeId(this.typeId);						// For updating the paperclip image on the main (source) grid			Ext.getCmp(i.section + '_grid').getStore().reload();						// For updating the paperclip image on the destination grid			var form = this.panels[0].get().getForm();			var vals = form.getValues();						var srcSec = Eve.Resource.getSecInfoByTypeId(this.typeId).section;			var desSec = Eve.Resource.getSecInfoByTypeId(this.toTypeId).section;						if (vals.linkBack == "on" && srcSec != desSec) {				if (srcSec == 'forum') {					this.fire("forum_reload_discussion_view");					// return;				}				else {					var grid = Ext.getCmp(desSec + '_grid');					// If section already loaded					// And Store loaded previously					if (grid && grid.getStore().lastOptions) {						if (grid.getStore().lastOptions.event) {							// If section loaded before							grid.getStore().reload();						} else if (grid.bridge) {							// If section pre rendered before							grid.bridge.fetchData();						}					}				}			}			// Update the counter of the TabPanel			var count = dq.selectValue('total', xml, '0');			this.referer.updateCountOfTitle('+', count);		}	}});// * * * * * * * * * * * * * * * * * * * * // 	Link an New Item// * * * * * * * * * * * * * * * * * * * * Eve.lib.Interlink.LinkNewItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Interlink.LinkNewItemDialogBridge.superclass.init.call(this, data);				var tab		= {			items : ["Link a new item"]		}				var dialog	= {			width 	: 400			,height : 160			,title	: 'Link a new item'			,noPrompt: true		}		this.createDialog({tab: tab ,dialog: dialog});	}		,afterAddButtons : function(buttons, scope)	{		var submitFunc	= function(id, close) {return this.submitForm.createDelegate(this, [id, close]);}		var closeFunc	= function()	{this.dialog.hide();}				buttons = [{			text	: 'Select'			,handler: submitFunc.apply(scope,[ 0, true])		}, {			text	: 'Cancel'			,handler: closeFunc			,scope	: scope		}];				return buttons;	}		,augment : function(callee)	{		var obj = callee.params;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.linkTo 			= this.linkTo;		obj.pathRequired	= true;				return callee;	}		,showHideCmp : function() {		var flag = (this.section == 'forum' ||					this.section == 'mail') ? true : false;				var lb	 = Ext.getCmp('ilNewLinkBack');		lb.setValue(!flag);		lb.setDisabled(flag);	}		,controller : function(data)	{		Ext.apply(this, data.info);		this.linkTo = data.linkTo;				this.panels[0].reset();		this.dialog.show();		this.showHideCmp();	}		,execute : function(callee, type, data) {		switch(type) {			case ('interlink_link_new_item_dlg'):				this.controller(data);				var cbo	= Ext.getCmp('il_location_combo_new');								switch (this.linkTo) {					case 'calendar':					case 'contacts':					case 'voting':						cbo.disable();						break;					default:						cbo.enable();				}								this.loadForm(0);				break;							case ('success_interlink_reload_combo'):				var dq	= Ext.DomQuery;				var loc	= Ext.getCmp('il_location_combo_new');				if (loc.store === undefined)					return;				loc.store.removeAll();								var xml 	= data.response.responseXML;				var locRoot	= dq.selectNode(loc.getName(), xml);								if (locRoot) {					loc.store.add(loc.store.reader.readRecords(locRoot).records);					var sv = dq.selectValue('selectedValue', locRoot);					loc.setValue(sv);				}				break;		}	}		,submitForm : function()	{		var grp	= Ext.getCmp('il_group_combo_new');		var loc	= Ext.getCmp('il_location_combo_new');		var lb	= Ext.getCmp('ilNewLinkBack').getValue();				if (grp.getValue() == '0') {			var root	= 'personal'			var groupId = '0';		} else {			var root	= 'group';			var groupId = grp.getValue();		}				var path = loc.getValue();						var data = {			type	: this.section			,mode	: 'interlink'			,info	: {				id			: 0				,root		: root				,groupId	: groupId				,path		: path				,typeId		: this.typeId				,objId		: this.id				,linkBack	: lb			}		}				var that = this;		data.func = function() {			var msg = '_il_create_item_dlg';						if (that.section == 'forum') {				msg = '_il_create_item_dlg';				data.info.confId	= that.confId;				data.info.topicId	= that.topicId;			}						that.fire(that.section + msg, data);		}				this.fire('proxy_dialog', data);		this.dialog.hide();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\interlink/InterlinkPopup.js *//*--------------------------------------------------*/// The PopupEve.Interlink._Popup = Ext.extend( Eve.lib.Bridge, {	 opacity    : { start: .1, end: .92 }	,height		: { start: 0, end: 175 }	,grid		: null	,currentTd	: null		,init		: function(data)	{		Eve.Interlink._Popup.superclass.init.call(this, data);				var view = Eve.Interlink.Popup.View;		view.on( 'dblclick', this.onDblClick, this );	}		,onDblClick : function( dv, idx, node, e )	{		var store = dv.store;		var id = node.id.split('_')[1];		var rc = null;				store.each( function( rec ){			if ( rec.get('id') == id ){				rc = rec;				return false;			}		} );				if ( !rc ){			console.log( 'No record matching the id was found', id )			return;		}				var groupId	= rc.get('objGroupId').split('_')[1];		var objType = rc.get('objType').toLowerCase();		var index	= objType.indexOf('folder');		var sec		= (index == '-1') ? objType : objType.substr(0, index);		var type	= (index == '-1') ? 'item' :  'folder';  		var event 	=  sec +'_edit_' + type + '_dlg';  				var func = function() {			Eve.Resource.superbridge.broadcast(this, event , { info: { id: rc.get('objId').split('_')[1]																,rawId	: rc.get('objId')																,path	: rc.get('objPath')																,root	: rc.get('objMode')																,groupId: groupId																,rec	: rc} });		};		switch( sec.toLowerCase() )		{			case 'event':			    sec = 'calendar';			    event 	= 'calendar_edit_item_dlg';			    break;			    			case 'link':			    event = 'link_open_link';				break;			case 'contact':			    event = 'contact_load_icon_popup';				break;			case 'message':			    sec = 'mail';			    event = 'mail_il_edit_item_dlg';			    break;		}		if( sec.toLowerCase() !== 'thread')		    	this.fire('proxy_dialog', {type: sec, func : func });																	// Hide it!		this.hideInterlinkPopup();	}		,onClick: function() {}		,execute : function( callee, type, object )	{		var activeSection = Eve.activeSec.toLowerCase();		var activeSection = (activeSection.indexOf('shared ') !== -1)? activeSection.split(' ')[1] : activeSection;		switch(type) {			case (activeSection + '_show_interlink_popup'):				this.showInterlinkPopup.apply( this, arguments );				break;			case 'force_hide_interlink_popup':				this.forceHideInterlinkPopup.apply(this, arguments);				break;			case (activeSection + '_hide_interlink_popup'):				this.hideInterlinkPopup.apply(this, arguments);				break		}	}		,forceHideInterlinkPopup : function(callee, type, object)	{		try {			this.type = object.type;			this.root = object.root;			this.groupId = object.groupId;			}catch(e){							}		var view = Eve.Interlink.Popup.View;		if ( view.el )			view.el.hide();	}	,fireLinkedItems: function(){		Eve.Interlink.Popup.fire( this.dataToSend.event, this.dataToSend.object );	}		,hideInterlinkPopup : function( callee, type, object ){				var view = Eve.Interlink.Popup.View;		if ( view.el ){		/*	view.el.shift( { height: this.height.start, opacity: this.opacity.start, callback: function(){ 					if ( view.el )						view.el.hide(); 				}, scope: this			});*/			view.el.hide();		}	}		,showInterlinkPopup : function( callee, type, object ){		if ( this.isLoading )			return;				//For Shared Sections		var activeSection = Eve.activeSec.toLowerCase();		var activeSection = (activeSection.indexOf('shared ') !== -1)? activeSection.split(' ')[1] : activeSection;				this.isLoading = true;		var view = Eve.Interlink.Popup.View;		var tp	 = (activeSection == 'calendar') ? 'item' : this.type;				var objectTypeId = Eve.Resource.getTypeId(this.root, tp, activeSection);		var params = {			event		: 'modern.interlink.' + this.root + '.view'			,objTypeId	: objectTypeId			 ,objId		: object.info.id		 };				if(this.groupId != null || this.groupId !== undefined){			params.groupId = this.groupId;		}				if ( !this.store )			this.store = Eve.Interlink.Popup.Store;		var info = object.info;						var type = info.bridge.getRowType(info.rowIndex)		var typeId = Eve.Resource.getTypeId(info.root, type, activeSection);		this.dataToSend = { event: info.bridge.gridSection+ '_interlinking_dlg', object: 					{ info: { id: info.id						   , parentId: info.parentId						   , path: info.path						   , groupId: info.groupId						   , root: info.root, typeId: typeId } } };						// Reset the internal cache		this.cache = {};		this.store.removeAll();		this.store.load( { params: params, callback: function(){ this.isLoading = false; }, scope: this } );				if ( !view.rendered ){			// Render the Interlinking thingy			view.render( document.body );		}				this.bindToElement( object.info.grid, object.info.el );		var xy = object.info.el.getXY();				view.el.setLeftTop( xy[0], xy[1] + object.info.el.getHeight() );		view.el.setHeight( this.height.start );		view.el.setOpacity( this.opacity.start);		view.el.show();				view.el.shift( { height: this.height.end, opacity: this.opacity.end } );	}		,bindToElement : function( grid, el ){		if ( this.grid )			this.grid.un( 'afterlayout', this.onMove, this );		this.currentTd = el;		this.grid	   = grid;				grid.on( 'resize', this.onMove, this );	}		,onMove : function( el ){		var el 	 = this.currentTd;		var view = Eve.Interlink.Popup.View;		var xy 	 = el.getXY();				view.el.setLeftTop( xy[0], xy[1] + el.getHeight() );	}} );Eve.Interlink.Popup = new Eve.Interlink._Popup();// Popup StoreEve.Interlink.Popup.Store = new Ext.data.Store({	url : Eve.url	,fields: [ 		'objCategory'		,'objId'		,'objMode'		,'objGroupId'		,'objTypeId'		,'objIcon'		,'objType'		,'objTitle'		,'objPath'		,'id'		,'autoLogin'		,'spawnNewWindow'		,'url' ]	,reader: new Ext.data.XmlReader({			record	: 'row'			,id		: 'id'		}, new Ext.data.Record.create([			'objCategory'			,'objId'			,'objMode'			,'objGroupId'			,'objTypeId'			,'objType'			,'objIcon'			,'objTitle'			,'objPath'			,'id'			,'autoLogin'			,'spawnNewWindow'			,'url' ]		)	)})// Collapse Expander handlerEve.Interlink.Popup.CEHandler = function(e) {	var t = Ext.get(e.target).up('.x-grid-group');	if ( !t ) return;	if ( t.hasClass('x-grid-group-collapsed') )		t.removeClass('x-grid-group-collapsed');	else		t.addClass('x-grid-group-collapsed');}Eve.Interlink.Popup.RowClickHandler = function(id) {	var dv			= Ext.getCmp('interlink_popup');	var rec			= dv.store.getById(id);	var id		 	= rec.get("objId");	var objTypeId	= rec.get("objTypeId");	var root		= rec.get("objMode");	var groupId		= rec.get("objGroupId").split('_')[1];	var path		= rec.get("objPath");	var title		= rec.get("objTitle");		// Get Section info by its type id	var i = Eve.Resource.getSecInfoByTypeId(objTypeId);	if (!i.section)		return	var section = i.section;	var type	= i.type;	var that	= this;	var data	= {		info	: {			id		: id.split('_')[1]			,rawId	: id			,root	: root			,path	: path			,groupId: groupId			,typeId	: objTypeId			,rec	: rec		}		,mode	: 'interlink'		,title	: title	}			// Decide what we should fire next!	switch (section) {		case 'contact':			var func = function() {				that.fire('contact_load_icon_popup', data);			}			break;		case 'document':			var func = function() {				that.fire('document_download_file', data);			}			break;		case 'link':			var func = function() {				that.fire('link_open_link', data);			}			break;		default:			var event = [section, "_il_edit_", type, "_dlg"].join('');			var func  = function() {				that.fire(event, data)			}	}	this.fire('proxy_dialog', { type: section, func: func });}Eve.Interlink.Popup.SubTemplate = new Ext.XTemplate( 	'<div class="x-grid-group">',	'<div class="x-grid-group-hd" onclick="Eve.Interlink.Popup.CEHandler( arguments[0] || window.event )">',		'<div>{section} ( {numRecs} {[ values.numRecs > 1 ? "Items" : "Item" ]} )</div>',	'</div>',	'<div class="x-grid-group-body">',		'<tpl for="rows">',			'<div id="ipg_{id}" class="x-grid3-row x-unselectable ev-pointer" style="padding: 5px 5px 5px 10px; position: relative" onclick="Eve.Interlink.Popup.RowClickHandler({id})">',				'{title}',				'{[ this.showDetails( values ) ]}',			'</div>',		'</tpl>',	'</div></div>', {		showDetails: function( vals ){			var det = vals.objTitle;			if ( det && det.length > 0 ){				return "<span style='padding: 2px'><img src='" + vals.objIcon + "' /></span><span style='position: absolute; top: 6px; padding-left: 10px;'>" + det + '</span>';			}						return '';		}	})// Popup ViewEve.Interlink.Popup.View = new Ext.DataView( {	tpl   : new Ext.XTemplate(	'<div style="overflow-x: hidden">',		'<div class="interlink-popup-header">Linked Items',			'<div style="float: right; padding-right: 60px; position: relative; top: -14px;">',				'<!---<a href="#" onclick="Eve.Interlink.Popup.fireLinkedItems()">Edit</a>---></div></div>',		'<tpl for=".">',			'{[this.sortAndExtract(values)]}',		'</tpl>',	  '</div>', {		sortAndExtract : function( values ) {			 var section = values.objCategory.toLowerCase();			 var that = Eve.Interlink.Popup;			 if ( that.cache[section] )				return '';			 that.cache[section] = 1;			 var recs = [];			 var store = that.Store;			 store.each( function( rec ){				if ( rec.get('objCategory').toLowerCase() == section )					recs.push( rec );				return true;			 } );			 var hash = { section: values.objCategory						, numRecs: recs.length };			 var row  = [];			 for ( var i = 0; i < recs.length; ++i )				 row.push( recs[i].data );			 hash.rows = row;			 return Eve.Interlink.Popup.SubTemplate.applyTemplate( hash );		 }	   }	)   ,cls			: "intelink-popup"   ,store		: Eve.Interlink.Popup.Store   ,autoHeight  : true   ,id			: 'interlink_popup'   ,singleSelect: true   ,itemSelector: 'div.x-grid3-row'   ,emptyText	: '<span style="position: relative; top: 10px; left: 15px; font-width: 900; color: #888888">No items are linked to this one.</span>'});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\comment/CommentDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/Eve._cm = Eve.Dialogs.Comment;// Namespace to store properties of this dialog.Eve._cm.main = {};// * * * * * * * * * * * * * * * * * * * * //	 Comment	 * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * Eve._cm.Main = function(data) {	var superbridge	= data.superbridge;	var section		= data.section;		var tpl = new Ext.XTemplate(		'<div>',		'<tpl for=".">',		'<div style="width:98%; margin: 10px 5px;">',			'<div style="float:right;" onmouseover="this.style.cursor=\'pointer\'">',				'<img style="display:{[this.setDisplay(values.commentEditPermission)]};" src="' + Eve.imagePath + 'general/edit.png" onclick="Eve.Resource.superbridge.broadcast(this, \'edit_comment_dlg\', { info: {id: {id}, index: {#} }, params: Eve._cm.main.params.info, section:\'' + section + '\'})" />&nbsp;',				'<img style="display:{[this.setDisplay(values.commentDeletePermission)]};" src="' + Eve.imagePath + 'general/delete.png" onclick="Eve.Resource.superbridge.broadcast(this,\'' + section + '\' + Eve._cm.main.type + \'_delete_comment\', { info: {id: {id}, index: {#} }, params: Eve._cm.main.params.info })" />',			'</div>',			'<div style="width:90%; overflow:hidden;">{comments}</div>',			'<br />',			'<div><i>{writtenBy}</i></div>',			'<div><i>{writtenOn}</i></div>',			'<hr />',		'</div>',		'</tpl>',		'</div>', {		setDisplay: function(p) {			p = p || 'true';			return (p == 'true') ? 'inline' : 'none';		}	})			return new Eve.FormPanel({		labelWidth	: 75		,frame		: false		,border		: false		,bodyStyle	: 'padding:5px 5px 0'		,width		: 400		,items 		: [{			xtype		: 'panel'			,height		: 300			,border		: true			,autoScroll	: true			,style		: 'margin-top: 5px; background-color:#FFF; border:1px solid;'			,items		: [{				xtype		: 'xdataview'					,name		: 'data'				,tpl		: tpl				,emptyText	: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,store		: new Ext.data.Store({					reader : new Ext.data.XmlReader({						record	: 'row'						,id		: 'id'					}, ['id', 'comments','userId','writtenBy','writtenOn', 'commentEditPermission', 'commentDeletePermission'])				})				,itemSelector: 'div.search-item'			}]		}, {			layout		: 'column'			,style		: 'margin-top:10px;'			,items		: [{				layout		: 'form'				,columnWidth: .8				,items		: [{					xtype		: 'textarea'					,name		: 'comment'					,hideLabel	: true					,anchor		: '95%'				}]			}, {				layout		: 'form'				,columnWidth: .2				,items		: [{					xtype		: 'button'					,text		: 'Add Comment'					,handler	: function() {						var comment = this.ownerCt.ownerCt.findByType('textarea')[0];												if (comment.getValue().trim() != '') {							var extra = ( Eve._cm.main.type == 'folder' ) ? '_folder' : '';							var type = section + extra + "_add_comment";							superbridge.broadcast(this, type);						}					}					,style		: 'padding-top: 20px; padding-left:15px;'				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * //	 Add/Edit Comment	 * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve._cm.AddEdit = function() { return new Eve.FormPanel({    labelWidth	: 75    ,frame		: false    ,border		: false    ,bodyStyle	: 'padding:5px 5px 0'    ,items 		: [{		   		xtype		: 'textarea'		,fieldLabel	: 'Comment'		,name		: 'comments'		,height		: 110		,allowBlank	: false		,anchor		: '95%'	}]})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       CommentDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */  Eve.vc.createFormPanel( 'cmAddEdit'		, Eve.Dialogs.Comment.AddEdit );Ext.override( Eve.vc.cmAddEdit, {		 loadEvent		: function(){ return 'modern.comment.{root}.edit'; }		,submitEvent	: function(){ return 'modern.comment.{root}.createModify'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\comment/CommentDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Comment.CommentDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	type 	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Comment.CommentDialogBridge.superclass.init.call(this, data);				var tab		= {			items : ["Edit Comment"]		}				var dialog	= {			width 	: 500			,height : 200			,title	: 'Comments'		}				this.createDialog({tab: tab ,dialog: dialog});	}		,augment : function(callee) {		var obj = callee.params;				if (this.type == 'create') {			obj.objId = this.id;		}		else {			obj.id 		= this.id;			obj.objId	= this.objId;		}				obj.objTypeId	= this.typeId;				// Just used in Documents		if (Eve._cm.main.revision)			obj.revisionNumber = Eve._cm.main.revision;					return callee;	}		,controller : function(obj) {		this.section = obj.section;				var params = Eve._cm.main.params;				this.objId 		= params.info.id;		this.id 		= obj.info.id		|| this.id;		this.typeId		= params.info.typeId;		this.parentId 	= params.info.parentId;		this.groupId 	= params.info.groupId;		this.root 		= params.info.root;		this.path		= params.info.path;				this.panels[0].reset();		this.dialog.show();	}		,execute : function(callee, type, data) {		switch (type) {			case ('edit_comment_dlg'):				this.type = 'edit';								this.controller(data);				this.loadForm(0);				break;					}	}		,submitSuccess : function( resp, action ) { 		var obj = action.params;				if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var xml  = resp.responseXML;		var code = xml.getElementsByTagName('code')[0].childNodes[0].nodeValue;				if (code == '0') {    		var extra = ( Eve._cm.main.type == 'folder' ) ? '_folder' : '';			var t = '_success_modify_comment';			this.fire(this.section + extra + t, xml);		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Defaults/DefaultCRUD.js *//*--------------------------------------------------*//** * Hyperoffice Default CRUD section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.DefaultCRUD = Ext.extend( Eve.lib.CRUDBridge, {// * * * * * * * * * * * * * * * * * * * *// 	General Requests// * * * * * * * * * * * * * * * * * * * *	deleteRequest : function(callee, type, object, itemType)	{		var section	 = object.section;				var root	 = object.info.root;		var isFolder = (itemType.toLowerCase() == 'folder') ? true : false;		var event    = (object.isMultiSelected)? Eve.Resource.cmdMultiDelete(section, root, isFolder): Eve.Resource.cmdDelete(section, root, isFolder);		var params 	 = {			event	: event			,id		: object.info.id			,path	: object.info.path		};				if (object.info.groupId !== undefined)			params.groupId = object.info.groupId;		// Calendar		if (object.info.singleEvent !== undefined) {			if (object.info.singleEvent == false) {				params.appliedToAllRecurrences = true;			}			else {				params.appliedToAllRecurrences = false;			}		}				this.conn.request({		   url		: Eve.url		   ,success	: function(resp, options) {				var xml 		= resp.responseXML;				object.info.id  = Ext.DomQuery.selectValue('id', xml);				object.itemType = itemType;				object.info.xml = xml;								if (object.dialog !== undefined) {					object.dialog.hide();					object.me.disableDeleteButtons();				}									if (isFolder) {					this.fire(section + '_success_delete_folder', object);				} else {					this.fire(section + '_success_delete_item', object);				}			}		   ,params	: params		   ,scope	: this		});	}	,updateRequest : function(callee, type, object, itemType)	{		var section	 = object.section;				var isFolder = (itemType.toLowerCase() == 'folder') ? true : false;		var root	 = object.info.root;		var gId 	 = object.info.groupId;		var event	 = (object.event === undefined)? Eve.Resource.cmdCreateModify(section, root, isFolder) : object.event;		var extra    = {			id  		: object.info.id			,event		: event			,parentId	: object.info.parentId, path : object.info.path		};				var partial = (object.mode == 'inline');		if (partial) {			extra.partial = 1;		}		if (gId || gId !== undefined) {			extra.groupId = object.info.groupId;		}				var params = Ext.urlEncode( object.params );		params = [Ext.urlEncode( extra ), params].join('&');		 var func = function(options, success, response) {			if (success) {				var xml = response.responseXML;				var dq  = Ext.DomQuery;				var type;				Ext.apply( object.info, {							 editPrm	: dq.selectValue('editPermission', xml)							,deletePrm	: dq.selectValue('deletePermission', xml)							,rawId		: dq.selectValue('id', xml)							,linkedItems: dq.selectValue('linkedItems', xml)						  } );				object.info.xml = xml;								var data = {					info	: object.info					,params	: object.params					,extra	: { options: options, response: response}					,record	: object.record					,partial: partial				};    							type = object.section;				type += (isFolder) ? '_success_update_folder' : '_success_update_item';				this.fire(type, data);			}		};		this.conn.request({		   url		 : Eve.url		   ,params	 : params		   ,scope	 : this		   ,callback : func		});	}	,moveRequest : function(callee, type, object, itemType)	{		var section	 = object.section;				var isFolder = (itemType.toLowerCase() == 'folder') ? true : false;		var root	 = object.destInfo.root;		var extra = {			event 			: Eve.Resource.cmdMove(section, root, isFolder)			,id				: object.info.ids || object.info.id			,parentId		: object.info.parentId			,path			: object.info.path			,newParentId	: object.destInfo.id			//,des_pid		: object.destInfo.parentId			,newPath		: object.destInfo.path			,partial		: 1		};		if (root == 'group') {			extra.newGroupId	= object.destInfo.gId || object.destInfo.groupId;			extra.groupId		= object.info.groupId;		}				var params = Ext.urlEncode( extra );		// Ajax request callback.		var func = function(options, success, response) {			if (success) {				var xml = response.responseXML;				object.info.rawId = Ext.DomQuery.selectValue('id', xml);				object.info.xml = xml;								this.fire(object.section + '_success_move_folder', object);			}		};		this.conn.request({			url			: Eve.url			,params		: params			,scope		: this			,callback	: func		});	}	,moveContactRequest : function(callee, type, data)	{		var params = {			event 		: Eve.Resource.cmdMove('contact', data.root)			,id			: data.ids.join(',')			,newParentId	: data.record.id.split('_')[1]			,path			: '\\' + data.fromParent + '\\'			,parentId		: data.fromParent			,newPath		: '\\' + data.record.id.split('_')[1] + '\\'			,partial		: 1		};		// Ajax request callback.		var cb = function(options, success, response) {			if (success) {				var xml = response.responseXML;				if (data.reload)					this.fire('contact_success_move_item');								if (data.successMessage)					Ext.Msg.alert('Success', 'Selected contacts has been successfully assigned to the new category.');			}		};		this.conn.request({			url			: Eve.url			,params		: params			,scope		: this			,callback	: cb		});	}	,printFolder : function(callee, type, data)	{		var p = {			event		: "modern." + data.section + "." + data.info.root + ".changeStartItemNumber"			,groupId	: data.info.groupId			,path		: data.info.path			,start		: data.info.start			,limit		: Eve.Preference.get('itemsperpage')		};		if (data.info.groupId)			p.groupId = data.info.groupId;		// Callback		var cb = function(options, success, response)		{			if (success) {				this.fire(data.section + '_success_print_folder', response);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}// * * * * * * * * * * * * * * * * * * * *// 	Tasks Requests// * * * * * * * * * * * * * * * * * * * *	,getTaskProjectSummary : function(callee, type,object)	{		var func = function(options, success, response)		{			if (success)				this.fire('tasks_success_get_summary', {response: response, obj: object});		};		var event = Eve.Resource.emblem+'taskFolder.' + object.info.root + '.summary';		var params = {};		if (object.info.root == 'group')		{			params = {				groupId : object.info.groupId				,event 	: event				,id    	: object.info.id			};		}		else		{			params = {				groupId : object.info.groupId				,event 	: event				,id    	: object.info.id			};		}		this.conn.request({			url       : Eve.url			,params   : params			,scope    : this			,callback : func		});	}// * * * * * * * * * * * * * * * * * * * *// 	Desktop Requests// * * * * * * * * * * * * * * * * * * * *	,getDesktopConfRequest : function(callee, type)	{		var func = function(options, success, response) {			if (success) {				this.fire('desktop_success_get_config', response);			}		};	this.conn.request({		url      : Eve.url		,params  : {			event	: 'modern.desktop.getConfig'		}		,scope   : this		,callback: func	});	}	,getPortletContent : function(callee, type, object)	{		var func = function(options, success, response)		{			if (success)				this.fire(object.secName + '_success_get_portlet_content',{response: response, params: options});		};		var id = object.obj.id.replace(new RegExp(object.secName+'_', "g"),'');		this.conn.request({			url			: Eve.url			,params		: {				event		: 'modern.desktop.getContent'				,portlet	:   id			}			,scope		: this			,callback	: func		});	}// * * * * * * * * * * * * * * * * * * * *// 	Calendar Requests// * * * * * * * * * * * * * * * * * * * *	,updateColor : function(callee, type, data)	{		var p = {			event					: "modern.calendar." + data.info.root + ".updateColor"			,calendarShareSpaceId	: data.info.id			,color					: data.color		};		var groupId = data.info.groupId;		if (groupId !== undefined || groupId != null)			p.groupId = groupId;		var cb = function(options, success, response)		{			if (success){				data.info.xml = response.responseXML;				this.fire('calendar_success_update_color', data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}		,calendarModifyFilter : function(callee, type, data)	{		var p = {			event 		: "modern." + data.section + ".personal.modifyFilter"			,startDate	: data.startDate			,startTime	: data.startTime			,endDate	: data.endDate			,endTime	: data.endTime		};				var cb = function(otions, success, response)		{			if (success) {				this.fire('calendar_success_modify_filter', response);			}		};				this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}// * * * * * * * * * * * * * * * * * * * *// 	Contacts Requests// * * * * * * * * * * * * * * * * * * * *	,getCategories : function(callee, type, data)	{		var p = {			event: "modern.contactFolder." + data.info.root + ".getAllContactFolder"		};				var groupId = data.info.groupId;		if (groupId !== undefined || groupId != null)			p.groupId = groupId;		var cb = function(options, success, response)		{			if (success)				this.fire('success_get_categories', response);		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,loadPopout : function(callee, type, data)	{		var id 		= data.info.id.split('_')[1] || data.info.id;		var section = (data.section === undefined) ? type.split('_')[0] : data.section;		var p  = {			event	: "modern." + section + "." + data.info.root + ".edit"			,id		: id		};				groupId = data.info.groupId;				if (groupId !== undefined || groupId != null)			p.groupId = groupId;						var cb = function(options, success, response) {			if (success) {				data.response = response;				this.fire(section + '_show_icon_popup', data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,contactModifyFilter : function(callee, type, data)	{		var p = {			event	: "modern." + data.section + "." + data.info.root + ".modifyFilter"		};				if (data.letter !== undefined)			p.letter = data.letter;						groupId = data.info.groupId;				if (groupId !== undefined || groupId != null)			p.groupId = groupId;						if (data.quickSearch) {			p.searchText 	 	= data.text;			p.searchFieldText	= data.type;			p.quickSearch	 	= true;		}				var cb = function(otions, success, response)		{			if (success)				this.fire('contact_success_modify_filter', response);		};				this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,deleteAllContacts	: function(callee, type, data){		var root = data.info.root;		var parentId = data.info.parentId;		var p = {			event	: "modern.contact."+ root +".purgeAll"		};		if(root == 'group')		    p.groupId = data.info.groupId;		var successFn = function(options, success, response){			if (success) {				Ext.getCmp('contact_grid').store.reload();			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: successFn			,scope		: this		});	}// * * * * * * * * * * * * * * * * * * * *// 	Document Requests// * * * * * * * * * * * * * * * * * * * *	,downloadRequest : function(callee, type, data)	{	//	var frm		= document.createElement('form');		var action = {			CFID	: Eve.CFId			,CFTOKEN: Eve.CFToken			,event	: 'modern.document.' + data.info.root + '.getFile'			,id		: data.info.id			,title	: data.title		}				var groupId = data.info.groupId;				if (groupId) {			action.groupId = groupId;		}				if (data.revisionNum) {		    action.revisionNum = data.revisionNum;		}		    		/*frm.setAttribute('action', Eve.url + '?' + Ext.urlEncode(action));		frm.setAttribute('method', 'POST');		document.body.appendChild(frm);		frm.submit();		// Free browser DOM.		delete frm;		*/		Eve.downloadFile(action);	}	,toggleLockRequest : function(callee, type, data)	{		var p = {			event		: "modern.document.group.toggleLock"			,id			: data.info.id			,groupId	: data.info.groupId		};		p.lockstatus = (data.lock == 'true') ? false : true;		var cb = function(options, success, response)		{			if (success) {				var xml 	= response.responseXML;				var dq  	= Ext.DomQuery;				var data	= options.data;				Ext.apply(data.info, {					 editPrm	: dq.selectValue('editPermission', xml)					,deletePrm	: dq.selectValue('deletePermission', xml)					,rawId		: dq.selectValue('id', xml)					,linkedItems: dq.selectValue('linkedItems', xml)				});				data.info.xml = xml;				var object = {					info	: data.info					,params	: data.params					,extra	: { options: options, response: response}					,record	: data.record				};				this.fire('document_success_update_item', object);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,data		: data			,scope		: this		});	}	,toggleVersioningRequest : function(callee, type, data)	{		var p = {			event		: "modern.document.group.toggleVersioning"			,id			: data.info.id			,groupId	: data.info.groupId		};		p.versioningType = (data.versioning == 'true') ? false : true;		var cb = function(options, success, response)		{			if (success) {				var xml 	= response.responseXML;				var dq  	= Ext.DomQuery;				var data	= options.data;				Ext.apply(data.info, {					 editPrm	: dq.selectValue('editPermission', xml)					,deletePrm	: dq.selectValue('deletePermission', xml)					,rawId		: dq.selectValue('id', xml)					,linkedItems: dq.selectValue('linkedItems', xml)				});				data.info.xml = xml;				var object = {					info	: data.info					,params	: data.params					,extra	: { options: options, response: response}					,record	: data.record				};				this.fire('document_success_update_item', object);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,data		: data			,scope		: this		});	}	,toggleSubscriptionRequest : function(callee, type, data)	{		var p = {			id			: data.info.id			,groupId	: data.info.groupId		};		// If there's no record in info object, so menu called from tree		var type	= (data.info.rec) ? data.info.rec.get('type').toLowerCase() : 'folder';		var eType	= (type == 'folder') ? 'Folder' : '';		p.event		= "modern.document" + eType + ".group.toggleNotification";		if (type == 'item')			p.notification = (data.subscription == 'true') ? false : true;		else			p.notification = (data.subscription == 'true') ? false : true;		var cb = function(options, success, response)		{			if (success) {				var xml 	= response.responseXML;				var dq  	= Ext.DomQuery;				var data	= options.data;				Ext.apply(data.info, {					 editPrm	: dq.selectValue('editPermission', xml)					,deletePrm	: dq.selectValue('deletePermission', xml)					,rawId		: dq.selectValue('id', xml)					,linkedItems: dq.selectValue('linkedItems', xml)				});				data.info.xml = xml;				var object = {					itemType: type					,info	: data.info					,params	: options.params					,extra	: { options: options, response: response}					,record	: data.info.rec				};				this.fire('document_success_update_' + type, object, true);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,data		: data			,scope		: this		});	}	,confirmPurge: function(callee, type, object)	{		var itemType = object.info.type.toLowerCase();		if(Eve.Preference.getBoolean('delPrompt'+ itemType ) == false ){            	this.recycleRequest(callee, type, object);            	return;        }		Ext.Msg.confirm( 'Delete Confirmation',						['Are you sure you want to delete ',itemType,' [', object.title, '] ', '?'].join(''),			function(btn)			{				if (btn == 'yes') {					this.recycleRequest(callee, type, object);				}		}, this );	}	,recycleRequest: function(callee, type, object)	{		var root = object.info.root;		var type = (object.info.type == 'item')?'': 'Folder';		var event = object.event;		if(object.isMultiSelected)		    event += "All";		var parentId = object.info.parentId;		var p = {			event	: "modern.document"+type+"."+ root +"."+event			,id     : object.info.id		};		if(root == 'group')		    p.groupId = object.info.groupId;		var successFn = function(options, success, response){			if (success) {				var xml 	= response.responseXML;				var dq  	= Ext.DomQuery;				var data = {					itemType: type.toLowerCase()					,info	: {id: Ext.DomQuery.selectValue('id', xml), parentId: parentId, xml: xml}					,isMultiSelected: object.isMultiSelected				};    			this.fire('doc_recycle_success_delete_item' , data, true);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: successFn			,scope		: this		});	}	,confirmPurgeAll: function(callee, type, object)	{		Ext.Msg.confirm( 'Delete Confirmation',							'Are you sure you want to delete all?',			function(btn)			{				if (btn == 'yes') {					this.purgeAllRequest(callee, type, object);				}		}, this );	}	,purgeAllRequest: function(callee, type, object)	{		var root = object.info.root;		var parentId = object.info.parentId;		var p = {			event	: "modern.document."+ root +".emptyBin"		};		if(root == 'group')		    p.groupId = object.info.groupId;		var successFn = function(options, success, response){			if (success) {	            var st = Ext.getCmp('doc_recycle_grid').store;	            st.removeAll();				st.commitChanges();			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: successFn			,scope		: this		});	}		,revertRequest: function(callee, type, object){		var p = object.info;		if( object.event == 'revert'){            p.revisionNum = object.revisionNum;		}		p.event = 'modern.document.group.'+ object.event;						var successFn = function(options, success, response){			if (success) {				var dq = Ext.DomQuery;								var st = Ext.getCmp('document_revision').view.store;				st.removeAll();				var records = st.reader.readRecords( dq.select('revision',response.responseXML) ).records;				st.add(records);				var st = Ext.getCmp('documentItemAuditDV').view.store;				if (st) {					st.removeAll();					var records = st.reader.readRecords( dq.select('audit',response.responseXML) ).records;					st.add(records);				}								//To update document grid				var row = dq.select('gridRow', response.responseXML);				var id = dq.selectValue ('id', row);				var st = Ext.getCmp('document_grid').store;				var rec = st.getById(id);				if(rec !== undefined){					rec.set('versioningCount', dq.selectValue ('versioningCount', row));					st.commitChanges();				}				/* Majid: Wait : next lines was commented */				Eve.mask.hide();							}		};		/* Majid: Wait : next lines was commented */		Eve.mask.show();		this.conn.request({			url     	: Eve.url			,params 	: p			,callback   : successFn			,scope      : this		});	}// * * * * * * * * * * * * * * * *// Interlinking Requests// * * * * * * * * * * * * * * * *	,ilReloadCombo : function(callee, type, data)	{		var p = {			event: "modern.interlink.personal.edit"		};		for (var i = 0, len = data.items.length; i < len; ++i) {			p[data.items[i].name] = data.items[i].value;		}		if (data.tName !== undefined) {			p[data.tName] = data.tVal;		}		if (data.linkTo) {			p.linkTo		= data.linkTo;			p.pathRequired	= true;		}		var cb = function(options, success, response) {			if (success) {				this.fire('success_interlink_reload_combo', { response: response, sender: data.sender });			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,ilDelete : function(callee, type, data)	{		var root = data.info.root;		var p	 = {			id			: data.id			,event		: "modern.interlink." + data.info.root + ".delete"		};				if (root == 'group') {			if (data.info.groupId.indexOf('_') == -1) {				p.groupId = data.info.groupId;			} else {				p.groupId = data.info.groupId.split('_')[1];			}		}				var cb = function(options, success, response) {			if (success) {				data.response	= response;				data.grid		= callee;				this.fire('success_interlink_delete', data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,ilSearch : function(callee, type, data)	{		var p 	 = data.info;		var gId	 = data.info.groupId;		var root = (gId == '0' || gId === undefined) ? 'personal' : 'group';		p.event  		= ["modern.interlink." + root + ".search", data.info.linkTo].join('');		p.componentkey	= 'interlinking';		p.id    		= data.info.folderId;		if (data.info.itemsOnly !== undefined)			p.itemsOnly = data.info.itemsOnly;		var cb = function(options, success, response) {			if (success) {				this.fire('success_interlink_search', {info: data.info, response: response});			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}		,ilGetItems : function(callee, type, data)	{		// Check there's multiple ids or just one		if (typeof data.info.id == 'string')			var id = data.info.id;		else			var id = data.info.id.join(',');						var root	= data.info.root;		var section = data.info.section;		var type	= data.type;				var p 	= {			event	: ["modern.", section, ".", root, ".getGrid"].join('')			,itemIds: id		};				if (root == 'group')			p.groupId = data.info.groupId.split('_')[1] || data.info.groupId;		else			delete data.info.groupId;								var cb = function(options, success, response) {			if (success) {				data.info.xml 	= response.responseXML;				this.fire(section + '_success_modify_' + type, data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}// * * * * * * * * * * * * * * * *// Comments Requests// * * * * * * * * * * * * * * * *	,editComment : function(callee, type, data)	{		var p = {			event		: "modern.comment.personal.edit"			,id			: data.info.id			,objTypeId	: 4		};		var cb = function(options, success, response) {			if (success) {				this.fire(data.section + '_success_edit_comment', data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}	,deleteComment : function(callee, type, data)	{		var p = {			event		: "modern.comment." + data.params.root + ".delete"			,id			: data.info.id			,objTypeId	: 4		};		var cb = function(options, success, response) {			var pre = type.split('_')[0];			if (success) {				this.fire(pre + '_success_delete_comment', data);			}		};		this.conn.request({			url			: Eve.url			,params		: p			,callback	: cb			,scope		: this		});	}// * * * * * * * * * * * * * * * * * * * *// 	Import/Export Requests// * * * * * * * * * * * * * * * * * * * *	,getMapGrid : function(callee, type, data)	{		var params = {			event	: "modern." + data.section + "." + data.root + ".importMapping"			,sourceFilePath : data.sourceFilePath			,importColumns 	: data.importColumns		};		if(data.root == 'group')		    params.groupId = data.groupId;		var successFn = function(options, success, response){			if(success){				this.fire(data.section + '_success_get_map', response);			}		};		this.conn.request({			url			:Eve.url			,params		: params			,callback	: successFn			,scope		:this		});	}	,submitImp : function(callee, type, params)	{		var obj		= {};		obj 		= params.param;		obj.event	= 'modern.' + params.secName + '.' + params.root + '.importOnce';		obj.path	= params.path;		if(params.root == 'group')		    obj.groupId = params.groupId;		var successFn = function(options, success, response) {			if (success)				this.fire(params.secName + '_success_import', response);		};		this.conn.request({			url			:Eve.url			,params		: obj			,callback	: successFn			,scope		:this		});	}		//----------------------------------	//      Filter	//----------------------------------	,getFilterInfo : function(callee, type, obj){		var params = {			event: 'modern.' + obj.section + '.' + obj.info.root + '.editFilter'		};		if (obj.info.root == 'group')		    params.groupId = obj.info.groupId;		var successFn = function(options, success, response) {			if (success) {				/* Majid: Wait : next lines was commented */				Eve.mask.hide();				this.fire(obj.section + '_success_filter_info', {response:response.responseXML});			}		};		this.conn.request({			url			: Eve.url			,params		: params			,callback	: successFn			,scope		: this		});	}		//------------------------------------	//      Attachment	//------------------------------------	,getList: function(callee, type, obj){		var params = {			event 	: 'modern.document.'+obj.info.root+'.getList'//Eve.Resource.cmdListView(obj.info.root)			,folderId		: obj.info.id			,path	: obj.info.path		};		if ( obj.info.root == 'groups' || obj.info.root == 'group') {			params.groupId = obj.info.groupId;		}		var successFn = function(options, success, response) {			if (success){				/* Majid: Wait : next lines was commented */				Eve.mask.hide();				this.fire('document_files_load_sucess', {response:response.responseXML});			}		};		// Execute the command		this.conn.request({			url			:Eve.url			,params		: params			,callback	: successFn			,scope		:this		});	}		,getMessages: function( callee, type, obj ){		var successFn = function(options, success, response) {			if (success) {				/* Majid: Wait : next lines was commented */				Eve.mask.hide();				this.fire('forum_success_get_msg', {response:response.responseXML});			}		};		this.conn.request({			url			: Eve.url			,params		: obj.params			,callback	: successFn			,scope		: this		});	}	//Forum	,toggleNotifyCategory: function(callee, type, obj){		var successFn = function(options, success, response) {			if (success) {				var userSubscribed = options.params.state;				obj.rec.set('userSubscribed', userSubscribed);							}		};		var params = obj.info;		params.event = 'modern.forum.group.toggleSubscriptionConference';		this.conn.request({			url			: Eve.url			,params		: params			,callback	: successFn			,scope		: this		});	}	//---------------------------------	//          Get grid 'Use in Forum'	//---------------------------------	,getGridRequest: function(callee, type, obj)	{		var params = obj.info;		params.event = 'modern.forum.group.getGrid';		var func = function(options, success, response)		{			var dq	 = Ext.DomQuery;			var xml  = response.responseXML;			var code = dq.selectValue("code", xml);			if (code == '0') {				var info = {					id 			: dq.selectValue('id', xml).split('_')[1]					,rawId		: dq.selectValue('id', xml)					,xml		: xml					,root		: this.root					,path		: this.path					,parentId	: this.parentId					,groupId	: this.groupId				};				var type = "forum_success_modify_folder";				this.fire(type, {params: params, info: info});			}		};		this.conn.request({		   url		 : Eve.url		   ,params	 : params		   ,scope	 : this		   ,callback : func		});	}	//Reminder PopOut	,reminderPopoutRequest : function(callee, type, params)	{		var func = function(options, success, response){			if(success){			var ids = options.params.ids || options.params.id;			ids = ids.split(",");			for(var i=0; i< ids.length; i++){				Eve.ReminderIds.remove(ids[i]);			}			this.fire('load_popout_reminder',{isCountChange : params.isCountChange});			}		};		this.conn.request({		   url		 : Eve.url		   ,params	 : params.params		   ,scope	 : this		   ,callback : func		});	}		,invitaionPopoutRequest : function(callee, type, params)	{		var func = function(options, success, response){			this.fire('load_popout_invitaion', {isCountChange : params.isCountChange});		};		this.conn.request({		   url		 : Eve.url		   ,params	 : params.params		   ,scope	 : this		   ,callback : func		});	}		,meetingPopoutRequest : function(callee, type, obj)	{		var isReschedule = obj.isReschedule;		var func = function(options, success, response){			this.fire('load_popout_meeting', {isCountChange : obj.isCountChange});			if(isReschedule)				Eve.Resource.superbridge.broadcast(this, 'proxy_dialog', { type:'reminder', func:function(){					var info = {						id: 0						,path: '\\'						,parentId: -1						,root   : 'personal'					};					Eve.Resource.superbridge.broadcast(this,'reminder_create_item_dlg',{info: info});				}				});		};		this.conn.request({		   url		 : Eve.url		   ,params	 : obj.params		   ,scope	 : this		   ,callback : func		});	}		//For assigned task	,assignedTaskRequest : function(callee, type, obj){		/* Majid: Wait : next lines was commented */		Eve.mask.show();				var func = function(opt, sucess, response){			/* Majid: Wait : next lines was commented */			Eve.mask.hide();			Ext.tools.msg('Your request was sent successfully','');		}		obj.event = 'modern.task.group.notifyTask';		this.conn.request({			url     	: Eve.url			,params 	:   obj			,scope  	: this			,callback   : func		})	}		//Update Grid	,updateGridRequest : function(callee, type, obj) {		var sec = obj.section;				var func = function(opt, sucess, response){					Eve.Resource.superbridge.broadcast(this, sec+"_success_update_grid", {res: response.responseXML, st: obj.st})		};				Ext.Ajax.request({			url			: Eve.url			,params		: obj.st.lastOptions.params			,callback	: func			,scope  	: this		});	}		//delete Calendar Attendee	,deleteCalendarMeeting  : function(callee, type, params){        params.event = 'modern.meeting.calendar.deleteAttendee';        var rawAttendeeId = params.attendeeId;        params.attendeeId = rawAttendeeId.split("_")[1];        		var successFn = function(options, success, response){			if(success){				var dv = Ext.getCmp('calendardvCalendarMeetingAttendees');				var ds = dv.store;				var rec = ds.getById(rawAttendeeId);				if(rec)					ds.remove(rec);				if(dv.view)					dv.view.refresh();			}		}		this.conn.request({			url     	: Eve.url			,params     : params			,callback   : successFn			,scope      : this		})	}	,modifyDesktop	: function(callee, type, params){			params.event = 'modern.userPreferences.desktop.updateRefreshInterval';			var successFn = function(options, success, response){			if(success){				console.log('succeed')			}		}		this.conn.request({			url     	: Eve.url			,params     : params			,callback   : successFn			,scope      : this		})	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Defaults/DefaultGrid.js *//*--------------------------------------------------*/// Written by Omid & KhashayarEve.widgets.DefaultGridBridge = Ext.extend( Eve.widgets.GridBridge, {	initLocalVars : function(){}	,init : function(obj)	{		Eve.widgets.DefaultGridBridge.superclass.init.call(this, obj);	}	// Return the grid of a section that this object instantiated with, no the current active section.	,getGrid : function()	{		var g = this.gridSection + "_grid";		return Ext.getCmp(g);	}		,fetchData : function()	{		// This works for sections like Reminder that we simulate Tree's behaviour.		if (this.root === undefined)			this.root = "personal";		var command = {			event 	: Eve.Resource.cmdSelectFolder(this.section, this.root)			,id		: this.id			,path	: this.path			,start	: 0			,limit	: Eve.Preference.get('itemsperpage')		};		if ( this.root == 'groups' || this.root == 'group') {			command.groupId = this.groupId;		}		// Append this object to store for PagingToolbar		this.conn.getStore().params = {			event	: Eve.Resource.cmdChangePage(this.section, this.root)			,groupId: this.groupId		};		// Execute the command		this.conn.request(command);	}	,forceLoad : function(data)	{		//TODO - PreRender... added by Ghazal		if(( data.section == 'task' || data.section == 'contact')&& !data.sharedSection){			this.fire('load_section_completed', {sectionId: data.section});			return;		}		var root		= (data.sharedSection) ? 'group' : 'personal';		var command = {			event 	: Eve.Resource.cmdSelectFolder(data.section, root)			,id		: data.info.id || 0			,groupId: data.info.groupId			,path	: data.info.path || '\\'			,start	: 0			,limit	: Eve.Preference.get('itemsperpage')		}		// Append this object to store for PagingToolbar		this.conn.getStore().params = {			event	: Eve.Resource.cmdChangePage(data.section, root)			,groupId: data.info.groupId		};		this.setSharedSection(data);		// Sync ColumnModel with Preference		if (data.info.groupId >= 0 || data.info.groupId == -10){			var rid = (root == 'personal') ? ( (data.info.groupId == -10) ? -10 : 0 ) : data.info.groupId;			this.syncColumnModel(rid);		}		// Execute the command		this.conn.request(command);	}	,setSharedSection : function(data)	{		this.sharedSection = data.sharedSection;	}		,filterData : function(params)	{		var command = ["event=",Eve.Resource.cmdModifyFilter(),"&", params].join('');		this.conn.request(command);	}	,createObject : function(callee, type, data)	{		var ext = false;		switch(this.gridSection)		{			case 'reminder':			case 'forum':			case 'voting':			case 'calendar':				ext = true;				break;		}		if (data.info.parentId == this.id || ext) {			this.groupId = this.groupId || 0;			if (this.groupId == data.info.groupId || ext) {				this.createRecordAt(data);			}		}	}	,updateGrid : function(obj /*{st: store, res: responseXML}*/)	{	//	Eve.GridUpdator.resetTaskRunner();		var st = Ext.getCmp(this.section+"_grid").getStore();				try {			var xml = obj.res || obj.info.xml ;		} catch (e) {			return;		}				var records = st.reader.readRecords(xml).records;		var keys = st.fields['keys'];		var j =0;		var rec;		st.suspendEvents();		var ids =  [];		for (var j=0, len=records.length; j<len; j++) {			var rec = st.getById(records[j].id);			if (rec !== undefined) {				for (var i=0, length=keys.length; i<length; i++) {					rec.set(keys[i], records[j].get(keys[i]));				}			} else {     			st.add(records[j]);			}						ids.push(records[j].id);		}		var isModified = false;	  	st.each(function(rec) {			isModified = isModified || rec.isModified();			if (ids.indexOf(rec.id) ==-1)				st.remove(rec);		});				st.resumeEvents();				if ( isModified )			st.fireEvent( 'datachanged', this ); // MAJID: VERY HUGE EVENT		var swap = function(index1, index2){		   var rec1 = st.getAt(index1);		   var rec2 = st.getAt(index2);		   st.remove(rec1);		   st.remove(rec2);		   if(index1 < index2){			st.insert(index1,rec2);		   	st.insert(index2, rec1);		   }		   else{            st.insert(index2,rec1);		   	st.insert(index1, rec2);		   }		}			/*	st.each(function(rec, ind){			for(var y=ind+1; y <= st.getCount()-1; y++)			{				if(st.getAt(ind).get('_index') > st.getAt(y).get('_index'))					swap(ind, y);			}		});*/		var count = 1;		st.each(function(rec, ind){			var min = -1000;			for(var y=ind+1; y <= st.getCount()-1; y++)			{				if(st.getAt(ind).get('_index') > st.getAt(y).get('_index'))					min = y;			}			if(min != -1000){			    swap(ind, min);			    console.log("swap is done ---" + count++);			}		});		st.commitChanges();	}	,createRecordAt : function(data)	{		var store	= this.getGrid().getStore();		 // Before changing anything reject the past changes		store.rejectChanges();		var xmlData = Eve.Resource.mapXml(data.info.xml, store.fields.keys);		// If back-end didn't return xml, it means		// it's not required to create object in		// current view.		if (!xmlData)			return false;		for(var i=0; i< xmlData.fields.length; i++){			var recFunc	= Ext.data.Record.create(store.fields);			var record	= new recFunc(xmlData.fields[i]);			var index	= xmlData.extra[i].index - 1;			record.id	= xmlData.extra[i].id;			data.obj 	 = data.params;			// Hook [at this moment just used in Tasks]			record = this.augmentToRecord(record, data.info.xml);			console.log('createRecordAt:index:',index,'store.totalLength:',store.getCount())			if (index >= 0 && index <= store.getCount())				store.insert(index, record);			else				store.add(record);		}		// Put it under try & catch because of interlinking (In case of the grid of target section didn't init yet).		try	{			// Commit the store and refresh the view			this.view.get().getView().refresh();		} catch(e) {			Eve.errors.push(e);		}	}	,modifyObject : function(callee, type, object)	{	/*		var ext = (this.gridSection == 'reminder'					|| this.gridSection == 'voting'					|| this.gridSection == 'forum'					|| this.gridSection == 'task'					|| this.gridSection == 'calendar');	*/		var dq = Ext.DomQuery;		var store	 = this.getGrid().getStore();		var record;	//	object.info.parentId = (object.info.parentId == "") ? 0 : object.info.parentId;	//if (object.info.parentId == this.id || ext) {		//if (!object.info.groupId || this.getGroupId() == object.info.groupId || object.info.groupId == '0') {		if (((!object.info.groupId || object.info.groupId == '0') && (!this.getGroupId() || this.getGroupId() == '0')) ||			(object.info.groupId != '0' && this.getGroupId() != '0' && this.getGroupId() == object.info.groupId)) {				// Remove the record from the store				this.deleteObject(callee, type, object);				//added by Ghazal to delete  multiple rows - Use in task				var deletedIds = dq.selectValue('deletedRows',  object.info.xml, '').split(',');				for(var i=0; i< deletedIds.length; i++){					record = store.getById(deletedIds[i]);					if(record)					store.remove(record);				}				// Now create a fresh one with new index.				this.createRecordAt(object);		}	//	}	}	,updateObject : function(callee, type, object)	{		this.modifyObject(callee, type, {info: object.info, params: object.params, object: object});	}	,deleteObject : function(callee, type, object)	{		var store	 = this.getGrid().getStore();		var isFolder = (object.itemType == 'folder');		if (isFolder === undefined)			isFolder = (object.object.itemType == 'folder');		var xml		  = object.info.xml;		if(!object.isMultiSelected){			var id		  =	object.info.rawId ||							Ext.DomQuery.selectValue('id', xml, undefined) ||							object.info.id;			var rec	= store.getById(id);			if (rec) {			// Before changing anything reject the past changes				store.rejectChanges();				store.remove(rec);			}		}		else		{			var successIds = Ext.DomQuery.selectValue('successfulIds', xml);			var unsuccessIds = Ext.DomQuery.selectValue('unsuccessfulIds', xml);			var titles = "<ul style='width:200px;list-style-type:disc;margin-left:20px;'>";			if(unsuccessIds){                unsuccessIds = unsuccessIds.split(',');				for(var i=0; i<unsuccessIds.length; i++){					record = store.getById(unsuccessIds[i]);					if(record)						titles+= "<li>"+this.getTitle(record)+"</li>";				}				titles+= "</ul>";                Ext.Msg.alert('Failed', ' For some reason following items could\'nt be deleted :<br/>'+ titles);			}						//Remove successfull from store			if(successIds){			    successIds = successIds.split(',');				var record;				for(var i=0; i<successIds.length; i++){					record = store.getById(successIds[i]);					if(record){						store.rejectChanges();						store.remove(record);					}				}			}			store.commitChanges();		}	}	,printFolder : function(callee, type, data)	{		var cm	= this.view.get().getColumnModel();		var th 	= "";		var tb 	= "";		var colspan = 0;		for (var i = 0; i < cm.config.length; i++) {			if (cm.config[i]['hidden']) {				continue;			}						var header 		= cm.config[i].header.trim();			var dataIndex	= cm.config[i].dataIndex;						if (header == "" || header == "&nbsp;") {				continue;			}			th += ["<td style='color:#CE0000; font-weight:bold; padding:3px; border-bottom:1px solid #646464'>",				   header,				   "</td>"].join('');			tb += ["<td style='border-color:white; border-style:solid; border-width:0 0 1px 1px; padding-left:4px; padding-top:3px;'>{",				   dataIndex,				   "}&nbsp;</td>"].join('');			colspan++;		}		var reader	= this.conn.getStore().reader;		var result	= reader.read(data);				// Replace type of items with image		var records = result.records;		for (var i = 0, len = result.records.length; i < len; i++) {			records[i].data.type = ["<img src='", Eve.Resource.getIcon(records[i].data.type + '-' + this.section, this.section), "' width=16>"].join('');			if( parseInt(records[i].data.linkedItems) > 0 ){				records[i].data.linkedItems =["<img src='", Eve.Resource.getIcon('paper-clip', 'interlink'), "' width=16>"].join('');			}			else{				records[i].data.linkedItems = "";			}		}		records = this.setPrintIcons(records);				// Create Template and feed with data.		var tpl = new Ext.XTemplate(				'<div>',					'<div style="float:right;">',						'<select id="expander">',							'<option value="1">Collapsed</option>',							'<option value="2">Expanded</option>',						'</select>',					'</div>',					'<table width="100%" border="0" style="border:1px solid #646464; font: 11px Tahoma; clear:both;" cellpadding="3" cellspacing="0">',					'<tr style="background:transparent url(' + Eve.Resource.getIcon('print-table-head-bg', 'general') + '" >',						th,					'</tr>',					'<tpl for=".">',						'<tpl for="data">',						 '<tr style="background-color:#F4F4F4; border:0px solid white">',							tb,						'</tr>',						'<tr class="content" style="display:none; background-color:#F4F4F4;">',							'<td colspan="' + colspan + '">',								'<table width="100%" style="padding: 5px;overflow: hidden; font: 11px Tahoma; color:#AAA;x">',								 '<tr>',									'<td><b>{title}</b></td>',								 '</tr>',								 '<tr>',									'<td><hr /></td>',								 '</tr>',								 '<tr>',									'<td>',										'<div style="float:left; position:relative;line-height:normal;" class="row-expander-desc">',											'{description}{notes}',										'</div>',									'</td>',								 '</tr>',								 '<tr>',									'<td><hr /></td>',								 '</tr>',								 '<tr>',									'<td>',										'<p>{created}',										'<br />{lastModified}</p>',									'</td>',								 "</tr>",								 '</table>',							'</td>',						'</tr>',						'</tpl>',					'</tpl>',					'</table>',				'</div>'		);		var content = tpl.apply(result.records);		// Create the new page		var page = window.open("/hyperoffice2nd/views/Styles/ModernStyle/print/Print.html", this.gridSection + "_print", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=500");		setTimeout( function() {			page = (Ext.isChrome &&  page.innerHeight == 0) ? false : page;			if (page) {				page.document.body.innerHTML = content;				var doc = page.document;				var cbo = doc.getElementById('expander');				Ext.fly(cbo).on('change', function(e, el) {					var nodes = Ext.DomQuery.select('tr.content', doc);										if (cbo.selectedIndex == 1) {						for (var c = 0; c < nodes.length; ++c) {							var n = Ext.get(nodes[c])							n.setDisplayed(true);						}					} else {						for (var c = 0; c < nodes.length; ++c) {							var n = Ext.get(nodes[c])							n.setDisplayed(false);						}					}				})				page.print();			}			else {				Ext.Msg.alert('Popup Blocker', 'Your browser is currently preventing popups, please change the setting and try again.');			}		}, 500);	}	,filter : function(callee, t, object)	{		var store	= this.conn.getStore();		var root 	= object.info.root;		var base 	= object.mode.base;		var branch 	= object.mode.branch;		var event	= Eve.Resource.cmdCreateBranch(this.section, root, branch );				// Filter method in backend will reset the start value		// So it would be better we change it in frontend too		// to prevent page mismatch on changing views, like notes section.		var start = 0; //store.lastOptions.params.start;		var limit = store.lastOptions.params.limit;		var params = {event: event, start: start, limit: limit};		if (object.info.groupId != null)			params.groupId = object.info.groupId;		switch (base) {			case ('folder_item'):				  var b = ( branch.toLowerCase() == 'itemsonly' ) ? true : false;				  params.itemsOnly = b;				break;			case ('completeMode'):			   params.completeMode = branch;        		break;			case ('assignMode'):				// Assignee just works  in 'Group'.				if (root == 'personal' & object.info.parentId != '-10')					return;			   	params.assignMode = branch;				break;			case ('search'):			        params.searchText = object.mode.str;			    break;			case ('filter'):			    params.criteria = object.criteria;				if (!this.onFilterChange(object))					return;			    break;		}		store.reload({params: params});	}	,inlineEdit : function(data)	{		var grid	= this.getGrid();		var idx		= grid.getStore().indexOf(data.record);		var cModel	= grid.getColumnModel();		// Commented by Khashayar (because of wrong assumption, add main property to column you want to be the main!)		// According to diffrent sections, editable column maybe first or the second one.		/*		try {			grid.startEditing(idx, 1, true);		}		catch (e) {			try {				grid.startEditing(idx, 2, true);			}			catch (e) {}		}		*/		// Search for main property on a column		for (var i = 0; i < cModel.config.length; ++i) {			var col = cModel.config[i];			if (col.main === true) {				grid.startEditing(idx, i, true);				break;			}		}	}	// It's just used in link section.	,openLink : function(obj)	{		var grid = Ext.getCmp('link_grid');		// If ds is undefined, it means interlinking fired this.		var rec = (grid) ? grid.getStore().getById(obj.info.rawId) : obj.info.rec;		rec		= rec || obj.info.rec;				if (rec) {			var url	= rec.data.url;			var nw	= rec.data.spawnNewWindow;			var al	= rec.data.autoLogin;			// Right side of "OR" is for Interlinking			var id	= (rec.id) ? rec.id.split("_")[1] : obj.info.rec.data.objId.split("_")[1];			var p	= [Eve.url, "?event=modern.link.personal.autoLogin&id=", id, "&CFID=", Eve.CFId, "&CFTOKEN=", Eve.CFToken].join('');			var el	= Ext.getCmp('MainCardLayout')			var lt	= el.getLayout();			var content = (al == '1') ? p : url;			if (nw == '1') {				window.open(content, rec.id);			} else {				var panel = {					xtype		: 'panel'					,id			: 'TempLayout'					,layout		: 'fit'					,items		: [ new Ext.ux.IFrameComponent({ url: content }) ]				};				el.remove(Ext.getCmp('TempLayout'));				el.add(panel);				lt.setActiveItem(el.items.items.length-1)				Eve.LayoutManager.sectionName = "";			}		}		Eve.activeSec = "TempLayout";	}		,deleteHdl: function(){		var id, title, type,groupId;		var isMultiSelected = false;		var selections = this.view.get().getSelectionModel().selections;		var sameType    = true;		if(selections.length > 1){			var titles	=[];			var ids		=[];			isMultiSelected = true;			type = selections.first().get('type');			selections.each(function(rec){				if(rec.get('type') != type){					sameType = false;					return;				}				title = this.getTitle(rec);				titles.push( title );				ids.push(rec.id.split("_")[1]);			},this);			if(!sameType){				Ext.tools.msg('', 'All selected rows must have the same type');				return;			}			title	= titles.join(",");			id      = ids.join(",");		}		else if(selections.length > 0){			var rec = (this.getRecord)? this.getRecord()				:this.view.get().getSelectionModel().getSelected();							id = rec.id.split("_")[1];			title = this.getTitle(rec);			type = rec.data.type;			//Added by Ghazale for overllayAll in task			var rawGroupId = (rec.data.groupId && rec.data.groupId.split) ? rec.data.groupId.split("_")[1] : rec.data.groupId			groupId = this.groupId || rawGroupId;		}		if (rec || selections.length > 1) {			var data = {				info :{					id: id					,parentId : this.id					,groupId : this.groupId || groupId					,root: this.root					,path: this.path					}				,title : title				,isMultiSelected : isMultiSelected			}			this.fire(this.section+"_delete_" + type.toLowerCase() + "_dlg", data );		}		else {			Ext.tools.msg('Select a Record', 'You need to select a record in grid below.');		}	}	,setPrintIcons: Ext.emptyFn});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Defaults/DefaultTree.js *//*--------------------------------------------------*/// Written by OmidEve.widgets.DefaultTreeBridge = Ext.extend( Eve.widgets.TreeBridge, {	fetchData : function()	{		var temp = {};		var root = (this.root=='group') ? 'group' : 'personal';				temp.event =  Eve.Resource.cmdGetSubTree(this.section, root);		//if ( this.isGroupSection )		//	temp.noSubGroup = "LalehIsOwnage";		temp.id   = this.id;		temp.path = this.path;				if (this.root == 'group')			temp.groupId = this.groupId;				return temp;	}		,forceLoad : function(data)	{		// forceLoad affects 'SelectionOnChange'		this.loadForce = true;				var tree	 = this.view.get();		var personal = tree.getNodeById( tree.getPersonalId() );		var groupId	 = data.info.groupId;				if (groupId == '0') {			if (personal)				personal.select();		} else {			var root = tree.getNodeById( tree.getRootId() );			tree.expandNode(root, data.info.groupPath, data.info.path);		}		this.setSharedSection(data);				this.manager.loadFinished(this);	}	,setSharedSection : function(data)	{		var tree	 = this.view.get();		var personal = tree.getNodeById( tree.getPersonalId() );		if (personal){			if (data.sharedSection) {				personal.getUI().hide();			} else {				personal.getUI().show();				personal.select();			}		}	}	});// - - - - - - - - - - - - - - - - - - - - - - -// Start: Document  Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Document.TreeBridge = function() {};Eve.Document.TreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Document.TreeBridge.superclass.registerView.apply(this, arguments);		this.treeEd.un('complete', this.treeEd._onComplete, this);				this.treeEd.on('complete', function(ct, value, oldValue) {			if (value == '' || (value == oldValue) || value.match(/[\\/\.\$\*,\'\!\+\=\&\~\"\`\@\^\|\#\%\?]/))				return false;			if ( this.treeEd.editNode && this.treeEd.editNode.id.indexOf('G_') !== -1 )				return false;			var temp = ct.tree.getNodeInfo(this.treeEd.editNode);			this.id			= temp.id;			this.groupId 	= temp.groupId;			this.parentId 	= temp.parentId;			this.root		= temp.root;			this.path		= ct.tree.getNodeInfo(this.treeEd.editNode.parentNode).path;			this.fire(this.section + '_update_folder', {params: {title:value} ,info:{ id: this.id, parentId : this.parentId, groupId : this.groupId,					  											root: this.root, path: this.path }, mode: 'inline' });		}, this);	}})// - - - - - - - - - - - - - - - - - - - - - - -// End: Document  Tree// - - - - - - - - - - - - - - - - - - - - - - -// - - - - - - - - - - - - - - - - - - - - - - -// Start: Document Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Document.CopyMoveTreeBridge = function() {};Eve.Document.CopyMoveTreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Document.CopyMoveTreeBridge.superclass.registerView.apply(this, arguments);				// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;				sel.un('selectionchange', sel._onSelChange, this);	}	,execute : function(callee, type, data)	{		var tree = this.view.get();		switch (type) {			case ('document_success_create_folder'):			case ('document_success_delete_folder'):			case ('document_success_modify_folder'):			case ('document_success_update_folder'):			case ('document_success_move_folder'):				Eve.Document.treeChanged = true;				break;		}	}})// - - - - - - - - - - - - - - - - - - - - - - -// End: Document Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -// - - - - - - - - - - - - - - - - - - - - - - -// Start: Contact Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Contact.CopyMoveTreeBridge = function() {	};Eve.Contact.CopyMoveTreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Contact.CopyMoveTreeBridge.superclass.registerView.apply(this, arguments);				// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;				sel.un('selectionchange', sel._onSelChange, this);						// Hide Personal Node		tree.on('beforeexpandnode', function(node) {			if (node.id == this.getRootId()) {				var personal = this.getNodeById( this.getPersonalId() );								if (personal) {					personal.getUI().hide();				}			}						return true;		})	}		,execute : Ext.emptyFn})// - - - - - - - - - - - - - - - - - - - - - - -// End: Contact Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -// - - - - - - - - - - - - - - - - - - - - - - -// Start: Link Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Link.CopyMoveTreeBridge = function() {};Eve.Link.CopyMoveTreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Link.CopyMoveTreeBridge.superclass.registerView.apply(this, arguments);		// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;		sel.un('selectionchange', sel._onSelChange, this);		// Hide Personal Node		tree.on('beforeexpandnode', function(node) {			if (node.id == this.getRootId()) {				var personal = this.getNodeById( this.getPersonalId() );				if (personal) {					personal.getUI().hide();				}			}			return true;		})	}	,execute : function(callee, type, data){		switch (type) {			case ('link_success_create_folder'):			case ('link_success_delete_folder'):			case ('link_success_modify_folder'):			case ('link_success_update_folder'):			case ('link_success_move_folder'):				Eve.Link.treeChanged = true;				break;		}	}})// - - - - - - - - - - - - - - - - - - - - - - -// End: Link Copy/Move Tree// - - - - - - - - - - - - - - - - - - - - - - -// - - - - - - - - - - - - - - - - - - - - - - -// Start: Mail AttachPortal Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Document.AttachPortalTreeBridge = function() {};Eve.Document.AttachPortalTreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Document.AttachPortalTreeBridge.superclass.registerView.apply(this, arguments);		// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;		sel.on('selectionchange', function(sel, el) {			var node = tree.getMode(el.id);			var path = tree.getNodePath(el).path;			var info = {				id 		: 	node.id				,root	:	node.root				,path	:	path				,groupId:   tree.getGroupId(el)			}						this.fire('document_get_files', {info: info})		}, this);	}	,execute : function(callee, type, data)	{		var tree = this.view.get();		switch (type) {			case ('document_success_create_folder'):			case ('document_success_delete_folder'):			case ('document_success_modify_folder'):			case ('document_success_update_folder'):			case ('document_success_move_folder'):				Eve.Document.treeChanged = true;				break;		}	}});// - - - - - - - - - - - - - - - - - - - - - - -// End: Mail AttachPortal Tree// - - - - - - - - - - - - - - - - - - - - - - -// - - - - - - - - - - - - - - - - - - - - - - -// Start: Mail Convert to Task Tree// - - - - - - - - - - - - - - - - - - - - - - -Eve.Task.TaskTreeBridge = function() {};Eve.Task.TaskTreeBridge = Ext.extend( Eve.widgets.DefaultTreeBridge, {	// Override	registerView : function()	{		Eve.Task.TaskTreeBridge.superclass.registerView.apply(this, arguments);		// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;			sel.un('selectionchange', sel._onSelChange, this);		var expandHdl = function(node){		}		tree.on('expandnode', function(node){			if(node.isRoot){				node.findChild('id', 'TP_-10').getUI().hide();				if(Eve.activeSec == 'task')					node.findChild('id', 'TP_0').getUI().hide();			}			return true;		}, this);	}	,execute : function(callee, type, data)	{		switch (type) {			case ('task_success_create_folder'):			case ('task_success_delete_folder'):			case ('task_success_modify_folder'):			case ('task_success_update_folder'):			case ('task_success_move_folder'):				Eve.Task.treeChanged = true;				break;		}	}});// - - - - - - - - - - - - - - - - - - - - - - -// End: Mail Convert to Task Tree// - - - - - - - - - - - - - - - - - - - - - - -/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\reminder/ReminderDialogs.js *//*--------------------------------------------------*//* * Hyperoffice Reminders section based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.Dialogs.Reminder.ReminderFormPanel = function(c) {	var timeSt = new Ext.data.SimpleStore({		fields : ['value', 'text'],		data : [			 ['-1'		,'None']			,['0'		,'At Event Time']			,['5'		,'5  Minutes Before']			,['10'		,'10  Minutes Before']			,['15'		,'15  Minutes Before']			,['30'		,'30  Minutes Before']			,['60' 		,'1  Hour Before']			,['120' 	,'2  Hour Before']			,['180' 	,'3  Hour Before']			,['240' 	,'4  Hour Before']			,['300' 	,'5  Hour Before']			,['360' 	,'6  Hour Before']			,['420' 	,'7  Hour Before']			,['480' 	,'8  Hour Before']			,['540' 	,'9  Hour Before']			,['600' 	,'10 Hour Before']			,['660' 	,'11 Hour Before']			,['720' 	,'12 Hour Before']			,['1440' 	,'1  Days Before']			,['2880' 	,'2  Days Before']			,['4320' 	,'3  Days Before']			,['5760' 	,'4  Days Before']			,['10080' 	,'1  Week Before']			,['20160' 	,'2  Week Before']		]	});	return new Eve.FormPanel({		 labelWidth	: 70		,frame		: false		,border		: false		,bodyStyle	: 'padding:5px 5px 0'		,width		: 400		,height 	: 450		,items 		: [{			layout		: 'form'			,id			: 'ReminderRadioCmp'			,hidden		: (c.section.toLowerCase() == 'reminder')? true : false			,items		: [{				xtype		: 'radiogroup'				,fieldLabel	: 'Reminder'				,name		: 'use_reminder'				,anchor		: '90%'				,items		: [{					boxLabel	: 'On'					,id			: c.section + 'reminderOn'					,name		: 'use_reminder'					,inputValue	: '1'					,listeners	: {						check : function(el, checked) {							if (checked) {								var cmpReminder = Ext.getCmp(c.section + 'ReminderCmp');								cmpReminder.show();								cmpReminder.doLayout()																Ext.getCmp(c.section + 'ReminderTextMsg').hide();							} else {								Ext.getCmp(c.section + 'ReminderTextMsg').show();								Ext.getCmp(c.section + 'ReminderCmp').hide();							}						}					}				}, {					boxLabel	: 'Off'					,id			: c.section + 'ReminderOff'					,name		: 'use_reminder'					,inputValue	: '0'					,listeners	: {						check : function(el, checked) {							if (checked) {								Ext.getCmp(c.section + 'ReminderCmp').hide();								Ext.getCmp(c.section + 'ReminderCmp').doLayout()								Ext.getCmp(c.section + 'ReminderTextMsg').show();							}							else {								Ext.getCmp(c.section + 'ReminderTextMsg').hide();								Ext.getCmp(c.section + 'ReminderCmp').show();							}						}					}				}]			}, {				html		: '<hr style="margin:5px 0px;" />'			}, {				layout		: 'form'				,id			: c.section + 'ReminderTextMsg'				,items		: [{					html: '<div style="text-align:center; margin-top:50px;">This task does not have reminder.</div>'				}]			}]		},{				layout: 'form'				,hidden: false				,id : c.section +'ReminderCmp'				,items: [{					layout		: 'form'					,hidden		: (c.reminderType == 'absolute')? true : false					,id			: c.section + 'rel_time'					,items		: 						new Ext.form.ComboBox({						xxtype			: 'combo'						,id				: c.section + 'relativeMinutes'						,hiddenName		: 'relativeMinutes'						,mode			: 'local'						,fieldLabel 	: 'When'						,store          : timeSt						,lazyInit		: false						,valueField		: 'value'						,value          : 1						,displayField	: 'text'						,labelStyle 	: 'width: 70px'						,labelSeparator : ''						,typeAhead		: true						,editable		: false						,selectOnFocus 	: true						,triggerAction 	: 'all'						,anchor 		: '98%'					})				}, {			layout		: "column"			,hidden     : (c.reminderType !== 'relative') ? false : true			,id         : c.section + 'abs_time'			,items		: [{				columnWidth	: .6				,layout		: "form"				,items		: [{					 xtype		: 'datefield'					,fieldLabel	: 'Date'					,id         : c.section + 'reminder_date'					,name		: 'reminder_date'					,anchor		: '95%'					,format		: Eve.Preference.get('dateFormat')					}]			}, {				columnWidth	: .4				,layout		: "form"				,items		: [{					 xtype		: 'timefield'					,id         : c.section + 'reminder_time'					,name		: 'reminder_time'					,hideLabel	: true					,anchor		: '88%'					,format		: Eve.Preference.get('timeFormat')				}]			}]		}, {			html		: '<hr style="color: #DDD" />'			,style		: 'margin: 5px 0 5px 0;'		}, {			 xtype		: 'textfield'			,id			: c.section + "reminder_subject"			,name		: 'reminder_message'			,fieldLabel	: 'Reminder'			,setFocus	: true			,anchor		: '95%'			,maxLength  : 350		}, {			 xtype		: 'htmleditor'			,id			: c.section + "reminder_desc"			,name		: 'reminder_notes'			,fieldLabel	: 'Notes'			,height		: 150			,width		: 470			,anchor		: '95%'			,enableLinks: false			,enableAlignments: false		},{			xtype		: 'checkbox'			,id			: c.section + 'reminderAsHTML'			,name		: 'reminder_evaluateAsHTML'			,checked	: true			,style		: 'display: none;'			,hidden     : true			,labelSeparator	: ''		}, {			xtype		: 'checkbox'			,id			: c.section + 'reminderPopup'			,name		: 'reminder_popup'			,boxLabel   : 'Popup Reminder'			,anchor		: '95%'			,labelSeparator	: ''		}, {			xtype		: 'checkbox'			,name		: 'reminderShowOnDesktop'			,boxLabel   : 'Show Reminder on Desktop'			,checked	: true			,labelSeparator	: ''			,anchor		: '95%'		}, {			xtype		: 'checkbox'			,id			: c.section + 'reminderSMS'			,name		: 'reminder_sms'			,boxLabel   : 'Send Text'			,labelSeparator	: ''			,anchor		: '95%'			,listeners	: {				check		: function(box, checked) {					if (checked) {						var sms = Eve.Preference.get('sms');						if (!sms || sms.trim() == '') {							// Uncheck							this.setValue(false);														Ext.Msg.show({								title	: 'SMS'								,msg	: 'Please add your phone number under "Settings > General Preferences" before activating this feature.'								,buttons: Ext.Msg.OK								,icon	: Ext.MessageBox.INFO							})						}					}				}			}		}, {			layout		: 'column'			,items		: [{				layout			: 'form'				,columnWidth	: .5				,items			: [{					xtype			: "checkbox"					,id				: c.section + 'UseEmail'					,name			: "use_email"					,boxLabel   	: 'Send E-Mail To:'					,anchor			: '95%'					,labelSeparator	: ''					,listeners		: {						check: function(t, checked) {							var cmp = Ext.getCmp(c.section + 'EmailChk');							if (checked) {								cmp.setValue(cmp._value);								cmp.enable();							}							else {								cmp._value = cmp.getValue();								cmp.setValue("");								cmp.disable();							}						}					}				}]			}, {				layout			: 'form'				,columnWidth	: .5				,items			: [{					 xtype			: 'combo'					,id				: c.section + 'EmailChk'					,hiddenName		: 'reminder_sendTo'					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,record			: 'item'					,lazyInit		: false					,hideLabel		: true					,typeAhead		: true					,editable		: true					,selectOnFocus 	: true					,validator		: Ext.form.VTypes.email					,triggerAction 	: 'all'					,anchor			: '88%'					,forceSelection : false					,store          : new Ext.data.Store({						 data	:[]						,fields	:[ 'text', 'value' ]						,reader	: new Ext.data.XmlReader({							record	: 'item'						}, [ 'text', 'value' ])					})				}]			}]		},{			layout			: 'column'			,style          : 'margin-top:3px'			,items			: [{				columnWidth	: .17				,items			: [{					 id				: c.section + 'associated_icon'					,anchor			: '99%'					,html           : ''					,style          : 'margin-left:75px'				}]			},{				columnWidth	: .7				,items			: [new Ext.ux.xLabel({					xtype			: "xlabel"					,id				: c.section + "associated"					,name			: "reminderAssociatedText"					,anchor			: '100%'					,text           : ''					,value          : ''				})]			}]		}]			}]	})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       ReminderDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */// RemindersEve.vc.createFormPanel( 'ReminderFormPanel'		,Eve.Dialogs.Reminder.ReminderFormPanel );Ext.override( Eve.vc.ReminderFormPanel, {		 loadEvent		: function(){ return 'modern.reminder.personal.edit'; }		,submitEvent	: function(){ return 'modern.reminder.personal.createModify'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\reminder/ReminderFactory.js *//*--------------------------------------------------*//** * Hyperoffice Reminders section based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.Reminder.Factory = function() {}Ext.extend( Eve.lib.Reminder.Factory, Eve.lib.Factory, {		section: 'reminder'			,createBefore : function(superbridge) {		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);	}	 	,createCenter: function(superbridge)	{		this.view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Reminder.GridBridge();		this.manager.registerComponents(bridge);				conn.setSection('Reminders');				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,manager	: this.manager		});				this.topBar = new Ext.Toolbar(bridge.getToolbar());				return { view: this.view, config: { layout: 'fit', tbar: this.topBar }  };	}		,createMenus : function(superbridge)	{		this.amenu = new Eve.widgets.ReminderAddMenu();		this.emenu = new Eve.widgets.ReminderEditMenu();				superbridge.addBridge([this.amenu, this.emenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}				this.emenu.init(data);		this.amenu.init(data);	}	,createDialogs : function(superbridge)	{		var reminderDlg = new Eve.lib.Reminder.ReminderDialogBridge();				superbridge.addBridge(reminderDlg);				reminderDlg.addPanel(new Eve.vc.ReminderFormPanel());		reminderDlg.init({			superbridge		: superbridge			,section		: this.section			,origin			: 'item'			,reminderType	: 'absolute'		});	}	 	 	,createRest : function(superbridge)	{			// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\reminder/ReminderGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Reminders section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Reminder.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge, {	gridSection : 'reminder'	,getToolbar : function() {return this.toolbar}		,getTitle   : function(rec) {return rec.data.reminder}		,initLocalVars : function() {		this.fields = [			 {name : 'reminder'				, type : 'string'}			,{name : 'type'			   		, type : 'string'}			,{name : 'reminderDate'	   		, type : 'string'}			,{name : 'reminderType'	   		, type : 'string'}			,{name : 'reminderShowOnDesktop' 	, type : 'string'}			,{name : 'reminderSMSSent' 		, type : 'string'}			,{name : 'reminderEmailSent' 		, type : 'string'}			,{name : 'reminderPopupSent' 		, type : 'string'}			,{name : 'reminderHasRecurrence'	, type : 'string'}			,{name : 'reminderNotes'			, type : 'string'}			,{name : 'created' 				, type : 'string'}			,{name : 'lastModified' 			, type : 'string'}			,{name : 'reminderAssociated' 		, type : 'string'}			,{name : 'editPermission'			, type : 'boolean'}			,{name : 'deletePermission'		, type : 'boolean'}			,{name: '_index'					,type: 'int' , mapping: 'index'}			,{name: 'createdBy'		,type: 'string'}			,{name: 'createdDate'		,type: 'string'}			,{name: 'lastModifiedBy'	,type: 'string'}			,{name: 'lastModifiedDate' ,type: 'string'}		];				this.reader = new Ext.data.XmlReader({			id			: 'id'			,record		: 'row'			,totalRecords: 'total' 		}, Ext.data.Record.create(this.fields));						this.deskCheck = new Ext.grid.CheckColumn({			 header			: 'Show On Desktop'			,dataIndex		: 'reminderShowOnDesktop'			,width			: 100			,editable 		: true			,align		: 'center'			,renderer       : this.checkboxRenderer()		});				this.deskCheck.on('click', function (element, e, record) {			if(record.editPermission !== false) this.grid.fireEvent('afteredit')		});			this.popupCheck = new Ext.grid.CheckColumn({			 header			: 'Show Popup'			,sortable    	: false			,dataIndex		: 'reminderPopupSent'			,width			: 80			,editable 		: true			,align		: 'center'			,renderer		: this.checkboxRenderer()		});				this.popupCheck.on('click', function (element, e, record) {			if(record.editPermission !== false) this.grid.fireEvent('afteredit')		});		this.smsCheck = new Ext.grid.CheckColumn({			 header			: 'Send Text'			,sortable    	: false			,dataIndex		: 'reminderSMSSent'			,width			: 80			,editable 		: true			,align			: 'center'			,renderer		: this.checkboxRenderer()		});		this.smsCheck.on('click', function (el, e, record, checked) {			if (checked) {				var sms = Eve.Preference.get('sms');				if (!sms || sms.trim() == '') {					Ext.Msg.show({						title	: 'SMS'						,msg	: 'Please add your phone number under "Settings > General Preferences" before activating this feature.'						,buttons: Ext.Msg.OK						,icon	: Ext.MessageBox.INFO					})					record.set(this.dataIndex, false);					this.grid.getStore().rejectChanges();					return;				}			}			if (record.editPermission !== false) this.grid.fireEvent('afteredit');		});			this.mailCheck = new Ext.grid.CheckColumn({			 header			: 'Send Email'			,sortable    	: false			,dataIndex		: 'reminderEmailSent'			,width			: 80			,editable 		: true			,align		: 'center'			,renderer		: this.checkboxRenderer()		});				this.mailCheck.on('click', function (element, e, record) {			if (record.editPermission !== false) this.grid.fireEvent('afteredit')		});				this.rowExpander = new Ext.grid.RowExpander({			dataIndex	: ""			,fieldName	: "type"			,enableCaching : false 			,tpl		: new Ext.Template(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td><b>{reminder}</b></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="32px" height="32px" src="' + Eve.Resource.getIcon('item-reminder','reminder') + '" />',						'</div>',						'<div style="float:left; position:relative;line-height:normal;" class="row-expander-desc">',							'{reminderNotes}<br />{reminderAssociated}',						'</div>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 "</tr>",				 '</table>'			)		});				// Column Model		this.columns = new Ext.grid.ColumnModel([this.rowExpander, {			 header		: '<img src="' + Eve.Resource.getIcon('item-reminder','reminder') + '" />'			,dataIndex	: 'type'			,width		: 30			,renderer 	: function(value) {				return '<img src="' + Eve.Resource.getIcon('item-reminder','reminder')	+ '" />'			}		}, {			 header		: 'Reminder'			,dataIndex	: 'reminder'			,width		: 350			,sortable	: true			,editor		: new Ext.form.TextField( {allowBlank : false} )		}, {			 header		: 'Date / Time'			,dataIndex	: 'reminderDate'			,sortable	: true			,width		: 110		}/*, {			 header		: 'Type'			,dataIndex	: 'reminderType'			,width		: 80			,align		: 'center'			,renderer	: function(val) {				return "<center>" + val + "</center>";			}		}*/		,this.deskCheck		,this.popupCheck		,this.smsCheck		,this.mailCheck, {			 header		: '<img src="' + Eve.Resource.getIcon('recurring','reminder') + '" />'			,dataIndex	: 'reminderHasRecurrence'			,width		: 30			,sortable	: false			,renderer 	: function(value) {				var src = "";				var val = value.toLowerCase();								if (val == '1' || val == 'yes' || val == 'true')					src = '<img src="' + Eve.Resource.getIcon('recurring','reminder') + '" />';				else					src = "";								return src;			}		},{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);				this.toolbar = {			items: [{				 text 	: 'New'				,cls 	: 'x-btn-text-icon'				,icon	: Eve.Resource.getIcon('new', 'general')				,handler: function() {					var data = {						info	: {							id			: 0							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path						}					}										this.fire( 'reminder_create_item_dlg', data);				}				,scope	: this			}, {				 text	: "Edit"				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('edit', 'general')				,handler: function() {					var rec = this.view.get().getSelectionModel().getSelected();										if (rec) {						var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path							}							,title	: this.getRowTitle(rec)						}												this.fire("reminder_edit_item_dlg", data);					}				}				,scope	: this			}, {				 text	: "Delete"				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('delete', 'general')				,handler: this.deleteHdl				,scope	: this			}, '-', {				 text 	: "Print"				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('print', 'general')				,handler: function() {					var info = {							id			: this.id		// Id of current tree node.							,groupId	: this.groupId							,root		: this.root							,path		: this.path							,start		: this.view.get().store.lastOptions.params.start						}					this.fire("reminder_print_folder", {info: info});				}				,scope	: this			}		]}	}		,init : function(obj)	{		Eve.widgets.Reminder.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();				this.conn.init( this.reader );		var view  = new Ext.grid.GridView({	        handleHdDown : function(e, t){				if( Ext.fly(t).hasClass('x-grid3-hd-btn') ) {					e.stopEvent();					var hd = this.findHeaderCell(t);					Ext.fly(hd).addClass('x-grid3-hd-menu-open');					var index = this.getCellIndex(hd);					this.hdCtxIndex = index;					var ms = this.hmenu.items, cm = this.cm;					if(cm.isSortable(index)){						ms.get("asc").show();						ms.get("desc").show();						ms.itemAt(2).show()					}					else{						ms.get("asc").hide();						ms.get("desc").hide();						ms.itemAt(2).hide();					}					//ms.get("asc").setDisabled(!cm.isSortable(index));					//ms.get("desc").setDisabled(!cm.isSortable(index));					this.hmenu.on("hide", function(){						Ext.fly(hd).removeClass('x-grid3-hd-menu-open');					}, this, {single:true});					this.hmenu.show(t, "tl-bl?");				}	    	}		});		this.view.init({			id 				: 'reminder_grid'			,view           : view			,ds 			: this.conn.getStore()			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				pageSize		: Eve.Preference.getInteger("itemsperpage")				,store			: this.conn.getStore()				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Reminders'			})			,plugins		: [ this.rowExpander, this.deskCheck, this.popupCheck, this.smsCheck, this.mailCheck]			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20				,autoFill           : false				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,keys			: this.getKeyMap()		});				this.registerView();	}		,registerView : function()	{		Eve.widgets.Reminder.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();			grid.on('render', function() {			grid.getStore().setDefaultSort('reminderDate', "ASC");			/*this.fire('reminder_set_active_node',				{ info:{ id: 0, path: '\\' }, header: 'reminders'}, true);*/					}, this);						// - - - - - - - - - - - - - - - - - -		// Handle Task Double Click		// - - - - - - - - - - - - - - - - - -		grid.on('rowdblclick', function(el, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx)				if (rec) {					var type = rec.data.type;					var info = {					   id		: rec.id.split("_")[1]					  ,parentId : this.id					  ,groupId	: this.groupId					  ,root		: this.root					  ,path		: this.path					  ,typeId	: Eve.Resource.getTypeId(this.root, type, this.section)					  ,reminderId: rec.data.reminderId					}					if ( type == "folder" )									this.fire("reminder_activate_child_node", {info: info} );					else						this.fire("reminder_edit_" + type + "_dlg", {info: info, title: this.getRowTitle(rec)} );				}		}, this);						//--------------------------------------		//  Handle Icon Click		//--------------------------------------		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm 	= grid.colModel;			if ( colIdx != 1 ) {				return;			}			var rec	 = grid.getStore().getAt(rowIdx)			if (rec) {				var type = rec.data.type;				var info = {				   id		: rec.id.split("_")[1]				  ,parentId : this.id				  ,groupId	: this.groupId				  ,root		: this.root				  ,path		: this.path				  ,typeId	: Eve.Resource.getTypeId(this.root, type, this.section)				  ,reminderId: rec.data.reminderId				}				this.fire("reminder_edit_" + type + "_dlg", {info: info, title: this.getRowTitle(rec)} );			}		}, this);	}		,checkboxRenderer :function(){		return function(v, p, record) {			if (v == '1' || v == 'true' || v == true) {				v = '1';			}			else if (v == '0' || v == 'false' || v == false) {				v = '0';			}			else if (v == 'Sent') {				v = 'Sent';				this.editable = false				return v;			}			this.editable = true;			//the +v type converts to a number (json returns a string			//which always evaluates true)			var checkState = (+v) ? '-on' : '';			p.css += ' x-grid3-check-col-td';			return '<div class="grid-checkbox'+ checkState +' x-grid3-cc-' + this.id + '">&nbsp;</div>';		}	}	,setPrintIcons: function(records){		var v;		for (var i = 0, len = records.length; i < len; i++) {			v = records[i].data.reminderShowOnDesktop;			if( v == "true" || v== true || v== "1" ){				records[i].data.reminderShowOnDesktop =["<img src='", Eve.Resource.getIcon('checked', 'general'), "' width=16>"].join('');			}			else{				records[i].data.reminderShowOnDesktop = "";			}			v = records[i].data.reminderEmailSent;			if( v == "true" || v== true || v== "1" ){				records[i].data.reminderEmailSent =["<img src='", Eve.Resource.getIcon('checked', 'general'), "' width=16>"].join('');			}			else{				records[i].data.reminderEmailSent = "";			}			v = records[i].data.reminderPopupSent;			if( v == "true" || v== true || v== "1" ){				records[i].data.reminderPopupSent =["<img src='", Eve.Resource.getIcon('checked', 'general'), "' width=16>"].join('');			}			else{				records[i].data.reminderPopupSent = "";			}			v = records[i].data.reminderHasRecurrence;			if( v == "true" || v== true || v== "1" ){				records[i].data.reminderHasRecurrence =["<img src='", Eve.Resource.getIcon('recurring', 'reminder'), "' width=16>"].join('');			}			else{				records[i].data.reminderHasRecurrence = "";			}		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\reminder/ReminderMenu.js *//*--------------------------------------------------*//** * Hyperoffice Reminder section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */  // -----------------------------------------------------------------------// Reminder Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.ReminderEditMenu = Ext.extend( Eve.widgets.BaseEditMenu, {	init : function(data)	{		Eve.widgets.ReminderEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Reminder Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.ReminderAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.ReminderAddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{					text	: "New Reminder"					,id		: 'item'					,icon	: Eve.Resource.getIcon('item-new','reminder')				}]		});		this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\reminder/ReminderDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Reminders section based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.Reminder.ReminderDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Reminder.ReminderDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			width 	: 600			,height : 450			,title	: 'Reminder'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,onDialogShow : function()	{		Eve.lib.Reminder.ReminderDialogBridge.superclass.onDialogShow.apply(this, arguments);				if (this.mode == 'create') {			Ext.getCmp(this.section + 'relativeMinutes').setValue(0);			Ext.getCmp(this.section + 'rel_time').hide();			Ext.getCmp(this.section + 'abs_time').show();					Ext.getCmp(this.section + 'associated_icon').el.innerHTML = '';			Ext.getCmp(this.section + "associated").el.innerHTML = '';						var dt = new Date();			Ext.getCmp(this.section + 'reminder_date').setValue(dt);			Ext.getCmp(this.section + 'reminder_time').setValue(dt);						Ext.getCmp(this.section + 'UseEmail').setValue(false);			Ext.getCmp(this.section + 'reminderAsHTML').setValue(true);			Ext.getCmp(this.section + 'reminderPopup').setValue(false);		}	}		,augment : function(callee)	{		var obj = callee.params;				if (this.mode == 'edit') {			obj.id			= this.id;			obj.standalone	= 1;		}				if (this.root == 'group') {			obj.groupId = this.groupId;		}				obj.parentId = this.parentId;		obj.path	 = this.path;		return callee;	}		,setCmpValue : function()	{		var chkSendTo = Ext.getCmp(this.section + "UseEmail");		var txtEmail  = Ext.getCmp(this.section + "EmailChk");				// If its not checked.		if (!chkSendTo.getValue()) {			txtEmail._value = txtEmail.value;			txtEmail.setValue();			txtEmail.disable();		}	}		,controller : function(obj)	{			this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;				this.panels[0].reset();				this.dialog.show();	}		,execute : function(callee, type, data)	{		switch (type) {			case 'reminder_edit_item_dlg':				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;							case 'reminder_create_item_dlg':				this.mode = 'create';				this.controller(data);								if (! this.isCached()) {					this.loadForm(0);				}								break;		}	}		,loadSuccess : function(res)	{		var dq = Ext.DomQuery;        var relative = dq.selectValue('relative', res.responseXML);		var relCmp = Ext.getCmp(this.section + 'rel_time');		var absCmp = Ext.getCmp(this.section + 'abs_time');		var imageEl = Ext.getCmp(this.section + 'associated_icon').el;		var iconType = dq.selectValue('reminderAssociatedType', res.responseXML);				if (iconType != "" && iconType !== undefined) {			if(iconType == "calendaritem")				imageEl.dom.innerHTML = '<img src="'+Eve.Resource.getIcon('item-event', 'calendar')+'">';			else if (iconType == "task")				imageEl.dom.innerHTML = '<img src="'+Eve.Resource.getIcon('item-task', 'task')+'">';		} else {		    imageEl.dom.innerHTML = "";		}		        if(relative == '1') {			relCmp.show();			absCmp.hide();        } else {			relCmp.hide();			absCmp.show();        }		 		this.dialog.doLayout();	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue('code', xml);				var info = {			id 			: dq.selectValue('id', xml).split("_")[1]			,rawId		: dq.selectValue('id', xml)			,xml		: xml		}				if (code == '0') {			var type = (obj.id == 0 || obj.id === undefined) ? ("reminder_success_create_item") : ("reminder_success_modify_item");			this.fire(type, { info: info, params: obj });		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\task/TaskDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Tasks section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *	START: Stores */ Eve.Dialogs.Task.statusStore = new Ext.data.SimpleStore({	fields : ['status', 'statusText'],	data : [		 ['1', 'Not Begun']		,['2', 'In Progress']		,['3', 'Complete']		,['4', 'Waiting on someone else']		,['5', 'Suspended']	]});Eve.Dialogs.Task.priorityStore = new Ext.data.SimpleStore({	fields : ['priority', 'priorityText'],	data : [		 ['1', 'High']		,['2', 'Normal']		,['3', 'Low']	]});Eve.Dialogs.Task.completeStore = new Ext.data.SimpleStore({	fields : ['value', 'text'],	data : [		['1', 'All']		,['2', 'Yes']		,['3', 'No']	]});Eve.Dialogs.Task.statusStore2 = new Ext.data.SimpleStore({	fields : ['status', 'statusText'],	data : [		['1', 'All']		,['2', 'Not Begun']		,['3', 'In Progress']		,['4', 'Complete']		,['5', 'Waiting on someone else']		,['6', 'Suspended']	]});Eve.Dialogs.Task.priorityStore2 = new Ext.data.SimpleStore({	fields : ['priority', 'priorityText'],	data : [		['1', 'All']		,['2', 'High']		,['3', 'Normal']		,['4', 'Low']	]});Eve.Dialogs.Task.notifyAssignee = new Ext.data.SimpleStore({	fields : ['value', 'text'],	data : [		['0' , 'Request Task Acceptance']		,['3', 'Assign and notify']		,['4', 'Assigned without notification']	]});/* *	END: Stores used by forms.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ Eve.Dialogs.Task.itemAssignee = function(c) {	return new Eve.FormPanel({		labelAlign	: 'left'		,frame 		: true		,bodyStyle	: 'padding: 5px 5px 0'		,width		: 600		,height     : 500		,items		: [{			layout  	: 'column'			,items		: [{				columnWidth : .84				,style		: 'border: 1px solid; height: 20px;"'				,items		: [{					name		: 'subscribed'					,id			: c.section + 'sub_state'					,html       : '<div style="height:20px;background-color: #FFFFAB;padding-top: 3px;">'								 +' <span style="padding-left: 3px;font-weight:600">You are not currently subscribed to this task</span></div>'				}]			}, {				columnWidth : .16				,style 		: 'margin-left:5px'				,items      : [{					xtype         	: 'xbutton'					,id             : c.section + 'btn_sub'					,text 			: 'Subscribe'					,hideLabel      : true					,name          	: 'subscribed'					,minWidth       : 79					,enableToggle 	: true					,toggleHandler  : function(btn, pressed) {						var subscription = Ext.getCmp(c.section + 'sub_state');						if (pressed == true){							btn.setText ('Unsubscribe');							var str = '<div style="height:20px;background-color: #A5DE63;padding-top: 3px;">'						              +'<span style="padding-left: 3px;font-weight:600">You are currently  subscribed to this task</span></div>';							subscription.getEl().dom.innerHTML = str;						} else {							btn.setText('Subscribe');							var str = '<div style="height:20px;background-color: #FFFFAB;padding-top: 3px;">'					                 +' <span style="padding-left: 3px;font-weight:600">You are not currently subscribed to this task</span></div>';							subscription.getEl().dom.innerHTML = str;						}					}					,scope : this				}]					,scope  : this			}]		}, {			html	: '<hr>'			,style	: 'margin-bottom:5px;margin-top:5px;'		}, {			layout	: 'column'			,items  : [{		        columnWidth : .45		       ,layout		: 'form'		       ,labelPad	: -25		       ,items 		: [{					xtype			: 'combo'					,id				: c.section + 'group_members'					,hiddenName		: 'unAssignees'					,fieldLabel 	: 'Assign To'					,valueField		: 'id'					,displayField	: 'title'					,labelStyle 	: 'width: 70px'    				,typeAhead		: true					,labelSeparator : ''					,lazyInit		: false					,forceSelection : false					,anchor 		: '98%'				}]     		}, {		        columnWidth	: .45		       ,layout		: 'form'		       ,labelPad	: -25		       ,items		: [{					xtype			: 'combo'					,xxtype			: 'combo'					,id				: c.section + 'assignee'					,hiddenName		: 'assigneeState'					,mode			: 'local'					,fieldLabel 	: 'Assignees'					,store          : Eve.Dialogs.Task.notifyAssignee					,lazyInit		: false					,valueField		: 'value'					,value          : 0					,displayField	: 'text'					,labelStyle 	: 'width: 70px'					,labelSeparator : ''					,typeAhead		: true					,editable 		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '98%'				}]     		}, {				columnWidth	: .1				,items		: [{					xtype		: 'button'					,id			: c.section + 'btn_add_assign'					,text		: 'Add'					,minWidth	: 55					,handler	: function() {						Eve.Resource.superbridge.broadcast(this,'task_add_assignee', {id:this.id});					}					,scope : this				}]     		}]	 	}, new Ext.Panel({			width 		: '580'			,height		: 180			,border		: true			,autoScroll : true			,style		: 'margin-top: 15px; background-color:#FFF;margin-bottom:5px;border:1px solid;border-top:none;'			,items		: [{				html : 	'<div style="" width:542px" class="task-gray-header">'							+'<div style="width:250px;float:left">Assignee</div>'							+'<div style="width:200px;float:left" >Status</div>'							+'<div  style="width:80px;"></div><div style="clear:both"></div>'						+'</div>'			}, {				xtype 	: 'xdataview'				,name 	: 'assignees'				,id		: c.section + 'assignee_dv'				,height	: 155				,store 	: new Ext.data.Store({					reader 	: new Ext.data.XmlReader({						record 	: 'row'						,id		: 'id'					}, ['id', 'title', 'assignedState', 'assignedStateText'])				})			   ,field		: ['id', 'assignedState']			   ,emptyText 	: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>'			   ,tpl   		: new Ext.XTemplate(					'<div style="float:left;width:250px">',					'<div style="height:3px">&nbsp;</div>',						'<div style="padding:5px;line-height: 18px "><tpl for="."><tpl for=".">{title}<br></tpl></tpl></div>',					'</div>',					'<div style="float:left;width:200px">',					'<div style="height:3px">&nbsp;</div>',						'<div  id="status_wrapper" style="padding:5px;line-height: 18px ;" >',						'<tpl for="."><tpl for=".">{assignedStateText}<br></tpl></tpl></div>',					'</div>',					'<div style="float:left;width:80px;text-align:center">',						'<div style="height:3px">&nbsp;</div>',						'<div style="padding:5px;">',							'<tpl for="."><tpl for=".">',							'<img src="' + Eve.Resource.getIcon('delete', 'general') + '" style="*_padding-bottom:2px" ',							'onclick="Eve.Resource.superbridge.broadcast(this,\'task_delete_assignee\',{info: {value: {id}, text:\'{[this.getTitle(values.title)]}\'}})">',							'<br></tpl></tpl>',						'</div>',					'</div>',				{					getTitle: function(title){						return String.escape(title);					}				})				,itemSelector : 'div.search-item'		   }]		})]	})};/* *	END: ITEM ASSIGNEE  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *	START: ITEM DETAILS */Eve.Dialogs.Task.itemDetails = function(c) {	var section = c.section;	// Custom Validators	var customVTypes = {};		// ToDo: Majid... it should be moved to the submit, not as a single common validator. 	customVTypes[section + "_ItemDateText"] = 'Due Date must be later than Start Date';	customVTypes[section + "_ItemDate"]  = function(val) {				var startDate	= Ext.getCmp(c.section + 'itm_startdate').getValue();		var dueDate	= Ext.getCmp(c.section + 'itm_duedate').getValue();		if (startDate == '' || dueDate == '' )			return true;					if (startDate > dueDate)			return false				return true;	}		// Apply custom validators to Ext VTypes	Ext.apply(Ext.form.VTypes, customVTypes);		return new Eve.FormPanel({		labelWidth		: 70		,id             : c.section + 'detail'		,frame			: false		,bodyStyle		: 'padding: 5px 5px 0'		,width			: 600		,waitMsgTarget	: true		,items 			: [{			xtype			: 'textfield'			,fieldLabel 	: 'Subject'			,id         	: c.section + 'subject'			,name 			: 'title'			,allowBlank 	: false			,setFocus		: true			,anchor 		: '95%'			,listeners		: {				change	: function(cmp, newVal, oldVal) {					var subReminder = Ext.getCmp(c.section + 'reminder_subject');					// Only change if reminder's subject ain't touched.					if (oldVal == subReminder.getValue()) {						subReminder.setValue(newVal);					}				}			}		}, {			xtype			: 'htmleditor'			,id         	: c.section + 'desc'			,fieldLabel		: 'Description'			,name			: 'notes'			,height			: 200			,enableLinks	: false			,enableAlignments: false			,anchor			: '95%'		}, {			xtype			: 'checkbox'			,id				: c.section + 'evaluateAsHTML'			,name			: 'evaluateAsHTML'			,checked		: true			,hideLabel		: true			,hidden         : true			,style			: 'display: none;'		}, {			layout			: 'column'			,style 			: 'margin-left:80px; margin-top:2px'			,items 			: [{				columnWidth		: .5				,layout			: 'form'				,items			: [{					xtype			: 'datefield'					,id				: c.section + 'itm_startdate'					,fieldLabel 	: 'Start Date'					,name			: 'startDate'					,format			: Eve.Preference.get('dateFormat')					,vtype			: c.section + '_ItemDate'					,validateOnBlur	: false					,anchor			: '90%'				}, {					xtype			: 'datefield'					,id				: c.section + 'itm_duedate'					,fieldLabel		: 'Due Date'					,name			: 'dueDate'					,format 		: Eve.Preference.get('dateFormat')					,vtype			: c.section + '_ItemDate'					,validateOnBlur	: false					,anchor			: '90%'					,onTriggerClick : function(){						if(this.disabled){							return;						}						if(this.menu == null){							this.menu = new Ext.menu.DateMenu();						}						Ext.apply(this.menu.picker,  {							minDate : this.minValue,							maxDate : this.maxValue,							disabledDatesRE : this.disabledDatesRE,							disabledDatesText : this.disabledDatesText,							disabledDays : this.disabledDays,							disabledDaysText : this.disabledDaysText,							format : this.format,							showToday : this.showToday,							minText : String.format(this.minText, this.formatDate(this.minValue)),							maxText : String.format(this.maxText, this.formatDate(this.maxValue))						});						this.menu.on(Ext.apply({}, this.menuListeners, {							scope:this						}));						if(Ext.getCmp(c.section+'itm_startdate').getValue() != "" && this.getValue()== "")							this.menu.picker.setValue(Ext.getCmp(c.section+'itm_startdate').getValue());						else							this.menu.picker.setValue(this.getValue() || new Date());						this.menu.show(this.el, "tl-bl?");					}				}			]			}, {				columnWidth 	: .5				,layout			: 'form'				,items			: [{					xtype			: 'datefield'					,format 		: Eve.Preference.get('dateFormat')					,id         	: c.section + 'itm_finishdate'					,fieldLabel		: 'Finish Date'					,name			: 'finishDate'					,anchor			: '88%'				}]			}]		}, {			html	: "<hr style='color:#E2E2E2; background-color:#B4B4B4; border-bottom:2px solid #fff; height:1px; margin:10px 80px; width:450px'/>"		}, {			layout	: 'column'			,style	: 'margin-left:80px; margin-top:2px'			,items	: [{				columnWidth	: .5				,layout		: 'form'				,items 		: [{					xtype			: 'combo'					,xxtype			: 'combo'					,store			: Eve.Dialogs.Task.statusStore					,mode			: 'local'					,id             : c.section + 'item_status'					,valueField		: 'status'					,displayField	: 'statusText'					,value			: '1'					,fieldLabel		: 'Status'					,hiddenName		: 'status'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'				}, {					xtype			: 'combo'					,xxtype			: 'combo'					,store			: Eve.Dialogs.Task.priorityStore					,mode			: 'local'					,valueField		: 'priority'					,displayField 	: 'priorityText'					,value			: '2'					,fieldLabel 	: 'Priority'					,hiddenName 	: 'priority'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'				}			]		},{			columnWidth	: .5  			,layout		: 'form'			,items 		: [				new Ext.ux.form.Spinner({                fieldLabel	: '%Complete'            	,id         : c.section + 'item_spinner'                ,value      : 0                ,name: 'percentCompleted'                ,strategy: new Ext.ux.form.Spinner.NumberStrategy({minValue:'0', maxValue:'100',incrementValue: 5})                ,width  :60                ,maxLength : 3            }), {				xtype			: 'checkbox'				,fieldLabel		: 'Milestone'          		,name			: 'milestone'          		,style    		: 'margin-top:5px'            }]      }]	}/*,{		layout	: 'form'		,id		: c.section + 'item_set_reminder'		,items	: [{			xtype			: 'checkbox'			,name			: 'use_reminder'			,id				: c.section + 'btnReminder'			,enableKeyEvent : true			,boxLabel		: 'Reminder'			,style			: "margin-left:105px;"			,labelSeparator : ''		}]	}*/]})};/* *	END: ITEM DETAILS * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **  START: ITEM RECURRENCE*/Eve.Dialogs.Task.itemRecurrence = function(c){	return new Eve.FormPanel({		labelWidth		: 70		//,id             : c.section + 'detail'		,frame			: false		,bodyStyle		: 'padding: 5px 5px 0'		,width			: 630		,waitMsgTarget	: true		,items 			: [{			layout		: 'form'			,id			: c.section + 'frmRecurrence'			//,hidden		: true			,items		: [{				xtype		: 'fieldset'				,title		: 'Recurrence pattern'				,autoHeight	: true				,items		: [{					layout		: 'column'					,items		: [{						columnWidth: .255						,layout		: 'form'						,id			: c.section + 'frmPeriodRadios'						,style		: 'border-right: 1px solid #B5B8C8;'						,items		: [{							xtype		: 'radio'							,boxLabel	: 'None'							,name		: 'typeParent'							,inputValue	: '0'							,checked	: true							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Daily'							,name		: 'typeParent'							,inputValue	: '1'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Weekly'							,name		: 'typeParent'							,inputValue	: '2'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Monthly'							,name		: 'typeParent'							,inputValue	: '3'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Yearly'							,name		: 'typeParent'							,inputValue	: '4'							,hideLabel	: true							,anchor		: '98%'						}]					}, {						columnWidth: .745						,layout		: 'form'						,id			: c.section + 'frmPeriodView'						,style		: 'margin:10px;'						,items		: [{							layout		: 'form'							,hidden		: true							,items		: [{								html		: 'No Recurrence'							}]						}, { // Daily							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .16									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'dailyRadio1'										,name		: 'typeChild1'										,boxLabel	: 'Every'										,inputValue	: '1'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'dailyJumpAmount'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var d	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(1);											var ds1	= Ext.getCmp(c.section + 'dailyRadio1');											if (d.checked && ds1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .5									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'day(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}/*, {								xtype		: 'radio'								,name		: 'typeChild1'								,boxLabel	: 'Every weekday'								,inputValue	: '1'								,hideLabel	: true							}*/]						}, { // Weekly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth: .3									,layout		: 'form'									,labelWidth	: 70									,items		: [{										xtype			: 'numberfield'										,fieldLabel		: 'Recur every'										,name			: 'weeklyJumpAmount'										,value			: 1										,anchor			: '100%'										,labelSeparator	: ''										,validate		: function() {											var w = Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(2);											if (w.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .5									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'Week(s) on:'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}, {								xtype			: 'checkboxgroup'								,id				: c.section + 'weekDaysMask'								,hiddenName		: 'weekDaysMask'								,name			: 'weekDaysMask'								,columns		: 4								,hideLabel		: true								,columns		: [110, 110, 110, 110]								,items			: [{									boxLabel		: 'Sunday'									,name			: 'weekDaysMask'									,inputValue		: '0'								}, {									boxLabel		: 'Monday'									,name			: 'weekDaysMask'									,inputValue		: '1'								}, {									boxLabel		: 'Tuesday'									,name			: 'weekDaysMask'									,inputValue		: '2'								}, {									boxLabel		: 'Wednesday'									,name			: 'weekDaysMask'									,inputValue		: '3'								}, {									boxLabel		: 'Thursday'									,name			: 'weekDaysMask'									,inputValue		: '4'								}, {									boxLabel		: 'Friday'									,name			: 'weekDaysMask'									,inputValue		: '5'								}, {									boxLabel		: 'Saturday'									,name			: 'weekDaysMask'									,inputValue		: '6'								}]								,validate		: function() {									var w 		= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(2);									var retVal	= false;									if (w.checked) {										this.items.each( function(el) {											// At least one checkbox should be checked!											if (el.checked) {												retVal = true;												return;											}										})										if (! retVal) {											this.markInvalid(this.blankText)											return false;										}									}									// In case of previously marked as invalid.									this.clearInvalid()									return true;								}							}]						}, { // Monthly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'MonthlyRadio1'										,name		: 'typeChild3'										,boxLabel	: 'Day'										,inputValue	: '1'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,id				: c.section + 'DayInMonthnth'										,name			: 'DayInMonthnth'										,hideLabel		: true										,anchor			: '98%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio1');											if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .15									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of every'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'jumpAmountMonthnth'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio1');											if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .25									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'month(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}, {								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'MonthlyRadio2'										,name		: 'typeChild3'										,inputValue	: '2'										,boxLabel	: 'The'										,hideLabel	: true									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'instanceOfDayInMonthMonthly'										,hiddenName		: 'instanceOfDayInMonthMonthly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'First'], ['2', 'Second'], ['3', 'Third'], ['4', 'Fourth'], ['5', 'Last'] ]										})										,value			: '1'									}]								}, {									columnWidth: .22									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'dayOfWeekMonthly'										,hiddenName		: 'dayOfWeekMonthly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '100%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'Sunday'], ['2', 'Monday'], ['3', 'Tuesday'], ['4', 'Wednesday'], ['5', 'Thursday'], ['6', 'Friday'], ['7', 'Saturday'] ]										})										,value			: '1'									}]								}, {									columnWidth: .15									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of every'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'jumpAmountMonthly'										,value			: 1										,hideLabel		: true										,anchor			: '98%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio2');											if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'month(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}]						}, { // Yearly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .15									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'YearlyRadio1'										,name		: 'typeChild4'										,inputValue	: '1'										,boxLabel	: 'Every'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .21									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'specificMonthYearnth'										,hiddenName		: 'specificMonthYearnth'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'January'], ['2', 'Febraury'], ['3', 'March'], ['4', 'April'], ['5', 'May'], ['6', 'June'], ['7', 'July'], ['8', 'August'], ['9', 'September'], ['10', 'October'], ['11', 'November'], ['12', 'December'] ]										})										,value			: '1'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'dayInMonthYearnth'										,id				: c.section + 'dayInMonthYearnth'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var y	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(4);											var ys1	= Ext.getCmp(c.section + 'YearlyRadio1');											if (y.checked && ys1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}											// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}]							}, {								layout		: 'column'								,items		: [{									columnWidth	: .15									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,name		: 'typeChild4'										,inputValue	: '2'										,boxLabel	: 'The'										,hideLabel	: true									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'instanceOfDayInMonthYearly'										,hiddenName		: 'instanceOfDayInMonthYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'First'], ['2', 'Second'], ['3', 'Third'], ['4', 'Fourth'], ['5', 'Last'] ]										})										,value			: '1'									}]								}, {									columnWidth: .22									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'dayOfWeekYearly'										,hiddenName		: 'dayOfWeekYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '100%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'Sunday'], ['2', 'Monday'], ['3', 'Tuesday'], ['4', 'Wednesday'], ['5', 'Thursday'], ['6', 'Friday'], ['7', 'Saturday'] ]										})										,value			: '1'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .21									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'specificMonthYearly'										,hiddenName		: 'specificMonthYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'January'], ['2', 'Febraury'], ['3', 'March'], ['4', 'April'], ['5', 'May'], ['6', 'June'], ['7', 'July'], ['8', 'August'], ['9', 'September'], ['10', 'October'], ['11', 'November'], ['12', 'December'] ]										})										,value			: '1'									}]								}]							}]						}]					}]				}]			}, {				xtype		: 'fieldset'				,title		: 'Ends on'				,autoHeight	: true				,height		: 200				,items		: [{					xtype		: 'radio'					,name		: 'noenddate'					,inputValue	: '1'					,boxLabel	: 'No end date'					,checked	: true					,hideLabel	: true				}, {					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: .3						,items		: [{							xtype		: 'radio'							,id			: c.section + 'NoEndDate'							,name		: 'noenddate'							,inputValue	: '0'							,boxLabel	: 'End by'							,hideLabel	: true							,anchor		: '90%'						}]					}, {						layout		: 'form'						,columnWidth: .3						,items		: [{							xtype		: 'datefield'							,name		: 'dateEndBy'							,format		: Eve.Preference.get('dateFormat')//'n/j/Y'							,hideLabel	: true							,anchor		: '100%'							,validate		: function() {								var ned = Ext.getCmp(c.section + 'NoEndDate');								if (ned.checked) {									if (this.getValue() == '') {										this.markInvalid(this.blankText)										return false;									}								}								// In case of previously marked as invalid.								this.clearInvalid()								return true;							}						}]					}]				}]			}]		}]	})}/* *	END: ITEM RECURRENCE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *	START: ITEM DEPENBENCY LIST */Eve.Dialogs.Task.itemDependency = function(c){	return new Eve.FormPanel({		labelWidth		: 70		,frame			: false		,bodyStyle		: 'padding: 5px 5px 0'		,width			: 630		,waitMsgTarget	: true		,items 			: [{			layout		: 'form'			,id			: c.section + 'frmDependency'			,items		:[				{				xtype:'fieldset'				,title: 'This task is a successor to the following tasks:'				,collapsible: true				,autoHeight:true				,items: [{				xtype			: 'panel'				,border			: true				,autoScroll		: true				,height			: 130				,cls			: 'ev-dataview-ct'				,items			: [{					html : 	'<div class="x-grid3-header task-dependency-header">'								+ '<div style="width:118px;float:left;">Subject</div>'								+ '<div style="width:110px;float:left" >Status</div>'								+ '<div style="width:90px;float:left" >Start Date</div>'								+ '<div style="width:90px;float:left" >Due Date</div>'								+ '<div style="width:90px;float:left" >Type<img style="padding-left:50px;position:absolute;top:1px;height: 19px;" src="'+Eve.Resource.getIcon('lamp-off', 'general')+'" id="dep_type_tip"></div>'								+ '<div style="width:34px;float:left" >&nbsp;</div>'								+ '<div style="clear:both"></div>'							+ '</div>'					,listeners:{							render : function(cmp){																cmp.createTip(cmp);                            }						}					,createTip : function(cmp){								try{								new Ext.ToolTip({                                    target	: 'dep_type_tip',                                    width	: 460,                                    html	:['Finish-To-Start: Task B cannot start until Task A has been completed.<br/>',												'<div style="font-style:italic;">ie: A Building foundation must be built before the frame can be begun.</div>',											'Start-To-Start: Task B cannot start until Task A has been begun.<br/>',												'<div style="font-style:italic;">ie: Construction workers will begin laying down road cones, 10 minutes later work  may begin in the coned off area.</div>',											'Finish-To-Finish: Task B cannot be completed until Task A has been completed.<br/>',												'<div style="font-style:italic;">ie: Valet Parking attendees park cars until the hotel closes.</div>',											'Start-To-Finish: Task B cannot be completed until Task A has started.<br/>',												'<div style="font-style:italic;">ie: Conference registration must start whether the registration booth  is ready or not. ',											'Therefore, the start of the task "Check in registered attendees" controls the end of the task "Set up registration booth."'].join('')                                    ,trackMouse:true                                });								}								catch(e){									setTimeout(cmp.createTip, 100)								}					}				}, {					xtype				: 'xdataview'					,id                 :  c.section + 'predecessorsDV'					,name				: 'predecessors'					,hideLabel			: true					,itemSelector		: 'div.task-item'					,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Predecessor.</i></div>'					,height				: 105					,store				: new Ext.data.Store({						reader	: new Ext.data.XmlReader({							record	: 'row'							,id		: 'id'						}, ['id', 'title', 'status','statusText','startDate', 'dueDate', 'type'])					})					,tpl				: new Ext.XTemplate(						'<div>',						'<tpl for=".">',						'<div style="width:566px;" class="x-grid3-row task-dependency-body task-item">',							'<div style="width:118px;float:left">{title}</div>',							'<div style="width:110px;float:left" >{statusText}</div>',							'<div style="width:90px;float:left" >{startDate}</div>',							'<div style="width:90px;float:left" >{dueDate}</div>',							'<div style="width:90px;float:left" >{[this.getType(values)]}</div>',							'<div style="width:32px;float:left" ><img src="'+Eve.Resource.getIcon('delete', 'general')+'" style="cursor:pointer;" class="btn-delete"></div>',						'</div>',						'</tpl>',						'</div>',{							getType: function(values){								switch(values.type){									case '0':										return 'Start to Start';									case '1':										return 'Start to Finish';									case '2':										return 'Finish to Start';									case '3':										return 'Finish to Finish';									default:										return '';								}							}						}					)				}]			}]				},{				xtype:'fieldset'				,title: 'This task is a Predecessor to the following tasks:'				,collapsible: true				,autoHeight:true				,items: [{				xtype			: 'panel'				,border			: true				,autoScroll		: true				,height			: 130				,cls			: 'ev-dataview-ct'				,items			: [{					html : 	'<div class="x-grid3-header task-dependency-header">'								+ '<div style="width:118px;float:left;">Subject</div>'								+ '<div style="width:110px;float:left" >Status</div>'								+ '<div style="width:90px;float:left" >Start Date</div>'								+ '<div style="width:90px;float:left" >Due Date</div>'								+ '<div style="width:90px;float:left" >Type</div>'								+ '<div style="width:34px;float:left" >&nbsp;</div>'								+ '<div style="clear:both"></div>'							+ '</div>'				}, {					xtype				: 'xdataview'					,id                 : c.section + 'successorsDV'					,name				: 'successors'					,hideLabel			: true					,itemSelector		: 'div.task-item'					,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Successor.</i></div>'					,height				: 105					,store				: new Ext.data.Store({						reader	: new Ext.data.XmlReader({							record	: 'row'							//,id		: 'dependecy'						}, ['id','title','status' ,'statusText','startDate', 'dueDate', 'type'])					})					,tpl				: new Ext.XTemplate(						'<div>',						'<tpl for=".">',						'<div style="width:566px;" class="x-grid3-row task-dependency-body task-item">',							'<div style="width:118px;float:left;">{title}</div>',							'<div style="width:110px;float:left" >{statusText}</div>',							'<div style="width:90px;float:left" >{startDate}</div>',							'<div style="width:90px;float:left" >{dueDate}</div>',							'<div style="width:90px;float:left" >{[this.getType(values)]}</div>',							'<div style="width:32px;float:left" ><img src="'+Eve.Resource.getIcon('delete', 'general')+'" style="cursor:pointer;" class="btn-delete"></div>',						'</div>',						'</tpl>',						'</div>',{							getType: function(values){								switch(values.type){									case '0':										return 'Start to Start';									case '1':										return 'Start to Finish';									case '2':										return 'Finish to Start';									case '3':										return 'Finish to Finish';									default:										return '';								}							}						}					)				}]			}]				},{			layout:'column'			,items:[{					columnWidth	: .3					,layout : 'form'					,items:[					new Ext.form.Checkbox({						labelSeparator	: ''						,id				: c.section + 'Chk'						,boxLabel 		: 'Enforce Predecessors'						,hideLabel		: true						,name 			: 'enforcedPredecessors'					})]			},{				columnWidth	: .4				,layout : 'form'				,items:{                        html : '<label></label>'                        ,cls : 'lamp-tip'						//,hidden: true                        ,id : c.section + 'enfrocePreTip'                        ,listeners : {                            render : function(cmp){															var tip = new Ext.ToolTip({                                    target: c.section + 'enfrocePreTip'                                    , width:460									,html	:['Finish-To-Start: Task B cannot start until Task A has been completed.<br/>',												'<div style="font-style:italic;">ie: A Building foundation must be built before the frame can be begun.</div>',											'Start-To-Start: Task B cannot start until Task A has been begun.<br/>',												'<div style="font-style:italic;">ie: Construction workers will begin laying down road cones, 10 minutes later work  may begin in the coned off area.</div>',											'Finish-To-Finish: Task B cannot be completed until Task A has been completed.<br/>',												'<div style="font-style:italic;">ie: Valet Parking attendees park cars until the hotel closes.</div>',											'Start-To-Finish: Task B cannot be completed until Task A has started.<br/>',												'<div style="font-style:italic;">ie: Conference registration must start whether the registration booth  is ready or not. ',											'Therefore, the start of the task "Check in registered attendees" controls the end of the task "Set up registration booth."'].join('')                                   , trackMouse:true                                });                            }                        }                    }			}]		},{			xtype: 'button'			,text: 'Add Dependency'			,id	 : c.section + 'btn_add_dependency'		}]		}]	})	}   /*  * END: ITEM DEPENDENCY LIST  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *	START: ITEM ADD DEPENBENCY */ Eve.Dialogs.Task.addDependency = function(c){	var searchItemsSt = new Ext.data.Store({		reader : new Ext.data.XmlReader({			record	: 'row'			,totalRecords	: 'total'			,id		: 'id'		}, ['id', 'type', 'title', 'details', 'startDate', 'dueDate', 'statusText','status'])		,baseParams	: {			 limit	: Eve.Preference.getInteger("itemsPerPage")			,folderId: '-1'			,itemsOnly: true			,searchFieldText: 'subject'			,componentkey	: 'interlinking'		}		,params :{			start : '0'		}		, proxy: new Ext.data.HttpProxy( 			{				url		: 'index.cfm'				,params	:{start	: 0}			})	});							return new Eve.FormPanel({		labelWidth		: 70		,frame			: false		,bodyStyle		: 'padding: 5px 5px 0'		,width			: 630		,waitMsgTarget	: true		,items 			: [{			layout		: 'form'			,id			: c.section + 'frmAddDependency'			,items		:[new Ext.form.ComboBox({			 	   xxtype			: 'combo'				   ,id				: 'cmb_create_type'				   ,store			: new Ext.data.SimpleStore({						fields : ['value', 'text'],						data : [							 ['0', 'Predecessor']							,['1', 'Successor']						]					})					,mode			: 'local'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '1'					,fieldLabel 	: 'Create a '					,name			: 'dependencyType'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '97%'					}),{					layout			: "column"					,bodyStyle		: "padding-top: 10px"					,items			: [{						columnWidth		: .3						,layout			: "form"						,items			: [{							xtype			: 'combo'							,xxtype			: 'combo'							,hiddenName		: 'searchFieldText'							,mode			: 'local'							,displayField 	: 'text'							,valueField		: 'value'							,triggerAction 	: 'all'							,editable 		: false							,hideLabel		: true							,anchor			: "90%"							,store			: new Ext.data.SimpleStore({								fields	: ['value', 'text']								,data	: [ ['subject', 'Subject'] ]							})							,value			: 'subject'						}]					}, {						columnWidth		: .3						,layout			: "form"						,items			: [{							xtype			: 'combo'							,xxtype			: 'combo'							,id				: 'dep_search_op'							,hiddenName		: 'searchOperator'							,mode			: 'local'							,displayField 	: 'text'							,valueField		: 'value'							,triggerAction 	: 'all'							,editable 		: false							,hideLabel		: true							,anchor			: '90%'							,store			: new Ext.data.SimpleStore({								fields	: ['value', 'text']								,data	: [ ['contains', 'Contains'], ['startWith', 'Start With'], ['endWith', 'End With'] ]							})							,value			: 'contains'						}]					}, {						columnWidth		: .28						,layout			: "form"						,items			: [{							xtype			: "textfield"							,id				: 'dep_search_text'							,name			: "searchText"							,hideLabel		: true							,anchor			: "90%"						}]					}, {						columnWidth		: .1						,layout			: "form"						,items			: [{							xtype			: "button"							,text			: "Find"							,handler		: function(){								Eve.Resource.superbridge.broadcast(this, 'search_dep_task_items', {st: searchItemsSt});							}													}]					}]					},{							xtype			: 'panel'							,border			: true							,autoScroll		: true							,style			: 'margin-top: 5px; background-color:#FFF; border:1px solid;margin-bottom:5px;'							,items			: [{								html : 	'<div class="x-grid3-header">'											+ '<table style="width:100%;">'											+ '<tr class="x-grid3-hd-row">'												+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-0" style="width:15px"><div class="x-grid3-hd-inner x-grid3-hd-2">&nbsp;</div></td>'												+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-1" style="width:235px"><div class="x-grid3-hd-inner x-grid3-hd-2">Title</div></td>'												+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-2"><div class="x-grid3-hd-inner x-grid3-hd-2">Details</div></td>'											+ '</tr>'											+ '</table>'										+ '</div>'							}, {								xtype			: 'dataview'								,name			: 'searchItems'								,id				: c.section + 'search_dep_dev'								,hideLabel		: true								,itemSelector	: 'div.search-item'								,emptyText		: ''								,height			: 200								,store			: searchItemsSt								,tpl			: new Ext.XTemplate(									'<div class="x-grid3-body" style="width:545px;">',									'<tpl for=".">',										'<div class="x-grid3-row x-grid3-row-collapsed" style="padding:5px 0px;">',											'<table class="x-grid3-row-table" style="width:95%;">',											'<tr>',												'<td style="width:20px"><input type="checkbox" id="{id}" class="ev-dep-checkbox" {[this.isValid(values)]} /></td>',												'<td style="width:200px" >{title}</td>',												'<td style="width:220px" >{details}</td>',											'</tr>',											'</table>',										'</div>',										'</tpl>',									'</div>',{										isValid : function(v){											if(v.startDate.trim() == "" || v.dueDate.trim() == "")												return 'disabled';											return true;										}									}								)							}]								//,bbar: new Ext.PagingToolbar( {store:  searchItemsSt} )						},{							layout:'column'							,items:[{									columnWidth	: .6									,layout : 'form'									,labelWidth: 125									,items:[new Ext.form.ComboBox({									   xxtype			: 'combo'									   ,id				: 'cmb_dependecy_type'									   ,store			: new Ext.data.SimpleStore({											fields : ['value', 'text'],											data : [												 ['0', 'Start to Start']												,['1', 'Start to Finish']												,['2', 'Finish to Start']												,['3', 'Finish to Finish']											]										})										,mode			: 'local'										,valueField		: 'value'										,displayField 	: 'text'										,value			: '1'										,fieldLabel 	: 'The dependency is'										,name			: 'type'										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										})]							},{								columnWidth	: .4								,layout : 'form'								,items:{										html : '<label></label>'										,cls : 'lamp-tip'										,id : 'depTypeTip'										,listeners : {											render : function(cmp){												var tip = new Ext.ToolTip({													target: 'depTypeTip'													,width	: 460													,html	:['Finish-To-Start: Task B cannot start until Task A has been completed.<br/>',																'<div style="font-style:italic;">ie: A Building foundation must be built before the frame can be begun.</div>',															'Start-To-Start: Task B cannot start until Task A has been begun.<br/>',																'<div style="font-style:italic;">ie: Construction workers will begin laying down road cones, 10 minutes later work  may begin in the coned off area.</div>',															'Finish-To-Finish: Task B cannot be completed until Task A has been completed.<br/>',																'<div style="font-style:italic;">ie: Valet Parking attendees park cars until the hotel closes.</div>',															'Start-To-Finish: Task B cannot be completed until Task A has started.<br/>',																'<div style="font-style:italic;">ie: Conference registration must start whether the registration booth  is ready or not. ',															'Therefore, the start of the task "Check in registered attendees" controls the end of the task "Set up registration booth."'].join('')													,trackMouse:true												});											}										}									}							}]						}]		}]	}) }  /*  * END: ITEM ADD DEPENDENCY  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / /* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # *//* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # *//* # # # # # # # # # # PROJECT FORMS # # # # # # # # # # # # # *//* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # *//* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *	START: PROJECT DETAILS */Eve.Dialogs.Task.folderDetails = function(c) { 	var section = c.section;	// Custom Validators	var customVTypes = {};		// ToDo: Majid... it should be moved to the submit, not as a single common validator. 	customVTypes[section + "_FolderDateText"] = 'Due Date must be later than Start Date';	customVTypes[section + "_FolderDate"]  = function(val) {		var startDate	= Ext.getCmp(c.section + 'fld_startdate').getValue();		var dueDate	= Ext.getCmp(c.section + 'fld_dueDate').getValue();				if (startDate == '' || dueDate == '' )			return true;		if (startDate > dueDate)			return false		return true;	}		// Apply custom validators to Ext VTypes	Ext.apply(Ext.form.VTypes, customVTypes);		return new Eve.FormPanel({	labelWidth		: 70	,frame			: false	,bodyStyle		: 'padding: 5px 5px 0'	,width			: 600	,waitMsgTarget	: true	,items 			: [{		xtype			: 'textfield'		,fieldLabel 	: 'Subject'		,name 			: 'title'		,allowBlank 	: false		,setFocus		: true		,anchor 		: '95%'	}, {		xtype			: 'textarea'		,fieldLabel		: 'Description'		,name			: 'description'		,height			: 200		,anchor			: '95%'	}, {		layout			: 'column'		,style 			: 'margin-left:80px; margin-top:20px'		,items 			: [{			columnWidth		: .5			,layout			: 'form'			,items			: [{				xtype			: 'datefield'				,id				: c.section + 'fld_startdate'				,fieldLabel 	: 'Start Date'				,format 		: Eve.Preference.get('dateFormat')				,name			: 'startDate'				,anchor			: '90%'				,vtype			: c.section + '_FolderDate'				,validateOnBlur	: false			}]		}, {			columnWidth 	: .5			,layout			: 'form'			,items			: [{				 xtype			: 'datefield'  				,fieldLabel		: 'Due Date'  				,id				: c.section + 'fld_dueDate'  				,name			: 'dueDate'				,format 		: Eve.Preference.get('dateFormat')  				,anchor			: '88%'				,vtype			: c.section + '_FolderDate'				,validateOnBlur	: false				,onTriggerClick : function(){					if(this.disabled){						return;					}					if(this.menu == null){						this.menu = new Ext.menu.DateMenu();					}					Ext.apply(this.menu.picker,  {						minDate : this.minValue,						maxDate : this.maxValue,						disabledDatesRE : this.disabledDatesRE,						disabledDatesText : this.disabledDatesText,						disabledDays : this.disabledDays,						disabledDaysText : this.disabledDaysText,						format : this.format,						showToday : this.showToday,						minText : String.format(this.minText, this.formatDate(this.minValue)),						maxText : String.format(this.maxText, this.formatDate(this.maxValue))					});					this.menu.on(Ext.apply({}, this.menuListeners, {						scope:this					}));					if(Ext.getCmp(c.section+'fld_startdate').getValue() != "" && this.getValue()== "")						this.menu.picker.setValue(Ext.getCmp(c.section+'fld_startdate').getValue());					else						this.menu.picker.setValue(this.getValue() || new Date());					this.menu.show(this.el, "tl-bl?");				}			}]		}]	}, { 		html		: "<hr style='color:#E2E2E2; background-color:#B4B4B4; border-bottom:2px solid #fff; height:1px; margin:10px 80px;width:450px'/>"    }, {		layout		: 'column'		,style		: 'margin-left:80px; margin-top:2px'		,items		: [{			columnWidth	: .5  			,layout		: 'form'			,items 		: [ new Ext.form.ComboBox({					 xxtype			: 'combo'					,store			: Eve.Dialogs.Task.statusStore					,mode			: 'local'					,id             : c.section + 'folder_status'					,valueField		: 'status'					,displayField	: 'statusText'					,value			: '1'					,fieldLabel		: 'Status'					,hiddenName		: 'status'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'					,listeners      : {						select : function(cmb, rec, index){							var spinner = Ext.getCmp( c.section + 'folder_spinner');							switch(index){								case 0:								    spinner.setValue(0);								    break;								case 2:								    spinner.setValue(100);								    break;								case 1:								    spinner.setValue(25);								    break;							}						}					}			}),new Ext.form.ComboBox({			 	   xxtype			: 'combo'					,store			: Eve.Dialogs.Task.priorityStore					,mode			: 'local'					,valueField		: 'priority'					,displayField 	: 'priorityText'					,value			: '2'					,fieldLabel 	: 'Priority'					,hiddenName 	: 'priority'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			})]      },{         columnWidth	: .5  		,layout			: 'form'        ,items 			: [            new Ext.ux.form.Spinner({                 fieldLabel	: '%Complete'          		,id        	: c.section + 'folder_spinner'                ,name		: 'percentCompleted'                ,strategy	: new Ext.ux.form.Spinner.NumberStrategy({minValue:'0', maxValue:'100',incrementValue: 5})                ,width  	: 60                ,maxLength	: 3                ,value		: 0				,listeners	: {					change: function(el, newVal, oldVal){						var statusCmb = Ext.getCmp(c.section + 'folder_status');						if( newVal == 100){							statusCmb.setValue(3);						}						else if(newVal == 0){                            statusCmb.setValue(1);						}						else if( 0< newVal <100 && statusCmb.getValue()!=4 &&  statusCmb.getValue()!=5 ){							statusCmb.setValue(2);						}					}					,spin: function(el){						var newVal = el.getValue();						var statusCmb = Ext.getCmp(c.section + 'folder_status');						if( newVal == 100){							statusCmb.setValue(3);						}						else if( newVal == 0){                            statusCmb.setValue(1);						}						else if( 0< newVal <100 && statusCmb.getValue()!=4 &&  statusCmb.getValue()!=5 ){							statusCmb.setValue(2);						}					}					,scope: this				}            }),{            	xtype: 'checkbox',            	id: c.section + 'folder_workflow',            	boxLabel: 'Task assignment workflow',            	name: 'workflow',            	hideLabel: true            }]      }           ]	},	{		 id: c.section + 'folder_subscribe_button'		,items:[			{				html	: '<hr>'				,style	: 'margin-bottom:5px;margin-top:5px;'			},{				layout  	: 'column'				,items		: [{					columnWidth : .84					,style		: 'border: 1px solid; height: 20px;"'					,items		: [{						name		: 'subscribed'						,id			: c.section + 'project_sub_state'						,html       : '<div style="height:20px;background-color: #FFFFAB;padding-top: 3px;">'									 +' <span style="padding-left: 3px;font-weight:600">You are not currently subscribed to this project</span></div>'					}]				}, {					columnWidth : .16					,style 		: 'margin-left:5px'					,items      : [{						xtype         	: 'xbutton'						,id             : c.section + 'project_btn_sub'						,text 			: 'Subscribe'						,hideLabel      : true						,name          	: 'subscribed'						,minWidth       : 79						,enableToggle 	: true						,handler		: function(btn) {											if (btn.getText() == "Subscribe")											{												Ext.Msg.confirm('Notice', 'If you unsubscribe this project all sub projects and sub tasks would be unsubscribed. Are you sure you want to unsubscribe?', function(btn, text){												    if (btn == "no") {												    	Ext.getCmp('taskproject_btn_sub').toggle();												    	return false;												    }												});											}						}						,toggleHandler  : function(btn, pressed) {							var subscription = Ext.getCmp(c.section + 'project_sub_state');							if (pressed == true){								btn.setText ('Unsubscribe');								var str = '<div style="height:20px;background-color: #A5DE63;padding-top: 3px;">'							              +'<span style="padding-left: 3px;font-weight:600">You are currently  subscribed to this project</span></div>';																subscription.getEl().dom.innerHTML = str;							} else {								btn.setText('Subscribe');								var str = '<div style="height:20px;background-color: #FFFFAB;padding-top: 3px;">'						                 +' <span style="padding-left: 3px;font-weight:600">You are not currently subscribed to this task</span></div>';										subscription.getEl().dom.innerHTML = str;							}						}						,scope : this					}]						,scope  : this				}]			}] 		}    ]})};/* *	END: PROJECT DETAILS * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // * * * * * * * * * * * * * * * * * * * *// Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.Dialogs.Task.CopyMove = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,width		: 500		,height		: 300		,layout		: 'fit'		,items 		: [{			autoScroll : true			,style: 'background-color: white; border: 1px solid #D0D0D0;'			,items:c.view			}]	})}; /* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       TaskDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */Eve.vc.createFormPanel( 'TaskFolderDetails'		, Eve.Dialogs.Task.folderDetails );// ItemsEve.vc.createFormPanel( 'TaskItemDetails'		, Eve.Dialogs.Task.itemDetails);Eve.vc.createFormPanel( 'TaskItemReminder'		, Eve.Dialogs.Reminder.ReminderFormPanel);Eve.vc.createFormPanel( 'TaskItemRecurrence'	, Eve.Dialogs.Task.itemRecurrence);Eve.vc.createFormPanel( 'TaskItemDependency'	, Eve.Dialogs.Task.itemDependency);Eve.vc.createFormPanel( 'TaskAssigneeDetails'	, Eve.Dialogs.Task.itemAssignee);//CommentsEve.vc.createFormPanel( 'TaskComments'    		, Eve.Dialogs.Comment.Main);//InterlinkingEve.vc.createFormPanel( 'TaskInterlinking'		, Eve.Dialogs.Interlink.Main);// Copy/MoveEve.vc.createFormPanel( 'TaskCopyMove'			, Eve.Dialogs.Task.CopyMove );//DepenencyEve.vc.createFormPanel( 'TaskAddDependency'		, Eve.Dialogs.Task.addDependency );Ext.override( Eve.vc.TaskAddDependency, {		  loadEvent 	  : Ext.emptyFn		 ,submitEvent 	: Ext.emptyFn//function(){ return 'modern.task.{root}.addDependency'; }});Ext.override( Eve.vc.TaskFolderDetails, {		  loadEvent 	  : function(){ return 'modern.taskFolder.{root}.edit'; }		 ,submitEvent 	: function(){ return 'modern.taskFolder.{root}.createModify'; }});Ext.override( Eve.vc.TaskItemDetails, {		 loadEvent   : function(){ return 'modern.task.{root}.edit'; }		,submitEvent : function(){ return 'modern.task.{root}.createModify'; }});Ext.override( Eve.vc.TaskItemReminder, {		 loadEvent   : function(){ return 'modern.task.{root}.edit'; }		,submitEvent : function(){ return 'modern.task.{root}.createModify'; }});Ext.override( Eve.vc.TaskAssigneeDetails,  {		  loadEvent 	: function(){ return 'modern.task.{root}.edit'; }		 ,submitEvent 	: function(){ return 'modern.task.{root}.createModify'; }});Ext.override( Eve.vc.TaskItemRecurrence,  {		  loadEvent 	: function(){ return 'modern.task.{root}.edit'; }		 ,submitEvent 	: function(){ return 'modern.task.{root}.createModify'; }});Ext.override( Eve.vc.TaskItemDependency,  {		  loadEvent 	: function(){ return 'modern.task.{root}.edit'; }		 ,submitEvent 	: function(){ return 'modern.task.{root}.createModify'; }});Ext.override( Eve.vc.TaskComments, {	 loadEvent		: function(){ return 'modern.comment.{root}.view'; }	,submitEvent	: function(){ return 'modern.comment.{root}.createModify'; }});Ext.override( Eve.vc.TaskInterlinking, {	 loadEvent		: function(){ return 'modern.interlink.{root}.view'; }	,submitEvent	: function(){ return ''; }});// CopyMoveExt.override( Eve.vc.TaskCopyMove, {	loadEvent 		: Ext.emptyFn	,submitEvent 	: function(){ return 'modern.task.group.executeCopyMove'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\task/TaskFactory.js *//*--------------------------------------------------*//** * Hyperoffice Tasks section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Task.Factory = function() {}Ext.extend( Eve.lib.Task.Factory, Eve.lib.Factory, {		section: 'task'	,prefix	: 'T'  	,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}	 /*	,createNorth : function(superbridge)	{		var view	= new Eve.vc.Header();		var bridge	= new Eve.lib.HeaderBridge();				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,section	: this.section		});				return { view : view, config: {height: 38, split: false, border: false} };	}*/	 	,createWest  : function(superbridge)	{		Eve.vc.createComponent('TaskTreePanel', Eve.Task.Tree);		var view	= new Eve.vc.TaskTreePanel();		var conn	= Eve.widgets.TreeStore;				var bridge	= new Eve.widgets.DefaultTreeBridge();				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Tasks <span id ="task_tree_toolbar_menu" style="cursor:pointer;float:right;margin-right:35px;margin-top:-2px;"></span>'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]		}				return { view: view, config: config };	}		,createCenter: function(superbridge)	{		this.view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();    	var bridge 	= new Eve.widgets.Task.GridBridge();				conn.setSection('Tasks');				Eve.widgets.Task.Sum = new Eve.widgets.Task.Summery();		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,manager	: this.manager		});				superbridge.addBridge(Eve.widgets.Task.Sum);    	Eve.widgets.Task.Sum.init({			superbridge	: superbridge			,section	: this.section		});				// Top Bar    	this.topBar = new Ext.Toolbar(bridge.getToolbar());		    	var tipBox = new Ext.Panel({			 html :	'<div style="font-size:11px;font-family:tahoma,arial,helvetica,sans-serif;color:gray;padding:25px 15px">'					+'<b>In order to see project summary , you need to follow the instruction.'					+'<br/>'					+'1- Expand the personal or group you like to work on, please note they are located on the tree in left panel.'					+'<br/>'					+'2- Select the project under the selected node.'					+'</div>'		});					var config = {			xtype		: 'tabpanel'			,id 		: 'taskCardLayout'			,activeTab	: 0			,tbar		: this.topBar			,tabPosition: 'bottom'			,layoutOnTabChange: true			,items  	: [				{ title: 'Task List', layout:'fit', items:this.view.get() }				,{ title: 'Gantt Chart', layout: 'fit', id: 'gantt_chart'/*, bodyStyle: 'overflow: scroll;'*/ }				,{ title: 'Project Summary', layout:'fit', items:Eve.widgets.Task.Sum.createLayout()}]			,listeners	: {				tabchange		: {					fn		: function( cmp, tab ) {						var it = cmp.items.items;						var idx = 0;						this.topBar.disable();												for ( idx = 0; idx < it.length; ++idx ){							if ( it[idx].id == tab.getId() )								break;						}												if ( idx == it.length )							return false;												var info = {							id 		: bridge.id							,groupId: bridge.groupId							,root	: bridge.root							,path	: bridge.path						}												switch (idx) {							case 0:								this.topBar.enable();																bridge.fire('task_change_tab', { idx: 0, info: info, view: 'grid' });								break;															case 1:								bridge.fire('task_change_tab', { idx: 1, info: info, view: 'gantt' } );								break;															case 2:								bridge.fire('task_change_tab', { idx: 2, info: info, view: 'summary' });																break;																				}					}					,scope: this				}			}		}				return { view: this.view, config: config  };	}		/*	,createSouth  : function(superbridge)	{		var view	= new Eve.vc.StatusBar();		var bridge	= new Eve.widgets.StatusBarBridge();				superbridge.addBridge(bridge);		bridge.init({			superbridge	: brdg			,view		: view			,section	: this.section		});				return { view: view, config: { titleBar: false, height: 25, split: false, border: false } };	}	*/		,createMenus : function(superbridge)	{		this.amenu = new Eve.widgets.TaskAddMenu();		this.emenu = new Eve.widgets.TaskEditMenu();		this.tmenu = new Eve.widgets.TaskTreeMenu();		//this.ttmenu= new Eve.widgets.TaskTreeToolbarMenu();				superbridge.addBridge([this.amenu, this.emenu, this.tmenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}				this.emenu.init(data);		this.amenu.init(data);		this.tmenu.init(data);		//this.ttmenu.init(data);	}	 	,createDialogs : function(superbridge)	{		var itemDlg			= new Eve.lib.Task.ItemDialogBridge();		var folderDlg		= new Eve.lib.Task.FolderDialogBridge();		var cmDlg			= new Eve.lib.Task.CopyMoveDialogBridge();		var depDlg			= new Eve.lib.Task.AddDependencyDialogBridge();				superbridge.addBridge([ itemDlg, folderDlg, cmDlg, depDlg ]);				itemDlg.addPanel(new Eve.vc.TaskItemDetails());		itemDlg.addPanel(new Eve.vc.TaskItemReminder());		itemDlg.addPanel(new Eve.vc.TaskItemRecurrence());		itemDlg.addPanel(new Eve.vc.TaskItemDependency());		itemDlg.addPanel(new Eve.vc.TaskAssigneeDetails());		itemDlg.addPanel(new Eve.vc.TaskComments());		itemDlg.addPanel(new Eve.vc.TaskInterlinking());				folderDlg.addPanel(new Eve.vc.TaskFolderDetails());		folderDlg.addPanel(new Eve.vc.TaskComments());		folderDlg.addPanel(new Eve.vc.TaskInterlinking());		cmDlg.addPanel(new Eve.vc.TaskCopyMove());		depDlg.addPanel(new Eve.vc.TaskAddDependency());		itemDlg.init({			superbridge		: superbridge			,section		: this.section			,origin			: 'item'			,reminderType	: 'absolute'		});				folderDlg.init({			superbridge		: superbridge			,section		: this.section			,origin			: 'folder'		});								// Import Dialog		var importDlg = new Eve.widgets.ImportDlgBridge();		superbridge.addBridge(importDlg);		importDlg.init({			superbridge	: superbridge			,section	: this.section		});					// Export Dialog		var expDlg = new Eve.widgets.TaskExportDlgBridge();		superbridge.addBridge(expDlg);		expDlg.init({			superbridge	: superbridge			,section	: this.section		});						// Filter Dialog		var filterDlg = new Eve.widgets.FilterDlgBridge();		superbridge.addBridge(filterDlg);		filterDlg.init({			superbridge	: superbridge			,section	: this.section		});						// Start: Copy task/project dialog		var view = new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.Task.TaskTreeBridge();				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix		});		cmDlg.init({			superbridge	: superbridge			,section	: this.section			,view		: view.get()		});		depDlg.init({			superbridge	: superbridge			,section	: this.section			,view		: view.get()		});				// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgTaskItem 	= new Eve.lib.Task.ItemDialogBridge();		var dlgTaskFolder 	= new Eve.lib.Task.FolderDialogBridge();				superbridge.addBridge(dlgTaskItem);		superbridge.addBridge(dlgTaskFolder);				dlgTaskItem.addPanel(new Eve.vc.TaskItemDetails());		dlgTaskItem.addPanel(new Eve.vc.TaskItemReminder());		dlgTaskItem.addPanel(new Eve.vc.TaskItemRecurrence());		dlgTaskItem.addPanel(new Eve.vc.TaskItemDependency());		dlgTaskItem.addPanel(new Eve.vc.TaskAssigneeDetails());				dlgTaskFolder.addPanel(new Eve.vc.TaskFolderDetails());				dlgTaskItem.init({			superbridge	: superbridge			,section	: this.section + '_il'			,origin		: 'item'		});				dlgTaskFolder.init({			superbridge	: superbridge,			section		: this.section + '_il'			,origin		: 'folder'		});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -			}		,createRest : function(superbridge)	{		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\task/TaskGridImp.js *//*--------------------------------------------------*//** * Set up plugin for a check column * @param {Object} config */Eve.widgets.Task.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge, {	gridSection : 'task'		,getToolbar : function() { return this.toolbar; }		,initLocalVars : function() {		var priCombo = new Ext.form.ComboBox({			store 			: Eve.Dialogs.Task.priorityStore			,mode         	:'local'			,valueField		: 'priority'			,displayField 	: 'priorityText'			,typeAhead 		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'     	});		     	var stCombo =new Ext.form.ComboBox({			store 			: Eve.Dialogs.Task.statusStore			,mode         	:'local'			,valueField		: 'status'			,displayField 	: 'statusText'			,typeAhead 		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'		});      		this.fields = [			 {name 	  : 'completed'				,type: 'bool'	}			,{name 	  : 'type'					,type: 'string'	}			,{name    : 'linkedItems'			,type: 'string'	}			,{name 	  : 'title'					,type: 'string'	}			,{name 	  : 'dueDate'				,type: 'string'	}			,{name 	  : 'startDate'				,type: 'string'	}			,{name	  : 'finishDate'			,type: 'string'	}			,{name    : 'priority'				,type: 'int'	}			,{name    : 'status'				,type: 'int'	}			,{name    : 'percentCompleted'		,type: 'int'	}			//,{name    : 'recurrence'			,type: 'string'	}			,{name    : 'recurrenceId'			,type: 'string'	}			,{name    : 'notes'					,type: 'string'	}			,{name    : 'created'				,type: 'string'	}			,{name    : 'lastModified'			,type: 'string'	}			,{name    : 'editPermission'		,type: 'bool'	}    			,{name    : 'deletePermission'		,type: 'bool'	}			,{name    : 'assignees'				,type: 'string'	}			,{name    : 'group'					,type: 'string'	}			,{name    : 'reminderId'			,type: 'int'	}			,{name	  : 'groupId'				,type: 'string', defaultValue: undefined}			,{name	  : 'path'					,type: 'string'}			,{name	  : 'textPath'				,type: 'string'}			,{name	  : 'mode'					,type: 'string'}			,{name	  : 'milestone'				,type: 'string', defaultValue: undefined}			,{name: '_index'					,type: 'int' , mapping: 'index'}			,{ name: 'createdBy'				,type: 'string'}			,{ name: 'createdDate'				,type: 'string'}			,{ name: 'lastModifiedBy'			,type: 'string'}			,{ name: 'lastModifiedDate'			,type: 'string'}			,{ name: 'startSuccessors'			,type: 'string'}			,{ name: 'endSuccessors'			,type: 'string'}			,{ name: 'enforcedPredecessors'		,type: 'string'}		];				this.reader = new Ext.data.XmlReader( { id: 'id', record: 'row', totalRecords: 'total' }, Ext.data.Record.create( this.fields ) );    		this.checkColumn = new Ext.grid.CheckColumn({			 header			: '<img src="' + Eve.Resource.getIcon('checked', 'general') + '" />'			,sortable    	: false			,fixed       	: true			,menuDisabled	: true			,dataIndex		: 'completed'			,width			: 30			,editable 		: true		});			this.checkColumn.on('click', function (element, e, record) {			if (record.editPermission !== false)				this.grid.fireEvent('afteredit');		});		this.milestone = new Ext.grid.CheckColumn({			 header			: "<img src="+Eve.Resource.getIcon('milestone-on','task')+">"			,sortable    	: false			,fixed       	: true			,menuDisabled	: true			,dataIndex		: 'milestone'			,width			: 30			,editable 		: true			,renderer 	: function(v, p, record) {				if (v === undefined || v == "")				    return;				if (v == '1' || v == 'true' || v == true) {					v = '1';				}				else if (v == '0' || v == 'false' || v == false) {					v = '0';				}				//the +v type converts to a number (json returns a string				//which always evaluates true)				var checkState = (+v) ? '-on' : '';				p.css += ' x-grid3-check-col-td';				return '<div class="task-milestone-checkbox'+ checkState +' x-grid3-cc-'+this.id+'"> </div>';			}		});	  	this.milestone.on('click', function (element, e, record) {			if (record.editPermission !== false)				this.grid.fireEvent('afteredit');		});		this.rowExpander = new Ext.grid.RowExpander({			 enableCaching : false			,tpl		: new Ext.XTemplate(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td ><b>{title}&nbsp;({percentCompleted}% complete)</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				//'<tpl if="this.validateNote(values)">',				 '<tr >',					'<td width ="100%" style="line-height: normal;">',						'<div style="float:left;position:relative;margin-right:15px">',							'<img width="32px" height="32px" src="' + Eve.Resource.getIcon('{type}-task','task') + '" />',						'</div>',						'<div style="float:left; position:relative;line-height:normal;" class="row-expander-desc">{notes}</div>',						'<tpl if="this.isValid(values)">',						'<div style="clear:both;"></div>',						'<div style="float:left;position:relative;padding-right:15px;font-weight:bold"> Assigned To </div>',						'<div style="float:left;position:relative;">',							'<table>',							'<tpl for="assignee">',							 '<tr>',								'<td style="padding-right:15px">{title}</td>',								'<td>( {assignedStateText} )</td>',								'<td style="padding-left:5px">{assignedOnDate}</td>',							 '</tr>',							'</tpl>',							'</table>',						'</div>',						'</tpl>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>', 				   				 '<tr>',					'<td style="padding:0px 5px 5px 5px;" width ="100%">',						'<p>{created}<br />',						'{lastModified}</p>',					'</td>',				 '</tr>',				 '</table>', {				  validateNote: function(values){				    if (values.notes == "" || values.notes === undefined){						return false ;		            }					else {						return true;		            }  				  }				  ,isValid : function(values){				  	if(values.assignee === undefined){				  		return false;				  	}				  	else{				  		return true;				  	}				  }				}			)		});				// - - - - - - - - - - - - - - - - - - - - - - - - -	// Start: Column Model	// - - - - - - - - - - - - - - - - - - - - - - - - -				// Column Model	this.columns = new Ext.grid.ColumnModel([		this.rowExpander, {			header 		: '<img src="' + Eve.Resource.getIcon('item-task','task') + '" />'			,dataIndex 	: 'type'			,width 		: 30			,hidden 	: false			,menuDisabled: true			,sortable   : false			,fixed      : true			,renderer 	: function(value, metadata, rec) {				if (value == 'item') {					var icon = '<img src="' + Eve.Resource.getIcon('item-task','task') + '" />';				}				else {					var icon = '<img src="' + Eve.Resource.getIcon('folder-task','task') + '" />';				}								return (icon);			}		}, {			header  		: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex  	: 'linkedItems'			,width      	: 30			,manueDisabled  : true			,sortable       : false			,fixed          : true			,renderer       : function(value, metadata, rec){				var icon = (rec.data.linkedItems != '0' ) ?					    '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />': '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		}, this.checkColumn, {			header 		: 'Subject'			,dataIndex 	: 'title'		  	,sortable	: true			,width 		: 110			,hidden 	: false			,editor 	: new Ext.grid.GridEditor(new Ext.form.TextField({				allowBlank : false			}))			,renderer : function(value, meta, rec){			   if (rec.data.completed == true){			     return '<span style = "text-decoration:line-through ">' + value + '</span>';			   }  			   else{			     return value;			   }  			}		}, {			header 		: 'Start Date'			,dataIndex 	: 'startDate'			,sortable	: true			,width 		: 80			,hidden 	: false			,editor 	:new Ext.grid.GridEditor(new Ext.form.DateField({				 allowBlank : true				,format		: Eve.Preference.get('dateFormat')			}))			,renderer	: this.dateRenderer.createDelegate(this)		}, {			header 		: 'Due Date'			,dataIndex 	: 'dueDate'			,width 		: 80			,sortable	: true			,hidden 	: false			,editor 	: new Ext.grid.GridEditor(new Ext.form.DateField({				 allowBlank : true				,format		: Eve.Preference.get('dateFormat')			}))			,renderer	: this.dateRenderer.createDelegate(this)		}, {			header 		: 'Finish Date'			,dataIndex 	: 'finishDate'			,width 		: 80			,sortable	: true			,hidden 	: false			,editor 	: new Ext.grid.GridEditor(new Ext.form.DateField({				 allowBlank : true				,format		: Eve.Preference.get('dateFormat')			}))			,renderer	: this.dateRenderer.createDelegate(this)		}, {			header		:'Priority'			,dataIndex	: 'priority'			,sortable	: true			,width 		: 60			,hidden		: false			,editor		: new Ext.grid.GridEditor(priCombo)			,renderer	: this.comboRenderer(priCombo)		}, {			header		: 'Status'			,dataIndex	: 'status'			,width		: 100			,sortable	: true			,editor		: new Ext.grid.GridEditor(stCombo)			,renderer	: this.comboRenderer(stCombo)		}, {			header  	: '%Complete'			,dataIndex 	: 'percentCompleted'			,width 		: 80			,sortable	: true		}, {			header		: 'Assignees'			,dataIndex	: 'assignees'			,width		: 100			,renderer	: function(value){				return value;			}		}, {			header 		: 'Location'			,dataIndex 	: 'textPath'		  	,sortable	: true			,width 		: 100			,hidden 	: false			,renderer	: function(value, meta, rec) {				return value;			}		},{			header			: '<img src="' + Eve.Resource.getIcon('recurrence','task')	+ '" />'			,dataIndex		: 'recurrenceId'			,width			: 25			,sortable		: true			,hidden			: false			,renderer		: function(val) {				if (val && val != '0') {					return '<img src="' + Eve.Resource.getIcon('recurrence','task')	+ '" />';				}				return '';			}		}, this.milestone		,{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]	);		// - - - - - - - - - - - - - - - - - - - - - - - - -	// End: Column Model	// - - - - - - - - - - - - - - - - - - - - - - - - -				//-----------------------------------------------------	// Start:	Toolbar Object		//-----------------------------------------------------		//Quick search field	 var that = this;	 var searchField = new Ext.form.TriggerField({		width			: 'auto'	 	,triggerClass	: 'x-form-search-trigger'	 	,id				: 'task_quick_search'	 	,emptyText : 'Search'		,hideLabel : true	 	,listeners : {			specialKey : function(el, e){				if (e.getKey() == e.ENTER){				var info = {                    parentId 	: this.id					,groupId 	: this.getGroupId()					,root		: this.root					,id 		: 0					,path       : this.getPath()				};				this.fire('task_filter' ,{ mode: { base: 'search', str:  el.getValue() },	                                              info:info}, true);				}			}			,resize: function(cmp){				Ext.get(cmp.wrap.dom).setWidth(130);			}			,scope : this	 	}	 	,onTriggerClick : function(e){         	var info = {                    parentId 	: that.id					,groupId 	: that.getGroupId()					,root		: that.root					,id 		: 0					,path       : that.getPath()			};			that.fire('task_filter' ,{ mode: { base: 'search', str:  this.el.getValue() },info: info},true);	 	}	 });	// New Item handler	var newItemHdl = function(){		var info = {			parentId 	: this.id			,groupId 	: this.getGroupId()			,root		: this.root			,id 		: 0			,path       : this.path		};		this.fire('task_create_item_dlg', {info: info});	};		this.toolbar = {		id	: 'task-grid-toolbar'		,items:[ new Ext.Toolbar.SplitButton({			text 		: 'New'			,cls 		: 'x-btn-text-icon'			,icon		: Eve.Resource.getIcon('new', 'general')			,disabled	: true			,handler	: newItemHdl.createDelegate(this)			,menu 		: [{				 text 		: 'Project'				,cls 		: 'x-btn-text-icon'				,icon		: Eve.Resource.getIcon('new-project','task')				,handler	: function() { 					var info = {						parentId 	: this.id						,groupId 	: this.getGroupId()						,root		: this.root						,id 		: 0						,path       : this.path					};										this.fire('task_create_folder_dlg', {info: info});				}				,scope		: this			}, {				 text 	: 'Task'				,cls 	: 'x-btn-text-icon'				,icon	: Eve.Resource.getIcon('new-task','task')				,handler: newItemHdl				,scope	: this			}]		}), {			 text	: "Edit"			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('edit', 'general')			,handler: function() {				var rec = this.view.get().getSelectionModel().getSelected();				if (rec) {					type = rec.data.type;										var data = {						info	: {						   id		: rec.id.split("_")[1] 						  ,parentId : this.id						  ,groupId	: this.getGroupId()						  ,root		: this.root						  ,path		: this.getPath()						  ,typeId	: Eve.Resource.getTypeId(this.root, type, this.section)						  ,reminderId: rec.data.reminderId						}						,title	: this.getRowTitle(rec)					};							this.fire("task_edit_" + type + "_dlg", data);				}				else {					Ext.tools.msg('Select a Record', 'To Edit a Task, You need to select a record in grid below.');				}			}			,scope : this		}, {			 text	: "Delete"			,icon	: Eve.Resource.getIcon('delete', 'general')			,cls	: "x-btn-text-icon"			,handler: this.deleteHdl			,scope	: this		}, '-', {			xtype	: "splitbutton"			,id		: "btnTaskFind"			,text	: "Find"			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('find', 'general')			,handler: function() {				var info = {					groupId		: this.getGroupId()					,root		: this.root				};								this.fire("task_filter_dlg", {info: info});			}			,scope  : this			,menu	: [{				text		: 'Clear'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('filter-clear', 'general')				,disabled	: true				,handler	: function() {					var data = {						criteria: ''						,mode	: {							base	: 'filter'							,branch	: ''						}						,info	: { root: this.root }					}										this.filter(this, this.gridSection + '_filter', data);				}				,scope		: this			}]		}, '-', {			text		: 'Up'			,id			: this.section + 'btnToolbarUp'			,cls 		: "x-btn-text-icon"			,icon		: Eve.Resource.getIcon('arrow-up', 'general')			,handler	: function() {				this.fire(this.section + "_activate_parent_node");			}			,scope		: this		},'-', {			 text	: "Print"			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('print', 'general')			,handler: function() {				var info = {					id			: this.id		// Id of current tree node.					,groupId	: this.getGroupId()					,root		: this.root					,path		: this.getPath()					,start		: this.view.get().store.lastOptions.params.start				};								this.fire("task_print_folder", {info: info});							}			,scope	: this		}, new Ext.Button({			 text	: 'Tools'			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('tools','task')			,id     :'task_tool'			,handler: function(){this.showMenu();}			,menu   : new Ext.menu.Menu({				items : [					new Ext.menu.Item({						 text    : 'Import'						,group   : 'tl' 						,handler : function(e){							this.fire('task_open_import_dlg',{path: this.getPath(),root: this.root, groupId: this.getGroupId(), grid: this.view.get()});						}						,scope   : this				}), new Ext.menu.Item({						text	:'Export'						,group	: 'tl'						,handler: function (e){							this.fire(this.section + '_do_export',{ path: this.getPath(),root: this.root, groupId: this.getGroupId()});						}						,scope   :this				})]			})		}), '->', new Ext.Button({			text	: 'View Projects and Tasks'			,id		: 'task_folderItem'			,handler: function() { this.showMenu(); }			,menu	: new Ext.menu.Menu({				items: [					new Ext.menu.CheckItem({						text	: 'View Projects and Tasks'						,checked: true						,group	: 'fi'						,handler: function(e) {							this.view.get().colModel.setHidden(10, true);														this.fire( 'task_filter', { mode: { base: 'folder_item', branch: 'flatView' },									  info:{ parentId : this.id, groupId : this.getGroupId(), root: this.root, id : 0 }}, true );						}						,scope	: this					})					,new Ext.menu.CheckItem({						text	: 'View All Tasks (Including Sub-Projects)'						,group	: 'fi'						,handler: function(e) {							this.view.get().colModel.setHidden(10, false);														this.fire( 'task_filter', { mode: { base: 'folder_item', branch: 'itemsOnly' }, 									  info:{ parentId : this.id, groupId : this.getGroupId(), root: this.root, id : 0 }}, true );						}						,scope	: this					})				]			})		}), new Ext.Button({			text	: 'All Tasks'			,id		: 'completeMode'			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('all-tasks','task')			,handler: function() { this.showMenu(); }			,menu	: new Ext.menu.Menu({				items	: [{					text	: 'All Tasks'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('all-tasks','task')					,group	: 'cp'					,handler: function() {						var cmp = Ext.getCmp('completeMode');						cmp.setText('All Tasks');						cmp.setIcon(Eve.Resource.getIcon('all-tasks','task'));												this.fire( 'task_filter', { mode: { base: 'completeMode', branch: 'all' },								  info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},								  true );					}					,scope	: this				}, {					 text	: 'Complete'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('completed','task')					,group	: 'cp'					,handler: function() {						var cmp = Ext.getCmp('completeMode');						cmp.setText('Complete');						cmp.setIcon(Eve.Resource.getIcon('completed','task'));						this.fire( 'task_filter', { mode: { base: 'completeMode', branch: 'completed' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );					}					,scope	: this				}, {					text	: 'Incomplete'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('incompleted','task')					,group	: 'cp'					,handler: function() {						var cmp = Ext.getCmp('completeMode');						cmp.setText('Incomplete');						cmp.setIcon(Eve.Resource.getIcon('incompleted','task'));												this.fire( 'task_filter', { mode: { base: 'completeMode', branch: 'incomplete' }, 								  info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},								   true );					}					,scope	: this				}, {					 text	: 'Overdue'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('overdue','task')					,group	: 'cp'					,handler: function() {						var cmp = Ext.getCmp('completeMode');						cmp.setText('Overdue');						cmp.setIcon(Eve.Resource.getIcon('overdue','task'));						this.fire( 'task_filter', { mode: { base: 'completeMode', branch: 'overdue' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );											}					,scope	: this				}]			})		}), new Ext.Button({			 text	: 'All Assigned'			,id		: 'assignMode'			,cls	: "x-btn-text-icon"			,icon	: Eve.Resource.getIcon('all-assigned','task')			,handler: function() { this.showMenu(); }			,menu	: new Ext.menu.Menu({				items	: [{					text	: 'All Assigned'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('all-assigned','task')					,group	: 'as'					,handler: function() {						var cmp = Ext.getCmp('assignMode');						cmp.setText('All Assigned');						cmp.setIcon(Eve.Resource.getIcon('all-assigned','task'));						this.fire( 'task_filter', { mode: { base: 'assignMode', branch: 'all' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );					}					,scope	: this				}, {					text	: 'Assigned To Me'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('assigned-to-me','task')					,group	: 'as'					,handler: function() { 						var cmp = Ext.getCmp('assignMode');						cmp.setText('Assigned To Me');						cmp.setIcon(Eve.Resource.getIcon('assigned-to-me','task'));						this.fire( 'task_filter', { mode: { base: 'assignMode', branch: 'toMe' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );					}					,scope	: this				}, {					text	: 'Assigned By Me'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('assigned-by-me','task')					,group	: 'as'					,handler: function() {						var cmp = Ext.getCmp('assignMode');						cmp.setText('Assigned By Me');						cmp.setIcon(Eve.Resource.getIcon('assigned-by-me','task'));						this.fire( 'task_filter', { mode: { base: 'assignMode', branch: 'byMe' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );					}					,scope	: this				}, {					text	: 'Unassigned'					,cls	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('unassigned','task')					,group	: 'as'					,handler: function() {						var cmp = Ext.getCmp('assignMode');						cmp.setText('Unassigned');						cmp.setIcon(Eve.Resource.getIcon('unassigned','task'));												this.fire( 'task_filter', { mode: { base: 'assignMode', branch: 'unassigned' }, 							info: { id: id, parentId : this.id, groupId : this.getGroupId(), root: this.root, path: this.getPath() }},						true );					}					,scope	: this				}]			})		}),searchField	]};			//end toolbar			}		,comboRenderer : function(combo){		return function (value, meta, record) {			var idx = combo.store.find(combo.valueField, value);			var txt = '';			if(idx != -1){				var rec = combo.store.getAt(idx);				txt = rec.get(combo.displayField);			}			//if (record.data.completedInList == true) txt =  '<span style="text-decoration:line-through">'+txt+'</span>';			return txt;   		};	}		,dateRenderer : function(value, meta, rec){		//(rec.get('type') == 'folder')		    		if( value == '' || value == undefined ) return '';		if( value.dateFormat ) return value.dateFormat(Eve.Preference.get('dateFormat'));		else return value;	}  	,init : function(obj)	{		Eve.widgets.Task.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();				this.conn.init( this.reader );				this.view.init({			id 				: 'task_grid'			,ds 			: this.conn.getStore()			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			,plugins		: [this.rowExpander, this.checkColumn, this.milestone]		  	,stripeRows 	: true			// Pagination Toolbar		  	,bbar			: new Ext.PagingToolbar({				store			: this.conn.getStore()				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Tasks'			})			,loadMask 		: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,bridge			: this			,keys			: this.getKeyMap()		});						this.registerView();	}		,registerView : function(){		 Eve.widgets.Task.GridBridge.superclass.registerView.call(this);				 var grid = this.view.get();		//PreRender...Added by Ghazal		grid.on('render', function(grid){			if(Eve.Preference.get('mytasks')== '1'){				var store = grid.store;				store.loadData(Eve.Preference.get('taskpersonalgrid'));				store.params = {					event : Eve.Resource.cmdChangePage('task', 'personal')					,groupId: 0				};				this.setSharedSection({sharedSection : false});				this.syncColumnModel(0);						}		}, this);		var columns = this.columns;			grid.on('beforeedit', function(e) {				var type = this.getStore().getAt(e.row).data.type;				// Prevent user from editing folder's url column				if ((e.column == 2 || e.field == "milestone")  && type == 'folder')					return false;		});		grid.on('beforeedit', function(e) {			var rec = e.record;			if (rec.data.type == 'folder' && e.column == 7)				return false;		}, this);		// - - - - - - - - - - - - - - - - - -		// Handle Task Double Click		// - - - - - - - - - - - - - - - - - -		grid.on('rowdblclick', function(grid, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx);				if (rec) {					type = rec.data.type;					var info = {					   id		: rec.id.split("_")[1]					  ,parentId : this.id					  ,groupId	: this.getGroupId()					  ,root		: this.root					  ,path		: this.getPath()					  ,typeId	: Eve.Resource.getTypeId(this.root, type, this.section)					  ,reminderId: rec.data.reminderId					};					if ( type == "folder"  && this.id != -10){						this.fire("task_activate_child_node", {info: info} );					}else{						this.fire("task_edit_" + type + "_dlg", {info: info, title: this.getRowTitle(rec)} );					}				}		}, this);						//--------------------------------------		//  Handle Icon Click		//--------------------------------------		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm 	= grid.colModel;			if (cm.getDataIndex(colIdx) != 'type')				return;						var rec	 = grid.getStore().getAt(rowIdx);			if (rec) {				type = rec.data.type;				var info = {				   id		: rec.id.split("_")[1]				  ,parentId : this.id				  ,groupId	: this.getGroupId()				  ,root		: this.root				  ,path		: this.getPath()				  ,typeId	: Eve.Resource.getTypeId(this.root, type, this.section)				  ,reminderId: rec.data.reminderId				};				this.fire("task_edit_" + type + "_dlg", {info: info, title: this.getRowTitle(rec)} );			}		}, this);		// Enable the Assignee Filter just on 'Group'.		this.conn.getStore().on('load', function() {		  var xmlData = grid.store.reader.xmlData;    		var btn = Ext.getCmp('assignMode');						if (this.root == 'personal') {				btn.disable()			} else {				btn.enable()			}			 			if (this.id == -10) { 				btn.enable();			}			      		var str = this.createBreadCrumb(xmlData, this.root);		  	this.fire('task_header_update', {breadCrumb: str });      		this.addAssigneeData(xmlData);		}, this);				}		// Hook before Grid store load for new filter	// Return false makes the process stop	,onFilterChange : function(data)	{		var btnFind = Ext.getCmp('btnTaskFind');		var btnClear  = btnFind.menu.items.items[0];				if (data.criteria.trim() != '') {			btnClear.enable();			btnFind.setText('Find +');			this.filterIsOn = true;		}		else {			btnClear.disable();			btnFind.setText('Find');			this.filterIsOn = false;		}				return true;	}	,deleteItems : function(isMultiSelected, singleTask, data){		var object = {			info :{				id: data.id				,parentId : this.id				,groupId : this.groupId || data.groupId				,root: this.root				,path: this.path				}			,title : data.title			,isMultiSelected : isMultiSelected		}		object.info.singleEvent = singleTask;		this.fire(this.section+"_delete_" + data.type.toLowerCase() + "_dlg", object );			}	,deleteHdl: function(data /*comes from Gantt*/){		var id, title, type,groupId;		var isMultiSelected = false;		var singleTask = true;		var selections = (!data.selections)? this.view.get().getSelectionModel().selections : data.selections;		var sameType    = true;		if (selections.length == 0) {			Ext.tools.msg('Select a Record', 'You need to select a record in grid below.');		}		else if(selections.length > 1){			var titles	=[];			var ids		=[];			isMultiSelected = true;			type = selections.first().get('type');			selections.each(function(rec){				if(rec.get('type') != type){					sameType = false;					return;				}				title = this.getTitle(rec);				titles.push( title );				ids.push(rec.id.split("_")[1]);			},this);			if(!sameType){				Ext.tools.msg('', 'All selected rows must have the same type');				return;			}			title	= titles.join(",");			id      = ids.join(",");			this.deleteItems(isMultiSelected, singleTask, {id: id, title: title, type: type });		}		else if(selections.length > 0){			var rec = (this.getRecord)? this.getRecord()				:this.view.get().getSelectionModel().getSelected();			id = rec.id.split("_")[1] || rec.id;			title = this.getTitle(rec);			type = rec.data.type || 'item';			var recurrenceId = rec.data.recurrenceId;			//Added by Ghazale for overllayAll in task			var rawGroupId = (rec.data.groupId && rec.data.groupId.split) ? rec.data.groupId.split("_")[1] : rec.data.groupId			groupId = this.groupId || rawGroupId;			if(recurrenceId !== undefined && recurrenceId != "0" )			{				Ext.Msg.confirm("Confirmation", "Would you like to delete the whole series?",function(btn) {					if (btn == 'yes') {						singleTask = false;					}					this.deleteItems(isMultiSelected, singleTask, {id: id, title: title, type: type, groupId: groupId });				}, this);							}			else{				this.deleteItems(isMultiSelected, singleTask, {id: id, title: title, type: type, groupId: groupId });			}		}	}	,execute : function(callee, type, data){        Eve.widgets.Task.GridBridge.superclass.execute.apply(this, arguments);        switch(type) {			case ('task_success_modify_item'):			case ('task_success_modify_folder'):			case ('task_success_update_item'):			case ('task_success_update_folder'):			    if(data.info.parentId == "-10" && this.root == 'group'){					delete data.info;					data.info = {						id: -10						,path: "\\"						,root: 'personal'					};			        this.fire('task_set_active_node', data, true);			    }				break;			case ('task_set_active_node'):			    if(data.info.id == "-10")			        this.view.get().getSelectionModel().singleSelect = true;				else				    this.view.get().getSelectionModel().singleSelect = false;				break;							case ('task_filter'):			    if(data.mode.branch == 'flatView')			    	this.view.get().getSelectionModel().singleSelect = false;			    else			    	this.view.get().getSelectionModel().singleSelect = true;				break;			case ('task_delete_items'):				this.deleteHdl(data);				break;        }	}		/////////////////////////////////////////////	,getGroupId : function()	{		var grid 	= this.view.get();		var rec		= grid.getSelectionModel().getSelected(); 		var groupId;		if (rec){		    groupId = rec.get('groupId').split('_')[1];		}		else{		    groupId =  this.groupId;		}		this.root = (groupId && parseInt( groupId )!= 0 )? 'group' : 'personal';		return groupId;			}	// Overrride	,getPath : function()	{		var grid 	= this.view.get();		var rec		= grid.getSelectionModel().getSelected();				if (rec)			return rec.get('path');		else		    return this.path	}		//override	,submitChanges : function() {		var store = this.conn.getStore();		if (store.modified.length <= 0) { return }				var alertBroadcast = false;				// Loop throught all modified records		for (var k = 0; k < store.modified.length; ++k ) {			var mf		= store.modified[k].modified;			var map		= store.modified[k];			var newObj	= {};			for (var i in mf) {				newObj[i] = map.data[i];				if ( typeof newObj[i] == 'object' ) {					try{						// BOOO, scary Aye?!						// commented by majid... it isn't support in Ext 2.3						//newObj[i] = newObj[i].format0();						newObj[i] = newObj[i].format('n/j/y');					} catch(e) {						console.log(e);					}				} else if ( typeof newObj[i] == 'function' ) {					newObj[i] = newObj[i]();				}			}		}		var type = map.data.type;		var fn	 = function(d) { return Date.parseDate(map.get(d), Eve.Preference.get('dateFormat')).format('n/j/y'); }		switch(i) {			case 'startDate':				newObj.finishDate	= (map.get('finishDate') == "None") ? "" : fn('finishDate');		    	newObj.dueDate		= (map.get('dueDate') == "None") ? "" :  fn('dueDate');				newObj.title 		= map.get('title');				newObj.status 		= map.get('status');      			newObj.priority 	= map.get('priority');      			newObj.percentCompleted			= map.get('percentCompleted');				newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');				if( type == "item" && parseInt(map.get('startSuccessors')) > 0 ){					alertBroadcast = 'shift_successors_alert';				}				break;			case 'dueDate':      			newObj.startDate	= (map.get('startDate') == "None") ? ""	: fn('startDate');      			newObj.finishDate	= (map.get('finishDate') == "None") ? "" : fn('finishDate');      			newObj.title 		= map.get('title');				newObj.status 		= map.get('status');      			newObj.priority 	= map.get('priority');      			newObj.percentCompleted			= map.get('percentCompleted');				newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');				if( type == "item" && parseInt(map.get('endSuccessors')) > 0){					alertBroadcast = 'shift_successors_alert';				}			    break;			case 'finishDate':      			newObj.startDate    = (map.get('startDate') == "None") ? "" : fn('startDate');      			newObj.dueDate 		= (map.get('dueDate') == "None") ? "" : fn('dueDate');      			newObj.title 		= map.get('title');				newObj.status 		= map.get('status');      			newObj.priority 	= map.get('priority');      			newObj.percentCompleted			= map.get('percentCompleted');				newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');			    break;			case 'completed':				newObj.title = map.get('title');				var completed = map.get('completed');				newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');				if(	type == "item" &&  parseInt(map.get('endSuccessors')) > 0 && completed == false){					alertBroadcast = 'reset_successors_alert';				}			    break;			case 'status':				var status = map.get('status');				if(	type == "item" &&  (parseInt(map.get('startSuccessors')) > 0 && status == "1") ||					(parseInt(map.get('endSuccessors')) > 0 && status != "3")				  ){					alertBroadcast = 'reset_successors_alert';				}      			newObj.startDate	= (map.get('startDate') == "None") ? "" : fn('startDate');				newObj.finishDate	= (map.get('finishDate') == "None") ? "" : fn('finishDate');				newObj.dueDate		= (map.get('dueDate') == "None") ? "" : fn('dueDate');      			newObj.title 		= map.get('title');      			newObj.status 		= map.get('status');      			newObj.priority 	= map.get('priority');      			newObj.percentCompleted			= map.get('percentCompleted');      			newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');				break;			default:      			newObj.startDate	= (map.get('startDate') == "None") ? "" : fn('startDate');				newObj.finishDate	= (map.get('finishDate') == "None") ? "" : fn('finishDate');				newObj.dueDate		= (map.get('dueDate') == "None") ? "" : fn('dueDate');      			newObj.title 		= map.get('title');      			newObj.status 		= map.get('status');      			newObj.priority 	= map.get('priority');      			newObj.percentCompleted			= map.get('percentCompleted');      			newObj.enforcedPredecessors 	= map.get('enforcedPredecessors');		}			var data = {				params		: newObj				,itemType	: type				,record		: map				,mode		: 'inline'				,info 		: {					id			: map.id.split('_')[1]					,parentId	: this.getId()					,groupId	: this.getGroupId()					,root		: this.getRoot()					,path		: this.getPath()				}			}			if (mf.completed === true ||				mf.completed === false ||				mf.completed == "1" ||				mf.completed === "0" ||				mf.milestone =="0"||				mf.milestone == "1" )			{				var temp = (type == "item") ? "task" : "taskFolder";				data.event =  "modern."+temp+"." + this.getRoot() + ".updateCustomFields";			}		if(!alertBroadcast){			this.applyChanges(type, data);		}		else{			this.fire( 'task_'+ alertBroadcast, {grid: this.view.get(), opt: data, callback: this.applyChanges, scope:this});		}			}	,applyChanges : function(type, data ){		this.fire(this.gridSection + '_update_' + type.toLowerCase(), data);	}	/////////////////////////////////////////////	,createBreadCrumb : function(xmlData, root) {		var str = ' - ';		if (root == 'group') {			var assignMode = Ext.DomQuery.selectValue('assignMode', xmlData);			switch(assignMode){				case 'toMe':					str += 'Assigned To Me';					break;				case 'byMe':					str += 'Assigned By Me';					break;				case 'all':					str += 'All Assigned';					break;				case 'unassigned':					str += 'Unassigned';					break;     			}      			str += ' > ';		}			var completeMode = Ext.DomQuery.selectValue('completeMode',xmlData);		switch(completeMode){			case 'all':				str += 'All task';				break;			case 'completed':				str += 'Complete';				break;			case 'incomplete':				str += 'Incomplete';				break; 			case 'overdue':				str += 'Overdue';				break;           		}		return str;	}		,addAssigneeData : function(xmlData){		var store = this.view.get().getStore();		if( store.getTotalCount()!= 0){		   var jsonObject = xml2json(xmlData, "");		   var data =  (jsonObject.data) ? jsonObject.data : jsonObject;		   var len = store.getCount();		   if( len == 1){		   	if(data.row.assigneeList !== undefined && data.row.assigneeList !== null){		   		if(data.row.assigneeList.assignee!== undefined)		     	store.data.items[0].data.assignee = data.row.assigneeList.assignee;		    }		   }		   else{		     for(var i=0; i<len; i++){		    	if(data.row[i].assigneeList !== undefined && data.row[i].assigneeList !== null){					if(data.row[i].assigneeList.assignee!== undefined){			       		store.data.items[i].data.assignee = data.row[i].assigneeList.assignee;			       }		       }		     }		  }		}	}// add assignee data at the end of each record	,augmentToRecord : function(record, xml){		var jsonObject = xml2json(xml, "");		if(jsonObject.data.row.assigneeList != undefined && jsonObject.data.row.assigneeList != null)		record.data.assignee = jsonObject.data.row.assigneeList.assignee;		return record;	}	,setPrintIcons : function(records){		var v ;		for (var i = 0, len = records.length; i < len; i++) {			v = records[i].data.completed;			if( v == "true" || v== true || v== "1" ){				records[i].data.completed =["<img src='", Eve.Resource.getIcon('checked', 'general'), "' width=16>"].join('');			}			else{				records[i].data.completed = "";			}						v = records[i].data.milestone;			if( v === undefined){				records[i].data.milestone = "";			}			else if( v == "true" || v== true || v== "1" ){				records[i].data.milestone =["<img src='", Eve.Resource.getIcon('milestone-on', 'task'), "' width=16>"].join('');			}			else{				records[i].data.milestone = records[i].data.milestone =["<img src='", Eve.Resource.getIcon('milestone-off', 'task'), "' width=16>"].join('');			}		}	}});/*--------------------------------------------------------*//*------------------------Project View--------------------*//*--------------------------------------------------------*/Eve.widgets.Task.Summery = Ext.extend(Eve.lib.Bridge, {	//-----------------------------------------------------	//               Membership	//-----------------------------------------------------	memberTpl :  new Ext.XTemplate(		'<div class="task-gray-header">Project Members</div>',		'<div style="padding:10px" >',		'<table width = 100%>',		'<tpl if="this.hasValue(values)">',		  '<tpl for="row">',		  '<tpl if="this.hasTask(values)">',		  '<tr>',		  	'<td width="80%">',		  		'<span>{title}</span>',		  	'</td>',				'<td width="20%">{taskCount} Task(s)</td>',			'</tr>',			'</tpl>',			'</tpl>',			'</tpl>',		'</table>',		'</div>',	 	 {	 		hasValue: function(values) {	  		 if(values.row === undefined)			  return false;			  else			  return true;	  		}	  		,hasTask : function(val){				if(val.taskCount == "0")				    return false;				else				    return true;	  		}	 	 }	)  	,init: function(obj)	{		Eve.widgets.Task.Summery.superclass.init.call(this, obj);				this.layoutItems = obj.layout;		this.currentTab = 'grid';				this.detailsTpl = new Ext.XTemplate(		'<div >',			'<div class="task-gray-header" style="border-left:1px solid black;border-right:1px solid black">',				'<div style="float:left">Details : {title}</div>',				'<div style="float: right;" id="task-project-edit"  class="portlet bold-item">',				'<a href="#" onclick="return false;">',				' <span onclick="{[this.handler(values)]}" >Edit</span></a></div>',				'<div style="clear:both"></div>',			'</div>',			'<div style="background-color:#D3E2FF;padding:15px 0px 15px 0;min-height:70px" id="project-details">',			'<table width= 100% >',			'<tr>',			'<td width=10% style="font-weight:bold;text-align:right;"> Start Date :</td>',			'<td width=40% style="padding-left:5px;">{startDate}</td>',			'<td width=25% style="text-align:right;font-weight:bold">Priority:</td>',			'<td width=25% style="padding-left:5px">{priorityText}</td>',			'</tr>',			'<tr>',			'<td width=10% style="font-weight:bold;text-align:right;"> Due Date:</td>',			'<td width=40% style="padding-left:5px;">{dueDate}</td>',			'<td width=25% style="text-align:right;font-weight:bold"> %Completed:</td>',			'<td width=25% style="padding-left:5px">{[this.getPercent(values)]}%',			'( {[Math.round(values.allTasksCompletedDays)]} of {allTasksDays} task days completed)</td>',			'</tr>',			'</table>',			'<hr  style="color:#f3f3f3; background-color:#f3f3f3;border-bottom:1px solid #fff;height:1px;padding-bopttom:5px"/>',			'<span style="font-weight:bold;padding-left:25px">Description:</span><br/>',			'<div  style="padding-left:25px">{description}</div>',			'</div>',		  '</div>'		  ,{			getPercent : function(val){				if(val.allTasksDays == "0"){					return 0;				}				return Math.round((parseFloat(val.allTasksCompletedDays) / parseInt(val.allTasksDays)) * 100);			}			,handler :(function(val){				val.type = 'folder';				return this.createUrl(val);			}).createDelegate(this)		  }		);								//-------------------------------------------		//			milestone		//-------------------------------------------	 	this.milestoneTpl = new Ext.XTemplate(				'<div class="task-gray-header" ><div style="float:left">Milestone</div>',		        '<div style="float:right"><tpl>{[this.count(values)]}</tpl></div>',		        '<div style="clear:both"></div>',				'</div>',				'<div style="padding:10px;" class="portlet" >',				'<table width=100%>',			  '<tpl if="this.hasValue(values)">',			  '<tpl for="row">',			  '<tr>',			  	'<td width="65%">',			  	'<tpl if="this.checkStatus(values)">',			  		'{[this.checkStatus(values)]}',			  	'</tpl>',			  		'<a href="#" onclick="return false;">',					  '<span onclick="{[this.handler(values)]}">{title}</span>',					 '</a>',			  		//'<tpl if="this.isCompleted(values)"></tpl>',			  	'</td>',					'<td width="30%">{statusText}</td>',					'</tr>',				'</tpl>',				'</tpl>',				'</table>',				'</div>', {				count : function(values){					var count = 0;					if(values.totalMilestones == "1"){						if(values.row.status == "Complete")						    count = 1;					}					else if(values.totalMilestones > 1){						for (var i = 0; i< parseInt(values.totalMilestones); i++){							if(values.row[i].status  == "3")							    count++;						}					}					return (count+" of "+values.totalMilestones+" Completed" );				}				,handler :(function(val){					val.portlet = 'milestone';					val.type = 'item';					return this.createUrl(val);				}).createDelegate(this)								,checkStatus : function (values){					if(values.status == "3"){						return ('<span style="text-decoration: line-through">');					}					else if (values.status == "2"){						return ('<span style="font-style:italic ">');					}					return ('<span>');				}			  	,hasValue: function(values) {			  		 if(values.row === undefined)					  return false;					 else					 	return true;			  	}			  }			);		//------------------------------------		// 			overdue		//------------------------------------		this.overdueTpl =  new Ext.XTemplate(		'<div class="task-pink-header"> There are currently <tpl>{[this.overdueCount(values)]}</tpl> overdue task(s)</div>',    	'<div style="background-color: #FFC9C8;	border: 1px solid #B81814;border-top:none;" class="portlet">',		'<table cellspacing =0  cellpadding=0  width=100%>',	 	'<tr>',	  	'<td style ="text-align:center;border-right:1px solid #B4B4B4; vertical-align:middle">',		 		'<img width="30px" height="30px" src="' + Eve.Resource.getIcon('overdue','task') + '" />',		'</td>',	   	'<td>',	   	'<tpl if="!this.hasValue(values)"><div style="height:10px;width:476px"></div></tpl>',	   	'<tpl if="this.hasValue(values)">',	   	//'<div style="height:10px;width:476px;border-right:0px solid #B4B4B4"></div>',	   		'<table cellspacing=0 cellpadding=0 width=100% >',	     	'<tpl for="row">',	     	'<tr height="{[xindex === 1 ? "30" : ""]}" >',	     		'<td style="padding:3px 0px 0px 5px; vertical-align:top;" width=2%>',	       		'{#}.',					'</td>',					'<td style="padding-top:3px">',//style="vertical-align:bottom"                        '<a href="#" onclick="return false;">',							'<span onclick="{[this.handler(values)]}"> {title}</span>',						'</a>',						' ( {overdueDays} days overdue )<br/>',		       		'<tpl if="this.hasAssignee(values)">',//				   '<tpl for="assigneeList">',		       		'<table cellspacing = 0 >',		       		'<tr>',		       			'<td style="font-weight:bold;" >Assigned To : </td>',//vertical-align: bottom;								'<td style="padding-left:5px">',										'<tpl for="assignee">{title}<br/></tpl><br/>',								'</td>',				 			'</tr>',				 			'</table>',			 			'</tpl>',			 		'</tpl>',//	     		'</td>',	       	'<td width=40% style="border-left:1px solid #B4B4B4;padding-left:5px;padding-top:3px">',//vertical-align:bottom;			   '<span style = "font-weight: bold;">Status:</span> {statusText}',			'</td>',	     '</tr>',	     '</tpl>',	   '</table>',	   '</tpl>',	   '</td>',	   '</tr>',	 	 '</table></div>',	 	 {	 		 overdueCount : function(values){	 		 	if (values.row === undefined)	 		 		return ( "0" );	 		 	else	 		 		return ( values.totalOverdues );	 		 }			  ,handler: (function(val){					val.type = 'item';					return this.createUrl(val);	 		 }).createDelegate(this)			 ,hasValue: function(values) {		  		 if(values.row === undefined)				  return false;				 else				 return true;	  		}	  		,hasAssignee : function(values){		  		if(values.assigneeList === null){		  			return false;		  		}		  		return true;	  		}	 	 });	}	,createUrl : function(val){		this.portlet = val.portlet;		var path = val.path;		var obj = '{info:{id :\''+ val.id.split('_')[1]+'\',path:\''+path+'\', root: \''+val.mode+'\'';		if(val.mode == 'group'){			obj += ',groupId:\''+val.groupId.split('_')[1]+'\'';		}		obj += '}}';		var str =  "Eve.Resource.superbridge.broadcast(this, \'task_edit_"+val.type+"_dlg\', "+obj+")";		return str;	}		,createLayout : function()	{		// Interlink Tabs		  		var ilFields = [			'objCategory'			,'objId'			,'objMode'			,'objGroupId'			,'objTypeId'			,'objType'			,'objTitle'			,'objPath'			,'objIcon'			,'id'		];					this.ilReader = new Ext.data.XmlReader({			record	: 'row'			,id		: 'id'			,success: '@success'		}, new Ext.data.Record.create(ilFields));		this.ilTmp = new Ext.XTemplate(			'<table width="100%" cellpadding="0" cellspacing="0">',			'<thead class="ev-dataview-header">',				'<td width="5%">&nbsp;</td>',				'<td width="45%">Title</td>',				'<td width="45%">Details</td>',				'<td width="5%">&nbsp;</td>',			'</thead>',			'<tpl for=".">',			 '<tr>',				'<td width="5%"><img src="{objIcon}" /></td>',				'<td width="45%">{objTitle}</td>',				'<td width="45%">&nbsp;</td>',				'<td width="5%" align="left">',					'<img src="' + Eve.Resource.getIcon('delete', 'general') +								   '" onmouseover="this.style.cursor=\'pointer\';"' +								   ' onclick="Eve.Resource.superbridge.broadcast(this, \'interlink_delete\',' +								   ' { id: {id}, info: { root: \'{objMode}\', groupId: \'{objGroupId}\' } }) ">',				'</td>',			 '</tr>',			'</tpl>',			'</table>'		);				// Shared store between all Dataviews.		this.shareStore = new Ext.data.Store ({			fields		: ilFields			,reader		: this.ilReader			,listeners	: {				load		: function() { this.setLinkedCountOfTab() }.createDelegate(this)			}		});								//------------------------------------------------------------		//	Dataviews goes here.		//------------------------------------------------------------				var sectionDV = ['mailDV', 'calendarDV', 'documentsDV', 'contactsDV', 'tasksDV', 'linksDV', 'discussionDV', 'votingDV']				for (var i = 0; i < sectionDV.length; ++i) {			this[sectionDV[i]] = {				xtype			: 'dataview'				,id				: sectionDV[i] + 'Document'				,store 			: this.shareStore				,itemSelector	: 'div.x-grid3-row'				,emptyText		: '<div style="padding:20px;"><b>No item<b></div>'				,tpl			: this.ilTmp			}		}				//------------------------------------------------------------		//	End of Dataviews goes here.		//------------------------------------------------------------		// Interlinking Panel and TabPanel inside.		this.interlink = new Ext.TabPanel({			id				: 'task-interLink-tabs'			,plain			: true			,autoScroll 	: true			,width			: 850			,height     	: 170			,activeTab 		: 0			,bbar			: Eve._il.main.toolbar()			,layoutOnTabChange : true			,defaults		: {				bodyStyle: 'overflow-y: auto;'			}			,items			: [{				title	: 'Mail'				,name	: 'Mail'				,mode	: 'message(s)'				,items	: [	this.mailDV	]			}, {				title	: 'Calendar'				,name	: 'Calendar'				,mode	: 'Calendar&nbsp;Events'				,items	: [ this.calendarDV	]			}, {				title	: 'Documents'				,name	: 'Documents'				,mode	: 'documents'				,items	: [ this.documentsDV ]			}, {				title	: 'Contacts'				,name	: 'Contacts'				,mode	: 'Contacts'				,items	: [ this.contactsDV ]			}, {				title	: 'Tasks'				,name	: 'Tasks'				,mode	: 'Tasks'				,items	: [ this.tasksDV ]			}, {				title	: 'Links'				,name	: 'Links'				,mode	: 'Links'				,items	: [ this.linksDV ]			}, {				title	: 'Discussion'				,name	: 'Discussion'				,mode	: 'thread'				,items	: [ this.discussionDV ]			}, {				title	: 'Voting'				,name	: 'Voting'				,mode	: 'voting'				,items	: [ this.votingDV ]			}]			,listeners	: {				tabchange	: function() {					this.shareStore.clearFilter();					this.shareStore.filter('objCategory', Ext.getCmp('task-interLink-tabs').getActiveTab().mode);				}.createDelegate(this)			}		});			this.tipBox = new Ext.Panel({			layout 	: 	'fit'			,html	:	'<div style="font-size:11px;font-family:tahoma,arial,helvetica,sans-serif;color:gray;padding:25px 15px;">'						+'<b>In order to see project summary , you need to follow the instruction.'						+'<br/>'						+'1- Expand the personal or group you like to work on, please note they are located on the tree in left panel.'						+'<br/>'						+'2- Select the project under the selected node.'						+'</div>'			,border     : false		});			this.container = new Ext.Panel({			id			: 'summary'			,border		: false			,autoScroll : true			//,bodyStyle: 'overflow-y: auto;'			,html 		: 				'<div class="task-summary-container">'					+'<div id="details" class="task-summary-section"></div>'					+'<div id="overdue" class="task-summary-section"></div>'					+'<div id="milestone" class="task-summary-section"></div>'					+'<div id="member" class="task-summary-section"></div>'										+'<div class="task-summary-section">'						+'<div class="task-gray-header" style="border-left:1px solid;border-right:1px solid;">Gantt Chart</div>'						+'<div id="task-gant-chart" style="overflow:hidden;"></div>'					+'</div>'										+'<div id="task-interlink" class="task-summary-section"></div>'				+'</div>'		});				return this.container;}			// Set counts of linked items for each tab on its Title.	,setLinkedCountOfTab : function(tab)	{		var tabPanel = Ext.getCmp('task-interLink-tabs');				if (tab !== undefined) {			tab = (typeof tab == 'number') ? tabPanel.items.getItem(idx) : tab;			var count = this.shareStore.query('objCategory', tab.mode).getCount();			var title = tab.title.split(' ')[0] + " (" + count + ")";			tab.setTitle(title);		}		else {			// Loop through each item.			for (var i = 0; i < tabPanel.items.items.length; ++i) {				var item	= tabPanel.items.items[i];				var count	= this.shareStore.query('objCategory', item.mode).getCount();				var title	= item.title.split(' ')[0] + " (" + count + ")";				item.setTitle(title);			}			}			}		,updateGantt: function(obj)	{/*		var ganttUrl = '';				if (obj.info.groupId !== null) {			ganttUrl = 'index.cfm?event=modern.task.group.showGant&full=true&id='+obj.info.id+'&path='+obj.info.path+'&groupId='+ obj.info.groupId;		} else {			ganttUrl = 'index.cfm?event=modern.task.personal.showGant&full=true&id='+obj.info.id+'&path='+obj.info.path;		}				ganttUrl = ganttUrl + '&CFID=' + Eve.CFId + '&CFTOKEN=' + Eve.CFToken;		var rs = null;		if (this.gantt && this.currentTab == "gannt" ) {			this.gantt.Clear();			this.gantt.clearDependencies();			JSGantt.parseXML(ganttUrl, this.gantt );			this.gantt.Draw();			this.gantt.DrawDependencies();			//rs = new Ext.Resizable( 'leftside', { handles: 'e', pinned: true } );		}		else if (this.ganttChart && this.currentTab == 'summary') {			this.ganttChart.Clear();			this.ganttChart.clearDependencies();						JSGantt.parseXML(ganttUrl, this.ganttChart );			this.ganttChart.Draw();			this.ganttChart.DrawDependencies();			//rs = new Ext.Resizable( 'leftside', { handles: 'e', pinned: true } );		}*/		/*		if ( rs && rs.on ){			Ext.get('rightside').dom.style.left = '585px';			rs.on( 'resize', function( rs, w, h, e ){				Ext.get('rightside').dom.style.left = w + 'px';			} );		}*/		var url = [Eve.url, '?event=modern.taskFolder.',obj.info.root,'.viewGantt&id=',obj.info.id,					'&path=',obj.info.path,'&CFID=', Eve.CFId, '&CFTOKEN=', Eve.CFToken];		if(obj.info.root != 'personal')			url.push('&groupId='+obj.info.groupId);		var panel = {			xtype		: 'panel'			,id			: 'wow_gantt'			,layout		: 'fit'			,items		: [ new Ext.ux.IFrameComponent({ url: url.join('') }) ]		};		var el	= Ext.getCmp('gantt_chart')		el.remove(Ext.getCmp('wow_gantt'));		el.add(panel);		Ext.getCmp('gantt_chart').doLayout();	}		,changeView : function(obj, isIL)	{		var card = Ext.getCmp('taskCardLayout');		var tb = Ext.getCmp('task-grid-toolbar');		var h = card.getSize().height;		// Reset gantt charts to prevent id conflict		//delete this.gantt;		//delete this.ganttChart;		switch(obj.idx) {			case 0:				tb.show();				if(!this.isPlus){					card.setHeight(h + 1);					this.isPlus = true;				}				else{					card.setHeight( h - 1);					this.isPlus = false;				}				this.currentTab = 'grid';				card.setActiveTab(0);				if(this.nodeInfo)					this.fire('task_set_active_node', this.nodeInfo, true);				break;							case 1:				tb.hide();				if(!this.isPlus){					card.setHeight(h + 1);					this.isPlus = true;				}				else{					card.setHeight( h - 1);					this.isPlus = false;				}				this.currentTab = 'gannt';				card.setActiveTab(1);				/*				if ( !this.gantt ) {					this.gantt = new JSGantt.GanttChart('g',Ext.getCmp('gantt_chart').body.dom, 'day');					this.gantt.setShowRes( 1 );					this.gantt.setShowDur( 1 );					this.gantt.setShowComp( 1 );					this.gantt.setCaptionType( 'Resource' );					window.g = this.gantt;								}												this.updateGantt(obj);				*/				this.updateGantt(obj);				break;							case 2:				tb.hide();				if(!this.isPlus){					card.setHeight(h + 1);					this.isPlus = true;				}				else{					card.setHeight( h - 1);					this.isPlus = false;				}			    this.currentTab = 'summary';			    card.setActiveTab(2);								// Just update the IL params if it's not called from "reload_interlink_grid"				if (! isIL) {					this.nodeInfo.info.typeId = Eve.Resource.getTypeId(this.nodeInfo.info.root, 'folder', this.section);					Eve._il.main.params	= this.nodeInfo;				}							    this.fire('task_get_summary', obj);								break;									}	}  	,fillPanels : function(obj)	{		// -------------- Load Details --------------		var jsonObject	= xml2json(obj.response.responseXML, "");		var temp 		= this.detailsTpl.apply(jsonObject.data.details);		this.details 	= Ext.get('details');		this.details.dom.innerHTML = temp;				//--------------- Load Overdu ---------------		var _temp = jsonObject.data.overdues;				if(_temp === null)			_temp = {};				temp = this.overdueTpl.apply(_temp);				this.overdue = Ext.get('overdue');		this.overdue.dom.innerHTML = temp;								// -------------- Load Milestones --------------		_temp = jsonObject.data.milestones;				if(_temp === null)			_temp = {};				temp = this.milestoneTpl.apply(_temp);				this.milestone = Ext.get('milestone');		this.milestone.dom.innerHTML = temp;								// -------------- Load Members --------------		_temp = jsonObject.data.members;				if(_temp === null)			_temp = {};				temp = this.memberTpl.apply(_temp);				this.member = Ext.get('member');		this.member.dom.innerHTML = temp;				// load gant chart		/*if (!this.ganttChart) {			this.ganttChart = new JSGantt.GanttChart('g',Ext.get('task-gant-chart').dom, 'day');			this.ganttChart.setShowRes(1);			this.ganttChart.setShowDur(1);			this.ganttChart.setShowComp(1);						this.ganttChart.setCaptionType( 'Resource' );			window.g = this.ganttChart;		}*/		var url = [Eve.url, '?event=modern.taskFolder.',obj.obj.info.root,'.viewGantt&id=',obj.obj.info.id,					'&path=',obj.obj.info.path,'&CFID=', Eve.CFId, '&CFTOKEN=', Eve.CFToken];		if(obj.obj.info.root != 'personal')			url.push('&groupId='+obj.obj.info.groupId);				if(!Ext.get('wow_gantt_summary')){			var panel = new Ext.Panel({				xtype		: 'panel'				,id			: 'wow_gantt_summary'				,layout		: 'fit'				,items		: [ new Ext.ux.IFrameComponent({id:'wow_gant_IFRAME', url: url.join('') }) ]				,renderTo	: 'task-gant-chart'			});		}		else{				Ext.get('iframe-wow_gant_IFRAME').dom.src = url.join('');		}				//this.updateGantt(obj.obj);						// -------------- Load Interlinking --------------		this.interlink.render('task-interlink');		this.shareStore.removeAll();				// load store.		var root = Ext.DomQuery.selectNode('linkedItems', obj.response.responseXML);				if (root !== undefined) {			var result	= this.shareStore.reader.read({responseXML: root});			this.shareStore.loadRecords(result, {add: true}, true);						var filter = Ext.getCmp('task-interLink-tabs').getActiveTab().title.split(' ')[0];			this.shareStore.filter('objCategory', filter);						// Only update id, otherwise you will lose objTypeId			Eve._il.main.params.info.id = this.nodeInfo.info.id;		}						Ext.getCmp('taskCardLayout').setActiveTab(2);	}	,execute : function (callee, type, obj)	{		switch (type) {			case 'task_change_tab':				this.changeView(obj);				break;							case 'task_set_active_node':				this.nodeInfo = obj;                //Ext.getCmp('taskCardLayout').items.items[3].disable();				                if (parseInt(obj.info.id) == 0 || parseInt(obj.info.id) == -10) {					Ext.getCmp('taskCardLayout').items.items[2].disable();                } else {                    Ext.getCmp('taskCardLayout').items.items[2].enable();                }								if (this.currentTab == 'summary') {					if (parseInt(obj.info.id) != 0 && parseInt(obj.info.id) != -10) {       									this.fire('task_get_summary', obj);						Ext.getCmp('taskCardLayout').items.items[2].enable();					} else {						Ext.getCmp('taskCardLayout').setActiveTab(0);						this.currentTab = 'grid';						Ext.getCmp('taskCardLayout').items.items[2].disable();					}				}								this.updateGantt(obj);				break;							case 'show_section':				if (this.section != Eve.SectionManager.getSectionId( obj.sectionName )) {					return;				}								if (obj.info.groupId == 0) {					Ext.getCmp('taskCardLayout').items.items[2].disable();                } else {                    Ext.getCmp('taskCardLayout').items.items[2].enable();                }								break;							case 'tasks_success_get_summary':				this.fillPanels(obj);				Ext.getCmp('task-interLink-tabs').fireEvent('tabchange');				/* Majid: Wait : next lines was commented */				Eve.mask.hide();								break;							case 'success_interlink_delete':				if (this.section == 'task' && this.currentTab == 'summary')	{					var rec = this.shareStore.getById(obj.id);					var tab = Ext.getCmp('task-interLink-tabs').getActiveTab();					this.shareStore.remove(rec);										var dvId = tab.name.toLowerCase() + 'DVDocument';										// tada...					this.setLinkedCountOfTab(tab);					Ext.getCmp(dvId).refresh();				}				break;			case 'task_reload_project_summary':			case 'task_reload_interlink_grid':				if (Eve.activeSec.toLowerCase() == 'task' && this.currentTab == 'summary') {					this.nodeInfo.idx = 2;					this.changeView(this.nodeInfo, true);					/*					var result = this.shareStore.reader.read(obj.info.response);					this.shareStore.loadRecords(result, {add: true}, true);										this.setLinkedCountOfTab();					*/				}				break;			default:			    if (type == "task_success_update_grid")			        return;							    if (this.section == 'task' &&			 		this.currentTab == 'summary'&&		 			type.indexOf( '_success_' ) !== -1)			    {										this.fire('task_get_summary',this.nodeInfo);			    }			    break;		}	}}) ;/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\task/TaskMenu.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */ // -----------------------------------------------------------------------// Task Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.TaskEditMenu = Ext.extend( Eve.widgets.BaseEditMenu, {	init : function(data)	{		Eve.widgets.TaskEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			},{				text	: "Copy"				,id		: "task_copy"				,icon	: Eve.Resource.getIcon('item-copy','link')			}, '-', {				text	: "Comments"				,id		: "comments"			}, {				text	: "Linked Items"				,id		: "linked"			}]		});				this.folder_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}/*,{				text	: "Copy"				,id		: "task_copy"				,icon	: Eve.Resource.getIcon('item-copy','link')			}*/]		});				this.registerView();	}	,registerView : function( brdg )	{		this.item_menu.on('itemclick', function(bi)		{			console.log("registerView , itemClick")			var data = {				title	: this.title				,isMultiSelected : this.isMultiSelected				,type: 'item'				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}			switch(bi.id)			{				case 'edit':					//@@Benchmark					//console.log("@@Benchmark -- Time(N1): ",(new Date()).getRTime() % 100000);					this.fire(this.section + '_edit_item_dlg'  , data);					break;				case 'delete':					this.fire('task_delete_items'  , data );					break;				case 'task_copy':					this.fire('task_copy_dlg', data);					break;				case 'linked':					this.fire(this.section + '_interlinking_dlg', data);					break;				case 'comments':					this.fire(this.section + '_comment_dlg', data);					break;			}		}, this );		if (this.folder_menu.on) {			this.folder_menu.on('itemclick', function( bi )			{				var data = {					title			: this.title					,isMultiSelected : this.isMultiSelected					,type			: 'folder'					,info	: {						id			: this.id						,typeId		: this.typeId						,reminderId	: this.reminderId						,parentId	: this.parentId						,groupId	: this.groupId						,root		: this.root						,path		: this.path					}				}				switch(bi.id)				{					case 'edit':						this.fire(this.section + '_edit_folder_dlg' ,data);						break;					case 'delete':							this.fire(this.section + '_delete_folder_dlg' ,data);						break;					case 'task_copy':						this.fire('task_copy_dlg', data);						break;				}			}, this);		}	}});// -----------------------------------------------------------------------// Task Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.TaskAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.TaskAddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{					text	: "New Project"					,id		: 'folder'					,icon	: Eve.Resource.getIcon('new-project','task')				}, {					text	: "New Task"					,id		: 'item'					,icon	: Eve.Resource.getIcon('new-task','task')				}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Task Tree Add Context Menu// -----------------------------------------------------------------------Eve.widgets.TaskTreeMenu = Ext.extend( Eve.widgets.BaseTreeMenu, {	init : function(data)	{		Eve.widgets.TaskTreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','task')				}, {					text	: "Edit"					,id		: 'edit'					,icon	: Eve.Resource.getIcon('edit', 'general')				}, {					text	: "Delete"					,id		: 'delete'					,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.groupmenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','task')			}]		});				this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\task/TaskDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Tasks section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Task.ItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Task.ItemDialogBridge.superclass.init.call(this, data);		//		this.panels[0].get().getForm().transit.add( new Eve.form.SimpleComboStrategy() );//		this.panels[2].get().getForm().transit.add( new Eve.form.SimpleComboStrategy() );			var items	= (this.isIL()) ? ['General', 'Reminders','Recurrence','Dependencies','Assign & Notify'] : ['General', 'Reminders','Recurrence', 'Dependencies', 'Assign & Notify', 'Comments', 'Linked Items'];		var tab		= {			items		: items			,related	: [[0, 1, 2, 3, 4]]			,main 		: [0, 1]		}				var dialog	= {			width 	: 630			,height : 530			,title	: 'Task'		}				//this.createDialog({tab: tab ,dialog: dialog, preRender: !this.isIL()})		this.createDialog({tab: tab ,dialog: dialog, preRender: false});		this.registerView();	}	,showDateAlert : function(el, isDialog, data)	{		//if(!this.dateAlert){			var dateAlert = new Ext.Window({				width		: 400				,height		: 100				,modal		: true				,border		: false				,resizable	: false				,closable	: false				,constrain	: true				,buttonAlign: 'center'				//,closeAction: 'hide'				,items		: [{					layout		: 'form'					,border		: false					,bodyStyle	: 'padding:5px; background-color:#E5E5E5;'					,items		: [{						xtype		: 'label'						,text		: 'You are modifying a task that has dependencies. Would you like to shift the dates for the dependent tasks?'						,hideLabel	: true						,style		: 'font-size:12px; text-align:justify;'					},{					layout:'column'					,border: false					,bodyStyle	: 'padding:5px;background-color:#E5E5E5;'					,items:[{							columnWidth	: .5							,border: false							,bodyStyle	: 'background-color:#E5E5E5;'							,items:[{								xtype		: 'button'								,text		: 'Yes'								,style		: 'margin-left:90px;'								,minWidth	: 90								,handler	: function()								{									dateAlert.close();									if( isDialog )									{										this.shiftSuccessors = true;										Eve.lib.Task.ItemDialogBridge.superclass.submitForm .apply(this, [data.id, data.close, data.changeTo]);									}									else{										data.opt.params.shiftSuccessors = true;										data.callback.apply(data.scope, ['item',data.opt]);									}								}								,scope		: this							}]					},{						columnWidth	: .5						,border: false						,bodyStyle	: 'background-color:#E5E5E5;'						,items:[{							xtype		: 'button'							,minWidth	: 90							,style		: 'margin-left:5px;'							,text		: 'No'							,handler	: function()							{								dateAlert.close();								if( isDialog )									Eve.lib.Task.ItemDialogBridge.superclass.submitForm .apply(this, [data.id, data.close, data.changeTo]);								else									data.callback.apply(data.scope,['item', data.opt]);							}							,scope		: this						}]					}]				}/*,{					xtype: 'label'					,html: '<i><b>Note:</b>You can turn on Shift Dependent Tasks by clicking the checkbox in the top right corner of the Gantt chart.</i>'				}*/]				}]			});		//}		try{			dateAlert.show(el.getEl().dom.id);		}catch(e){			dateAlert.show();		}			}	,showStatusAlert: function(el, isDialog, data)	{		//if(!this.statusAlert){			var statusAlert = new Ext.Window({				width		: 400				,id			: 'status_reset_window'				,height		: 100				,modal		: true				,border		: false				,resizable	: false				,closable	: false				,constrain	: true				,buttonAlign: 'center'				//,closeAction: 'hide'				,items		: [{					layout		: 'form'					,border		: false					,bodyStyle	: 'padding:5px; background-color:#E5E5E5;'					,items		: [{						xtype		: 'label'						,text		: 'This task has successors that are in a status that conflicts with this change. What would you like to do?'						,hideLabel	: true						,style		: 'font-size:12px; text-align:justify;'					}]				}]				,buttons	: [{					text		: 'Reset the status of these tasks'					,handler	: function(){						statusAlert.close();						if(isDialog)						{							this.resetSuccessors = true;							if( this.alertShift)								this.showDateAlert( el, 'dialog', {id: data.id, close: data.close, changeTo: data.changeTo});							else								Eve.lib.Task.ItemDialogBridge.superclass.submitForm .apply(this, [data.id, data.close, data.changeTo]);						}						else{							data.opt.params.resetSuccessors = true							data.callback.apply(data.scope, ['item',data.opt]);						}					}					,scope		: this				}, {					text		: 'Leave the successors unchanged'					,handler	: function() {						statusAlert.close();						if(isDialog)						{							if( this.alertShift)								this.showDateAlert( el, 'date', {id: data.id, close: data.close, changeTo: data.changeTo});							else								Eve.lib.Task.ItemDialogBridge.superclass.submitForm .apply(this, [data.id, data.close, data.changeTo]);						}						else{							data.callback.apply(data.scope,['item', data.opt]);						}					}					,scope		: this				}]			});		//}			try{				statusAlert.show(el.getEl().dom.id);			}			catch(e){				statusAlert.show();			}	}	,registerView : function(){		this.getTabPanel().on('beforetabchange', function(tPanel, newTab, tab){			var idx 		= this.getIndex(newTab);			if(this.mode == 'edit' && idx == 3){				var startDate = Ext.getCmp( this.section + 'itm_startdate');				var dueDate =  Ext.getCmp( this.section + 'itm_duedate');				if(!startDate.getValue().format){					Ext.tools.msg('Validation Error', 'Please fill all required fields to proceed.');					return false;				}				if(!dueDate.getValue().format){					Ext.tools.msg('Validation Error', 'Please fill all required fields to proceed.');					return false;				}			}			else if (this.mode == 'create' && (idx == 3)) {				this.win = new Ext.Window({					width		: 400					,height		: 120					,modal		: true					,border		: false					,resizable	: false					,closable	: false					,constrain	: true					,buttonAlign: 'center'					,items		: [{						layout		: 'form'						,border		: false						,bodyStyle	: 'padding:5px; background-color:#E5E5E5;'						,items		: [{							xtype		: 'label'							,text		: 'The item you are editing will be saved if you proceed to this tab so you can add dependecies to it. Are you sure you wish to proceed and save your changes?'							,hideLabel	: true							,style		: 'font-size:12px; text-align:justify;'						}]					}]					,buttons	: [{						text		: 'Proceed'						,handler	:  function() {							var fp	= tab.items.itemAt(0);							// Before sumbit, check if the form is valid							if (! fp.getForm().isValid()) {								Ext.tools.msg('Validation Error', 'Please fill all required fields to proceed.');								if (this.win) {									this.win.close();								}								return;							}							// Submit previous tab							this.submitForm(this.getIndex(tab), false, newTab);							if (this.win) {								this.win.close();							}						}						,scope		: this					}, {						text		: 'Cancel'						,handler	: function() {this.ownerCt.hide();}					}]				});				this.win.show(tab.getEl().dom.id);				return false;			}			return true;					}, this);		Ext.getCmp(this.section + 'btn_add_dependency').on('click', function(){			var dependencyTab = this.getTabPanel().items.itemAt( 3 );			this.fire('task_add_dependency_dlg', {dependencyTab: dependencyTab ,info: {id: this.id, groupId : this.groupId, root: this.root, parentId: this.parentId}});		}, this);		//Delete Dependency		Ext.getCmp(this.section + 'predecessorsDV').on('click', function(dv, index, node, e){			if(e.getTarget().className == 'btn-delete'){				var record = dv.getRecord(node);				dv.store.remove( record );			}		}, this);		Ext.getCmp(this.section + 'successorsDV').on('click', function(dv, index, node, e){			if(e.getTarget().className == 'btn-delete'){				var record = dv.getRecord(node);				dv.store.remove( record );			}		}, this);		// Attach handler for 'Daily' ... 'Yearly' radios		Ext.getCmp(this.section + 'frmPeriodRadios').items.each( function(el, idx) {			el.on('check', function(rd, checked) {				var frmPeriodView = Ext.getCmp(this.section + 'frmPeriodView');								if (checked) {					frmPeriodView.items.each( function(item) {						item.hide();					})										frmPeriodView.items.itemAt(idx).show();					frmPeriodView.doLayout();				}			}, this)		},this);		//Set Status		var spinner = Ext.getCmp(this.section + 'item_spinner');		spinner.on('change', function(el, newVal, oldVal){			var statusCmb = Ext.getCmp(this.section+'item_status');			this.setStatus(newVal, statusCmb);		}, this);		spinner.on('spin', function(el){			var newVal = el.getValue();			var statusCmb = Ext.getCmp(this.section+'item_status');			this.setStatus(newVal, statusCmb);		}, this);		Ext.getCmp(this.section + 'item_status').on('select', function(cmb, rec, index){			var spinner = Ext.getCmp(this.section+'item_spinner');			switch(index){				case 0:					spinner.setValue(0);					break;				case 2:					spinner.setValue(100);					break;				case 1:					spinner.setValue(25);					break;			}			if(index == 2){				this.getTabPanel().getItem(2).disable();				//this.recurrenceId = 0;			}			else{				this.getTabPanel().getItem(2).enable();			}		}, this);	}	,setStatus : function(newVal, statusCmb){		if( newVal == 100){			statusCmb.setValue(3);		}		else if(newVal == 0){			statusCmb.setValue(1);		}		else if( 0< newVal <100 && statusCmb.getValue()!=4 &&  statusCmb.getValue()!=5 ){			statusCmb.setValue(2);		}		if(newVal == 100){			this.getTabPanel().getItem(2).disable();			//this.recurrenceId = 0;		}		else{			this.getTabPanel().getItem(2).enable()		}	}	,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset all Flags.		this.clearLoaded();	}		,onDialogShow : function()	{		Eve.lib.Task.ItemDialogBridge.superclass.onDialogShow.apply(this, arguments);//		if(this.id == "0")//			Ext.getCmp(this.section + 'btn_add_dependency').disable();//		else//			Ext.getCmp(this.section + 'btn_add_dependency').enable();				if (this.mode == 'create' && this.root == 'personal') {			// Task			var dt = new Date();			Ext.getCmp(this.section + 'itm_startdate').setValue(dt);			Ext.getCmp(this.section + 'evaluateAsHTML').setValue(true);						if (this.root == 'personal') {				// Reminder				Ext.getCmp(this.section + 'ReminderOff').setValue('0');				Ext.getCmp(this.section + 'relativeMinutes').setValue(0);				Ext.getCmp(this.section + 'rel_time').hide();				Ext.getCmp(this.section + 'abs_time').show();							Ext.getCmp(this.section + 'associated_icon').el.innerHTML = '';				Ext.getCmp(this.section + "associated").el.innerHTML = '';								Ext.getCmp(this.section + 'reminder_date').setValue(dt);				Ext.getCmp(this.section + 'reminder_time').setValue(dt);								Ext.getCmp(this.section + 'UseEmail').setValue(false);				Ext.getCmp(this.section + 'reminderAsHTML').setValue(true);				Ext.getCmp(this.section + 'reminderPopup').setValue(false);			}		}		if (this.mode == 'create' && this.isCached()) {			var sd = new Date();			// Set Default values for Recurrence Patterns			var checkBoxes = Ext.getCmp(this.section + 'weekDaysMask').items.items;			// Weekly			for (var i = 0; i < checkBoxes.length; ++i) {				if (parseInt(checkBoxes[i].inputValue) == sd.getDay()) {					checkBoxes[i].setValue(true);				}			}			// Monthly			Ext.getCmp(this.section + 'DayInMonthnth').setValue(sd.getDate());			Ext.getCmp(this.section + 'instanceOfDayInMonthMonthly').setValue(Math.ceil( sd.getDate() / 7 ));			Ext.getCmp(this.section + 'dayOfWeekMonthly').setValue(sd.getDay() + 1);			// Yearly			Ext.getCmp(this.section + 'specificMonthYearnth').setValue(sd.getMonth() + 1);			Ext.getCmp(this.section + 'instanceOfDayInMonthYearly').setValue(Math.ceil( sd.getDate() / 7 ));			Ext.getCmp(this.section + 'dayOfWeekYearly').setValue(sd.getDay() + 1);			Ext.getCmp(this.section + 'specificMonthYearly').setValue(sd.getMonth() + 1);			Ext.getCmp(this.section + 'dayInMonthYearnth').setValue(sd.getDate());		}		if(this.mode == 'create'){			Ext.getCmp(this.section + 'successorsDV').store.removeAll();			Ext.getCmp(this.section + 'predecessorsDV').store.removeAll();			var dependencyTab = this.getTabPanel().items.itemAt( 3 );			dependencyTab.setTitle('Dependencies ( 0 )');		}			}		// Overriden	,onTabChange : function(tPanel, tab)	{		var idx = this.getIndex(tab);				// Prevent the related tab from loading.		if (this.mode == 'create' && this.isCached() &&			(idx != this.idxComments || idx != this.idxInterlink))		{			return;		}				// If this tab previously loaded,		// prevent it from loading agian.		if (this.getLoaded(idx))			return				// Do not load the form, if it's 		// in 'Create' mode or index not		// equals to one.		if (this.mode != 'create' || idx == '1') {			this.loadForm(idx);			this.setLoaded(idx);		}	}		,augment : function(callee, idx, type)	{		if ( callee.params && callee.params.event === undefined )			callee.params = {};					var obj = callee.params;				if (this.mode != 'create')			obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;				if (idx === undefined)			idx = this.getIndex(this.getTabPanel().activeTab);				switch(idx)	{			//General			case 0:			case 1:			case 2:			case 3:				if(type == 'submit'){					obj.recurrenceId	= this.recurrenceId;					if(this.root === 'personal')						obj.reminderId	= this.reminderId;					else if (this.root === 'group')						obj.NotifyAssignees = 1;					//if (this.mode != 'create')					obj.shiftSuccessors = this.shiftSuccessors;					obj.resetSuccessors = this.resetSuccessors;					var st = Ext.getCmp( this.section + 'successorsDV').store					var temp = [];					st.each(function(record){						temp.push( [record.get('id').split("_")[1] , '|', record.get('type'), '|', record.get('status')].join('') );					}, this);					obj.successorIds = temp.join(',');					st = Ext.getCmp( this.section + 'predecessorsDV').store;					temp = [];					st.each(function(record){						temp.push( [record.get('id').split("_")[1] , '|', record.get('type'), '|', record.get('status')].join('') );					}, this);					obj.predecessorIds = temp.join(',');				}				else if(type == 'load' && this.selectedDate){					obj.selectedDate = this.selectedDate;				}							break;										// Notify assignee			case 4:				obj.NotifyAssignees = 1;				obj.recurrenceId	= this.recurrenceId;				break;							// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}				return callee;	}		,setCmpValue : function()	{		var chkSendTo = Ext.getCmp(this.section + "UseEmail");		var txtEmail  = Ext.getCmp(this.section + "EmailChk");				// If its not checked.		if (!chkSendTo.getValue()) {			txtEmail._value = txtEmail.value;			txtEmail.setValue();			txtEmail.disable();		}	}	,showHideCmp : function()	{		// Based on the root, Enable/Disable 'Reminder' and 'Asignee' tabs.		if (this.root == 'personal') {            this.getTabPanel().unhideTabStripItem(1);			this.getTabPanel().hideTabStripItem(4);		}		else {    		this.getTabPanel().hideTabStripItem(1);			if (this.mode == 'edit'){				this.getTabPanel().unhideTabStripItem(4);				//this.getTabPanel().getItem(2).enable();			}			else{				this.getTabPanel().unhideTabStripItem(4);				//this.getTabPanel().getItem(2).disable();			}		}		//enable recurrence tab		this.getTabPanel().getItem(2).enable();	}		,controller : function(obj)	{		this.shiftSuccessors = false;		this.resetSuccessors = false;		this.id 		= obj.info.id;  		this.parentId 	= obj.info.parentId ;  		this.groupId 	= obj.info.groupId  		this.root 		= obj.info.root;  		this.path		= obj.info.path ;		this.reminderId = obj.info.reminderId || 0;		this.recurrenceId = obj.info.recurrenceId || 0;		this.selectedDate 	= obj.info.selectedDate || undefined;  		//From Mail		this.taskSubject = obj.taskSubject || undefined;		this.taskBody = obj.taskBody || undefined;		// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack				this.title		= obj.title;		if (! this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;			this.panels[this.idxComments].reset();		}  		this.panels[0].reset();		this.panels[1].reset();		this.panels[2].reset();		this.panels[3].reset();		  		this.dialog.show();  		this.showHideCmp();	}		,execute : function(callee, type, data)	{    	switch(type) {			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				Ext.getCmp(this.section + 'btn_sub').toggle(false);								if (!this.getLoaded(0))					this.loadForm(0);								break;							case (this.section + '_create_item_dlg'):				this.mode = data.mode || 'create';				this.controller(data);				var dt = new Date();								Ext.getCmp(this.section + 'btn_sub').toggle(false);								if (! this.isCached() || this.root == 'group') {					this.loadForm(0);				}				if(this.taskSubject !== undefined && this.taskSubject !== undefined){					Ext.getCmp(this.section + 'subject').setValue(this.taskSubject);					Ext.getCmp(this.section + 'desc').setValue(this.taskBody);				}								break;						 	case (this.section + '_add_assignee'):			 	var store 	= Ext.getCmp(this.section + 'assignee_dv').store;				var members = Ext.getCmp(this.section + 'group_members');							//get user info				var idx			= members.store.find(members.valueField, members.hiddenField.value);				var recCombo	= members.store.getAt(idx);				members.store.remove(recCombo);								 	var id			= members.hiddenField.value;			 	var name		= members.el.dom.value;			 	var rec			= Ext.data.Record.create(['id', 'title', 'assignedStateValue', 'assignedStateText']);								//get state of notify			 	var notifyCmb = Ext.getCmp(this.section + 'assignee');			 	var val = notifyCmb.getValue();			 	var selectedRec = notifyCmb.store.getAt(notifyCmb.store.find(notifyCmb.valueField, val));			 	var state = selectedRec.get(notifyCmb.displayField);				state = ( state == 'Request Task Acceptance') ? 'Awaiting reply' :state;			 	var newRec = new rec({id: id, title: name, assignedStateText: state, assignedState : val});				members.store.clearFilter();				if (members.store.getCount() != 0) {					var temp = members.store.getAt(0).get(members.valueField);				} else {					var temp = '';					Ext.getCmp(this.section + 'btn_add_assign').disable();				}							 	members.setValue(temp);				 store.add(newRec);			 	break;				case (this.section + '_delete_assignee'):				var dataView	= Ext.getCmp(this.section + 'assignee_dv');				var ds			= dataView.store;				var idx			= ds.find('id',data.info.value);				var rec			= ds.getAt(idx);				ds.remove(rec);				dataView.view.refresh();				var rec, newRec;				var members = Ext.getCmp(this.section + 'group_members');								if (members.store.getCount() == 0){					Ext.getCmp(this.section + 'btn_add_assign').enable();					}							rec = Ext.data.Record.create(['id', 'title']);				newRec = new rec({id : data.info.value, title : data.info.text});				members.store.add(newRec);								members.setValue(members.store.getAt(0).get(members.valueField));				break							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_comment_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxComments);				// ...Clear its load status ;)				this.clearLoaded(0);				break;							case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_interlinking_dlg'):				this.mode = data.mode || 'edit';								// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxInterlink);								// ...Clear its load status ;)				this.clearLoaded(0);				break;							case (this.section + '_reload_interlink_grid'):				if (this.origin != data.origin)					return;				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;			case (this.section + '_reset_successors_alert'):				this.showStatusAlert( data.grid, false, data );				break;			case (this.section + '_shift_successors_alert'):				this.showDateAlert(data.grid, false, data);				break;			case (this.section + '_before_update_item'):				if(parseInt(data.params.endSuccessors)> 0 && data.params.completed == "false" ){					var object ={opt: data, callback: this.updateTaskItem , scope:this};					this.showStatusAlert( Ext.getBody(), false, object );				}				else{					this.updateTaskItem('item', data);				}				break;		}	}	,updateTaskItem : function(type, data){		this.fire(this.section + '_update_' + type.toLowerCase(), data);	}	,staticLoad : function(xml)	{		var dq	 = Ext.DomQuery;		var root = xml.task;					for (var i = 0; i < this.panels.length; ++i) {			var form = this.panels[i].get().getForm();			form.transit.load(root);		}		this.reminderId = 0;		this.recurrenceId = 0;		this.cached = true;	}		,loadSuccess : function(res) {		var idx	 = this.getIndex(this.getTabPanel().activeTab);		var dq = Ext.DomQuery;		switch(idx) {			case 3:			case 2:			case 1:			case 0:			    this.reminderId = dq.selectValue('reminderId', res.responseXML, "RPI_0").split("_")[1];			    this.recurrenceId = dq.selectValue('recurrenceId', res.responseXML, "0");			    this.status = dq.selectValue('status', res.responseXML, "1");				this.successorsCount = Ext.getCmp(this.section + 'successorsDV').store.getCount();								this.startDate = dq.selectValue('startDate', res.responseXML, undefined);				this.dueDate = dq.selectValue('dueDate', res.responseXML, undefined);				if(this.status == "3"){					this.getTabPanel().getItem(2).disable();				}				else{					this.getTabPanel().getItem(2).enable()				}			    			 	if (Ext.getCmp(this.section + 'group_members').store.getCount() == 0)					Ext.getCmp(this.section + 'btn_add_assign').disable();			 	else					Ext.getCmp(this.section + 'btn_add_assign').enable();				if(this.taskSubject !== undefined && this.taskBody !== undefined){					Ext.getCmp(this.section + 'subject').setValue(this.taskSubject);					Ext.getCmp(this.section + 'desc').setValue(this.taskBody);				}				//For setting path whenever task pops from other sections like mail				if(parseInt(this.id ) > 0){					var path = Ext.DomQuery.selectValue('path', res.responseXML)					if(path !== undefined && path.length > 0)					    this.path = dq.selectValue('path', res.responseXML);								}				try{					var dependencyTab = this.getTabPanel().items.itemAt( 3 );					var c =  Ext.getCmp(this.section + 'successorsDV').store.getCount() + Ext.getCmp(this.section + 'predecessorsDV').store.getCount();					dependencyTab.setTitle('Dependencies ( ' + c + ' )');				}				catch(e){}				//			    break;						// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}	}	,submitForm : function(id, close, changeTo)	{		var tab = this.getTabPanel().items.itemAt( id );		var sStore = Ext.getCmp(this.section + 'successorsDV').store;		var pStore = Ext.getCmp(this.section + 'predecessorsDV').store;		this.alertReset = false;		this.alertShift = false;				var status = Ext.getCmp( this.section + 'item_status' ).getValue();		var statusChanged = (status != this.status);				var startDate = Ext.getCmp( this.section + 'itm_startdate');		var dueDate =  Ext.getCmp( this.section + 'itm_duedate');		if(sStore.getCount() > 0 || pStore.getCount()> 0){			if(!startDate.getValue().format){				startDate.markInvalid('Start date is required');				return;			}			if(!dueDate.getValue().format){				dueDate.markInvalid('Due date is required');				return;			}		}		try{			startDate = startDate.getValue().format( Eve.Preference.get('dateFormat'));			dueDate = dueDate.getValue().format( Eve.Preference.get('dateFormat'));		}		catch(e){		}		var startChanged = (startDate != this.startDate);		var endChanged = (dueDate != this.dueDate);		if(sStore.getCount() > 0){			sStore.each(function(record){				if( record.get('type') == '0' || record.get('type') == '1'){					if(statusChanged && status == '1')						this.alertReset = true;													if(startChanged)						this.alertShift = true;				}				else{					if( statusChanged && status != '3')						this.alertReset = true;										if(endChanged)						this.alertShift = true;				}			}, this)		}		 this.alertShift = (this.alertShift) ? this.alertShift : ( this.successorsCount != sStore.getCount());		if(this.alertReset)			this.showStatusAlert( tab, 'dialog',{id: id, close: close, changeTo: changeTo});		else if( this.alertShift )			this.showDateAlert( tab, 'dialog', {id: id, close: close, changeTo: changeTo});		else			Eve.lib.Task.ItemDialogBridge.superclass.submitForm .apply(this, [id, close, changeTo]);			}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex)			{				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];					var node = dq.select('row', xml);					if(node){						this.reminderId = dq.selectValue('reminderId', node)|| '0';						this.recurrenceId = dq.selectValue('recurrenceId', node)|| '0';					}										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}										var type = (obj.id == 0 || obj.id === undefined) ? ("task_success_create_item") : ("task_success_modify_item");					this.fire(type, { info: info, params: obj });					this.fire("object_global_change", { info: info, params: obj, owner: 'task' });					// To reload assignee store					if (this.getIndex(this.getTabPanel().activeTab) == '2')						this.fire("task_success_add_assignee", {xml:info.xml},true);								} // End of Switch		} // End of If	}});/*-----------------------------------------------                Folder Dialog-------------------------------------------------*/Eve.lib.Task.FolderDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,clear  : false		,init : function(data)	{		Eve.lib.Task.FolderDialogBridge.superclass.init.call(this, data);				var items	= (this.isIL()) ? ["Details"] : ['Details','Comments', 'Linked Items'];		var tab		= {			items	: items			,main	: [0]		}				var dialog	= {			width 	: 600			,height : 500			,title	: 'Project'		}		//this.createDialog({tab: tab ,dialog: dialog, preRender: !this.isIL()})		this.createDialog({tab: tab ,dialog: dialog, preRender: false})	}		,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset all Flags.		this.clearLoaded();	}		// Overriden	,onTabChange : function(tPanel, tab)	{		var idx = this.getIndex(tab);				// If this tab previously loaded,		// prevent it from loading agian.		if (this.getLoaded(idx))			return				// Do not load the form, if it's 		// in 'Create' mode or index not		// equals to one.		if (this.mode != 'create' || idx == '1') {			this.loadForm(idx);			this.setLoaded(idx);		}	}		,onDialogShow : function()	{		Eve.lib.Task.ItemDialogBridge.superclass.onDialogShow.apply(this, arguments);		if (this.root == 'personal')		{			Ext.getCmp(this.section + 'folder_workflow').hide();		} else {			Ext.getCmp(this.section + 'folder_workflow').show();		}			}	,augment : function(callee)	{			var obj = callee.params;		if (this.mode != 'create')			obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;				var idx = this.getIndex(this.getTabPanel().activeTab);				switch(idx)		{			// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}				return callee;	}		,controller : function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'folder', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack				this.title		= obj.title;				if (!this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "folder";			Eve._il.main.params = obj;		}				this.panels[0].reset();				if (! this.isIL()) {			this.panels[this.idxComments].reset();		}				this.showHideCmp();    	this.dialog.show();	}		,execute : function(callee, type, data)	{			switch(type.toLowerCase()) {			case (this.section + '_edit_folder_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				Ext.getCmp(this.section + 'project_btn_sub').toggle(false);							// to handle simple combo				this.panels[0].get().getForm().transit.add( new Eve.form.SimpleComboStrategy() );				this.loadForm(0);				break;							case (this.section + '_create_folder_dlg'):				this.mode = 'create';				this.controller(data);				Ext.getCmp(this.section + 'project_btn_sub').toggle(false);				var dt = new Date();				Ext.getCmp(this.section + 'fld_startdate').getEl().dom.value = dt.format(Eve.Preference.get('dateFormat'));				break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_folder_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_folder_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + 'folder_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_reload_interlink_grid'):				if (this.origin != data.origin)					return;				if (this.dialog.isVisible() == false)					return;				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}    	}		,loadSuccess : function(res)	{		Ext.getCmp('taskfolder_subscribe_button').setVisible(this.root == 'group');		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}	}		,submitSuccess : function(resp, action)	{		this.clear = false;		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0')		{			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex)			{				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}					var type = (obj.id == 0 || obj.id === undefined) ? "task_success_create_folder" : "task_success_modify_folder";					this.fire(type, { info: info, params: obj });			} // End of Switch		} // End of If	}});// * * * * * * * * * * * * * * * * * * * *// Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.lib.Task.CopyMoveDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []	,init : function(data)	{		Eve.lib.Task.CopyMoveDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ['Copy']		}		var dialog	= {			width 	: 500			,height : 300			,title	: 'Copy'		}		this.createDialog({tab: tab ,dialog: dialog})	}		,afterAddButtons : function(btns)	{		btns.splice(0, 1);		btns[0].text = "Copy";		btns[0].id	 = "taskCopyMoveButton";		return btns;	}	,augment : function(callee)	{		var obj = callee.params;		if(this.type == 'item')			obj.event = 'modern.task.group.executeCopyMove';		else			obj.event = 'modern.taskFolder.group.executeCopyMove';		var node = this.view.getSelectionModel().getSelectedNode();		var nodeInfo = this.view.getNodeInfo(node);		obj.parentId = ( nodeInfo.parentId == '-2' )? '0' : nodeInfo.parentId ;		obj.folders = nodeInfo.folderId;		if (nodeInfo.groupId != null || nodeInfo.groupId != "0" || nodeInfo.groupId !== undefined)			obj.groups = nodeInfo.groupId;			obj.ids		= this.id;			if (this.root == 'group')				obj.groupId = this.groupId;		return callee;	}	,controller	: function(obj)	{		Ext.apply(this, obj.info);		this.title = obj.title;		this.type = obj.type;		delete this.groups;		this.dialog.show();	}	,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('task_copy_dlg'):				if (Eve.Task.treeChanged === true) {					this.view.root.reload();					delete Eve.Task.treeChanged;				}				this.mode = 'copy';				this.controller(data);				break;		}	}	,submitSuccess : function(resp, action){		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		try{			if (code == '0')			{					var sentIDs = obj.ids.split(',');					if( this.groupId == obj.groups && sentIDs.length == '1' ){						this.id = dq.selectValue('id', xml).split("_")[1];						var info = {							id			: dq.selectValue('id', xml).split('_')[1]							,rawId		: this.id							,xml		: xml							,root		: (obj.groups && obj.groups != "0") ? 'group':'personal'							,path		: this.path							,parentId	: obj.parentId							,groupId	: obj.groups						}						obj.title = dq.selectValue('title', xml);						this.fire("task_success_create_item", { info: info, params: obj });					}					else if ( this.groupId == obj.groups  && sentIDs.length > 1){						Ext.getCmp('task_grid').store.reload();					}			}		}		catch(e){			console.log('Nothing passed')		}	}});// * * * * * * * * * * * * * * * * * * * *// Add Dependency * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.lib.Task.AddDependencyDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Task.AddDependencyDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ['Dependency']		}		var dialog	= {			width 	: 500			,height : 450			,title	: 'Dependency'		}		this.createDialog({tab: tab ,dialog: dialog});		this.registerViews();	}	,registerViews: function(){		Ext.getCmp( this.section + 'search_dep_dev').store.on('load', function(store){			store.params.event = 'modern.task.'+this.root+'.changeStartItemNumber';			store.params.groupId = this.groupId;		}, this);	}	,afterAddButtons : function(btns)	{		btns.splice(0, 1);		btns[0].handler = this.hdlAddDependency.createDelegate(this)		btns[0].scope = this;		return btns;	}	,hdlAddDependency : function(callee, idx, type)	{		this.dialog.hide();		var obj = {};		//return;		if (this.root == 'group')			obj.groupId = this.groupId;		var st = Ext.getCmp(this.section + 'search_dep_dev').store;		var depType = Ext.getCmp('cmb_dependecy_type').getValue();		var record, rec;		var isSuccessors = (Ext.getCmp('cmb_create_type').getValue() == "1") ? true : false;		// Validate checkboxes.		var chBoxes  = Ext.query('.ev-dep-checkbox');		if (chBoxes.length > 0) {			var id		= '';			var selectedRec	= [];			record	= Ext.data.Record.create(['id', 'title', 'status','statusText','startDate', 'dueDate', 'type']);						for (var i=0; i < chBoxes.length; ++i) {				if (chBoxes[i].checked) {					id = chBoxes[i].id;					rec = st.getById(id);					if(rec){						selectedRec.push(new record({							id: rec.get('id')							, title: rec.get('title')							, status: rec.get('status')							, startDate: rec.get('startDate')							, dueDate: rec.get('dueDate')							,type: depType						}));					}				}			}		}		var c = this.dependencyTab.title.match(/\(([^\)]*)/)[1];		c = parseInt( c ) + selectedRec.length ;		this.dependencyTab.setTitle('Dependencies ( ' + c + ' )');		if(isSuccessors){			Ext.getCmp(this.section + 'successorsDV').store.add(selectedRec);		}		else{			Ext.getCmp(this.section + 'predecessorsDV').store.add(selectedRec);		}		//return callee;	}	,controller	: function(obj)	{		Ext.apply(this, obj.info);		this.dependencyTab = obj.dependencyTab;		this.panels[0].reset();		try{			var dv = Ext.getCmp(this.section + 'search_dep_dev');			//dv.store.removeAll();			//Ext.getCmp( this.section + 'search_dep_dev' ).refresh();			//to reset pagination			dv.store.loadData("");		} catch(e){}				this.dialog.show();	}	,onDialogBeforeHide : function(){return true;}	,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('task_add_dependency_dlg'):				this.controller(data);				break;			case ('search_dep_task_items'):				var params = {					event: "modern.interlink." + this.root + ".searchtasks"					,groupId: this.groupId					,searchText: Ext.getCmp('dep_search_text').getValue()					,id			: this.parentId					,searchOperator:  Ext.getCmp('dep_search_op').getValue()					,start: 0				};				data.st.load({params: params,callback: function(){Ext.getCmp( this.section +'search_dep_dev').refresh();},scope: this});				break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\voting/VotingDialogs.js *//*--------------------------------------------------*//** * *@author: Ghazaleh Famili */  Eve.Voting._frmEl = [];	/*****************	    Vote Dialog	******************/Eve.Dialogs.Voting.Vote = function(){return	new Eve.FormPanel({		labelAlign : 'left'		,frame : true		,bodyStyle : 'padding: 5px 5px 0; overflow-y: auto;'		,width : 550		,height: 200		,items : [{}]		});};Eve.Voting._frmEl['secretSt'] = new Ext.data.SimpleStore({	fields	: ['value', 'text']	,data	: [		 ['0', 'Secret Ballot']		,['1', 'Secret Ballot (Admin Permitted)']		,['2', 'Non-Secret']	]});Eve.Voting._frmEl['store'] 	= new Ext.data.Store({	reader 	: new Ext.data.XmlReader({		record : 'opt'		,id		:'id'	}, ['id', 'text', 'value'])});/////////////////////////////Eve.Dialogs.Voting.FileDetails = function(c){		var section = c.section;		return	new Eve.FormPanel({			labelAlign	: 'left'			,frame		: true			,bodyStyle	: 'padding: 5px 5px 0'			,width		: 550			,items		: [{				xtype			: 'textfield'				,fieldLabel 	: 'Title'				,allowBlank		: false				,name			: 'title'				,labelSeparator	: ''				,anchor			: '90%'			}, {				xtype 			: 'textfield'				,fieldLabel		: 'Question'				,id				: c.section + 'vote_question'				,allowBlank		: false				,name			: 'question'				,labelSeparator	: ''				,anchor			: '90%'			}, {				layout	:'column'				,items  : [{					columnWidth : .6					,layout		:'form'					,items		: [{						xtype			: 'datefield'						,fieldLabel 	: 'Voting Ends'						,name			: 'ending_date'						,value			: new Date().add(Date.DAY, 5)						,format			: Eve.Preference.get('dateFormat')						,allowBlank		: false						,labelSeparator : ''						,anchor			: '95%'					}]				}, {					columnWidth	: .4					,layout		: 'form'					,items		: [{						xtype		: 'timefield'						,id			: c.section + 'EndTime'						,name		: 'ending_time'						,allowBlank	: false						,value      : '8:00 AM'						,format		: Eve.Preference.get('timeFormat')						,hideLabel  : true						,anchor     : '75%'					}]				}]			}, {				xtype			: 'combo'				,xxtype			: 'combo'				,id				: c.section + 'vote_secret'				,store			: Eve.Voting._frmEl['secretSt']				,mode			: 'local'				,valueField		: 'value'				,displayField	: 'text'				,value			: '0'				,fieldLabel		: 'Type'				,labelStyle		: 'width: 70px'				,hiddenName		: 'secret'				,typeAhead		: true				,editable		: false				,selectOnFocus 	: true				,triggerAction 	: 'all'				,labelSeparator : ''				,anchor 		: '90%'			},{				html: '<hr style="color:#E2E2E2; background-color:#B4B4B4; border-bottom:2px solid #fff; height:1px; margin:15px 0px;"/>'				}, {				layout  		: 'column'				,items  		: [{					columnWidth 	: .83					,layout 		: 'form'					,items  		: [{						xtype			: 'textfield'						,id				: c.section + 'optField'						,fieldLabel		: 'Options'						,name			: 'txt'						,labelSeparator : ''						,anchor			: '99%'					}]				}, {					columnWidth : .1					,items  	: [{						xtype		: 'xbutton'						,id			: c.section + 'vote_btn_add'						,text		: 'Add'						,handler	: function() {							var el		= Ext.getCmp(c.section + 'optField');							var title	= el.getValue();							el.reset();														if (title !== '') {								var rec = Ext.data.Record.create(['id', 'text', 'value']);								var newRec = new rec({id: -1, text: title, value: title});								Eve.Voting._frmEl['store'].add(newRec);							}						}					}]				}]			}, {				layout			: 'column'				,items  		: [{					columnWidth 	: .21					,layout 		: 'form'					,items  		: [{						xtype   		: 'label'						,text 			: 'Current Options'						,cls    		: 'x-form-item'						,anchor 		: '99%'					}]				}, {					columnWidth		: .76					,items			: [{						xtype			: 'panel'						,layout 		: 'form'						,autoScroll		: true						,width			: 349						,height			: 150						,bodyStyle		: 'background-color: white;border:1px solid'						,items			: [{							xtype 			: 'xdataview'							,id				: c.section + 'options_dv'							,name 			: 'opts'							,hideLabel		: true							,store			: Eve.Voting._frmEl['store']							,field			: ['value']							,rowName        : 'opt'							,itemSelector : 'div.opt_item'							,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>'							,tpl			: new Ext.XTemplate(								'<div style="float:left;width:330px" >',								'<tpl for="."><tpl for=".">',									'<div id="opt_item">',									'<div style="float:left;margin-left:4px;font:12px tahoma bold">{text}</div>',									'<div style="float:right" class= "v_btn_del">',									'<img src="'+Eve.Resource.getIcon('delete', 'general')+'" style="padding-bottom:3px"',										'onclick="Eve.Resource.superbridge.broadcast(this,\''+section+'_delete_opt\',{info: {text:\'{value}\'}})"',									' class = "opts_del"></div>',									'<div style="clear:both"></div>',									'</div>',								'</tpl></tpl>',								'</div>')						}]					}]				}]			}, {				xtype			: 'checkbox'				,id				: c.section + 'voting_notify'				,boxLabel		: 'Notify Members'				,labelStyle		: 'width:0px'				,name			: 'notifyall'				,achor			: '99%'				,hideLabel		: true			}]	})}/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       VotingDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */ Eve.vc.createFormPanel( 'VoteFileDetails'		, Eve.Dialogs.Voting.FileDetails );Eve.vc.createFormPanel( 'VoteComments'    		, Eve.Dialogs.Comment.Main);Eve.vc.createFormPanel( 'VoteInterlinking'		, Eve.Dialogs.Interlink.Main);Eve.vc.createFormPanel( 'VoteScreen'		, Eve.Dialogs.Voting.Vote);Ext.override( Eve.vc.VoteFileDetails, {	  loadEvent 	  : function(){ return 'modern.voting.{root}.edit'; }	 ,submitEvent 	: function(){ return 'modern.voting.{root}.createModify'; }});Ext.override( Eve.vc.VoteComments, {	 loadEvent		: function(){ return 'modern.comment.{root}.view'; }	,submitEvent	: function(){ return 'modern.comment.{root}.createModify'; }});Ext.override( Eve.vc.VoteInterlinking, {	 loadEvent		: function(){ return 'modern.interlink.{root}.view'; }	,submitEvent	: function(){ return ''; }});Ext.override( Eve.vc.VoteScreen, {	  loadEvent 	  : function(){ return 'modern.voting.group.voteFor'; }	 ,submitEvent 	: function(){ return 'modern.voting.group.insertVote'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\voting/VotingFactory.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 January 2009 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.Voting.Factory = function() {}Ext.extend( Eve.lib.Voting.Factory, Eve.lib.Factory, {		section: 'voting'	,prefix	: 'V'	,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}	,createWest  : function(superbridge)	{		var view 	= new Eve.vc.TreePanel();		var conn 	= Eve.widgets.TreeStore;		var bridge	= new Eve.widgets.DefaultTreeBridge();		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Voting'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.firstChild.reload();				}			}]		}		return { view: view, config: config };	 }	,createCenter: function(superbridge)	{		this.view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Voting.GridBridge();		conn.setSection('Voting');		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,manager	: this.manager		});		this.topBar = new Ext.Toolbar(bridge.getToolbar());		return { view: this.view, config: { layout: 'fit', tbar: this.topBar} };	 }	 	 ,createMenus : function(superbridge)	 {		 this.amenu = new Eve.widgets.VotingAddMenu();		 this.emenu = new Eve.widgets.VoteEditMenu();		 superbridge.addBridge([this.amenu, this.emenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}		 this.emenu.init(data);		 this.amenu.init(data);	 }	 ,createDialogs : function(superbridge)	 {		var fileDlg		= new Eve.lib.Voting.FileDialogBridge();		var voteDlg     = new Eve.lib.Voting.VoteDialogBridge();				superbridge.addBridge([fileDlg, voteDlg]);				fileDlg.addPanel(new Eve.vc.VoteFileDetails());		fileDlg.addPanel(new Eve.vc.VoteComments());		fileDlg.addPanel(new Eve.vc.VoteInterlinking());		voteDlg.addPanel(new Eve.vc.VoteScreen());				fileDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				voteDlg.init({			superbridge	: superbridge			,section	: this.section		});								// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgVotingItem 	= new Eve.lib.Voting.FileDialogBridge();				superbridge.addBridge(dlgVotingItem);				dlgVotingItem.addPanel(new Eve.vc.VoteFileDetails());		dlgVotingItem.addPanel(new Eve.vc.VoteComments());		dlgVotingItem.addPanel(new Eve.vc.VoteInterlinking());				dlgVotingItem.init({			superbridge	: superbridge			,section	: this.section + '_il'			,origin		: 'item'		});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -	 }	 ,createRest : function(superbridge)	 {		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})		// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})		prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	 }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\voting/VotingGridImp.js *//*--------------------------------------------------*//** *@author : Ghazaleh Famili */Eve.widgets.Voting.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge, {	gridSection : 'voting'	,getToolbar : function() {    return this.toolbar  	}  	,initLocalVars : function() {		/*----------------------------		        Grid's config		------------------------------*/		this.fields = [  			{name	: 'title'}  			,{name	: 'id'}			,{name	: 'timeRemaining'}            ,{name	: 'endingDate'}            ,{name	: 'userVoted'			,type: 'string'}            ,{name	: 'question'}            ,{name	: 'created'}            ,{name	: 'lastModified'}			,{name	: 'editPermission'		,type: 'boolean'}			,{name	: 'deletePermission'	,type: 'boolean'}			,{name	: 'open'				,type: 'string'}			,{name	: 'secret'				,type: 'boolean'}			,{name	: 'result'				,type: 'string'}			,{name	: 'linkedItems'			,type: 'string'}			,{ name: 'createdBy'			,type: 'string'}			,{ name: 'createdDate'			,type: 'string'}			,{ name: 'lastModifiedBy'		,type: 'string'}			,{ name: 'lastModifiedDate'		,type: 'string'}		];		this.reader = new Ext.data.XmlReader({ id : 'id', record : 'row', totalRecords	: 'total'},Ext.data.Record.create( this.fields ));	   //Row Expander	   	this.rowExpander = new Ext.grid.RowExpander({			dataIndex     :''			,width      : 20			,fieldName	: "choice"			,enableCaching : false			,tpl		: new Ext.XTemplate(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td><tpl if="this.isVoted(values)">',                '<div style="background-color:#E3FDBF; width: 560px; border: 1px solid;text-align:center;margin:2px auto;padding:2px 0px;">',                '<span style="font-weight:bold; cursor: pointer"',                ' onclick="Eve.Resource.superbridge.broadcast(this,\'vote_screen_dlg\',{info: {[this.getInfo(values)]}})" >',				'You have not voted yet. Click here to vote now.',				'</span>',                '</div>',				'</tpl></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="32px" height="32px" src="' + Eve.Resource.getIcon('item-vote','voting') + '" />',						'</div>',						'<div style="float:left; position:relative;">{question}</div>',					'</td>',				 '</tr>',    			'<tpl if="this.isClosed(values)"><tr><td>',    			'<div style="padding-left:2px;"><span style="font-weight:bold"> Final Result:</span> {result}</div>',    			'</tpl></td></tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 "</tr>",				 '</table>',				{				isVoted : function(values){					if((values.userVoted == '0' || values.userVoted == false) &&						( values.open == true || values.open == "true"))				 		return true					else			  			return false				}				,isClosed : function(val){					if(val.open == false || val.open == "false")					    return true					else					    return false				}				,getInfo: function(values){					var rec = this.scope.view.get().getSelectionModel().getSelected();					var itemId  = rec.id.split("_")[1];					var gId = this.scope.groupId;					var parentId = this.scope.parentId;					var path = "\\"+this.scope.path					var info = "{path:'"+path+"',id:'"+itemId+"', groupId: '"+gId+"', parentId: '"+parentId+"'}";					return info;				}				,scope: this				}			)		});		this.columns = new Ext.grid.ColumnModel ([			this.rowExpander			,{				header  : '<img src="' + Eve.Resource.getIcon('item-vote','voting') + '" />'				,dataIndex  : 'type'				,width : 30    			,renderer 	: function(value, metadata, rec) {					var icon = '<img src="' + Eve.Resource.getIcon('item-vote','voting') + '" />';					return (icon);				}				,menuDisabled: true				,sortable   : false				,fixed      : true				//,width      :20            },{			header  		: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex  	: 'linkedItems'			,width      	: 30			,manueDisabled  : true			,sortable       : false			,fixed          : true			,renderer       : function(value, metadata, rec){				var icon = (value != '0' ) ? '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />': '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		},{				header  : 'Subject'				,dataIndex  : 'title'				,width  : 300				,sortable    : true            }            ,{				header  : 'Time Remaining'				,dataIndex  : 'timeRemaining'				,width  : 120				,sortable    : true            }            ,{				header  : 'Ending Date'				,dataIndex  : 'endingDate'				,width      : 100				,sortable    : true            }            ,{				header : 'Voted'				,dataIndex  : 'userVoted'				,width      : 55				,sortable    : true				,renderer   : function(val) {					if (val == '1' || val =='true' || val == true) {						var img = Eve.Resource.getIcon('checked', 'general');					}					else {						var img = Eve.Resource.getIcon('unchecked', 'general');					}										return '<center><img  src="' + img + '" ></center>';				}            },{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}		])		/*---------------------------		      Tool bar		-----------------------------*/		 var that = this;		this.toolbar = {			items :[{				xtype   	: 'button'				,text   	: 'New'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('new', 'general')				,disabled	: true				,handler	: function(e){					var info = {						id			: 0,						root		: this.root,						groupId		: this.groupId,						parentId	: this.id,						path		: this.path					};					this.fire("voting_create_item_dlg", {info: info});				}				,scope  	: this			}, {				xtype   	: 'button'				,text   	: 'Edit'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('edit', 'general')				,disabled	: true				,handler 	: function(e){					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path							}							,title	: this.getRowTitle(rec)						}												this.fire("voting_edit_item_dlg", data);					}					else {						Ext.tools.msg('Select a Record', 'To Edit a Vote , You need to select a record in grid below.');					}				}				,scope  	: this			}, {				xtype   	: 'button'				,text   	: 'Delete'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('delete', 'general')				//,tooltip	: Eve.Resource.getToolTip.btnDelete				,disabled	: true				,handler	: function(e){					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var info = {							id			: rec.id.split("_")[1]							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path							,rec       	: rec						}						this.fire("voting_delete_item_dlg", {info: info, title: rec.data.title} );					}					else {						Ext.tools.msg('Select a Record', 'To Delete a Vote , You need to select a record in grid below.');					}				}				,scope  	: this			}, {				xtype   	: 'button'				,text   	: 'Vote'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('vote','voting')				,handler	: function(e){					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var info = {							id			: rec.id.split("_")[1]							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path						}						this.fire("vote_screen_dlg", {info: info});					}					else {						Ext.tools.msg('Select a Record', 'You need to select a record in grid below.');					}				}				,scope  	: this			}, {				xtype   	: 'button'				,text   	: 'View Results'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('view-result','voting')				,handler: function(e){					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var info = {							id			: rec.id.split("_")[1]							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path						}						this.fire( "voting_result_dlg", {info: info, secret: rec.open} );					}					else {						Ext.tools.msg('Select a Record', 'You need to select a record in grid below.');					}				}				,scope  	: this		   }]		};	}		,init : function(obj)	{		Eve.widgets.Voting.GridBridge.superclass.init.call(this, obj);				this.initLocalVars();		this.conn.init(this.reader);		var store = this.conn.getStore();		this.view.init({			id 				: 'voting_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Voting'			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}		});		this.registerView();	}	,registerView : function(){		Eve.widgets.Voting.GridBridge.superclass.registerView.call(this);		var grid = this.view.get();		// - - - - - - - - - - - - - - - - - -		// Custom Handlers can go here.		// - - - - - - - - - - - - - - - - - -	  grid.on('rowdblclick',function(grid,index,e) {		 var rec = grid.store.getAt(index);		this.id 		= rec.get('id').split('_')[1];		this.record    	= rec;		//this.typeId		= obj.info.typeId;			var data = {				//title	: this.title				info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}		// cause of loosing field's type after updating grid		var userVoted;		var voteOpen;		if(rec.data.userVoted == false || rec.data.userVoted == "0")		  userVoted = false;		else		    userVoted = true;		if(rec.data.open == "false" || rec.data.open== "0"){		 	voteOpen = false;	 	}		else{		 	voteOpen = true;		}		//				if(voteOpen == true && userVoted == false){			this.fire("vote_screen_dlg", data);		}		else if(voteOpen == closed){           this.fire("voting_result_dlg", data);		}		},this);	// Click on Icon	  grid.on('cellclick',function(grid,rowIdx,colIdx) {		var cm 	= grid.colModel;		if ( colIdx != '1' ) {			return;		}	 	var rec = grid.store.getAt(rowIdx);		this.id 		= rec.get('id').split('_')[1];		this.record    	= rec;			var data = {				info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}		// cause of loosing field's type after updating grid		var userVoted;		var voteOpen;		if(rec.data.userVoted == false || rec.data.userVoted == "0")		  userVoted = false;		else		    userVoted = true;		if(rec.data.open == "false" || rec.data.open== "0"){		 	voteOpen = false;	 	}		else{		 	voteOpen = true;		}		//		if(voteOpen == true && userVoted == false){			this.fire("vote_screen_dlg", data);		}		else if(voteOpen == closed){           this.fire("voting_result_dlg", data);		}		},this);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\voting/VotingMenu.js *//*--------------------------------------------------*//** * Hyperoffice Voting section based on ExtJS Library 2.2 March 2009 *  * ghazaleh@hyperoffice.com *  * http://www.hyperoffice.com */// -----------------------------------------------------------------------// Base Voting Grid Context-Menu// -----------------------------------------------------------------------Eve.widgets.VoteBaseEditMenu = Ext.extend( Eve.widgets.Menu, {	item_menu 	: {}	,type		: {}	,init : function(data)	{		Eve.widgets.VoteBaseEditMenu.superclass.init.call(this, data);	}	,registerView : function( brdg )	{		this.item_menu.on('itemclick', function(bi) {			var data = {				title	: this.title				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}						switch(bi.id) {				case 'edit':					this.fire(this.section + '_edit_item_dlg'  , data);					break;				case 'delete':					this.fire(this.section + '_delete_item_dlg'  , data );					break;				case 'vote':					this.fire("vote_screen_dlg"  , data );				    break;				case 'result':				    this.fire("voting_result_dlg"  , data );				    break;			}					}, this);	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_editmenu'):				Ext.apply(this, obj.info);				this.type		= obj.type;				this.title		= obj.title;				this.record		= obj.rec;				this.typeId     = obj.info.typeId;				var amenu = (this.type == 'folder') ? this.folder_menu : this.item_menu;				amenu.showAt(obj.pos);				break;		}	}});// -----------------------------------------------------------------------// Voting Grid Context-Menu// -----------------------------------------------------------------------Eve.widgets.VoteEditMenu = Ext.extend( Eve.widgets.VoteBaseEditMenu, {	init : function(data)	{		Eve.widgets.VoteEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({			items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Vote"				,id		: "vote"				,icon	: Eve.Resource.getIcon('vote','voting')			}, {				text	: "View Results"				,id		: "result"				,icon	: Eve.Resource.getIcon('view-result','voting')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.registerView();	}});//---------------------------------------------------//              Simple Add Menu//---------------------------------------------------Eve.widgets.VotingAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.AddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{				text	: "New Voting"				,id		: 'item'				,icon	: Eve.Resource.getIcon('new', 'general')			}]		});		this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\voting/VotingDialogControl.js *//*--------------------------------------------------*//** * @author : Ghazaleh Famili */Eve.lib.Voting.FileDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	 mode 			 : 'create'	,isNewDlgCreated : false	,init : function(data)	{		Eve.lib.Voting.FileDialogBridge.superclass.init.call(this, data);				this.panels[0].get().getForm().transit.add( new Eve.form.SimpleComboStrategy() );				var items	= (this.isIL()) ? ["Details"] : ['Details', 'Comments', 'Linked Items'];		var tab		= {			items : ['Details', 'Comments', 'Linked Items']			,main : [0]		}				var dialog	= {			width 	: 550			,height : 500			,title	: 'Vote'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset all Flags.		this.clearLoaded();	}		,getVoteResult : function(obj)	{		this.id		 = obj.info.id;		this.groupId =  obj.info.groupId;				var param = {			event   : 'modern.voting.group.viewResults'			,id     : obj.info.id			,groupId: obj.info.groupId		};				Ext.Ajax.request({			url		: Eve.url			,params	: param			,success: function(response, options) {				var data = xml2json(response.responseXML).data;				this.showVoteResult(data, options.params)			}			,scope  : this				});	}		,getVoteDetailResult : function(obj)	{		var param = {			event   : 'modern.voting.group.viewDetailResults'			,id     :   this.id			,groupId: this.groupId		};				Ext.Ajax.request({			url			: Eve.url			,params		: param			,callback	: this.showDetailResult			,scope		: this		});	}		,showVoteResult : function(data, options)	{		var opt			= data.votesResult.row;		var totalCount	= 0;		var optCount	= opt.length;				for(var i=0 ; i<optCount; i++) {			totalCount += parseInt(opt[i].value)		}				var items = [];				items.push({			region	: 'north'			,html   : data.question+'<br><hr>'		});				var resultLst = new Ext.Panel({			autoScroll : true		});        //build chart		var chart = '<table width=100% cellspacing=10 class="task-panel">';		for (var i=0; i<optCount; i++) {			var percent = (totalCount === 0)? 0 : Math.round(parseInt(opt[i].value)/totalCount * 100);			var width = percent *.8;			chart += '<tr>\					<td style="vertical-align:top" width=30%>'+opt[i].text+'</td>\					<td>\						<div style="width:'+width+'%;" class="vote-chart"></div>\					<div style="float:left">'+percent+'%</div>\					</td> \					</tr>';		}		chart+='</table>';	 	var resultGraph = new Ext.Panel({			html : chart			,autoScroll : true	    });	    this.card = new Ext.Panel({			 region		: 'center'			,autoScroll : true			,layout		: 'card'			,items		: [resultGraph]			,activeItem : 0		});    				items.push(this.card);				items.push({			region	: 'south'			,style	: 'padding-top:5px'			,html	: '<hr>'			,buttons: [{				text		: 'Tally'				,id			: this.section + 'voting_result'				//,disabled	: false				,handler 	: function(btn, e) {					  if (btn.text == 'Results Graph') {						btn.setText ('Tally');						this.card.getLayout().setActiveItem(0);					  } else if (btn.text == 'Tally') {						//btn.setText ('Results Graph');						this.fire("voting_result_details_dlg", {btn: btn}, true);					  }				}				,scope		: this      		}, {				text	: 'Close'        		,handler: function() {          			winResult.close();        		}	       	}]		});				var resultContainer = new Ext.Panel({			width	: 400			,height	: 300			,layout : 'border'			,frame  : true			,items  : items		});				var winResult = new Ext.Window({			layout  		: 'fit'			,modal  		: true			,border 		: false			,width  		: 450			,y      		: 100			,height 		: 300			,autoScroll 	: true			,closeAction    : 'close'			,resizable      : false			,items  		: [resultContainer]			,title  		: 'Results'		});				winResult.show();				if (data.tallyEnabled == 'false')			resultContainer.items.items[2].buttons[0].disable();	}		,showDetailResult :function(param, success, res)	{		var resultLst = new Ext.Panel({			autoScroll : true		});				this.card.add(resultLst);		this.card.getLayout().setActiveItem(1);		if (Ext.DomQuery.select('vote', res.responseXML).length !== 0) {			var data = xml2json(res.responseXML).data;						try {				this.tpl = new Ext.XTemplate(					'<tpl for="row">',					'<div style="width:400px;margin:5px auto;">',					'<div style="float:left;width:250px" >{title}</div>',					'<div style = "float:right;width:120px"> {choiceText}</div>',					'<div style="clear:both"></div>',					'</div>',					'</tpl>'				);								this.tpl.overwrite(this.card.items.items[1].body, {row:data.votes.vote});			} catch(e){}		} else {			resultLst.add({xtype: 'panel',html: '<div style="width:100%;margin:5px ;font-weight:bold">No One has voted</div>'});		}		Ext.getCmp(this.section + 'voting_result').setText('Results Graph');		this.card.doLayout();	}		,augment: function(callee, idx, type){		var obj = callee.params;						if (this.mode != 'create')			obj.id = this.id;		if (this.root == 'group')			obj.groupId = this.groupId;		obj.parentId = this.parentId;		obj.path	 = this.path;				if (idx === undefined)			idx = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				obj.objId		 = this.id;				//To Do				Eve._il.main.params.info.id = this.id;				break;		}		return callee;	}	,controller : function(obj) {		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack				this.title		= obj.title;		if (!this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;		}				this.panels[0].reset();				Eve.Voting._frmEl['store'].removeAll();				// Check Elements.		this.showHideCmp();		this.dialog.show();	}		,execute : function(calee, type, data)	{		switch(type) {			case (this.section + "_create_item_dlg"):				this.mode = 'create';				this.controller(data);   				Ext.getCmp(this.section + 'vote_btn_add').enable();   				Ext.getCmp(this.section + 'optField').enable();			    Ext.getCmp(this.section + 'vote_question').enable();			    Ext.getCmp(this.section + 'vote_secret').enable();				Ext.getCmp(this.section + 'voting_notify').show();				break;						case (this.section + "_result_details_dlg"):			    this.getVoteDetailResult(data);			    break;						case(this.section + "_result_dlg"):			    this.getVoteResult(data);			    break;						case(this.section + "_edit_item_dlg"):			    this.mode = data.mode || 'edit';			    Ext.getCmp(this.section + 'vote_btn_add').disable();			    Ext.getCmp(this.section + 'vote_question').disable();			    Ext.getCmp(this.section + 'optField').disable();			    Ext.getCmp(this.section + 'vote_secret').disable();				Ext.getCmp(this.section + 'voting_notify').hide();			    			    this.controller(data);				   				if (!this.getLoaded(0))					this.loadForm(0);			    break;						case(this.section + "_delete_opt"):			    if (this.mode === 'create') {				    var ds = Eve.Voting._frmEl['store'];					var idx = ds.find('text',data.info.text);					var rec = ds.getAt(idx);					ds.remove(rec);										Ext.getCmp(this.section + 'options_dv').view.refresh();			    }			    break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}	}		,loadSuccess: function(res)	{		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// Voting			case "0":				var tempArray = Ext.DomQuery.select('div[class="v_btn_del"]');				for( var i = 0,len= tempArray.length; i < len; i++){					tempArray[i].parentNode.removeChild(tempArray[i]);				}							// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex)			{				case (this.idxComments):					this.addComment(xml);					break;								default:					var info = {						id 			: dq.selectValue('id', xml).split('_')[1]						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}					var type = (obj.id == 0 || obj.id === undefined) ? "voting_success_create_item" : "voting_success_modify_item";					this.fire(type, { info: info, params: obj });			} // End of Switch		} // End of If	}});/************************************************************************/Eve.lib.Voting.VoteDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	 mode			 : 'edit'	,isNewDlgCreated : false	,init : function(data)	{		Eve.lib.Voting.VoteDialogBridge.superclass.init.call(this, data);		var tab		= {			items 		: ['Vote']			,autoScroll	: true		}				var dialog	= {			width 		: 480			,height 	: 300			//,autoScroll	: true			,title  	: 'Place your vote'		}				this.createDialog({tab: tab ,dialog: dialog})	}	,augment: function(callee, idx, type)	{			var obj = callee.params;				obj.votingItemId = this.id;		obj.groupId 	= this.groupId;		obj.parentId 	= this.parentId;		obj.path	 	= this.path;				return callee;	}		,afterAddButtons: function(buttons, scope){		buttons[1].text = 'Place your vote';		var btn = [];		btn.push(buttons[1]);		// Also add Cancel button		btn.push(buttons[2]);		return btn;	}	,showVoteScreen : function(data)	{		var frmItems = [];		var options = [];				for (var i=0; i<data.opts.opt.length; i++){			var radioItem = {boxLabel:data.opts.opt[i].text , name:'choice',inputValue:i+1};			options.push(radioItem);		}				var question =  Ext.util.Format.capitalize(data.question);		this.panels[0].component.add({			html: '<b>'+question+'<br/><hr/>'			,style  :'padding:5px'			,id: 'v_question'		});		Eve.Voting._frmEl['radio'] = new Ext.form.RadioGroup({			xtype:'radiogroup'			,style: 'margin:5px;'			,id: 'choice'		  	,columns : 1		  	,hideLabel : true		  	,items:options		});		var panel = new Ext.Panel({			//autoScroll: false			//,height     : 185		 	id         :'v_options'			//,width      : 405			,layout     : 'anchor'			,anchor     : '90%'			,items      : Eve.Voting._frmEl['radio']		})		this.panels[0].component.add(panel);		if(this.el === undefined){						var temp = '<div style="background-color:#A5A5A5;border:1px solid #5A5A5A; margin-top:-32px;float:left;;width:150px;display:inline;visibility:hidden;">'				+'<img src="'+Eve.Resource.getIcon('secret-ballot','voting')+'" width=32 height=32 style="margin-right:10px;float:left;">'				+'<div style="width:70px;float:left;padding:2px;">'				+'This vote is a secret ballet</div>'				+'<div style="clear:both"></div></div>'            this.el = Ext.DomHelper.append(this.panels[0].component.ownerCt.footer.dom, temp, true);		}		if(data.secret == '1' || data.secret == '0'){			this.el.setVisible(true );		}		else {			this.el.setVisible(false );		}				this.panels[0].component.doLayout();	}		,controller : function(obj) {		this.id 		= obj.info.id;		this.typeId		= obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;		// Check Elements.		//this.showHideCmp();		this.dialog.show();	}		,execute : function(calee, type, data){		switch(type)		{			case ( "vote_screen_dlg" ) :			    this.controller(data);			    //this.panels[0].component.remove('v_secret');			    this.panels[0].component.remove('v_question');			    this.panels[0].component.remove('v_options');			    this.loadForm(0);			    break;		}	}		,loadSuccess : function(res){		 var data = xml2json(res.responseXML).data;		 this.showVoteScreen(data);	}	,submitSuccess : function( resp, action ){		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId			}			var type =  "voting_success_modify_item";			this.fire(type, { info: info, params: obj });		}	}	});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\note/NoteDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Notes section based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.Dialogs.Note.FolderDetails = function() { return new Eve.FormPanel({	labelWidth	: 75	,frame		: false	,border		: false	,bodyStyle	: 'padding:5px 5px 0'	,width		: 400	,reader 	: new Ext.data.XmlReader({			record 	: 'data',			success	: '@success',			id		: 'id'		}, ['title', 'description'])	,items 		: [{			 xtype		: 'textfield'			,fieldLabel	: 'Name'			,name		: 'title'			,maxLength  : 350			,anchor		: '95%'			,allowBlank	: false			,setFocus	: true		}, {			 xtype		: 'textarea'			,fieldLabel	: 'Description'			,name		: 'description'			,maxLength  : 350			//,height     : 150			,anchor		: '95%'		}	]})};// * * * * * * * * * * * * * * * * * * * * Eve.Dialogs.Note.ItemDetails = function() { return new Eve.FormPanel({	labelWidth	: 50	,frame		: false	,border		: false	,bodyStyle	: 'padding:5px 5px 0'	,width		: 400	,reader 	: new Ext.data.XmlReader({			record 	: 'data',			success	: '@success',			id		: 'id'		}, ['title', 'notes'])	,items 		: [{			 xtype		: 'textfield'			,fieldLabel	: 'Title'			,name		: 'title'			,anchor		: '97%'			,maxLength  : 350			,allowBlank	: false			,setFocus	: true		}, {			 xtype		: 'htmleditor'			,fieldLabel	: 'Notes'			,name		: 'notes'			,height     : 140			,anchor		: '97%'			,enableLinks	 : false			,enableAlignments: false		}, new Ext.form.Checkbox({			name		: 'evaluateAsHTML'			//,boxLabel : 'Evaluate Description as HTML'			,checked	: true			,style		: 'display: none;'			,labelSeparator:''			,hidden     : true		})	]})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       NoteDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */   // FoldersEve.vc.createFormPanel( 'NoteFolderDetails'		,Eve.Dialogs.Note.FolderDetails ); // ItemsEve.vc.createFormPanel( 'NoteItemDetails'		,Eve.Dialogs.Note.ItemDetails );Ext.override( Eve.vc.NoteFolderDetails, {		 loadEvent		: function(){ return 'modern.NoteFolder.personal.edit'; }		,submitEvent	: function(){ return 'modern.NoteFolder.personal.createModify'; }});Ext.override( Eve.vc.NoteItemDetails, {		 loadEvent		: function(){ return 'modern.Note.personal.edit'; }		,submitEvent	: function(){ return 'modern.Note.personal.createModify'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\note/NoteFactory.js *//*--------------------------------------------------*//** * Hyperoffice Notes section based on ExtJS Library 2.1 May 2008 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.Note.Factory = function() {}Ext.extend( Eve.lib.Note.Factory, Eve.lib.Factory, {		section: 'note'	,prefix	: 'N'		,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}	 	,createWest  : function(superbridge)	{		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.widgets.DefaultTreeBridge();		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Notes'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]		}		return { view: view, config: config };	}	,createCenter: function(superbridge)	{		var view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Note.GridBridge();		var nIcon	= new Eve.widgets.Note.IconLayout();		conn.setSection('Notes');		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,manager	: this.manager		});		superbridge.addBridge(nIcon);		nIcon.init({			superbridge	: superbridge			,store		: conn.getStore()			,section	: this.section		});				var icon = nIcon.createLayout();		this.topBar = new Ext.Toolbar(bridge.getToolbar());		var config = {			layout		: "card"			,id			: "noteCardLayout"			,activeItem	: 0			,tbar		: this.topBar			,items		: [	view.get(), icon ]		}		return { view: view, config: config };	}		,createMenus : function(superbridge)	{		this.amenu = new Eve.widgets.NoteAddMenu();		this.emenu = new Eve.widgets.NoteEditMenu();		this.tmenu = new Eve.widgets.NoteTreeMenu();				superbridge.addBridge([this.amenu, this.emenu, this.tmenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}				this.emenu.init(data);		this.amenu.init(data);		this.tmenu.init(data);	} 	,createDialogs : function(superbridge)	{		var itemDlg 	= new Eve.lib.Note.ItemDialogBridge();		var folderDlg 	= new Eve.lib.Note.FolderDialogBridge();				superbridge.addBridge(itemDlg);		superbridge.addBridge(folderDlg);				itemDlg.addPanel(new Eve.vc.NoteItemDetails());		folderDlg.addPanel(new Eve.vc.NoteFolderDetails());				itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				folderDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'folder'		});	}	 	 	,createRest : function(superbridge)	{		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})		// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})		prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\note/NoteGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Notes section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Note.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge, {	gridSection : 'note'		,getToolbar : function() {return this.toolbar}	,getRecord	: function() {		var lt = Ext.getCmp('noteCardLayout');		var id = lt.getLayout().activeItem.id;		var rec= null;				// if activeItem's Id equals to Grid's Id.		var res = (id == this.view.get().id) ? '0' : '1';						if (res == '0') {			rec = this.view.get().getSelectionModel().getSelected();		}		else {			rec = Ext.getCmp('note_customview').getSelectedRecords()[0];		}				return rec;	}		,initLocalVars : function() {		this.fields = [			 { name: 'id'	     		,type: 'string' }			,{ name: 'type'     		,type: 'string' }			,{ name: 'title'    		,type: 'string' }			,{ name: 'writeDate'		,type: 'string' }			,{ name: 'linkedItems'		,type: 'string' }			,{ name: 'description'		,type: 'string' }			,{ name: 'created'			,type: 'string' }			,{ name: 'lastModified'		,type: 'string' }			,{ name: 'editPermission'	,type: 'boolean'}			,{ name: 'deletePermission'	,type: 'boolean'}			,{ name: '_index'			,type: 'int' , mapping: 'index'}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}		];				this.reader = new Ext.data.XmlReader({			id				: 'id'			,record			: 'row'			,totalRecords	: 'total' 		}, Ext.data.Record.create(this.fields));		this.rowExpander = new Ext.grid.RowExpander({			dataIndex	: ""			,fieldName	: "type"			,enableCaching : false 			,tpl		: new Ext.Template(				'<table width="100%" style="padding: 5px;overflow:hidden;">',				 '<tr>',					'<td><b>{title}</b></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="32px" height="32px" src="',								Eve.Resource.getIcon('{type}-note','note'),							'" />',						'</div>',						'<div style="float:left; position:relative;line-height:normal;" class="row-expander-desc">{description}</div>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 "</tr>",				 '</table>'			)		});				// Column Model		this.columns = new Ext.grid.ColumnModel([this.rowExpander, {			 header    : '<img src="' + Eve.Resource.getIcon('item-note','note') + '" />'			,dataIndex : 'type'			,width 	   : 30			,hidden    : false			,renderer  : function(value) {				return (value == 'folder') ?					'<img src="' + Eve.Resource.getIcon('folder-note','note')	+ '" />' :					'<img src="' + Eve.Resource.getIcon('item-note','note')	+ '" />'			}		}, {			 header    : 'Title'			,dataIndex : 'title'			,width 	   : 350			,hidden    : false			,sortable  : true			,editor    : new Ext.grid.GridEditor( new Ext.form.TextField( { allowBlank : false } ) )		}, {			 header    : 'Written On'			,dataIndex : 'writeDate'			,width 	   : 130			,hidden    : false		},{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);		//New Item handler		var newItemHdl = function(){			var info = {				parentId : this.id				,groupId : this.groupId				,root: this.root				,id : 0				,path: this.path			};			this.fire( 'note_create_item_dlg', {info: info});		}				this.toolbar = {			items:[new Ext.Toolbar.SplitButton({				text 	: 'New'				,cls 	: 'x-btn-text-icon'				,icon	: Eve.Resource.getIcon('new', 'general')				,type 	: 'tbsplit'				,handler: newItemHdl.createDelegate(this)				,menu 	: [{					text 	: 'Note Folder'					,handler: function() { this.fire( 'note_create_folder_dlg', {info:{ parentId : this.id,											groupId : this.groupId, root: this.root, id : 0, path: this.path }} ); }					,scope	: this				}, {					text	: 'Note'					,handler: newItemHdl					,scope	: this				}]			}), {				 text	: "Edit"				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('edit', 'general')				,handler: function() {					var rec = this.getRecord();										if (rec) {						type = rec.data.type;												var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path								//,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)							}							,title	: this.getRowTitle(rec)						}												this.fire("note_edit_" + type + "_dlg", data);					}}				,scope	: this			}, {				 text	: "Delete"				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('delete', 'general')				,handler: this.deleteHdl				,scope	: this			}, '-', {				text		: 'Up'				,id			: this.section + 'btnToolbarUp'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('arrow-up', 'general')				,handler	: function() {					this.fire(this.section + "_activate_parent_node");				}				,scope		: this			}, '-', {				text 		: "Print"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('print', 'general')				,handler	: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path						,start		: this.view.get().store.lastOptions.params.start					}										this.fire("note_print_folder", {info: info});				}				,scope		: this							}, '->', {				xtype	: "splitbutton"				,text	: "List"				,id		: "note_list_icon_view"				,icon	: Eve.Resource.getIcon('view-list','note')				,cls	: "x-btn-text-icon"				,handler: function() { this.showMenu() }				,menu	: new Ext.menu.Menu({					items: [{							text	: "List"							,icon	: Eve.Resource.getIcon('view-list','note')							,cls	: "x-btn-text-icon"							,group	: "liv"							,handler: function(e) {								info = {									parentId: this.id									,groupId: this.groupId									,root	: this.root									,id		: 0								}																Ext.getCmp("note_list_icon_view").setIcon(Eve.Resource.getIcon('view-list','note'));								this.fire("note_change_layout", {idx: 0, text: 'List', info: info}, true);							}							,scope	: this						}, {							text	: "Icons"							,icon	: Eve.Resource.getIcon('view-icon','note')							,cls	: "x-btn-text-icon"							,group	: "liv"							,handler: function(e) {								info = {									parentId: this.id									,groupId: this.groupId									,root	: this.root									,id		: 0								}																Ext.getCmp("note_list_icon_view").setIcon(Eve.Resource.getIcon('view-icon','note'));								this.fire("note_change_layout", {idx: 1, text: 'Icons', info: info}, true);							}							,scope	: this						}					]				})			}]		};							}		,init : function(obj) {		Eve.widgets.Note.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();						this.conn.init(this.reader);		this.view.init({			id 				: 'note_grid'			,ds 			: this.conn.getStore()			,cm				: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				pageSize		: Eve.Preference.getInteger("itemsperpage")				,store			: this.conn.getStore()				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Notes'			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,ddGroup		: Eve.Resource.getGridGroup()			,clicksToEdit	: 1			,enableDragDrop : true			,viewConfig 	: {				rowSelectorDepth	: 20				,forceFit           : false				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,keys			: this.getKeyMap()		});				this.registerView();		/** Syavash: For fixing the +- bug after changing layout **/		this.conn.getStore().on('load', function() { 			this.rowExpander.collapseAll();		} , this)			}		,registerView : function(){		Eve.widgets.Note.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();				// - - - - - - - - - - - - - - - - - -		// Custom Handlers can go here.		// - - - - - - - - - - - - - - - - - -				grid.on('rowdblclick', function(grid, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx);			var data = {				info	: {					id			: rec.id					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : rec				}			}						if (rec && rec.data.type == 'item')				this.fire("note_load_icon_popup", data);			else if ( rec && rec.data.type == 'folder' ){				this.fire("note_activate_child_node", { info: { id: rec.get('id').split('_')[1], root: this.root } } );			}		}, this);				grid.on('cellclick', function(grid, rowIdx, colIdx) {			var rec	= grid.getStore().getAt(rowIdx);			var cm	= grid.colModel;						if (colIdx != 1)				return;						var data = {				info	: {					id			: rec.id					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : rec				}			}						if (rec && rec.data.type == 'item')				this.fire("note_load_icon_popup", data);					},this);				}});// * * * * * * * * * * * * * * * * * * * * * * * *// Note Icon View Layout// * * * * * * * * * * * * * * * * * * * * * * * *Eve.widgets.Note.IconLayout = Ext.extend(Eve.lib.Bridge, {	init : function(data) {		Eve.widgets.Note.IconLayout.superclass.init.call(this, data);				this.store = data.store;				this.tpl		 = new Ext.XTemplate(			'<tpl for=".">',			'<div style="padding: 10px;" class= "row-expander-desc">',				'<div>',					'<b>{title}</b> <br /> Written on: {writeDate}',				'</div>',				'<div>',					'<br /><hr /><br />',					'<p>{notes}</p>',				'</div>',			'</div>',			'</tpl>'		)	}		,createLayout : function() {		return {			layout			: 'fit'			,border			: false			,items			: {				xtype			: 'customview'				,listeners      : {					'render' : {                        'fn' : function( cmp ){							cmp.el.on('dblclick', function(){								this.fire('note_create_item_dlg', {									info	: {										parentId	: this.id										,groupId	: this.groupId										,root		: this.root										,id			: 0										,path		: this.path									}								})							}, this );                        }                        ,scope  : this					}				}				,dvConfig		: { 					id				: "note_customview"					,itemSelector	: 'div.thumb-wrap'					,overClass		: 'x-view-over'					,singleSelect	: true					,selectedClass  : 'x-view-selected'					,prepareData	: function(data){						data.titlex = Ext.util.Format.ellipsis(data.title, 9);						return data;					}					,listeners		: {						dblclick		: function(dv, index, el, e) {							var rec	 = dv.getRecord(el);							var data = {								idx		: index								,target	: el								,rec	: rec								,info	: {									id			: rec.id									,root		: this.root									,parentId	: this.parentId									,path		: this.path								}							}														this.fire("note_load_icon_popup", data);						}						,contextmenu	: function(dv, index, el, e) {							var grid = Ext.getCmp('note_grid');							// Tricky one							grid.fireEvent('rowcontextmenu', grid, index, e)						}						,render       : function(cmp){							cmp.el.on('contextmenu',function(e){					    		e.stopEvent();					     		var item = e.getTarget(cmp.itemSelector, cmp.el);					        	if(!item) {									this.fire(this.section + '_addmenu',{										info	: {											id			: 0											,parentId	: this.id											,groupId	: this.groupId											,root		: this.root											,path		: this.path										}										,pos	: e.getXY()									});								}							},this);						}						,scope			: this					}				}				,store 		: this.store				,bbar		: new Ext.PagingToolbar({					store		: this.store					,id			: 'note_icon_view_paging'					,pageSize	: Eve.Preference.getInteger("itemsperpage")					,displayInfo: true				})				,template	: new Ext.XTemplate(					'<tpl for=".">',						'<div class="thumb-wrap">',						'<div class="thumb">',							'<img src="', Eve.Resource.getIcon('item-icon','note'), '" title="{titlex}">',						'</div>',						'<span class="x-editable">{titlex}</span></div>',					'</tpl>'				)			}		}	}		,showIconLayout : function(d) {		this.layout	= Ext.getCmp("noteCardLayout");		//var ifview	= Ext.getCmp('note_folderItem');		var cmp = Ext.getCmp('note_customview');		this.layout.getLayout().setActiveItem(d.idx);		Ext.getCmp("note_list_icon_view").setText(d.text);				if (d.idx == 0) {			// List View			//ifview.enable();			this.fire('note_filter', { mode: { base: 'folder_item', branch: 'flatView' }, info: d.info }, true );		}		else {			// Icon View			//ifview.disable();			this.fire('note_filter', { mode: { base: 'folder_item', branch: 'itemsOnly' }, info: d.info }, true );		}	}		,showPopup : function(d) {		var rd	= new Ext.data.XmlReader({			record 		: 'data'			,success	: '@success'			,id			: 'id'		}, [			 {name: 'title', 		type: 'string'}			,{name: 'notes', 		type: 'string'}			,{name: 'writeDate', 		type: 'string'}			,{name: 'lastModified',	type: 'string'}		]);				var info	= rd.read(d.response, {add: false}, true).records[0].data;		delete rd;				// Hanlder for Print & Popout tools.		var toolHandler = function(e, el, panel) {			var content = panel.items.itemAt(0).body.dom.innerHTML;			var page	= window.open("about:blank", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width=300, height=200");						setTimeout( function() {				var body = "<div style='font: 11px tahoma; background-color: #FFFFCC; width:100%; height:100%;'>" + content;				page.focus();								if (el.dom.qtip.toLowerCase() == 'print') {					body += "<div style='position:absolute; right:10px; top:10px;'><input type='submit' value='Print' onclick='window.print();' /></div>";				}								body += "</div>";								page.document.body.innerHTML	= body;				page.document.body.style.margin = "0px";			}, 100);		}				var win = new Ext.Window({			layout		: 'fit'			,frame		: true			,modal		: false			,floating	: true			//,autoHeight	: true			,height     : 200			,width		: 300			,autoScroll : true			,style		: "position:absolute;"			,tools		: [{				id			: 'print'				,qtip		: "Print"				,handler	: toolHandler			}, {				id			: 'restore'				,qtip		: "Popout"				,handler	: toolHandler			}]			,items		: [{				xtype   	: 'panel'				,layout      : 'anchor'				,anchor     : '100%'				,autoScroll : true				,bodyStyle  : "background-color: #FFFFCC;"				,html		: '<div style="background-color:#FFFFCC;">' + this.tpl.apply(info) + '<div>'			}]		})				win.show(d.target);		win.getEl().on('dblclick', function() {			this.fire('note_edit_item_dlg', {				info: {					id		: d.info.id.split('_')[1] || d.info.id,					parentId: d.info.parentId,					path	: d.info.path				}			});			win.close();		}, this);		// Check permission.		var rec = d.rec || d.info.rec;		//this.fire('note_set_active_row', {rec: rec})	}		,execute : function(callee, type, data) {		switch(type) {			case ('note_set_active_node'):				Ext.apply(this, data.info);				break;			case ('note_change_layout'):				this.showIconLayout(data);				break;							case ('note_show_icon_popup'):				this.showPopup(data);				break;							case ('show_section'):				if (this.section == Eve.SectionManager.getSectionId( data.sectionName )) {					this.id 	 = data.info.id || 0;					this.groupId = data.info.groupId || 0;					this.root	 = (data.info.groupId == '0') ? 'personal' : 'group';					this.path	 = data.info.path || '\\';					this.parentId= 0;				}				break;		}	}})/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\note/NoteMenu.js *//*--------------------------------------------------*//** * Hyperoffice Notes section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */  // -----------------------------------------------------------------------// Note Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.NoteEditMenu = Ext.extend( Eve.widgets.EditMenu, {	init : function(data)	{		Eve.widgets.NoteEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}, {				text	: "Open Note"				,id		: "open"				,icon	: Eve.Resource.getIcon('item-open','note')			}]		});		this.folder_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Note Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.NoteAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.NoteAddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{					text	: "New Note Folder"					,id		: 'folder'					,icon	: Eve.Resource.getIcon('folder-new','note')				}, {					text	: "New Note"					,id		: 'item'					,icon	: Eve.Resource.getIcon('item-new','note')				}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Note Tree Add Context Menu// -----------------------------------------------------------------------Eve.widgets.NoteTreeMenu = Ext.extend( Eve.widgets.BaseTreeMenu, {	init : function(data)	{		Eve.widgets.NoteTreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('item-new','note')				}, {					text	: "Edit"					,id		: 'edit'					,icon	: Eve.Resource.getIcon('edit', 'general')				}, {					text	: "Delete"					,id		: 'delete'					,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.groupmenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','note')			}]		});				this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\note/NoteDialogControl.js *//*--------------------------------------------------*/// Written by KhashayarEve.lib.Note.ItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Note.ItemDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			width 	: 550			,height : 280			,title	: 'Note'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,augment : function(callee)	{		var obj = callee.params;				if (this.mode == 'edit')			obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;				return callee;	}		,controller : function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;				this.panels[0].reset();		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type) {			case 'note_edit_item_dlg':				this.controller(data);				this.mode = 'edit';				this.loadForm(0);				break;							case 'note_create_item_dlg':				this.controller(data);				this.mode = 'create';				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ((typeof action.params).toLowerCase() == 'string')			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				var info = {			id 			: dq.selectValue('id', xml).split('_')[1]			,rawId		: dq.selectValue('id', xml)			,root		: this.root			,path		: this.path			,parentId	: obj.parentId			,groupId	: obj.groupId			,editPrm	: dq.selectValue('editPermission', xml)			,deletePrm	: dq.selectValue('deletePermission', xml)			,xml		: xml		}				if (code == '0') {			var type = (obj.id == 0 || obj.id === undefined) ? "note_success_create_item" : "note_success_modify_item";			this.fire(type, { info: info, params: obj });		}	}});Eve.lib.Note.FolderDialogBridge = Ext.extend( Eve.lib.Note.ItemDialogBridge, {	mode 	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Note.FolderDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			width 	: 550			,height : 200			,title	: 'Note Folder'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,controller : function(data)	{		this.id 		= data.info.id;		this.parentId 	= data.info.parentId;		this.groupId 	= data.info.groupId;		this.root 		= data.info.root;		this.path		= data.info.path;			this.title		= data.title;				this.panels[0].reset();		this.dialog.show();	}		,execute : function(callee, type, obj)	{		switch(type.toLowerCase())		{			case 'note_edit_folder_dlg':				this.mode = 'edit';				this.controller(obj);				this.loadForm(0);				break;							case 'note_create_folder_dlg':				this.mode = 'create';				this.controller(obj);				break;		}	}		,submitSuccess : function(resp, action) { 		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				var info = {			id 			: dq.selectValue('id', xml).split('_')[1]			,xml		: xml			,rawId		: dq.selectValue('id', xml)			,root		: this.root			,path		: this.path			,parentId	: obj.parentId			,groupId	: obj.groupId		}				if (code == '0') {			var type = (obj.id == 0 || obj.id === undefined) ? "note_success_create_folder" : "note_success_modify_folder";			this.fire(type, { info: info, params: obj/*, object: { extra : { response: resp } }*/ });		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\link/LinkDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/var dlgLin = Eve.Dialogs.Link;// * * * * * * * * * * * * * * * * * * * * // Item Details	 * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgLin.ItemDetails = function(c) { return new Eve.FormPanel({    labelWidth	: 70    ,frame		: false    ,border		: false    ,bodyStyle	: 'padding:5px 5px 0'    ,width		: 400	,defaults	: {		anchor		: '95%'	}    ,items 		: [{			layout 	: 'column'			,items : [{				columnWidth : .85				,layout		: 'form'				,defaults	: {	anchor		: '99%'	}				,items		: [{					xtype		: 'textfield'					,fieldLabel	: 'Title'					,name		: 'title'					,allowBlank	: false					,setFocus	: true					,maxLength	: 255				}, {					xtype		: 'textfield'					,fieldLabel	: 'URL'					,name		: 'url'					//,validator	: Ext.form.VTypes.url					,allowBlank	: false					,maxLength	: 255				}, {					xtype		: 'textfield'					,id			: c.section + 'ImageUrl'					,fieldLabel	: 'Image URL'					,name		: 'imageUrl'					//,validator	: Ext.form.VTypes.url					,maxLength	: 255					,listeners	: {						change		: function() {							var imgPreview = Ext.getCmp(c.section + 'ImagePreview');							if (this.getValue().trim() == '')								imgPreview.setImage(true);							else								imgPreview.setImage();						}					}				}]			}, {				columnWidth : .15				,layout		: 'form'				,items		: [{					id			: c.section + 'ImagePreview'					,html		: "<img id='" + c.section + "ImagePreviewBox' src='" + Ext.BLANK_IMAGE_URL  +"' height =70 width=80/>"					,setImage	: function(clear) {						var el = Ext.get(c.section + 'ImagePreviewBox');												if (clear || Ext.getCmp(c.section + 'ImageUrl').getValue().trim() == '' )							el.dom.setAttribute('src', Ext.BLANK_IMAGE_URL );						else							el.dom.setAttribute('src', Ext.getCmp(c.section + 'ImageUrl').getValue());					}					,anchor		: '100%'				}]			}]		}, {        	xtype			: 'htmleditor'            ,fieldLabel		: 'Description'            ,name			: 'description'			,height     	: 110			,enableLinks	 : false			,enableAlignments: false		},		new Ext.form.Checkbox({			labelSeparator	: ''			,id				: c.section + 'ItemEDAH'			//,boxLabel		: 'Evaluate Description as HTML'			,name			: 'evaluateAsHTML'			,checked		: true			,style			: 'display: none;'			,hidden         : true		}),		new Ext.form.Checkbox({			labelSeparator	: ''			,boxLabel 		: 'Open Link in New Window'			,name			: 'spawnNewWindow'		}),		{			layout:'column'			,items:[{					columnWidth	: .4					,layout : 'form'					,items:[					new Ext.form.Checkbox({						labelSeparator	: ''						,id				: c.section + 'autoLoginChk'						,boxLabel 		: 'Auto Login'						,name 			: 'autoLogin'						,listeners		: {							check: function(checkbox, checked)							{								if (checked) {									Ext.select('.autologin').applyStyles('display:inline');								} else {									Ext.select('.autologin').applyStyles('display:none');								}							}						}					})]			},{				columnWidth	: .4				,layout : 'form'				,items:{                        html : '<label></label>'                        ,cls : 'lamp-tip'                        ,id : 'autoLoginTip'                        ,listeners : {                            render : function(cmp){//                                cmp.el.on('click', function(){//									window.open('http://fast.hyperoffice.com');//								});								var tip = new Ext.ToolTip({                                    target: 'autoLoginTip',                                    width:250,                                    html:	'This is an advanced feature that requires\n\											 an in depth knowledge of the website you are\n\											 logging into.This is usually recommended for\n\											 use by webmasters and designers only',                                    trackMouse:true                                });                            }                        }                    }			}]		}, {		layout 	: 'column'		,items : [{				columnWidth : .4				,layout		: 'form'				,defaults	: {		        	xtype		: 'textfield'					,style		: 'display:none;'					,cls		: 'autologin'					,anchor		: '95%'					,labelSeparator: ''				}				,items 		: [{			            name		: 'autoLoginA'						,hasDefValue: true						,listeners	: {							render		: function() {								this.el.dom.value = "Username"							}						}					}, {			            name		: 'autoLoginC'						,hasDefValue: true						,listeners	: {							render		: function() {								this.el.dom.value = "Password"							}						}					}, {			            name		: 'autoLoginE'						,hasDefValue: true					}, {			            name		: 'autoLoginG'						,hasDefValue: true					}, {			            name		: 'autoLoginI'						,hasDefValue: true					}				]			}, {				columnWidth : .6,				layout : 'form'				,labelWidth	: 1				,defaults	: {			        xtype		: 'textfield'					,style		: 'display: none;'					,cls		: 'autologin'					,anchor		: '90%'					,labelSeparator: ''				}				,items : [{			            name		: 'autoLoginB'					}, {			            name		: 'autoLoginD'					}, {			            name		: 'autoLoginF'					}, {			            name		: 'autoLoginH'					}, {			            name		: 'autoLoginJ'					}				]			}		]	}/*,new Ext.ux.xLabel({	        	xtype		: 'xlabel'				,id			: c.section + 'ItemCreated'	            ,name		: 'created'				//,disabled	: true				,labelSeparator	: ''				,value      : ''			}),	new Ext.ux.xLabel({	        	xtype		: 'xlabel'				,id			: c.section + 'ItemModified'	            ,name		: 'created'				//,disabled	: true				,labelSeparator	: ''				,value      : ''			})*/]})}// * * * * * * * * * * * * * * * * * * * * // Folder Details  * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgLin.FolderDetails = function(c) { return new Eve.FormPanel({    labelWidth	: 75    ,frame		: false    ,border		: false    ,bodyStyle	: 'padding:5px 5px 0'    ,width		: 400	,defaults	: {		anchor		: '95%'	}    ,items 		: [{        	xtype		: 'textfield'            ,fieldLabel	: 'Name'            ,name		: 'title'            ,allowBlank	: false			,setFocus	: true			,maxLength	: 255		}, {        	xtype		: 'textarea'            ,fieldLabel	: 'Description'            ,name		: 'description'		}	]})};// * * * * * * * * * * * * * * * * * * * *// Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgLin.CopyMove = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,width		: 500		,height		: 300		,layout		: 'fit'		,items 		: [{			autoScroll : true			,style: 'background-color: white; border: 1px solid #D0D0D0;'			,items:c.view			}]	})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       LinkDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */  // FoldersEve.vc.createFormPanel( 'LinkFolderDetails'		, Eve.Dialogs.Link.FolderDetails );// ItemsEve.vc.createFormPanel( 'LinkItemDetails'		, Eve.Dialogs.Link.ItemDetails );// CommentsEve.vc.createFormPanel( 'Comments'				, Eve.Dialogs.Comment.Main );// InterlinkingEve.vc.createFormPanel( 'Interlinking'			, Eve.Dialogs.Interlink.Main );// Copy/MoveEve.vc.createFormPanel( 'LinkCopyMove'				, Eve.Dialogs.Link.CopyMove );Ext.override( Eve.vc.LinkFolderDetails, {	  loadEvent 	: function(){ return 'modern.linkFolder.{root}.edit'; }	 ,submitEvent 	: function(){ return 'modern.linkFolder.{root}.createModify'; }});Ext.override( Eve.vc.LinkItemDetails, {	 loadEvent		: function(){ return 'modern.link.{root}.edit'; }	,submitEvent	: function(){ return 'modern.link.{root}.createModify'; }});Ext.override( Eve.vc.Comments, {	 loadEvent		: function(){ return 'modern.comment.{root}.view'; }	,submitEvent	: function(){ return 'modern.comment.{root}.createModify'; }});Ext.override( Eve.vc.Interlinking, {	 loadEvent		: function(){ return 'modern.interlink.{root}.view'; }	,submitEvent	: function(){ return ''; }});// CopyMoveExt.override( Eve.vc.LinkCopyMove, {	loadEvent 		: Ext.emptyFn	,submitEvent 	: function(){ return 'modern.link.group.executeCopyMove'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\link/LinkFactory.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Link.Factory = function() {}Ext.extend( Eve.lib.Link.Factory, Eve.lib.Factory, {		section: 'link'	,prefix	: 'L'		,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}	,createWest  : function(superbridge)	{		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.widgets.DefaultTreeBridge();				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Links'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]		}				return { view: view, config: config };	}	 	,createCenter: function(superbridge)	{		this.view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Link.GridBridge();				conn.setSection('Links');				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,manager	: this.manager		});				this.topBar = new Ext.Toolbar(bridge.getToolbar());				return { view: this.view, config: { layout: 'fit', tbar: this.topBar} };	}		,createMenus : function(superbridge)	{		this.amenu = new Eve.widgets.LinkAddMenu();		this.emenu = new Eve.widgets.LinkEditMenu();		this.tmenu = new Eve.widgets.LinkTreeMenu();				superbridge.addBridge([this.amenu, this.emenu, this.tmenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}				this.emenu.init(data);		this.amenu.init(data);		this.tmenu.init(data);	}	 	,createDialogs : function(superbridge)	{		var itemDlg 	= new Eve.lib.Link.ItemDialogBridge();		var folderDlg 	= new Eve.lib.Link.FolderDialogBridge();		var cmDlg		= new Eve.lib.Link.CopyMoveDialogBridge();		superbridge.addBridge([itemDlg, folderDlg, cmDlg]);		itemDlg.addPanel(new Eve.vc.LinkItemDetails());		itemDlg.addPanel(new Eve.vc.Comments());		itemDlg.addPanel(new Eve.vc.Interlinking());		folderDlg.addPanel(new Eve.vc.LinkFolderDetails());		cmDlg.addPanel(new Eve.vc.LinkCopyMove());		itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				folderDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'folder'		});		cmDlg.init({			superbridge	: superbridge			,section	: this.section		});		// Start: Copy/Move		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.Link.CopyMoveTreeBridge();		superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix		});        cmDlg.init({			superbridge	: superbridge			,view		: view.get()			,section	: this.section		});		// End: Copy/Move						// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgLinkItem = new Eve.lib.Link.ItemDialogBridge();				superbridge.addBridge(dlgLinkItem);				dlgLinkItem.addPanel(new Eve.vc.LinkItemDetails());				dlgLinkItem.init({			superbridge	: superbridge			,section	: this.section + '_il'			,origin		: 'item'		});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -	}	 	,createRest : function(superbridge)	{		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\link/LinkGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Link.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge, {	gridSection : 'link'		,getToolbar : function() {return this.toolbar}		,initLocalVars : function(){		this.fields = [			 { name: 'type'				,type: 'string' }			,{ name: 'title'			,type: 'string' }			,{ name: 'description'		,type: 'string' }			,{ name: 'spawnNewWindow'	,type: 'string' }			,{ name: 'url'				,type: 'string' }			,{ name: 'imageUrl'			,type: 'string', defaultValue: '' }			,{ name: 'autoLogin'		,type: 'string' }			,{ name: 'linkedItems'		,type: 'string' }			,{ name: 'created'			,type: 'string' }			,{ name: 'creationDate'		,type: 'string' }			,{ name: 'lastModified'		,type: 'string' }			,{ name: 'editPermission'	,type: 'boolean'}			,{ name: 'deletePermission'	,type: 'boolean'}			,{ name: '_index'			,type: 'int' , mapping: 'index'}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}		];				this.reader = new Ext.data.XmlReader({			id				: 'id'			,record			: 'row'			,totalRecords	: 'total'		}, Ext.data.Record.create( this.fields ) );						// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Column Model		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		this.rowExpander = new Ext.grid.RowExpander({			dataIndex	: ""			,fieldName	: "type"			,enableCaching : false 			,tpl		: new Ext.XTemplate(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td><b>{title}</b></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="32px" height="32px" src=',								'<tpl if="this.hasImage(imageUrl)">',									'{imageUrl}',								'</tpl>',								'<tpl if="this.hasImage(imageUrl) == false">',									Eve.Resource.getIcon('{type}-link','link'),								'</tpl>',							' />',						'</div>',						'<div style="float:left; position:relative;line-height:normal;" class="row-expander-desc">',							'{description}',						'</div>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 "</tr>",				 '</table>', {				hasImage : function(url) {					if (url !== undefined && url.trim() != "")						return true;					return false;				}			})		});								var columnModel = [this.rowExpander, {			header 		: '<img src="' + Eve.Resource.getIcon('item-link','link') + '" />'			,dataIndex 	: 'type'			,width 		: 30			,sortable	: false			,fixed		: true			,menuDisabled: true			,renderer 	: function(value, attr, rec) {				var path = "";								if (value == "folder") {					path = "<img src='" + Eve.Resource.getIcon('folder-link','link') + "'/>";				}				else {					var url = rec.get('imageUrl');					var src = (url != '' && url !== undefined) ? url : Eve.Resource.getIcon('item-link','link');					path	= "<img src='" + src + "' height='16' width='16' />" ;				}								return path;			}		}, {			header  		: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex  	: 'linkedItems'			,width      	: 30			,menuDisabled  	: true			,sortable       : false			,fixed          : true			,renderer       : function(value, metadata, rec) {				var icon = (value != '0') ? '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />': '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		}, {			header 		: 'Title'			,dataIndex 	: 'title'			,width 		: 300			,sortable	: true			,editor 	: new Ext.form.TextField({ allowBlank : false })		}, {			header 		: 'URL'			,dataIndex 	: 'url'			,width 		: 300			,sortable	: true			,editor 	: new Ext.form.TextField({ allowBlank : false })		}, {			header 		: 'Created On'			,dataIndex 	: 'creationDate'			,width 		: 80			,sortable	: true		}, {			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		}, {			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		}, {			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]				this.columns = new Ext.grid.ColumnModel(columnModel);		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Column Model		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -								// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Toolbar		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -				// New Item handler		var newItemHdl = function() {			this.fire('link_create_item_dlg', {				info	: {					parentId	: this.id					,groupId	: this.groupId					,root		: this.root					,id 		: 0					,path		: this.path				}			});		};		this.toolbar = {			items: [new Ext.Toolbar.SplitButton({				text 		: 'New'				,cls 		: 'x-btn-text-icon'				,icon		: Eve.Resource.getIcon('new', 'general')				,disabled	: true				//,tooltip	: Eve.Resource.getToolTip.btnNew				,handler	: newItemHdl.createDelegate(this)				,menu 		: [{					text 		: 'Link Folder'					,handler	: function() {						this.fire('link_create_folder_dlg', {info:{ parentId : this.id, groupId : this.groupId, 															root: this.root, id : 0, path: this.path }} ); 					}					,scope		: this				}, {					text 		: 'Link'					,handler	: newItemHdl					,scope		: this				}]			}), {				text 		: "Edit"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('edit', 'general')				//,tooltip	: Eve.Resource.getToolTip.btnEdit				,handler	: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						type = rec.data.type;												var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path								,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)							}							,title	: this.getRowTitle(rec)						}												this.fire("link_edit_" + type + "_dlg", data);					}					else {						Ext.tools.msg('Select a Record', 'To Edit a Link, You need to select a record in grid below.');					}				}				,scope		: this			}, {				text 		: "Delete"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('delete', 'general')				//,tooltip	: Eve.Resource.getToolTip.btnDelete				,handler	: this.deleteHdl				,scope		: this							}, '-', {				text		: 'Up'				,id			: this.section + 'btnToolbarUp'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('arrow-up', 'general')				,handler	: function() {					this.fire(this.section + "_activate_parent_node");				}				,scope		: this			}, '-', {				text 		: "Print"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('print', 'general')				,handler	: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path						,start		: this.view.get().store.lastOptions.params.start					}										this.fire("link_print_folder", {info: info});				}				,scope		: this							}, '->', new Ext.SplitButton({				text 		: 'Links and Folders'				,id  		: 'link_folderItem'				//,tooltip	: Eve.Resource.getToolTip.btnSwitchView				,handler	: function() { this.showMenu() }				,menu		: new Ext.menu.Menu({					items		: [						new Ext.menu.CheckItem({							text	: 'Links and Folders'							,checked: true							,group	: 'fi'							,handler: function(e) {								var data = {									mode	: {										base	: 'folder_item'										,branch	: 'flatView'									}									,info	:{										parentId: this.id										,groupId: this.groupId										,root	: this.root										,id		: 0									}								}																this.fire( 'link_filter', data, true ); 							}							,scope	: this						})						,new Ext.menu.CheckItem({							text	: 'Links Only'							,group	: 'fi'							,handler: function(e) {								var data = {									mode	: {										base	: 'folder_item'										,branch	: 'itemsOnly'									}									,info	: {										parentId: this.id										,groupId: this.groupId										,root	: this.root										,id		: 0									}								}																this.fire( 'link_filter', data, true ); 							}							,scope	: this						})					]				})			})		]}				// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -		// End: Toolbar		// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	}		,init : function(obj)	{		Eve.widgets.Link.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();				this.conn.init( this.reader );		var store = this.conn.getStore();				this.view.init({			id 				: 'link_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Links' //+ this.section			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,keys			: this.getKeyMap()		});				this.registerView();	}		,registerView : function(){		Eve.widgets.Link.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();				// - - - - - - - - - - - - - - - - - -		// Handle Link Grid Edit		// - - - - - - - - - - - - - - - - - - 		grid.on('beforeedit', function(e) {			var type = this.getStore().getAt(e.row).data.type;			// Prevent user from editing folder's url column			if (e.column == 3 && type == 'folder')				return false;		})								// - - - - - - - - - - - - - - - - - -		// Handle Link Double Click		// - - - - - - - - - - - - - - - - - - 		grid.on('rowdblclick', function(grid, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx)			var type = rec.get('type');						var data = {				info	: {					rawId		: rec.id					,root		: this.root					,rec        : rec					,id			: rec.id.split("_")[1]					,root		: this.root				}			}						if ( type == 'folder' ){				this.fire("link_activate_child_node", data );			}else{				this.fire('link_open_link', data, true);			}		}, this);				// Click on Icon  		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm 	= grid.colModel;			if ( cm.getDataIndex(colIdx) != 'type' ) {				return;			}			var rec	 = grid.getStore().getAt(rowIdx);			var type = rec.get('type');			if (type == 'folder')				return;			var data = {				info	: {					rawId		: rec.id					,root		: this.root					,rec        : rec				}			}			this.fire('link_open_link', data, true);		}, this);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\link/LinkMenu.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */  // -----------------------------------------------------------------------// Link Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.LinkEditMenu = Ext.extend( Eve.widgets.EditMenu, {	init : function(data) {		Eve.widgets.LinkEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}, {				text	: "Open Link"				,id		: "open"				,icon	: Eve.Resource.getIcon('item-open','link')			},{				text	: "Copy"				,id		: "link_copy"				,icon	: Eve.Resource.getIcon('item-copy','link')			}, '-', {				text	: "Comments"				,id		: "comments"			}, {				text	: "Linked Items"				,id		: "linked"			}]		});		this.folder_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.registerView();	}	,registerView : function( brdg )	{		this.item_menu.on('itemclick', function(bi)		{			var data = {				title	: this.title				,isMultiSelected : this.isMultiSelected				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}			switch(bi.id)			{				case 'edit':					//@@Benchmark					//console.log("@@Benchmark -- Time(N1): ",(new Date()).getRTime() % 100000);					this.fire(this.section + '_edit_item_dlg'  , data);					break;				case 'delete':					this.fire(this.section + '_delete_item_dlg'  , data );					break;				case 'open':							this.fire(this.section + '_open_link', data);					break;				case 'link_copy':					this.fire('link_copy_item_dlg', data);					break;				case 'linked':					this.fire(this.section + '_interlinking_dlg', data);					break;				case 'comments':					this.fire(this.section + '_comment_dlg', data);					break;			}		}, this );		if (this.folder_menu.on) {			this.folder_menu.on('itemclick', function( bi )			{				var data = {					title			: this.title					,isMultiSelected : this.isMultiSelected					,info	: {						id			: this.id						,typeId		: this.typeId						,reminderId	: this.reminderId						,parentId	: this.parentId						,groupId	: this.groupId						,root		: this.root						,path		: this.path					}				}				switch(bi.id)				{					case 'edit':						this.fire(this.section + '_edit_folder_dlg' ,data);						break;					case 'delete':							this.fire(this.section + '_delete_folder_dlg' ,data);				}			}, this);		}	}});// -----------------------------------------------------------------------// Link Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.LinkAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data){		Eve.widgets.LinkAddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{					text	: "New Link Folder"					,id		: 'folder'					,icon	: Eve.Resource.getIcon('folder-new','link')				}, {					text	: "New Link"					,id		: 'item'					,icon	: Eve.Resource.getIcon('item-new','link')				}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Link Tree Add Context Menu// -----------------------------------------------------------------------Eve.widgets.LinkTreeMenu = Ext.extend( Eve.widgets.BaseTreeMenu, {	init : function(data){		Eve.widgets.LinkTreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','link')				}, {					text	: "Edit"					,id		: 'edit'					,icon	: Eve.Resource.getIcon('edit', 'general')				}, {					text	: "Delete"					,id		: 'delete'					,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.groupmenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','link')			}]		});				this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\link/LinkDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Tasks section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// * * * * * * * * * * * * * * * * * * * * // 	Item , Comments, Interlinking// * * * * * * * * * * * * * * * * * * * * Eve.lib.Link.ItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Link.ItemDialogBridge.superclass.init.call(this, data);				var items	= (this.isIL()) ? ["Details"] : ["Details", "Comments", "Linked Items"];		var tab		= {			items	: items			,main	: [0]		}				var dialog	= {			width 	: 600			,height : 500			,title	: 'Link'		}				this.createDialog({tab: tab ,dialog: dialog});	}		,onDialogHide : function()	{		//@@Benchmark		//console.log("@@Benchmark -- Time(N2): ",(new Date()).getRTime() % 100000);		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL())			Eve._il.main.store.removeAll();				// Reset Image Preview		var imagePreview = Ext.getCmp(this.section + 'ImagePreview');		imagePreview.setImage(true);						// Reset all Flags.		this.clearLoaded();	}		,augment : function(callee) {		var obj = callee.params;		if (this.mode != 'create')			obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;				var idx = this.getIndex(this.getTabPanel().activeTab);		switch(idx) {			// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}				return callee;	}		,showHideCmp : function() {		var checkEval  	= Ext.getCmp(this.section + 'ItemEDAH');		var checkLogin 	= Ext.getCmp(this.section + 'autoLoginChk');		//var itemCreated	= Ext.getCmp(this.section + 'ItemCreated');		//var itemModified= Ext.getCmp(this.section + 'ItemModified');				if (this.root == 'personal') {			checkEval.enable();			checkLogin.enable();		}		else {			checkEval.disable();			checkLogin.disable();		}				// Show/Hide 'Created by' & 'Last Modified' fields./*		if (this.root == 'group' && this.mode == 'edit') {			itemCreated.show();			itemModified.show();		}		else {			itemCreated.hide();			itemModified.hide();					}				if (this.mode != 'edit') {			this.getTabPanel().items.itemAt(this.idxComments).disable();			this.getTabPanel().items.itemAt(this.idxInterlink).disable();		}		else {			this.getTabPanel().items.itemAt(this.idxComments).enable();			this.getTabPanel().items.itemAt(this.idxInterlink).enable();		}		*/	}		,controller : function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack;				this.title		= obj.title;				if (! this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;			this.panels[this.idxComments].reset();		}				this.panels[0].reset();				// Check Elements.		this.showHideCmp();		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type) {			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);								if (!this.getLoaded(0)) 					this.loadForm(0);								break;							case (this.section + '_create_item_dlg'):				this.mode = 'create';				this.controller(data);				break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_comment_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxComments);				// ...Clear its load status ;)				this.clearLoaded(0);				break;							case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_interlinking_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxInterlink);				// ...Clear its load status ;)				this.clearLoaded(0);				break;						case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid');				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}			}		,loadSuccess : function(res) {		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// Item			case 0:				var imagePreview = Ext.getCmp(this.section + 'ImagePreview');				imagePreview.setImage();				break;						// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex) {				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}										var type = (obj.id == 0 || obj.id === undefined) ? "link_success_create_item" : "link_success_modify_item";					this.fire(type, {info: info, params: obj});			} // End of Switch		} // End of If	}});// * * * * * * * * * * * * * * * * * * * * //	Folder Dialog// * * * * * * * * * * * * * * * * * * * * Eve.lib.Link.FolderDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Link.FolderDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			width 	: 600			,height : 200			,title	: 'Link Folder'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,augment : function( callee )	{		var obj = callee.params;				if (this.mode == 'edit')			obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;		return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;				// We can also write this as a function for all of the panels		this.panels[0].reset();		// Check Elements.		this.showHideCmp();		this.dialog.show();			}		,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('link_edit_folder_dlg'):				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;							case ('link_create_folder_dlg'):				this.mode = 'create';				this.controller(data);				break;		}			}		,submitSuccess : function( resp, action )	{ 		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId			}						var type = (obj.id == 0 || obj.id === undefined) ? "link_success_create_folder" : "link_success_modify_folder";			this.fire(type, {info: info, params: obj});		}	}});// * * * * * * * * * * * * * * * * * * * *// Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *Eve.lib.Link.CopyMoveDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []	,init : function(data)	{		Eve.lib.Link.CopyMoveDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ['Copy']		}		var dialog	= {			width 	: 500			,height : 300			,title	: 'Copy'		}		this.createDialog({tab: tab ,dialog: dialog})	}	,afterAddButtons : function(btns)	{		btns.splice(0, 1);		btns[0].text = "Copy";		btns[0].id	 = "linkCopyMoveButton";		return btns;	}	,augment : function(callee)	{		var obj = callee.params;		var node = this.view.getSelectionModel().getSelectedNode();		var nodeInfo = this.view.getNodeInfo(node);		obj.folders = nodeInfo.folderId;		if (nodeInfo.groupId != null || nodeInfo.groupId != "0" || nodeInfo.groupId !== undefined)			obj.groups = nodeInfo.groupId;					obj.id		= this.id;			if (this.root == 'group')				obj.groupId = this.groupId;				return callee;	}	,controller	: function(obj)	{		Ext.apply(this, obj.info);		this.title = obj.title;		delete this.groups;		this.dialog.show();	}	,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('link_copy_item_dlg'):				if (Eve.Link.treeChanged === true) {					this.tree.root.reload();					delete Eve.Link.treeChanged;				}				this.mode = 'copy';				this.controller(data);				break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\mail/MailDialogs.js *//*--------------------------------------------------*/Eve.widgets.ConvertToTaskDlgBridge = Ext.extend(Eve.lib.Bridge,{	init: function(data){		Eve.widgets.ConvertToTaskDlgBridge.superclass.init.call(this, data);		this.tree = data.tree;				this.dialog = new Ext.Panel({			layout: 'border'			,items:[{				region: 'center'				,layout: 'fit'				,items: data.tree				,width: 180            }]		});		this.window = new Ext.Window({		modal		: true		,layout 	: 'fit'		,minWidth	: 520		,width		: 520		,height		: 380		,y 			: 100		,border 	: false		,resizable	: true		,bodyBorder : false		,autoScroll : false		,closeAction: 'hide'		,items 		: this.dialog		,title		: 'Convert to a Task'		,buttons    : [{			text: 'Select'			,handler: function(){				this.data.nodeInfo = this.tree.getNodeInfo(this.tree.getSelectionModel().getSelectedNode());				if(!this.data.nodeInfo){					Ext.tools.msg('Please select an item','');					return;				}				this.data.convertToTask(this.data);				this.window.hide();			}			,scope: this		},{			text: 'Cancel'			,handler: function(){				this.window.hide();			}			,scope: this		}]			});		}	,execute: function(callee, type, data){		switch(type){			case 'open_task_tree_dlg':				if (Eve.Task.treeChanged === true) {					this.tree.root.reload();					delete Eve.Task.treeChanged;				}				this.data = data				this.window.show();				break;		}	}	})Eve.widgets.AttachmentDlgBridge = Ext.extend(Eve.lib.Bridge,{	init	: function(obj)	{		Eve.widgets.AttachmentDlgBridge.superclass.init.call(this, obj);		this.tree = obj.tree;		this.store = new Ext.data.Store({            	reader 	: this.reader		},this);				this.reader = new Ext.data.XmlReader({               	record 	: 'row'               ,id		:'id'               },['id', 'type', 'name', 'size', 'image', 'lastmoddate']  		);				var custom = {			layout			: 'fit'			,border			: false			,items			: [{			   layout: 'card'			  ,id:'mail-attach-dlg-card'			  ,activeItem: 0			  ,items:[{				xtype     : 'dataview'				,store    : this.store				,itemSelector: 'div.eve-container'				,singleSelect	: true        				,selectedClass: 'x-group-selected'				,emptyText: '<div style="padding:5px;font-weight:bold;">No files exist in the root of this folder, check subfolders if they exist.</div>'				,tpl	: new Ext.XTemplate(				  '<div style="overflow-y:auto;overflow-x:hidden; height:100%;width:100%;">',				  '<tpl for=".">',								'<div class="eve-container"  style="height:18px; width:98%; padding:2px;cursor:pointer;"> ',									'<div style="float:left; width:5%">',										'<center>',											'<img src="{image}" width=14 height=14 title="{name}"/>',										'</center>',									'</div>',									'<div class="" style="margin-left:10px;white-space:nowrap; width: 55%; font:11px tahoma;float:left;overflow:hidden;">',										'{name}',									'</div>',									'<div class="" style="margin-right:3px;white-space:nowrap;width: 32%; font:11px tahoma;float:right;overflow:hidden;">',										'{lastmoddate}',									'</div>',					  '<div style="clear:both;"></div>',								'</div>',				  '</tpl>',				  '</div>'				)         ,listeners: {          click: function(dv, index, node, e){            var node = dv.store.getAt(index);            this.title= node.get('name');            this.size = node.get('size');            this.id = node.get('id').split('_')[1];          }          ,scope: this        }              },{				xtype			: 'customview'				,dvConfig		: {					id				: "attachment_customview"					,itemSelector	: 'div.eve-container'					,singleSelect	: true					,selectedClass  : 'note-customview-selected-class'					,listeners: {						click: function(dv, index, node, e){							var node = dv.store.getAt(index);							this.title= node.get('name');							this.size = node.get('size');							this.id = node.get('id').split('_')[1];						}						,scope: this					}				}				,store 		: this.store				,template	: new Ext.XTemplate(					'<div class="eve-container" style="height: 100px; float:left;">',						'<div id="{id}" style="width: 40px; height: 40px; margin: 15px;"',						'onmouseover="this.style.cursor=\'pointer\'">',							'<div>',								'<center>',									'<img src="{image}" width=25 height=25 title="{name}"/>',								'</center>',							'</div>',							'<div class="" style="height: 24px; width: 30px; font:11px tahoma;">',								'<p><center><div style="width: 40px; overflow:hidden; height: 25px;">{[this.breakName(values)]}</div></center></p>',							'</div>',						'</div>',					'</div>', {            breakName: function(values){             return values.name.replace(/(.{10}?)/g, "$1<br />");           }           }				)				,scope: this			}]      }      ]		}         		this.attachDlg = new Ext.Panel({			layout: 'border'			,items:[{				region: 'center'				,layout: 'fit'				,items: custom            }, {				region: 'west'			,layout: 'fit'					,items: obj.tree					,width: 180			,minSize: 100			,split: true					,autoScroll: true            }]		});	this.attachWindow = new Ext.Window({		id          : 'e'		,modal		: true		,layout 	: 'fit'		,minWidth	: 520		,width		: 520		,height		: 380		,y 			: 100		,border 	: false		,resizable	: true		,bodyBorder : false		,autoScroll : false		,closeAction: 'hide'		,items 		: this.attachDlg		,title		: 'Attachment'		,buttons    : [{			text: 'Attach'			,handler: this.attachFileToMail			,scope: this		}]		,tbar       :[{				xtype	: "splitbutton"				,text	: "List"				,id		: "mail_list_icon_view"				,icon	: Eve.Resource.getIcon('view-list', 'note')				,cls	: "x-btn-text-icon"				,handler: function() { this.showMenu() }				,menu	: new Ext.menu.Menu({					items: [{							text	: "List"							,icon	: Eve.Resource.getIcon('view-list', 'note')							,cls	: "x-btn-text-icon"							,group	: "liv"							,handler: function(e) {								Ext.getCmp('mail-attach-dlg-card').getLayout().setActiveItem(0);								Ext.getCmp("mail_list_icon_view").setIcon(Eve.Resource.getIcon('view-list', 'note'));								Ext.getCmp("mail_list_icon_view").setText('List');							}							,scope	: this						}, {							text	: "Icons"							,icon	: Eve.Resource.getIcon('view-icon', 'note')							,cls	: "x-btn-text-icon"							,group	: "liv"							,handler: function(e) {								Ext.getCmp('mail-attach-dlg-card').getLayout().setActiveItem(1);								Ext.getCmp("mail_list_icon_view").setIcon(Eve.Resource.getIcon('view-icon', 'note'));								Ext.getCmp("mail_list_icon_view").setText('Icons');							}							,scope	: this						}					]				})			}  ]	});	// Reset the tree 	//TODO:  We should update the tree later;			/*this.attachWindow.on('hide', function(){			var tree = obj.tree;			var pNode = tree.getNodeById('DP_0');			pNode.collapse();			pNode.loaded = false;			tree.selModel.select(pNode);			var gNode = tree.getNodeById('DP_-2');			gNode.collapse();			gNode.loaded = false;		});*/	}	,attachFileToMail: function(){    if ( this.id != "0" && this.id !== undefined && this.title !== undefined){  		this.mailAttachFunc( { name: this.title , size: this.size, id: this.id } );  		this.attachWindow.hide();    }     else{      Ext.tools.msg('Please select a file to attach','');     }	}		,fillStore: function(res){		this.store.removeAll();		var rec = this.reader.readRecords(res).records;		this.store.add(rec);		this.store.commitChanges();			}		,execute : function(callee, type, object)	{		switch(type)		{			case 'open_attachment_dlg':				this.root		= object.root;				this.id			= object.id;				this.groupId 	= object.groupId;				/*				if(Eve.activeSec === 'mail')					this.mailAttachFunc = object.func;				else{				    this.mode = object.mode;				    this.title = object.title;				}				*/				this.mailAttachFunc = object.func;				this.attachWindow.show();				if (Eve.Document.treeChanged === true) {					this.store.removeAll();					this.tree.root.reload();										delete Eve.Document.treeChanged;				}				break;							case ('document_files_load_sucess'):			    this.fillStore(object.response)			    break;		}	}	});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\mail/MailFactory.js *//*--------------------------------------------------*//** * @author: Zubin Khavarian (zubin.khavarian@gmail.com) * */  //TO DO:Eve.GhazalTime = 300*1000;Eve._GridUpdator = function(section){	this.section = section;	this.initTaskRunner();};Eve._GridUpdator.prototype = {	initTaskRunner : function()	{		this.task = {			run: function(){				var d = new Date();				console.log(this.section,"------","Time:", d.getMinutes(), ":", d.getSeconds());    			console.log(this.section,"is updating");				if(this.section == "mail"){    				Eve.Resource.superbridge.broadcast(this, 'mail_call_updater');        			return;				}			}			,interval	: Eve.GhazalTime			,scope      : this		}  	this.delayStart = new Ext.util.DelayedTask(function(){    		Ext.TaskMgr.start(this.task);    },this );		    //this.delayStart.delay(Eve.GhazalTime);	}	,reset : function()	{		Ext.TaskMgr.stop(this.task);		this.delayStart.delay(Eve.GhazalTime);	}} //        //Added By Ghazale Ext.grid.GridDragZone.override({    handleMouseDown: function(e, t)    {        if(t.className == 'x-grid3-row-checker')            return false;        Ext.grid.GridDragZone.superclass.handleMouseDown.apply(this, arguments);    }});//Add "refresh" word Ext.namespace("Ext.ux.mail");Ext.ux.mail.PagingToolbar = function(config){  Ext.ux.mail.PagingToolbar.superclass.constructor.call(this, config);};Ext.extend(Ext.ux.mail.PagingToolbar ,Ext.PagingToolbar,{  onRender: function(ct, position){        Ext.PagingToolbar.superclass.onRender.call(this, ct, position);        this.first = this.addButton({            tooltip: this.firstText,            iconCls: "x-tbar-page-first",            disabled: true,            handler: this.onClick.createDelegate(this, ["first"])        });        this.prev = this.addButton({            tooltip: this.prevText,            iconCls: "x-tbar-page-prev",            disabled: true,            handler: this.onClick.createDelegate(this, ["prev"])        });        this.addSeparator();        this.add(this.beforePageText);        this.field = Ext.get(this.addDom({           tag: "input",           type: "text",           size: "3",           value: "1",           cls: "x-tbar-page-number"        }).el);        this.field.on("keydown", this.onPagingKeydown, this);        this.field.on("focus", function(){this.dom.select();});        this.field.on("blur", this.onPagingBlur, this);        this.afterTextEl = this.addText(String.format(this.afterPageText, 1));        this.field.setHeight(18);        this.addSeparator();        this.next = this.addButton({            tooltip: this.nextText,            iconCls: "x-tbar-page-next",            disabled: true,            handler: this.onClick.createDelegate(this, ["next"])        });        this.last = this.addButton({            tooltip: this.lastText,            iconCls: "x-tbar-page-last",            disabled: true,            handler: this.onClick.createDelegate(this, ["last"])        });        this.addSeparator();        this.loading = this.addButton({            tooltip: this.refreshText,            iconCls: "x-tbar-loading",            text: 'Refresh',            handler: this.onClick.createDelegate(this, ["refresh"])        });        if(this.displayInfo){            this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});        }        if(this.dsLoaded){            this.onLoad.apply(this, this.dsLoaded);        }  }}); Eve.MailHelper = { setIFrameContent : function(f,c){     if(Ext.isIE){        f.contentWindow.document.body.innerHTML = c;        var anchors = f.contentWindow.document.getElementsByTagName('a');		try{			if(Ext.DomQuery.select('a[href]', f.contentWindow.document.body).length == 0 ){				//c = c.replace(/([^(?:&quot;|"|=)])((http:\/\/www\.|http:\/\/)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="$2">$2</a>');				//c = c.replace(/([^(?:&quot;|"|=)\/])((www\.)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="http://$2">$2</a>');				c = this.linkify(c);				f.contentWindow.document.body.innerHTML = c;			}		}catch(e){cosnole.log('Error!! on url to link>>', e)}        for(var i=0; i< anchors.length; i++){          if(anchors[i].getAttribute('onclick') == null &&            anchors[i].getAttribute('href') && anchors[i].getAttribute('href').indexOf('#') == -1)            anchors[i].setAttribute('target', '_blank');        }      }      else{  		f.contentDocument.body.innerHTML = c;        var anchors = f.contentDocument.getElementsByTagName('a');		var images = f.contentDocument.getElementsByTagName('img');		try{			if(Ext.DomQuery.select('a[href]', f.contentDocument.body).length == 0 ){				//c = c.replace(/([^(?:&quot;|"|=)])((http:\/\/www\.|http:\/\/)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="$2">$2</a>');				//c = c.replace(/([^(?:&quot;|"|=)\/])((www\.)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="http://$2">$2</a>');				c = this.linkify(c);				f.contentDocument.body.innerHTML = c;			}		}catch(e){cosnole.log('Error!! on url to link>>', e)}		        for(var i=0; i< anchors.length; i++){          if(anchors[i].getAttribute('onclick') == null &&          anchors[i].getAttribute('href') && anchors[i].getAttribute('href').indexOf('#') == -1)            anchors[i].setAttribute('target', '_blank');        }     }},linkify: function(c){	/*			//URLs starting with http://, https://, or ftp://		var replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;		 c = c.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');		//URLs starting with www. (without // before it, or it'd re-link the ones done above)		var replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;		 c = c.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');	*/		c = c.replace(/([^(?:&quot;|"|=)])((http:\/\/www\.|http:\/\/)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="$2">$2</a>');		c = c.replace(/([^(?:&quot;|"|=)\/])((www\.)([a-zA-Z0-9\-\.]*)(\.[a-zA-Z]{2,4})([^ ,"<]*))/ig, '$1<a target="_blank" href="http://$2">$2</a>');		 return c;}}//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//[TODO] Put the ObjectCache class in its own file/*	Object-Cache	By Zubin Khavarian <zubin.khavarian@gmail.com>	Provides a client-side caching mechanism for javascript objects paired with keys*/Ext.namespace("Ext.ux.ObjectCache");/** * Class for caching any (key, object) pair with a simple * queue system of which the size is defined during instantiation. * * @author Zubin Khavarian */Ext.ux.ObjectCache = function(maxCacheSize) {  this.store = [];  this.cacheQueue = [];  this.maxCacheSize = maxCacheSize;};Ext.ux.ObjectCache.prototype = {  getCacheSize: function() {    return this.cacheQueue.length;  },  /**   * Method used to put objects in the cache using a key   *   * @param key String, Number   * @param obj Object   */  putInCache: function(key, obj) {    if(this.getCacheSize() >= this.maxCacheSize) {      this._freeUpFromCache();    }    this.cacheQueue.push(key);    this.store[key] = obj;  },  //takes a single key or an array of keys to remove from cache  removeFromCache: function(keys, idPrefix) {    if(typeof idPrefix === "undefined") {      var idPrefix = "";    }    if(typeof keys !== "object") {      keys = [keys];    }    for(var i in keys) {      this.cacheQueue.remove(idPrefix + keys[i]);      this.store.remove(this.store[idPrefix + keys[i]]);    }  },  _freeUpFromCache: function() {    var tempKey = this.cacheQueue[0];    this.cacheQueue.shift();    this.store[tempKey] = null;    delete this.store[tempKey];  },  /**   * Check if the object is available in the cache given its KEY   * If not available, returns false, otherwise, return the object itself   *   * @param key String, Number   * @return Boolean, Object   */  getFromCache: function(key) {    for(var i=0, len=this.cacheQueue.length; i<len; i++) {      if(this.cacheQueue[i] == key) {        return this.store[key];      }    }    return false;  },  clearCache: function() {    this.cacheQueue = [];    this.store = [];  },  dumpCache: function() {    for(var i=0, len=this.cacheQueue.length; i<len; i++) {      console.log(this.cacheQueue[i], this.store[this.cacheQueue[i]]);    }  }};//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//[TODO] Put the Cross-Browser Split in its own file/** * Cross-Browser Split 0.3 * By Steven Levithan <http://stevenlevithan.com> * MIT license * Provides a consistent cross-browser, ECMA-262 v3 compliant split method*/String.prototype._$$split = String.prototype._$$split || String.prototype.split;String.prototype.split = function (s /* separator */, limit) {	// if separator is not a regex, use the native split method	if (!(s instanceof RegExp))		return String.prototype._$$split.apply(this, arguments);	var	flags = (s.global ? "g" : "") + (s.ignoreCase ? "i" : "") + (s.multiline ? "m" : ""),		s2 = new RegExp("^" + s.source + "$", flags),		output = [],		origLastIndex = s.lastIndex,		lastLastIndex = 0,		i = 0, match, lastLength;	/* behavior for limit: if it's...	- undefined: no limit	- NaN or zero: return an empty array	- a positive number: use limit after dropping any decimal	- a negative number: no limit	- other: type-convert, then use the above rules	*/	if (limit === undefined || +limit < 0) {		limit = false;	} else {		limit = Math.floor(+limit);		if (!limit)			return [];	}	if (s.global)		s.lastIndex = 0;	else		s = new RegExp(s.source, "g" + flags);	while ((!limit || i++ <= limit) && (match = s.exec(this))) {		var emptyMatch = !match[0].length;		// Fix IE's infinite-loop-resistant but incorrect lastIndex		if (emptyMatch && s.lastIndex > match.index)			s.lastIndex--;		if (s.lastIndex > lastLastIndex) {			// Fix browsers whose exec methods don't consistently return undefined for non-participating capturing groups			if (match.length > 1) {				match[0].replace(s2, function () {					for (var j = 1; j < arguments.length - 2; j++) {						if (arguments[j] === undefined)							match[j] = undefined;					}				});			}			output = output.concat(this.slice(lastLastIndex, match.index));			if (1 < match.length && match.index < this.length)				output = output.concat(match.slice(1));			lastLength = match[0].length; // only needed if s.lastIndex === this.length			lastLastIndex = s.lastIndex;		}		if (emptyMatch)			s.lastIndex++; // avoid an infinite loop	}	// since this uses test(), output must be generated before restoring lastIndex	output = lastLastIndex === this.length ?		(s.test("") && !lastLength ? output : output.concat("")) :		(limit ? output : output.concat(this.slice(lastLastIndex)));	s.lastIndex = origLastIndex; // only needed if s.global, else we're working with a copy of the regex	return output;};//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Eve.lib.Mail = Ext.extend( Eve.lib.Bridge, {	init: function(obj)  {		Eve.lib.Mail.superclass.init.call(this, obj);	}  	,forceLoad: function()  {	var that = this;	var obj = {path: (Eve.Mail.Path) || 'Inbox'};	//Eve.Mail.selectFolder(obj);	setTimeout(function(){that.manager.loadFinished(that)}, 1000);	  }  	,setSharedSection : function(data)	{		this.sharedSection = data.sharedSection;	}  		,execute: function(callee, type, obj){		switch(type.toLowerCase()){			case "mail_create_item_dlg":				Eve.Mail.newComposeDlg('newWin', obj.to);				 break;          			  case "mail_il_create_item_dlg":						Eve.Mail.newComposeDlg('newWin', obj.to, obj, 'interlink'/* mode*/);						break;			  case "mail_il_edit_item_dlg":				  Eve.Mail.mailPopUp( obj.info.id );				  break;			  case "mail_file_select":				  Eve.Mail.uploadDoc(obj);				  break;			  case "mail_select_folder":				 Eve.Mail.selectFolder(obj);				  break;			  case "mail_call_updater":				  Eve.Mail.updater();				  break;			  case "show_section":				 Eve.Mail.checkUpdater(obj.section, obj);			   break;                		}	}});Eve._Mail = function() {    var ilParam = {};    var composeMode = "";      var filters = {    mail: function(text) {      if(text != null){        text = text.replace(/\\"/g, '"');        text = text.replace(/\\\\/g, '\\');        text = text.replace(/\\n/g, ' ');             }      return text;    }  };  var ServiceEvents = {    //Compose Mail Events    sendMail:                    'modern.mail.personal.send',    saveDraft:                   'modern.mail.personal.saveDraft',    saveBackup:                  'modern.mail.personal.saveBackup',    getPersonalContact:          'modern.contact.personal.getAllContacts',    getGroupContact:             'modern.contact.group.getAllContacts',    getAllContacts:               'modern.contact.personal.getAllPersonalGroupContacts',    newMail:                     'modern.mail.personal.new',    replyMail:                   'modern.mail.personal.reply',    replyToAllMail:              'modern.mail.personal.replyToAll',    forwardMail:                 'modern.mail.personal.forward',    showHeader:                  'modern.mail.personal.singleShowHeader',    //Search Events    searchInitialize:            'modern.mail.personal.searchInitialize',    modifyFilter:                'modern.mail.personal.modifyFilter',    //Mailbox Folder Events    getFullTree:                 'modern.mailFolder.personal.getFullTree',    getTreeNodeChildren:         'modern.mailfolder.personal.getsubtree',    deleteMailFolder:            'modern.mailfolder.personal.delete',    editMailFolder:              'modern.mailfolder.personal.createmodify',    mailFolderProperties:        'modern.mailFolder.personal.properties',    purgeMailFolder:             'modern.mailFolder.personal.purge',    //Mailbox Grid Events    getMailboxItems:             'modern.mail.personal.selectFolder',    changeOrderBy:               'modern.mail.personal.changeOrderBy',    changeStartItemNumber:       'modern.mail.personal.changeStartItemNumber',    singleChangeStartItemNumber: 'modern.mail.personal.singleChangeStartItemNumber',    //Mail Item Events    trash:                       'modern.mail.personal.trash',    move:                        'modern.mail.personal.move',    singleView:                  'modern.mail.personal.singleview',    flag:                        'modern.mail.personal.flag',    unflag:                      'modern.mail.personal.unflag',    read:                        'modern.mail.personal.read',    unread:                      'modern.mail.personal.unread',    popUpView:                   'modern.mail.personal.singleViewforInterlink',    //POP-Account Events    getAccountMails_POP:         'modern.popAccount.personal.getsubtree',    createAccount_POP:           'modern.popAccount.personal.createmodify',    editAccount_POP:             'modern.popAccount.personal.edit',    deleteAccount_POP:           'modern.popAccount.personal.delete',    //POP-Mail Operations Events    getMailboxItems_POP:               'modern.popMessage.personal.selectFolder',    changeOrderBy_POP:                 'modern.popMessage.personal.changeOrderBy',    changeStartItemNumber_POP:         'modern.popMessage.personal.changeStartItemNumber',    singleChangeStartItemNumber_POP:   'modern.popMessage.personal.singleChangeStartItemNumber',    singleView_POP:              'modern.popMessage.personal.singleView',    trash_POP:                   'modern.popMessage.personal.trash',    move_POP:                    'modern.popMessage.personal.move',    replyMail_POP:               'modern.popMessage.personal.reply',    replyToAllMail_POP:          'modern.popMessage.personal.replyToAll',    forwardMail_POP:             'modern.popMessage.personal.forward',    //File Attachment Events    attachFile:                  'modern.mail.personal.attachFile',    detachFile:                  'modern.mail.personal.detachFile',    downloadFile:                  'modern.mail.personal.previewAttachment',    getAttachment:               'modern.mail.personal.getAttachment'  };  var Templates = {     PremailHeaderTemplate: new Ext.XTemplate(      '<div mplateclass="" style="background-color:#f5f5f5; font-family:tahoma;font-size:9pt;font-weight:normal;line-height:normal; ">',        '<div style="font:bold 11pt tahoma, arial, helvetica, sans-serif;">',          '  <span class=\"subject-span\" title=\"{subject}\"  parentId="{parentId}">{subject}',		  '<tpl if="this.checkTask(values)">',		  '<div class="btn-visibility" style="display:inline;cursor:pointer;padding-left:15px;"><a href="#" title="Turn this message into a task" ><img  id="mail-{previewType}-create-task-{id}" src=' + Ext.BLANK_IMAGE_URL + ' style="background: transparent url('+Eve.Resource.getIcon('new-project','task')+') no-repeat 0 3px; height: 19px; width: 16px;margin-left:3px;margin-top:-5px;"></a></div>',		  '{[this.createTask(values)]}</tpl>',		  '</span>',        '</div>',        '<table border=0 style="font:normal 11px tahoma; width: 100%">',          '<tr>',            '<td style="padding-right: 30px;" colspan=2 >',            '<div style="float:left;margin-top:3px;font-size:11pt;">',              '{[values.from.replace("<", "&lt;")]}</div>{[this.addToContact(values)]}</td>',			'<td style="width: 40px; font-weight: bold;" colspan=2></td>',            '<td style="width: 40px; font-weight: bold;"></td>',            '<td style="padding-right: 30px; text-align: right;"></td>',          '</tr>',                    '<tr>',            '<td style="width: 25px; color:#06609B">Sent:</td>',            '<td style="padding-right: 30px;">{atDate}</td>',            '<td style="width: 40px; font-weight: bold;"></td>',            '<td style="padding-right: 30px; text-align: right;"></td>',            '<td></td>',			'<tpl if="!values.popMail">',            '<td class="btn-visibility" style="white-space:nowrap; padding-right: 30px; text-align: right;">{[this.showFullHeader(values)]}</td>',			'</tpl>',		  '</tr>',                    '<tr>',            '<td style="width: 25px; color:#06609B;">To: </td>',            '<td colspan=5><span id=\"to_{id}\" title=\"{[values.to.replace(/,([^ ])/g, ", $1")]}\" class=\"tocc-span\">{[this.getTruncatedEmails(values.to)]}</span></td>',          '</tr>',          '<tpl if="this.checkText( values.cc )">',          '<tr>',            '<td style="width: 25px; color:#06609B;">Cc: </td>',            '<td colspan=5><span id=\"cc_{id}\" title=\"{[values.cc.replace(/,([^ ])/g, ", $1")]}\" class=\"tocc-span\">{[this.getTruncatedEmails(values.cc)]}</span></td>',                   '</tr>',           '</tpl>',                    '<tpl if="this.checkText( values.bcc )">',          '<tr>',            '<td style="width: 25px; color:#06609B;">Bcc: </td>',            '<td colspan=5><span id=\"bcc_{id}\" title=\"{[values.bcc.replace(/,([^ ])/g, ", $1")]}\" class=\"tobcc-span\">{[this.getTruncatedEmails(values.bcc)]}</span></td>',          '</tr>',                    '</tpl>',                  '</table>',                  '<tpl if="this.hasAttachment(values)">',        '<div style=" border:1px solid #06609B;padding:3px;" id="mail-{previewType}-attachment-list-{id}">',        '<table width=100%>',          '<tr>',            '<td valign=top width=80>',              '<div style="padding:3px;padding-right:0px;font:normal 11px tahoma;">Attachments</div>',            '</td>',            '<td>',              '<div style="width:100%;height:{[this.setHeight(values.attachedFiles)]};overflow:auto;">',              '<tpl for="attachedFiles">',                '<div style="font:normal 11px tahoma;border:1px solid #D2D2D2;padding:3px;width:30%;float:left;margin:1px;height:11px">',                '<div style="float:left; width:90%;overflow:hidden;white-space:nowrap;">',				'<a  href="{[this.getAttachUrl(parent, values)]}" title="{name}"  id={id} class="mail-attachments-file">',                '{name}</a>',				'</div>',                '{[this.saveToDocument(values, parent)]}',				'<div style="clear:both;"></div>',              '</div>',              '</tpl>',              '</div>',            '</td>',          '</tr>',        '</table>',        '</div>',                 '</tpl>',       '</div>',      {        checkText: function( values ){          return ( values != null && values != '' && values != undefined );        }        ,getTitle: function(values){        	return Ext.urlEncode({title: values.title});        }        ,getTruncatedEmails: function(strEmails)        {    			var emails = strEmails.split(',');    			var output = '';    			for (var i = 0; i < emails.length; i++)    			{    				if (i == 5)    					output += "<a href=\"javascript:void(0);\" onclick=\"this.setAttribute('style', 'display: none;'); this.parentNode.getElementsByTagName('span')[0].setAttribute('style', 'display: inline;'); if (Ext.getCmp('mail-preview-panel')) { Ext.getCmp('mail-preview-panel').doLayout(); } if (Ext.getCmp('header_' + this.parentNode.getAttribute('id').substring(3))) { Ext.getCmp('header_' + this.parentNode.getAttribute('id').substring(3)).ownerCt.doLayout(); } \">More...</a><span style=\"display: none;\">";     				output += Ext.util.Format.trim(emails[i]) + ', ';    			}    			output = output.substring(0,output.length - 2);    			if (emails.length >= 5)    				output += "</span>";    			    			return output;        }        ,showFullHeader: function(values){            var id = values.id.split('_')[1];           return'<span style="cursor:pointer;"  onclick ="Eve.Mail.showFullHeader('+id+')"><b>Show Full Header </span>';        },        setHeight: function(val){          var len = val.length;          if(len <= 3)            return '20px';          if(len >= 4 && len <= 6)            return '42px';          if(len >= 7 )            return '63px';         },		checkTask: function(values){			if	(	(values.gridNumber != "3" &&					(Eve.Preference.getBoolean('mytasks') || Eve.Preference.getBoolean('sharedtasks')) && !values.popMail)				)				return true;			return false;		},		createTask: function(val){			var attachListener = function(){				try{					var createTaskBtn = Ext.get("mail-"+val.previewType+"-create-task-"+ val.id);					createTaskBtn.on({						click:{							fn: function(e, target){								val.convertToTask = function(data){									Eve.Resource.superbridge.broadcast( this, 'task_create_item_dlg',{mode:'create',info: data.nodeInfo, taskBody:val.body, taskSubject: val.subject});								};								Eve.Resource.superbridge.broadcast(this, 'open_task_tree_dlg', val);							}						}					})				}catch(e){					setTimeout(attachListener, 100);				}			}				attachListener();				 return '';		},        hasAttachment: function(val){          if(val.attachedFiles.length == 0)            return false;                        var attachmentList = null;            var attachListener = function(){              try{                var attachmentList = Ext.get("mail-"+val.previewType+"-attachment-list-" + val.id);				var p = val.popMail;				var event = (p == true || p == "true" || p == "1")?'modern.popMessage.personal.getAttachment' : 'modern.mail.personal.getAttachment';                attachmentList.on({                  click: {                    fn: function(e, target) {					e.stopEvent();                     if(target.className != 'mail-attachments-file')                        return true;                     var action = {                  			CFID	: Eve.CFId                  			,CFTOKEN: Eve.CFToken                  			,event	: event                  			,id		  : target.id                  			,title	: target.title                  		}                        Eve.downloadFile(action);                                          },                    delegate:'a'                  }                });                 }catch(e){                  setTimeout(attachListener, 100);                }            }                        attachListener();         return true;           },		getAttachUrl: function(parentVal, values){			var p = parentVal.popMail;			var action = {					CFID	: Eve.CFId					,CFTOKEN: Eve.CFToken					,event	: (p == true || p == "true" || p == "1")?'modern.popMessage.personal.getAttachment' : 'modern.mail.personal.getAttachment'					,id		  : parentVal.id.split("_")[1]					,title	: values.name				}			return [Eve.url ,"?", Ext.urlEncode(action)].join('')		},        saveToDocument: function(values, allVal){            var func = 'function(){ Eve.Resource.superbridge.broadcast( window, \'document_upload_item_dlg\',{mode:\'upload\',info: {id:\''+values.id+'\',parentId: 0, mailAttachment:\''+values.title+'\',mailId: \''+values.id+'\',root:\'personal\',popMail:\''+allVal.popMail+'\'}})}';						var t = 'Eve.Resource.superbridge.broadcast (window, \'proxy_dialog\', { type:\'document\', func:' + func + ' } )';					                        return'<div class="btn-visibility" style="float:right;cursor:pointer;"><a href="#" title="Add to document " onclick="'+t+'"><img  src="' + Ext.BLANK_IMAGE_URL + '" style="background: transparent url('+Eve.Resource.getIcon('item-upload','document')+') no-repeat 0 3px; height: 19px; width: 16px;margin-left:3px;margin-top:-5px;"></a></div>';        },                addToContact: function(val){            if(!Eve.Preference.getBoolean('MyContacts')&& !Eve.Preference.getBoolean('SharedContacts'))              return '';                          var mailAdd = "";             var fName = "";            var mName = "";            var lName = "";            var fullName ="";            var mailIndex = -1;//            var fr = val.from.trim() ;////            fr = fr.replace("<", " " ).replace(">", "  " ).replace("&gt;", " " ).replace("&lt;", " " ).replace("&quot;", " " ).replace('"', " " );//            //            var fromAr = fr.match(/[ ]*(((.*?)[ ]+)?(.*?)[ ]+)?(.*)/i);//////            if(fromAr[5].indexOf("@") != -1 )//              mailIndex =  5 ;//            if( mailIndex>= 0)//              mailAdd = fromAr[mailIndex].trim();////            for (var i = 3; i< mailIndex; i++)//            {//                if(i == 3){//                  if(fromAr[i])//                  fName = fromAr[i].trim();//                }//                else if(i == 4){//                  if(fromAr[i])//                  lName = fromAr[i].trim();//                }//            }                      var text = val.from.trim() ;						//text = text.replace('/&gt;/g', '>' ).replace('/&lt;/g', '<' ).replace('/&quot;/g', ' ' ).replace('/\"/g', ' ' ).replace('/\'/g', ' ' );						text = text.replace(/&gt;/g, '>' ).replace(/&lt;/g, '<' ).replace(/&quot;/g, '' ).replace(/"/g, '' ).replace(/'/g, '' );						            if (text.match(/<[^>]*>/))            {            	mailAdd = text.match(/<([^>]*)>/)[0];            	mailAdd = mailAdd.replace('<', '').replace('>', '');            	              text = text.replace(/<[^>]*>/, '').trim();	            if (text.split(' ').length >= 1)	                fName = text.split(' ')[0];		            if (text.split(' ').length == 2)	            {	                lName = text.split(' ')[1];	            }	            else if (text.split(' ').length > 2)	            {	                mName = text.split(' ')[1];	                lName = text.split(' ')[2];	            }            }            else            {            	mailAdd = text;            }                                    fullName = fName + (mName ? ' ' + mName : '') + ' ' + lName;                  			var func = 'function(){ Eve.Resource.superbridge.broadcast( window, \'contact_create_from_mail_dlg\',{mode:\'create\',mail: \''+mailAdd+'\',fName : \''+fName+'\',mName: \'' + mName + '\', lName: \''+lName+'\',fullName: \''+fullName+'\',isFromMail: true,info: {id:0,parentId: 0, path: \'\\\\\',root:\'personal\'}})}';			var t = 'Eve.Resource.superbridge.broadcast (window, \'proxy_dialog\', { type:\'contact\', func:' + func + ' } )';					                        return'<div class="btn-visibility"  style="cursor:pointer;"><a style="margin-left:16px;" href="#" alt="Add to contact " onclick="'+t+'"><img  src="' + Ext.BLANK_IMAGE_URL + '" style="background: transparent url('+Eve.Resource.getIcon('add-to-contact','mail')+') no-repeat 0 3px; height: 19px; width: 16px;margin-left:3px;"></a></div>';        }      }    ),               fullHeaderTemplate: new Ext.XTemplate(      '<div style="">',      '<table width=100% class="mail-header2">',      '<tr><td width=20%><span>Date</span></td><td>{atDate}</td></tr>',      '<tr><td><span>From</span></td><td>{from}</td></tr>',      '<tr><td><span>To</span></td><td>{[values.to.replace(/,([^ ])/g, ", $1")]}</td></tr>',      '<tr><td><span>CC</span></td><td>{[values.cc.replace(/,([^ ])/g, ", $1")]}</td></tr>',      '<tr><td><span>Sender</span></td><td>{sender}</td></tr>',      '<tr><td><span>Reply To</span></td><td>{replyTo}</td></tr>',      '<tr><td><span>Subject</span></td><td>{subject}</td></tr>',      '<tr><td valign=top><span>Header</span></td><td ><p>{[values.fullheader.replace(/\\\\n/g, "<br />")]}</p></td></tr>',      '</table>',        '</div>'     // '<a href="'+Eve.url + '?event=mail.single.rawMessage&id={id}">[Raw Message]</a>'    ),        printTemplate: new Ext.XTemplate(    	'<html>',    		'<head>',    			'<style>',    				//'body, td { font-family: Verdana; font-size: 10pt;}',    			'</style>',    		'</head>',    		'<body>',          '<div style="border-bottom: 1px solid gray; font-family: arial; font-size: 10px; padding: 10px;">',            '<div style="font:normal 10px tahoma, arial, helvetica, sans-serif;overflow=hidden">',              '<div style="font:normal 12px tahoma, arial, helvetica, sans-serif;"><span style="font-weight: bold; text-decoration: underline;">Subject:</span> {subject}</div>',              '<table style="font-size: 12px;">',                '<tr>',                  '<td style="width: 40px; font-weight: bold;">Date:</td>',                  '<td style="padding-right: 30px;">{atDate}</td>',                  '<td style="width: 40px; font-weight: bold;">Size:</td>',                  '<td>{sizeText}</td>',                '</tr>',                '<tr>',                  '<td style="width: 25px; font-weight: bold;">From: </td>',                  '<td style="padding-right: 30px;">{from}</td>',                  '<td style="width: 25px; font-weight: bold;">To: </td>',                  '<td>{to}</td>',                '</tr>',                '<tr>',                  '<td style="width: 30px; font-weight: bold;">CC:</td>',                  '<td style="padding-right: 30px;">{cc}</td>',                  '<td></td>',                  '<td></td>',                  /*'<td style="width: 25px; font-weight: bold;">Attachments: </td>',*/                  /*'<td>{attachments}</td>',*/                '</tr>',              '</table>',            '</div>',          '</div>',    			'<div>{body}</div>',    		'</body>',    	'</html>'    )  };  var gridRenderers = {    isNew: function(val, metadata, record) {      if(record.data['new'] == "1") {        metadata.css = "mail-new-icon";        metadata.attr += ' title="New Message"';      }      return '';    },    unreadMail: function(val, metadata, record) {      //Make text items like subject, from/to, data, and size BOLD for unread (new) mail      if(record.data['new'] == "1") { metadata.attr = ' style="font-weight: bold;"'; }      metadata.attr += ' title="' + val + '"';      return val;    },    isFlagged: function(val, metadata, record) {      if(val == "1") {        metadata.css = "mail-flagged-icon";        metadata.attr += ' title="You have flagged this message for follow-up"';      }      return '';    },    hasAttachments: function(val, metadata, record) {      if(val == "true") {        metadata.css = "mail-attachment-icon";        metadata.attr += ' title="Attachment"';      }      return '';    },    info: function(val, metadata, record) {      var value;      switch(val) {        case "0": // Not Replied To, Not Forwarded        default:          //metadata.css = "";          //metadata.attr += ' title=""';          break;        case "1": // Only Replied To          metadata.css = "mail-repliedto-icon";          metadata.attr += ' title="You have replied to this message"';          //value = '<img src="'+Eve.Resource.getIcon('replied','mail')+'">';          break;        case "2": // Only Forwarded          metadata.css = "mail-forwarded-icon";          metadata.attr += ' title="You have forwarded this message"';          //value = '<img src="'+Eve.Resource.getIcon('forward','mail')+'">';          break;        case "3": // Both, Forwarded and Replied To          metadata.css = "mail-forwarded-replied-icon";          metadata.attr += ' title="You have replied and forwarded this message"';          //value = '<img src="'+Eve.Resource.getIcon('reply-forward','mail')+'">';          break;      }      return '';    }  };  var dataStores = {    searchMailGridStore: null  };  var flagColumn  = new Ext.grid.CheckColumn({			 header			: '<img src="'+Eve.Resource.getIcon('flag-red','mail')+'"/>'			,sortable    	: true			,fixed       	: true			,menuDisabled	: false			,dataIndex		: 'isflagged'			,width			: 30			,editable 		: true			,renderer 	: function(v, p, record) {				if (v === undefined || v == "")				    return;				if (v == '1' || v == 'true' || v == true) {					v = '1';				}				else if (v == '0' || v == 'false' || v == false) {					v = '0';				}				//the +v type converts to a number (json returns a string				//which always evaluates true)				var checkState = (+v) ? '-on' : '';				p.css += ' x-grid3-check-col-td';				return '<div class="mail-flag-checkbox'+ checkState +' x-grid3-cc-'+this.id+'"> </div>';			}      		});    flagColumn.on('click', function(element, e, record){          var flagState = (record.get('isflagged') == '1' || record.get('isflagged') == true)? 'flag' : 'unflag'          Requests.markSelectedMessages( flagState, record.get('id'));                })  var mailGrid = {    XmlReader:      new Ext.data.XmlReader({        record: 'row',        id: 'id',        totalRecords: 'total'      }, [        {name: 'id', mapping: 'id' },        {name: 'itemNumber', mapping: 'itemNumber', type: 'int' },        {name: 'new', mapping: 'new'},        {name: 'isflagged', mapping: 'isFlagged'},        {name: 'info', mapping: 'info'},        {name: 'hasattachments', mapping: 'hasAttachments'},        {name: 'From', mapping: 'from' },        {name: 'To', mapping: 'to'},        {name: 'Subject', mapping: 'subject'},        {name: 'sendDate', mapping: 'sendDate'},        {name: 'Size', mapping: 'size'},        {name: 'body'},        {name: 'expiresIn'},        {name: 'textPath'},        {name: 'parentId'},        {name: 'prevItemNumber'},        {name: 'nextItemNumber'}              ]    ),    ColumnModel_From: new Ext.grid.ColumnModel([      new Ext.grid.CheckboxSelectionModel(),      {id: 'id', hidden: true, dataIndex: 'id', width:0},      {dataIndex: 'itemNumber', hidden: true, width:0},      {header: '<img src="' + Eve.Resource.getIcon('msg-unread','mail')+ '" />', width: 30, sortable: true, dataIndex: 'new', renderer: gridRenderers.isNew, fixed: true },      {        header: '<img src="' +Eve.Resource.getIcon('state','mail') +'" />',        width: 30,        sortable: false,        dataIndex: 'info',        renderer: gridRenderers.info,        fixed	: true      },      {header: 'To', id:'mail-cm-to',sortable: true, width: 200, dataIndex: 'To', renderer: gridRenderers.unreadMail, hidden:true},      {header: 'From', id: 'mail-cm-from',sortable: true, width: 200, dataIndex: 'From', renderer: gridRenderers.unreadMail },      {header: 'Subject', sortable: true, width: 250, dataIndex: 'Subject', renderer: gridRenderers.unreadMail },      {header: 'Date', sortable: true, width: 150, dataIndex: 'sendDate', renderer: gridRenderers.unreadMail },      {header: 'Size', sortable: true, width: 60, dataIndex: 'Size', renderer: gridRenderers.unreadMail },      flagColumn,      //{header: '<img src="' + Eve.Resource.getIcon('flag-red','mail') + '" />', width: 25, sortable: false, dataIndex: 'isflagged', renderer: gridRenderers.isFlagged, resizable: false },      {header: '<img src="' + Eve.Resource.getIcon('paper-clip','mail') + '" />', width: 30, sortable: true, dataIndex: 'hasattachments', renderer: gridRenderers.hasAttachments, fixed	: true },      {header: 'Expires In', id:'expireIn',width:60, dataIndex: 'expiresIn', hidden: true}        ])    	,getColModel : function()	{		//id = id || (this.getGroupId() || this.getId());		var data	= Eve.Preference.get('tree');	    if(!data['mail'])	      return false;      		var tempModel	= data['mail'].nodes[0].get('columns');				if (tempModel) {			var cols	 = tempModel.split(',');			var colModel = [];						for (var i = 0; i < cols.length; ++i) {				var col = cols[i].split(':');				colModel.push({					dataIndex	: col[0]					,width		: parseInt(col[1])					,index		: i + 1				});			}								}    return colModel;	}		,syncColumnModel : function()	{		var grid	 	 = Ext.getCmp('mail_grid');		var gridColModel = this.ColumnModel_From;		var colModel	 = this.getColModel();		if (colModel) {			for (var i = 0; i < colModel.length; ++i) {				var cm	= colModel[i];				var col = gridColModel.getColumnsBy( function(config, idx) {					return (config.dataIndex == cm.dataIndex)				});								// If Column exists in Grid				if (col[0]) {					var oldIndex = gridColModel.getIndexById(col[0].id);					var newIndex = cm.index;										// Update Column Position					if (oldIndex != newIndex) {						gridColModel.moveColumn(oldIndex, newIndex);					}										// Update Column Width except those have fixed width					if(cm.dataIndex != 'info' && cm.dataIndex != 'itemnumber' && cm.dataIndex != 'isflagged' &&					   cm.dataIndex != 'new' && cm.dataIndex != 'hasattachments')						gridColModel.setColumnWidth(cm.index, cm.width);				}			}		}	}      };  mailGrid.syncColumnModel();    var searchGrid = {    XmlReader:      new Ext.data.XmlReader({        record: 'row',        id: 'id',        totalRecords: 'total'      }, [        {name: 'id', mapping: 'id' },        {name: 'itemNumber', mapping: 'itemNumber' , type: 'int'},        {name: 'new', mapping: 'new'},        {name: 'isflagged', mapping: 'isFlagged'},        {name: 'info', mapping: 'info'},        {name: 'hasattachments', mapping: 'hasAttachments'},        {name: 'from', type:'string'},        {name: 'to', type:'string' },        {name: 'fromto', type: 'string'},        //{name: 'toCc', mapping: 'to'},        {name: 'Subject', mapping: 'subject'},        {name: 'sendDate', mapping: 'sendDate'},        {name: 'Size', mapping: 'size'},        {name: 'body'},        {name: 'prevItemNumber'},        {name: 'nextItemNumber'},        {name: 'textPath'},        {name: 'parentId'}      ]    ),    ColumnModel_From: new Ext.grid.ColumnModel([		new Ext.grid.CheckboxSelectionModel(),      {id: 'id', hidden: true, dataIndex: 'id'},      {dataIndex: 'itemNumber', hidden: true},      {header: '<img src="' +Eve.Resource.getIcon('msg-unread','mail')+ '" />', width: 30, sortable: true, dataIndex: 'new', renderer: gridRenderers.isNew, resizable: false },      {        header: '<img src="' +Eve.Resource.getIcon('state','mail')+ '" />',        width: 30,        sortable: false,        dataIndex: 'info',        renderer: gridRenderers.info,        resizable: false      },      {header: 'From/To', id: 'from-to',sortable: true,width: 200, dataIndex: 'fromto', renderer: gridRenderers.unreadMail },      {header: 'From', id: 'from',sortable: true, width: 200, dataIndex: 'from', renderer: gridRenderers.unreadMail, hidden:true},      {header: 'To', id: 'to',sortable: true, width: 200, dataIndex: 'to', renderer: gridRenderers.unreadMail, hidden:true },      {header: 'Subject', sortable: true, width: 250, dataIndex: 'Subject', renderer: gridRenderers.unreadMail },      {header: 'Date', sortable: true, width: 150, dataIndex: 'sendDate', renderer: gridRenderers.unreadMail },      {header: 'Size', sortable: true, width: 60, /*align: 'right',*/ dataIndex: 'Size', renderer: gridRenderers.unreadMail },      flagColumn,      //{header: '<img src="' + Eve.Resource.getIcon('flag-red','mail') + '" />', width: 25, sortable: false, dataIndex: 'isflagged', renderer: gridRenderers.isFlagged, resizable: false },      {header: '<img src="' + Eve.Resource.getIcon('paper-clip','mail')+ '" />', width: 30, sortable: false, dataIndex: 'hasattachments', renderer: gridRenderers.hasAttachments, resizable: false },      {header: 'Path', width: 30, sortable: false, dataIndex: 'textPath', resizable: true, renderer: gridRenderers.unreadMail }    ])  };  var popMailGrid = {    XmlReader:      new Ext.data.XmlReader({        record: 'row',        id: 'id',        totalRecords: 'total'      }, [        {name: 'id', mapping: 'id'  },        {name: 'itemNumber', mapping: 'itemNumber' },        {name: 'new', mapping: 'new'},        /*{name: 'hasattachments', mapping: 'hasAttachments'},*/        {name: 'From', mapping: 'from' },        {name: 'Subject', mapping: 'subject'},        {name: 'sendDate', mapping: 'sendDate'},        {name: 'Size', mapping: 'size'},        {name: 'body'},        {name: 'prevItemNumber'},        {name: 'nextItemNumber'}      ]    ),    ColumnModel: new Ext.grid.ColumnModel([      new Ext.grid.CheckboxSelectionModel(),      {id: 'id', hidden: true, dataIndex: 'id'},      {id: 'itemNumber', dataIndex: 'itemNumber', hidden: true},      {header: '<img src="' + Eve.Resource.getIcon('msg-unread','mail')+ '" />', width: 30, sortable: false, dataIndex: 'new', renderer: gridRenderers.isNew, resizable: false },      {header: 'From', sortable: false, width: 200, dataIndex: 'From', renderer: gridRenderers.unreadMail },      {header: 'Subject', sortable: false, width: 250, dataIndex: 'Subject', renderer: gridRenderers.unreadMail },      {header: 'Date', sortable: false, width: 150, dataIndex: 'sendDate', renderer: gridRenderers.unreadMail },      {header: 'Size', sortable: false, width: 60, /*align: 'right',*/ dataIndex: 'Size', renderer: gridRenderers.unreadMail }      /*{width: 15, sortable: false, dataIndex: 'hasattachments', renderer: gridRenderers.hasAttachments, resizable: false } */    ])  };  var State = {    currentPreviewItemId: null,    folderTree: null,    lastSelectedFolder: null,    isPreviewPaneCollapsed: function() { return mailPreviewPanel.collapsed; },	isPOPPreviewPaneCollapsed: function() { return popMailPreviewPanel.collapsed; },	mailFolderTree_Data: new Ext.util.MixedCollection(),	mailFolderFullTree_Data: new Ext.data.Store({		fields: ['title', 'id', 'path', 'depth'],		reader: new Ext.data.XmlReader({			record: 'node'		},['title', 'id', 'path', 'depth'])	}),    mailFolderTree_Dirty: false,	mailFolderFullTree_Dirty: false,	mailFolderTree_Fill: function(treeInfo) {      State.mailFolderTree_Data.clear();      for(var i=0, len=treeInfo.length; i<len; i++) {        //Path is required        if(treeInfo[i].get('path').indexOf('/') == -1){          State.mailFolderTree_Data.add(treeInfo[i].get('id').split('_')[1], {            id: treeInfo[i].get('id').split('_')[1],            title: treeInfo[i].get('title'),            depth: '1',            path: treeInfo[i].get('path')            });        }		State.mailFolderTree_Dirty = false;      }    },	mailFolderFullTree_Fill: function(treeInfo){		State.mailFolderFullTree_Data.removeAll();		var record = Ext.data.Record.create(['title', 'path', 'depth', 'id']);		State.mailFolderFullTree_Data.add(new record( {			id: -1,			title: 'No Parent Folder',			depth: 1,			path: '\/'		}));				for(var i=0; i<treeInfo.length; i++){			State.mailFolderFullTree_Data.add(new record( {			id: treeInfo[i].get('id').split('_')[1],			title: treeInfo[i].get('title'),			depth: treeInfo[i].get('path').split('\/').length,			path: treeInfo[i].get('path')			}));		}		State.mailFolderFullTree_Dirty = false;	  },    /*    //Added By Ghazal    mailFolderMoveTree_Fill: function(xml) {      var st = State.mailFolderMoveTree_St;      st.removeAll();      var records = st.reader.readRecords( xml ).records;      st.add(records);          },*/    getCountOfNewInStore: function() {      var count = 0;      var items = mailGridPanel_DataStore.data.items;      for(var i=0, len=items.length; i<len; i++) {        if(items[i].data['new'] == "1" || items[i].data['new'] == 1) {          count++;        }      }      return count;    },    updateCountOfNewInTree: function() {      mailFolders.getSelectionModel().getSelectedNode().attributes.unread = State.getCountOfNewInStore();      UI.updateTreeUnreadCount(mailFolders.root);    },    updateCountOfNew: function(changedCounter, status) {      if(status === "0") { changedCounter *= -1; }      mailFolders.getSelectionModel().getSelectedNode().attributes.unread += changedCounter;      UI.updateTreeUnreadCount(mailFolders.root);    },    transferUnreadCount: function(sourceFolderId, destinationFolderId, count) {      var sourceFolderNode = mailFolders.getNodeById(sourceFolderId);      var destinationFolderNode = mailFolders.getNodeById("MPF_" + destinationFolderId);      sourceFolderNode.attributes.unread -= count;      var trashFolderId = processId(State.getTrashFolderInfo().id);      if(destinationFolderNode !== undefined){        if(!((processId(sourceFolderId) === trashFolderId) && (destinationFolderId === trashFolderId)) ) {          destinationFolderNode.attributes.unread += count;        }      }      UI.updateTreeUnreadCount(mailFolders.root);    },    countUnread: function(selectedRows) {      var count = 0;      if(selectedRows[0] === undefined)        return count;              for(var i=0, len=selectedRows.length; i<len; i++) {        if(selectedRows[i].data['new'] === "1") {          count++;        }      }      return count;    },    isGeneralTabSelected: function() {      return Ext.getCmp('general-tab').isVisible();    },    /*    isPOPAccountTabOpen: function() {      var tab = Ext.getCmp('pop-account-tab');      console.log("inside isPOPAccountTabOpen");      if(typeof tab === "undefined") {        return false;      }      else {        return true;      }    },    */    isPOPAccountTabSelected: function() {      var tab = Ext.getCmp('pop-account-tab');      return tab.isVisible();    },    getCurrentSelectedFolderText: function() {      var node = mailFolders.getSelectionModel().getSelectedNode();      var currentMailFolder = Ext.util.Format.lowercase(node.text);      return currentMailFolder;    },    getCurrentSelectedFolderNode: function() {      var selectedNode = mailFolders.getSelectionModel().getSelectedNode();      return selectedNode;    },    getCurrentSelectedFolderId: function() {      var selectedNode = mailFolders.getSelectionModel().getSelectedNode();      if(selectedNode === null) {        return null;      }      else {        return selectedNode.id;      }    },    //.............................................................................................    getSpamFolderInfo: function() {      var items = rootNode.childNodes;      var spamFolder = null;      for(var i=0, len=items.length; i<len; i++) {        if(items[i].attributes.system == "Spam") {          spamFolder = items[i];        }      }      return {        id: spamFolder.attributes.id,        title: spamFolder.attributes.title,        path: spamFolder.attributes.path      }    },    getTrashFolderInfo: function() {      var items = rootNode.childNodes;      var trashFolder = null;      for(var i=0, len=items.length; i<len; i++) {        if(items[i].attributes.system == "Trash") {          trashFolder = items[i];        }      }      return {        id: trashFolder.attributes.id,        title: trashFolder.attributes.title      }    },    getDraftsFolderInfo: function() {      var items = rootNode.childNodes;      var draftsFolder = null;      for(var i=0, len=items.length; i<len; i++) {        if(items[i].attributes.system == "Drafts") {          draftsFolder = items[i];        }      }      return {        id: draftsFolder.attributes.id,        title: draftsFolder.attributes.title      }    },    getInboxFolderInfo: function() {      var items = rootNode.childNodes;      var inboxFolder = null;      for(var i=0, len=items.length; i<len; i++) {        if(items[i].attributes.system == "Inbox") {          inboxFolder = items[i];        }      }      return {        id: inboxFolder.attributes.id,        //path: inboxFolder.attributes.path,        title: inboxFolder.attributes.title      }    },    //.............................................................................................    isTrashFolderSelected: function() {      var childNode = mailFolders.getSelectionModel().getSelectedNode();      var trashFolderNode = mailFolders.getNodeById(State.getTrashFolderInfo().id);      if(childNode == trashFolderNode) {        return true;      }      return childNode.isAncestor(trashFolderNode);    },    isSpamFolderSelected: function() {      var node = mailFolders.getSelectionModel().getSelectedNode();      var currentMailFolder = Ext.util.Format.lowercase(node.attributes.system);      return (currentMailFolder == "spam")? true: false;    },    isSentItemsFolderSelected: function() {      var node = State.getCurrentSelectedFolderNode();      var currentMailFolder = Ext.util.Format.lowercase(node.attributes.system);      return (currentMailFolder == "sent items")? true: false;    },    isDraftsFolderSelected: function() {      var childNode = State.getCurrentSelectedFolderNode();      var draftsFolderNode = mailFolders.getNodeById(State.getDraftsFolderInfo().id);      if(childNode == draftsFolderNode) {        return true;      }      return childNode.isAncestor(draftsFolderNode);    },    //.............................................................................................    isInTrashFolder: function(folderId) {      var trashFolderNode = mailFolders.getNodeById(State.getTrashFolderInfo().id);      var childNode = mailFolders.getNodeById(folderId);      if(childNode == trashFolderNode) {        return true;      }      return childNode.isAncestor(trashFolderNode);    },    //.............................................................................................    isSystemNode: function(node) {      return (node.attributes.system === "")? false: true;    },    buildAttachmentInfo: function(data) {    data.attachments = data.attachments || '';    if(data.attachments.split){      var tempAttachedFiles = data.attachments.split("\t");      data.attachedFiles = [];      for(var i=0, len=tempAttachedFiles.length; i<len; i++) {        if(tempAttachedFiles[i] !== "") {          data.attachedFiles.push({            name: tempAttachedFiles[i],            id: processId(data.id),            title: tempAttachedFiles[i]          });        }      }    }    }  };  State.mailFolderTree_Fill(Eve.Preference.get('mailFolders'));  State.mailFolderFullTree_Fill(Eve.Preference.get('mailFolders'));  var dialogs = {    /**     * @param deleteItemName {String} item name or type being deleted to show as message     * @param handler {Function} handler function to be called after the 'Yes' or 'No' button is clicked     */    confirmDelete: function(msg, handler) {      Ext.MessageBox.confirm(        "Confirm Delete",        msg,        handler      );    },    nothingSelected: function() {      Ext.MessageBox.alert(        "Nothing Selected",        "Please select something first to proceed."      );    }  };  var Caches = {    mailItemCache: new Ext.ux.ObjectCache(10),    popMailItemCache: new Ext.ux.ObjectCache(10)  };  var Requests = {    loadMailForm: function(type, id, obj) {	   var requestParams;       var id = (id)? id : "0";       var compId = ["MPI_",id, type ].join("");        if(UI.showedDialogs.indexOf(compId) != -1)          return;              if(Ext.getCmp(compId) !== undefined){          if(compId.indexOf('newWin') != -1){            Ext.getCmp(compId).ownerCt.show();            statusBar.items.items[1].hide();          }            else{            mailCenter.setActiveTab(compId);          }            return;       }          UI.showedDialogs.push(compId);             if(type !== "new" || type !== "newWin") {        var selectedId = id;      }      if( type !== 'newWin'){        statusBar.showBusy("Loading compose, please wait...");      }      switch(type) {        case 'new':        case 'newWin':        default:          requestParams = { event: ServiceEvents.newMail };          break;        case 'reply':          requestParams = {            event: ServiceEvents.replyMail,            id: selectedId          }          break;        case 'draft':          requestParams = {            event: ServiceEvents.replyMail,            id: selectedId,            type: 'draft'          }          break;        case 'replytoall':          requestParams = {            event: ServiceEvents.replyToAllMail,            id: selectedId          }          break;        case 'forward':          requestParams = {            event: ServiceEvents.forwardMail,            id: selectedId          }          break;      }	  if(obj && obj.gridNumber && (type == "forward" || type=="replytoall" || type=="reply") )		  requestParams.gridNumber = obj.gridNumber;            if((type == "new" || type == "newWin") && UI.fromStore){        var data = {          from : UI.fromStore          ,body: UI.defaultBodyStyle           ,id  : "MPI_0"        };        if(composeMode == 'interlink')          data.ilParams = obj.ilParams;		if( obj !== undefined && obj.toField !== undefined ){               data.to = obj.toField;               data.isContact = true;        }        UI.composeMail(type, data);      }      else{        Ext.Ajax.request({          url: Eve.url,          params: requestParams,          success: function(response, options) {              var data = xml2json(response.responseXML).data;            if(type !== "newWin") {              statusBar.clearStatus();            }             if(type == "new" || type == "newWin"){                UI.fromStore = data.from;            }                            data.body = UI.defaultBodyStyle + filters.mail(Ext.DomQuery.selectValue('body', response.responseXML));            data.to = filters.mail(data.to);            data.cc = filters.mail(data.cc);            data.subject = filters.mail( data.subject );            if( obj !== undefined && obj.toField !== undefined ){               data.to = obj.toField;               data.isContact = true;            }                      if(options.params.type === "draft") {              data.draftId = options.params.id;              data.type = options.params.type;            }            data.subject = filters.mail( data.subject );            if(composeMode == 'interlink')              data.ilParams = obj.ilParams;                          UI.composeMail(type, data);                      }          ,failure: function(){              UI.showedDialogs.remove(compId);          }        });      }    },    loadMail: function(id){       var requestParams = { event: ServiceEvents.popUpView, id: id };            Ext.Ajax.request({        url: Eve.url,        params: requestParams,        success: function(response, options) {          var responseData = xml2json(response.responseXML, '');		  responseData.data.popMail = false;          UI.previewMessageInNewWindow(responseData.data, true, Ext.DomQuery.selectValue('body', response.responseXML));        }      });        },        loadPOPMailForm: function(type, startItemNumber) {      statusBar.showBusy("Loading compose, please wait...");      var popAccountId = processId(popAccounts.getSelectionModel().getSelectedNode().id);	  var requestParams;      switch(type) {        default:          break;        case 'reply':          requestParams = {            event: ServiceEvents.replyMail_POP,            startItemNumber: startItemNumber,            popaccountid: popAccountId          }          break;        case 'replytoall':          requestParams = {            event: ServiceEvents.replyToAllMail_POP,            startItemNumber: startItemNumber,            popaccountid: popAccountId          }          break;        case 'forward':          requestParams = {            event: ServiceEvents.forwardMail_POP,            startItemNumber: startItemNumber,            popaccountid: popAccountId          }          break;      }      Ext.Ajax.request({        url: Eve.url,        params: requestParams,        success: function(response, options) {          statusBar.clearStatus();          var data = xml2json(response.responseXML).data;          data.body = UI.defaultBodyStyle + filters.mail(data.body);          data.to = filters.mail(data.to);          data.cc = filters.mail(data.cc);          data.subject = filters.mail( data.subject );          data.subject = filters.mail( data.subject );          UI.composeMail(type, data);        }      });    },    loadTreeNodeChildren: function(nodeId) {      var event = ServiceEvents.getTreeNodeChildren;      Ext.Ajax.request({        url: Eve.url,        params: {          event: event,          id: nodeId        }      });    },    loadMailboxGrid: function(nodeId) {      mailGridPanel_DataStore.load({params: {id: nodeId, start: 0, limit: 20, forceSelect: true}} );    },    reloadMailboxGrid: function() {      var node = State.getCurrentSelectedFolderNode();      if(node != null)      {        var nodeId = processId(node.id);        //Requests.loadMailboxGrid(nodeId);		mailGridPanel_DataStore.reload();      }      },    loadPOPMailboxGrid: function(nodeId) {      popMailGridPanel_DataStore.load({params: {id: nodeId, start: 0, limit: 20, forceSelect: true} });    },    reloadPOPMailboxGrid: function() {      var node = popAccounts.getSelectionModel().getSelectedNode();      var nodeId = processId(node.id);      Requests.loadPOPMailboxGrid(nodeId);    },    deleteSelectedMessages: function(confirmButtonId, grid) {      console.log("in delete selected messages");      statusBar.showBusy("Deleting selected messages, please wait...");	  grid = grid || Ext.getCmp('mail_grid');      var confirmButtonId = confirmButtonId || null;      //If user answers NO to the deletion operation      if(confirmButtonId === "no") {        return;      }      var selection = getSelectedMessageIds(grid);      var selectionCurFolderIds = getSelectedMessageCurFolderIds(grid);      if(selection.length === 0) {        dialogs.nothingSelected();        return;      }      selection.push('-1');      selectionCurFolderIds.push('-1');      var selectedRows = getSelectedMessages();      var unreadCount = State.countUnread(selectedRows);      Ext.Ajax.request({        url: Eve.url,        params: {          event: ServiceEvents.trash,          selectedIds: selection.join(','),          selectedCurFolderIds: selectionCurFolderIds.join(',')        },        success: function(response, options) {          statusBar.clearStatus();          var trashFolderId = processId(State.getTrashFolderInfo().id);          var selectedIds = Ext.DomQuery.selectValue("selectedIds", response.responseXML);          if(selectedIds){              selectedIds = selectedIds.split(",");                        for(var i=0; i<selectedIds.length; i++){                mailCenter.remove(Ext.getCmp("mailbox-panel-MPI_" + selectedIds[i]));              }          }              Caches.mailItemCache.removeFromCache( selection, "MPI_" );                    Requests.reloadMailboxGrid();          State.transferUnreadCount(            State.getCurrentSelectedFolderId() /* source folder id */,            trashFolderId /* destination folder id */,            unreadCount          );          //To reload searchGrid		  var searchGrid = Ext.getCmp('mail-search-grid');          if(searchGrid){            var st = searchGrid.store;            if(st.lastOptions)              st.reload();          }          var hdCheckbox = Ext.getCmp('mail_grid').getEl().select('.x-grid3-hd-checker-on');          if(hdCheckbox) hdCheckbox.removeClass('x-grid3-hd-checker-on');                  }      });    },/*    deleteSelectedMessages_POP: function(confirmButtonId) {      statusBar.showBusy("Deleting selected POP messages, please wait...");      var confirmButtonId = confirmButtonId || null;      //If user answers NO to the deletion operation      if(confirmButtonId === "no") {        return;      }      function getSelection() {        var tempSelection = popMailGridPanel.getSelectionModel().getSelections();        var selection = [];        for(var i=0, len=tempSelection.length; i<len; i++) {          selection.push(processId(tempSelection[i]));        }        //return selection;      }      getSelection();      var selection = getSelectedMessageIds();      if(selection.length === 0) {        dialogs.nothingSelected();        return;      }      Ext.Ajax.request({        url: Eve.url,        params: {          event: ServiceEvents.trash_POP,          selectedIds: selection.join(','),          poopaccountid: processId(popAccounts.getSelectionModel().getSelectedNode().id)        },        success: function(response, options) {          statusBar.clearStatus();          Requests.reloadMailboxGrid();        }      });    },*/    deleteMessage: function(messageId, popMail, gridNumber) {      var grid;	  statusBar.showBusy("Deleting message, please wait...");      var selCurFolderId = 0;      if( !popMail){		if(gridNumber == "2" || gridNumber == "3")			grid = Ext.getCmp('mail-search-grid');		else if (gridNumber == '1')			grid = mailGridPanel;        var rec = grid.getStore().getById(messageId);        if(rec !== undefined)          var unreadCount = State.countUnread([rec]);          if (rec.data['parentId'] !== undefined)          	selCurFolderId = rec.data['parentId'];        }            var requestParams = {};      requestParams.event = (popMail === true)? ServiceEvents.trash_POP: ServiceEvents.trash;      requestParams.selectedIds = (popMail === true)? messageId: processId(messageId);      requestParams.selectedCurFolderIds = (popMail === true)? selCurFolderId: processId(selCurFolderId);      requestParams.singleView = true;      if(popMail === true) {        requestParams.popaccountid = processId(popAccounts.getSelectionModel().getSelectedNode().id);      }	  else{		  requestParams.gridNumber = gridNumber;	  }      var generatedId = (popMail === true)? popAccounts.getSelectionModel().getSelectedNode().id + "_" + messageId: messageId;      Ext.Ajax.request({        url: Eve.url,        params: requestParams,        success: function(response, options) {          statusBar.clearStatus();          var responseData = xml2json(response.responseXML);          var data = responseData.data;                    var trashFolderId = processId(State.getTrashFolderInfo().id);          if( !popMail && rec !== undefined){            State.transferUnreadCount(              State.getCurrentSelectedFolderId() /* source folder id */,              trashFolderId /* destination folder id */,              unreadCount            );          }          var generatedId = (popMail === true)? popAccounts.getSelectionModel().getSelectedNode().id + "_" + messageId: messageId;          var tempEl = Ext.getCmp('mailbox-panel-' + generatedId);          if(tempEl) {            mailCenter.remove(tempEl);            tempEl.destroy();            if(popMail === true) {              mailCenter.setActiveTab(popAccountTab);            }            else {              mailCenter.setActiveTab(generalTab);              //mailCenter.setActiveTab(Ext.getCmp('pop-account-tab'));            }          }          if(popMail === true) {            Requests.reloadPOPMailboxGrid();          }          else {            Caches.mailItemCache.removeFromCache( messageId );            Requests.reloadMailboxGrid();                        if(Ext.getCmp('mail-search-grid')){              var st = Ext.getCmp('mail-search-grid').store;              if(st.lastOptions)                st.reload();            }          }             if(!data.row)                return;            var generatedId = (popMail === true)? popAccountId + "_" + (data.row.id.split("_"[1])): responseData.data.row.id;			data.row.gridNumber = gridNumber;            Helpers.tabPreview(responseData, generatedId, popMail);                                                                 }      });    },    markSelectedMessages: function(markType, rightClickedRowId, grid) {      var event = null;      switch(markType) {        case 'flag':        default:          event = ServiceEvents.flag;          break;        case 'unflag':          event = ServiceEvents.unflag;          break;        case 'read':          event = ServiceEvents.read;          break;        case 'unread':          event = ServiceEvents.unread;          break;      }      var selection = getSelectedMessageIds(grid);      var selectionCurFolderIds = getSelectedMessageCurFolderIds(grid);      if(selection.length === 0) {        if(typeof rightClickedRowId === "undefined") {          dialogs.nothingSelected();          return;        }        selection.push(rightClickedRowId);        var searchGrid = Ext.getCmp('mail-search-grid');        if (searchGrid){						var recc = searchGrid.store.getById("MPI_" + rightClickedRowId);						var selCurFolderId = 0;						if (recc !== undefined && recc.data['parentId'] !== undefined)			      	selCurFolderId = recc.data['parentId'];		        selectionCurFolderIds.push(processId(selCurFolderId));        }      }      selection.push('-1');      selectionCurFolderIds.push('-1');      statusBar.showBusy("Marking selected messages, please wait...");      Ext.Ajax.request({        url: Eve.url,        params: {          event: event,          selectedIds: selection.join(','),          selectedCurFolderIds: selectionCurFolderIds.join(',')        },        success: function(response, options) {          statusBar.clearStatus();          var idList = options.params.selectedIds.split(",");          var newIdList = [];          for(var i=0, len=idList.length; i<len; i++) {          	if (idList[i] >= 0)	            newIdList.push(mailGridPanel.getStore().indexOfId("MPI_" + idList[i]));          }          var markType = options.params.event.split(".")[3];          switch(markType) {            case "flag":            default:              UI.updateFlagStatus( newIdList, 'on');              break;            case "unflag":              UI.updateFlagStatus( newIdList, 'off');              break;            case "read":              UI.updateNewStatus( newIdList, 'off');              break;            case "unread":              UI.updateNewStatus( newIdList, 'on');              break;          }          var tempIdList = [];          for(var i=0, len=idList.length; i<len; i++) {          	if (idList[i] >= 0)            	tempIdList.push("MPI_" + idList[i]);          }          Caches.mailItemCache.removeFromCache( tempIdList );                    var searchGrid = Ext.getCmp('mail-search-grid');          if(searchGrid){            var st = searchGrid.store;            if(st.lastOptions)              st.reload();          }          //UI.updateTreeUnreadCount(mailFolders.root);        }      });    },    moveSingleMessage: function(messageId, folder, isPopMail, gridNumber) {		var grid;		var unreadCount = State.countUnread([mailGridPanel.getStore().getById("MPI_" + messageId)]);				var selCurFolderId = 0;		if(gridNumber != "0"){			if(gridNumber == "2" || gridNumber == "3")				grid = Ext.getCmp('mail-search-grid');			else if (gridNumber == '1')				grid = mailGridPanel;			var recc = grid.getStore().getById("MPI_" + messageId);			if (recc !== undefined && recc.data['parentId'] !== undefined)				selCurFolderId = recc.data['parentId'];		}		statusBar.showBusy("Moving selected messages, please wait...");		var params = (isPopMail) ? {		  event: ServiceEvents.move_POP,		  selectedIds: messageId,		  id: folder.id,		  title: folder.title,		  path: folder.path,		  singleView: true,		  popaccountid: processId(popAccounts.getSelectionModel().getSelectedNode().id)		} :		{		  event: ServiceEvents.move,		  selectedIds: messageId,		  selectedCurFolderIds: processId(selCurFolderId),		  id: folder.id,		  title: folder.title    ,		  path: folder.path,		  singleView: true		};		if(gridNumber)			params.gridNumber = gridNumber;		Ext.Ajax.request({		url: Eve.url,		params: params,		success: function(response, options) {		  statusBar.clearStatus();		  var responseData = xml2json(response.responseXML);		  var data = responseData.data;		  if(!isPopMail){			Caches.mailItemCache.removeFromCache(messageId, "MPI_");			var curTab = Ext.getCmp('mailbox-panel-MPI_' + messageId);		  }else{			var popAccountId = popAccounts.getSelectionModel().getSelectedNode().id;			Caches.mailItemCache.removeFromCache(messageId, popAccountId +"_");			var curTab = Ext.getCmp('mailbox-panel-'+popAccountId+'_'+ messageId);		  }		  mailCenter.remove(curTab);		  Requests.reloadMailboxGrid();		  //UI.updateTreeUnreadCount(mailFolders.root);		  State.transferUnreadCount(			State.getCurrentSelectedFolderId() /* source folder id */,			folder.id /* destination folder id */,			unreadCount		  );		  Ext.tools.msg("Success", "Selected message was moved.", 3);			 if(!data.row)				return;			var generatedId = (isPopMail === true)? popAccountId + "_" + (data.row.id.split("_"[1])): data.row.id;			data.row.gridNumber = gridNumber;			Helpers.tabPreview(responseData, generatedId, isPopMail);		}		});    },    moveSelectedMessages: function(folder, rightClickedRowId, grid) {      console.log("in move selected messages");      grid = grid || Ext.getCmp("mail_grid");      var selectedRows = getSelectedMessages(grid);      var unreadCount = 0;      var selection = getSelectedMessageIds(grid);      var selectionCurFolderIds = getSelectedMessageCurFolderIds(grid);      if(selection.length === 0) {        if(typeof rightClickedRowId === "undefined") {          dialogs.nothingSelected();          return;        }        unreadCount = State.countUnread([grid.getStore().getById("MPI_" + rightClickedRowId)]);        selection.push(rightClickedRowId);        var searchGrid = Ext.getCmp('mail-search-grid');        if (searchGrid){						var recc = searchGrid.store.getById("MPI_" + rightClickedRowId);						var selCurFolderId = 0;						if (recc !== undefined && recc.data['parentId'] !== undefined)			      	selCurFolderId = recc.data['parentId'];		        selectionCurFolderIds.push(processId(selCurFolderId));        }      }      else {        unreadCount = State.countUnread(selectedRows);      }      selection.push('-1');      selectionCurFolderIds.push('-1');            statusBar.showBusy("Moving selected messages, please wait...");      Ext.Ajax.request({        url: Eve.url,        params: {          event: ServiceEvents.move,          selectedIds: selection.join(','),          selectedCurFolderIds: selectionCurFolderIds.join(','),          // id: processId(folder.id),          id: folder.id,          path: folder.path,//path is required          title: folder.title        },        success: function(response, options) {          statusBar.clearStatus();          Caches.mailItemCache.removeFromCache( selection, "MPI_" );          Requests.reloadMailboxGrid();          //To reload search grid          if(Ext.getCmp('mail-search-grid')){            var st = Ext.getCmp('mail-search-grid').store;            if(st.lastOptions)              st.reload();          }                    State.transferUnreadCount(            State.getCurrentSelectedFolderId() /* source folder id */,            folder.id /* destination folder id */,            unreadCount          );                    var selectedIds = Ext.DomQuery.selectValue("selectedIds", response.responseXML);          if(selectedIds){              selectedIds = selectedIds.split(",");                        for(var i=0; i<selectedIds.length; i++){                mailCenter.remove(Ext.getCmp("mailbox-panel-MPI_" + selectedIds[i]));              }          }            }      });    },    updateTree: function() {      mailFolders.getLoader().load(rootNode);      rootNode.expand();      //setTimeout(function() { UI.updateTreeUnreadCount(); }, 100);    },    saveDraft: function(mask, that, mailFields) {		var attachmentList = (function() {		  var tempAttachmentList = [];		  for(var i=0, len=mailFields.attachments.getCount(); i<len; i++) {			tempAttachmentList.push(mailFields.attachments.itemAt(i).name);		  }		  return tempAttachmentList.join("|");		})();		//Stripping out the extra "," and/or ";" from the end of the list of contacts		  var toList = mailFields.to.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');		  var ccList = (typeof mailFields.cc === "undefined")? "": mailFields.cc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');		  var bccList = (typeof mailFields.bcc === "undefined")? "": mailFields.bcc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');		  var requestParams = {			event: ServiceEvents.saveDraft,			from: mailFields.from,			to: toList,			cc: ccList,			bcc: bccList,			subject: mailFields.subject,			body: mailFields.body,			isHTML: mailFields.isHTML,			save_copy: mailFields.save_copy,			type: mailFields.type,			attachments: attachmentList		  };		  if(requestParams.save_copy === 0) {			delete requestParams.save_copy;		  }		  if(that.draftId !== null) {			requestParams.id = that.draftId;			requestParams.draftId = that.draftId;		  }		  Ext.Ajax.request({			url: Eve.url,			params: requestParams,			success: function(response, options) {			  var resp = xml2json(response.responseXML);			  Caches.mailItemCache.removeFromCache(that.draftId, "MPI_");			  that.dirty = false;			  that.forceRemove = true;			  that.windowClose = true;			  if( that.ownerCt.getXType() == "window")				that.ownerCt.close();			  else				mailCenter.remove(that);			  mask.hide();			  Ext.tools.msg("Success", "Draft saved successfully.", 3);			  if(Ext.getCmp('mail_grid'))				  Requests.reloadMailboxGrid();			}			,fail: function(){				that.dirty = false;				that.forceRemove = true;				that.windowClose = true;				mask.hide();			}      });    },    saveBackup: function(mask, that, mailFields) {		var attachmentList = (function() {		var tempAttachmentList = [];		  for(var i=0, len=mailFields.attachments.getCount(); i<len; i++) {			tempAttachmentList.push(mailFields.attachments.itemAt(i).name);		  }		  return tempAttachmentList.join("|");		})();      //Stripping out the extra "," and/or ";" from the end of the list of contacts      var toList = mailFields.to.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');      var ccList = (typeof mailFields.cc === "undefined")? "": mailFields.cc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');      var bccList = (typeof mailFields.bcc === "undefined")? "": mailFields.bcc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');      var requestParams = {        event: ServiceEvents.saveBackup,        from: mailFields.from,        to: toList,        cc: ccList,        bcc: bccList,        subject: mailFields.subject,        body: mailFields.body,        isHTML: mailFields.isHTML,        save_copy: mailFields.save_copy,        type: mailFields.type,		attachments: attachmentList      };      if(requestParams.save_copy === 0) {        delete requestParams.save_copy;      }      if(that.lastSaveBackupId !== null) {        requestParams.id = that.lastSaveBackupId;        requestParams.draftId = that.lastSaveBackupId;      }      Ext.Ajax.request({        url: Eve.url,        params: requestParams,        success: function(response, options) {          var resp = xml2json(response.responseXML);          that.dirty = false;          that.lastSaveBackupId = processId(resp.data.id);          mask.hide();          Ext.tools.msg("Success", "Your composition was backed-up.", 3);        }      });    },    Mail: {      open: function(grid, rowIndex, fromSearchGrid, tabType /* window, tab */, popMail, isModal) {        statusBar.showBusy("Opening mail, please wait...");        isModal = isModal || false;		 var gridNumber = (fromSearchGrid) ? UI.gridNumber : 1;        var row = grid.getStore().getAt(rowIndex);        if(popMail === true) {          var popAccountId = popAccounts.getSelectionModel().getSelectedNode().id;		  gridNumber = 0;        }        var generatedId = (popMail === true)? popAccountId + "_" + (rowIndex + 1): row.data.id;        var fromCache = Caches.mailItemCache.getFromCache(generatedId);                if(tabType === "tab") {          var panel = Ext.getCmp('mailbox-panel-' + generatedId);          if(panel !== undefined) {            mailCenter.setActiveTab(panel);            if(Ext.getCmp('mail-preview-panel').collapsed == false )                UI.previewMessage(fromCache.data.row, popMail ); 			statusBar.clearStatus();            return;          }        }        //Cache-Miss        if(fromCache === false) {          var requestParams = {};          var selCurFolderId = 0;          if (row.data['parentId'] !== undefined)          	selCurFolderId = row.data['parentId'];                    if(fromSearchGrid) { requestParams.gridNumber = UI.gridNumber; }          requestParams.event = (popMail === true)? ServiceEvents.singleView_POP : ServiceEvents.singleView;          requestParams.startItemNumber = row.data.itemNumber;          requestParams.selectedIds = processId(row.data.id);		  requestParams.selectedCurFolderIds = (popMail === true)? selCurFolderId: processId(selCurFolderId);          requestParams.Id = processId(row.data.id);                    Ext.Ajax.request({            url: Eve.url,            params: requestParams,            success: function(response) {              statusBar.clearStatus();			  var dq = Ext.DomQuery;              var responseData = xml2json(response.responseXML, '');              responseData.data.row.body = UI.defaultBodyStyle + filters.mail(dq.selectValue('body', response.responseXML));              responseData.data.row.to = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.to));              responseData.data.row.cc = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.cc));              responseData.data.row.from = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.from));              responseData.data.row.subject = filters.mail(responseData.data.row.subject);			                responseData.data.row.gridNumber = gridNumber;              if(responseData.code == "0") {                Caches.mailItemCache.putInCache(generatedId, responseData);                if(tabType === "tab") {                               UI.previewMessageInTab(responseData.data.row, row.data, generatedId, popMail);                                    if( Ext.getCmp('mail-preview-panel').collapsed == false)                    UI.previewMessage(responseData.data.row, popMail );                }                else {					responseData.data.row.popMail = popMail;					 UI.previewMessageInNewWindow(responseData.data.row, isModal);                }                UI.updateNewStatus(rowIndex, 'off');              }              else {                //Server Error              }            }          });        }        //Cache-Hit        else {          statusBar.clearStatus();		  fromCache.data.row.gridNumber = gridNumber;		  fromCache.data.row.nextItemNumber = row.data.nextItemNumber;		  fromCache.data.row.prevItemNumber = row.data.prevItemNumber;		  fromCache.data.row.itemNumber = row.data.itemNumber;          if(tabType === "tab") {            //mailCenter.remove(curTab);            UI.previewMessageInTab(fromCache.data.row, row.data, generatedId, popMail);            if(Ext.getCmp('mail-preview-panel').collapsed == false)                UI.previewMessage(fromCache.data.row, popMail /* popMail */);          }          else {			fromCache.data.row.popMail = popMail;            UI.previewMessageInNewWindow(fromCache.data.row, isModal);          }        }        UI.updateNewStatus(rowIndex, 'off');      },	  convertToTask : function(data){		 		 var callback = function(resp, nodeInfo){			 Eve.Resource.superbridge.broadcast( this, 'task_create_item_dlg',{mode:'create',info: nodeInfo, taskBody:resp.row.body, taskSubject: resp.row.subject});		 }		 var fromCache = Caches.mailItemCache.getFromCache(data.id);		  if(fromCache == false){			   var requestParams = {};          var selCurFolderId = 0;          if (data['parentId'] !== undefined)          	selCurFolderId = data['parentId'];			  if(data.fromSearchGrid) { requestParams.gridNumber = 2; }			  requestParams.event = ServiceEvents.singleView;			  requestParams.startItemNumber = data.itemNumber;			  requestParams.selectedIds = processId(data.id);			  requestParams.selectedCurFolderIds = processId(selCurFolderId);			  requestParams.Id = processId(data.id);			  Ext.Ajax.request({				url: Eve.url,				params: requestParams,				success: function(response) {					  var dq = Ext.DomQuery;					  var responseData = xml2json(response.responseXML, '');					  responseData.data.row.body = UI.defaultBodyStyle + filters.mail(dq.selectValue('body', response.responseXML));					  responseData.data.row.to = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.to));					  responseData.data.row.cc = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.cc));					  responseData.data.row.from = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.from));					  responseData.data.row.subject = filters.mail(responseData.data.row.subject);					  if(responseData.code == "0") {						Caches.mailItemCache.putInCache(data.id, responseData);						Eve.Resource.superbridge.broadcast(this, 'proxy_dialog',{type: 'task', func:callback.createDelegate(this, [responseData.data, data.nodeInfo])})					  }				}				,scope: this			  });		  }		  else{			  callback(fromCache.data, data.nodeInfo);		  }			  	  },      nextPreHdl: function(obj/*grid, data, fromSearchGrid, tabType , popMail, isModal, curTab, mode*/){        statusBar.showBusy("Opening mail, please wait...");          var requestParams = {};		  if(obj.popMail === true)			  requestParams.gridNumber = 0;		  else			requestParams.gridNumber =obj.gridNumber;		  requestParams.event = (obj.popMail === true)? ServiceEvents.singleChangeStartItemNumber_POP : ServiceEvents.singleChangeStartItemNumber;          requestParams.startItemNumber = (obj.mode == 'next') ? obj.data.nextItemNumber : obj.data.prevItemNumber;          Ext.Ajax.request({            url: Eve.url,            params: requestParams,            success: function(response) {              statusBar.clearStatus();              var responseData = xml2json(response.responseXML, '');              if(!responseData.data.row)                return;              responseData.data.row.body = UI.defaultBodyStyle + filters.mail(Ext.DomQuery.selectValue('body', response.responseXML));              responseData.data.row.to = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.to));              responseData.data.row.cc = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.cc));              responseData.data.row.from = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.from));              responseData.data.row.subject = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.subject));              responseData.data.row.gridNumber = requestParams.gridNumber;              if(responseData.code == "0") {                                 if(obj.popMail === true) {                  var popAccountId = popAccounts.getSelectionModel().getSelectedNode().id;                }                     var generatedId = (obj.popMail === true)? popAccountId + "_" + (responseData.data.row.id.split("_"[1])): responseData.data.row.id;                if(obj.tabType === "tab") {                  mailCenter.remove(obj.curTab);                  //TO DO                  UI.previewMessageInTab(responseData.data.row, obj.data, generatedId, obj.popMail);                                    if( Ext.getCmp('mail-preview-panel').collapsed == false )                    UI.previewMessage(responseData.data.row, obj.popMail );                }                else {					responseData.data.row.popMail = obj.popMail;					UI.previewMessageInNewWindow(responseData.data.row, obj.isModal);                }                var store = obj.grid.getStore();                var rec = store.getById(generatedId);                if( responseData.data.row.isNew == "1"){                  if(rec){                    rec.set('new',"0");                    store.commitChanges();                    obj.grid.getView().refresh();                  }                    State.updateCountOfNew(1, "0");                }                responseData.data.row.isNew = "0";                Caches.mailItemCache.putInCache(generatedId, responseData);                                mailGridPanel.getSelectionModel().selectRow(responseData.data.row.itemNumber - 1);                }            }          });      },      preview: function(grid, rowIndex, type) {        switch(type) {          case "normal":          default:            //Prevent a server request for preview pane if it is in collapsed mode            if( State.isPreviewPaneCollapsed() ) {              return;            }            //var data = {};            var row = grid.getStore().getAt(rowIndex);            var gridData = row.data;            var fromCache = Caches.mailItemCache.getFromCache(gridData.id);            if(fromCache === false) {              previewPanelMask = new Ext.LoadMask(mailPreviewPanel.getEl(), { msg: "Getting mail preview, please wait..." });              previewPanelMask.show();              Ext.Ajax.request({                url: Eve.url,                params: {                  event: ServiceEvents.singleView,                  startItemNumber: gridData.itemNumber,                  selectedIds: processId(gridData.id),          		  selectedCurFolderIds: (gridData.parentId === undefined) ? 0 : processId(gridData.parentId),                  id: processId(gridData.id)                },                success: function(response, options) {                  previewPanelMask.hide();				  var dq = Ext.DomQuery;                  var responseData = xml2json(response.responseXML, '');                  responseData.data.row.body = UI.defaultBodyStyle + filters.mail(dq.selectValue('body', response.responseXML));                  responseData.data.row.to = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.to));                  responseData.data.row.cc = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.cc));                  responseData.data.row.from = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.from));                  responseData.data.row.subject = filters.mail(responseData.data.row.subject);                  if(responseData.code == "0") {                    Caches.mailItemCache.putInCache(gridData.id, responseData);                    var gridItemIndex = [options.params.startItemNumber-1];                    UI.previewMessage(responseData.data.row, false /* popMail */);                    UI.updateNewStatus(rowIndex, 'off');                  }                  else {                    //Server Error                  }                }              });            }            else {              UI.previewMessage(fromCache.data.row, false /* popMail */);              UI.updateNewStatus(rowIndex, 'off');            }            break;          case "pop":            //Prevent a server request for preview pane if it is in collapsed mode            if( State.isPOPPreviewPaneCollapsed() ) {              return;            }            //var data = {};            var row = grid.getStore().getAt(rowIndex);            var gridData = row.data;            var fromCache = Caches.popMailItemCache.getFromCache(gridData.id);            if(fromCache === false) {              popPreviewPanelMask = new Ext.LoadMask(popMailPreviewPanel.getEl(), { msg: "Getting mail preview, please wait..." });              popPreviewPanelMask.show();              Ext.Ajax.request({                url: Eve.url,                params: {                  event: ServiceEvents.singleView_POP,                  //startItemNumber: rowIndex + 1                  startItemNumber: rowIndex + 1,                  selectedIds: processId(gridData.id)                },                success: function(response, options) {                  popPreviewPanelMask.hide();                  var responseData = xml2json(response.responseXML, '');                  responseData.data.row.body = UI.defaultBodyStyle + filters.mail(Ext.DomQuery.selectValue('body', response.responseXML));                  responseData.data.row.to = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.to));                  responseData.data.row.cc = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.cc));                  responseData.data.row.from = Ext.util.Format.htmlEncode(filters.mail(responseData.data.row.from));                  responseData.data.row.subject = filters.mail(responseData.data.row.subject);                  if(responseData.code == "0") {                    Caches.popMailItemCache.putInCache(gridData.id, responseData);                    var gridItemIndex = [options.params.startItemNumber-1];                    UI.previewMessage(responseData.data.row, true /* popMail */);                    //UI.updateNewStatus(rowIndex, 'off');                  }                  else {                    //Server Error                  }                }              });            }            else {              UI.previewMessage(fromCache.data.row, true /* popMail */);              //UI.updateNewStatus(rowIndex, 'off');            }            break;        }      },      spamSelectedMessages: function(grid) {        console.log("spam selected messages");        var spamFolder = State.getSpamFolderInfo();        var grid = grid || Ext.getCmp("mail_grid");        var selection = getSelectedMessageIds(grid);	      var selectionCurFolderIds = getSelectedMessageCurFolderIds(grid);	      if(selection.length === 0) {          dialogs.nothingSelected();          return;        }	      selection.push('-1');	      selectionCurFolderIds.push('-1');        var selectedRows = getSelectedMessages();        var unreadCount = State.countUnread(selectedRows);        statusBar.showBusy("Marking selected messages as spam, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.move,            selectedIds: selection.join(','),	          selectedCurFolderIds: selectionCurFolderIds.join(','),            id: processId(spamFolder.id),            path: spamFolder.path,            title: spamFolder.title          },          success: function(response, options) {            statusBar.clearStatus();            var spamFolderId = processId(State.getSpamFolderInfo().id);            Caches.mailItemCache.removeFromCache( selection, "MPI_" );            Requests.reloadMailboxGrid();            State.transferUnreadCount(              State.getCurrentSelectedFolderId() /* source folder id */,              spamFolderId /* destination folder id */,              unreadCount            );          },          failure: function(response, options) {            statusBar.clearStatus();          }        });      },      spamMessage: function(messageId, gridNumber) {        var grid;	        statusBar.showBusy("Moving message to spam, please wait...");        var unreadCount = State.countUnread([mailGridPanel.getStore().getById(messageId)]);		var selCurFolderId = 0;				if(gridNumber != "0"){			if(gridNumber == "2" || gridNumber == "3")				grid = Ext.getCmp('mail-search-grid');			else if (gridNumber == '1')				grid = mailGridPanel;			var recc = grid.getStore().getById(messageId);			if (recc !== undefined && recc.data['parentId'] !== undefined)				selCurFolderId = recc.data['parentId'];		}        var spamFolder = State.getSpamFolderInfo();        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.move,            selectedIds: processId(messageId),          	selectedCurFolderIds: processId(selCurFolderId),            id: processId(spamFolder.id),            path: spamFolder.path,            title: spamFolder.title,            singleView: true,			gridNumber: gridNumber          },          success: function(response, options) {            statusBar.clearStatus();            var responseData = xml2json(response.responseXML);            var data = responseData.data;                         var spamFolderId = processId(State.getSpamFolderInfo().id);            Caches.mailItemCache.removeFromCache(messageId);                        var curTab = Ext.getCmp('mailbox-panel-' + messageId);             mailCenter.remove(curTab);            Requests.reloadMailboxGrid();            if(Ext.getCmp('mail-search-grid')){              var st = Ext.getCmp('mail-search-grid').store;              if(st.lastOptions)                st.reload();            }            State.transferUnreadCount(              State.getCurrentSelectedFolderId() /* source folder id */,              spamFolderId /* destination folder id */,              unreadCount            );                        if(!data.row)                return;            var generatedId = data.row.id;	    data.row.gridNumber = gridNumber;            Helpers.tabPreview(responseData, generatedId, false);          },          failure: function(response, options) {            statusBar.clearStatus();          }        });      },      unspamMessage: function(messageId, gridNumber) {		var grid;        statusBar.showBusy("Removing message from spam, please wait...");		var selCurFolderId = 0;		if(gridNumber != "0"){			if(gridNumber == "2" || gridNumber == "3")				grid = Ext.getCmp('mail-search-grid');			else if (gridNumber == '1')				grid = mailGridPanel;			var recc = grid.getStore().getById(messageId);			if (recc !== undefined && recc.data['parentId'] !== undefined)				selCurFolderId = recc.data['parentId'];		}        var inboxFolder = State.getInboxFolderInfo();        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.move,            selectedIds: processId(messageId),          	selectedCurFolderIds: processId(selCurFolderId),            id: processId(inboxFolder.id),            path: inboxFolder.path,            title: inboxFolder.title,            singleView: true,			gridNumber: gridNumber          },          success: function(response, options) {            statusBar.clearStatus();            Caches.mailItemCache.removeFromCache(messageId);             var curTab = Ext.getCmp('mailbox-panel-' + messageId);             var responseData = xml2json(response.responseXML);             var data = responseData.data;                           mailCenter.remove(curTab);             Requests.reloadMailboxGrid();                        if(Ext.getCmp('mail-search-grid')){              var st = Ext.getCmp('mail-search-grid').store;              if(st.lastOptions)                st.reload();            }                        if(!data.row)                return;            var generatedId = data.row.id;			data.row.girdNumber = gridNumber;            Helpers.tabPreview(responseData, generatedId, false);          },          failure: function(response, options) {            statusBar.clearStatus();          }        });      },            loadFullHeader: function(id){        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.showHeader,            id: id          },          success: function(response, options) {            UI.openFullHeader(response.responseXML, id);          },          failure: function(response, options) {            console.log('Failed');          }        });      }    },    MailCompose: {      send: function(mask, that, mailFields, ilParams) {        var attachmentList = (function() {          var tempAttachmentList = [];                    for(var i=0, len=mailFields.attachments.getCount(); i<len; i++) {            tempAttachmentList.push(mailFields.attachments.itemAt(i).name);          }          return tempAttachmentList.join("|");        })();        //Stripping out the extra "," and/or ";" from the end of the list of contacts        var toList = mailFields.to.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');        var ccList = (typeof mailFields.cc === "undefined")? "": mailFields.cc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');        var bccList = (typeof mailFields.bcc === "undefined")? "": mailFields.bcc.replace(/,[ \s\t\n\f\r]*$/, '').replace(/;[ \s\t\n\f\r]*$/,'');        var requestParams = {          event: ServiceEvents.sendMail,          from: mailFields.from,          id: mailFields.id,          cc: ccList,          to: toList,          bcc: bccList,          subject: mailFields.subject,          body: mailFields.body,          attachments: attachmentList,          isHTML: mailFields.isHTML,          save_copy: mailFields.save_copy,          delete_after_send: mailFields.delete_after_send,          type: (mailFields.type == 'newWin') ? 'new' : mailFields.type         };               if( composeMode == 'interlink' )          requestParams.forwardURL = ilParam.forwardURL;                  if(typeof mailFields.draftId !== "undefined") {          requestParams.draftId = mailFields.draftId;        }        if(requestParams.save_copy === 0) {          delete requestParams.save_copy;        }        if(requestParams.delete_after_send === 0) {          delete requestParams.delete_after_send;        }        Ext.Ajax.request({          url: Eve.url,          params: requestParams,          success: function(response, options) {            that.dirty = false;            that.forceRemove = true;			that.windowClose = true;                      if( that.ownerCt.getXType() == "window")            that.ownerCt.close();          else            mailCenter.remove(that);            if( composeMode == 'interlink'){              var section = Eve.Resource.getSecInfoByTypeId(ilParams.info.typeId).section;              Eve.Resource.superbridge.broadcast(this, section+'_reload_interlink_grid', {});              composeMode = "";            }            mask.hide();            var reader	= new Ext.data.XmlReader({						record	: 'row'            }, ['email', 'type']);                        var data = reader.readRecords( response.responseXML ).records;            var records = [];                      	var hasFailed = false;            for(var i =0; i<data.length; i++){              var item = [];              item.push(data[i].get('email'));              item.push(data[i].get('type'));              records.push(item);              if (data[i].get('type') == 'failedSends')              	hasFailed = true;            }            if(Eve.Preference.getBoolean('confirm') == true || hasFailed){                          if(data.length !=0) {              var contactDV = new Ext.DataView ({									 hideLabel			: true									,itemSelector		: 'tr.x-doc-select'									,overClass      : 'x-doc-over'									,multiSelect    : true									,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>Nothing.</i></div>'									,selectedClass  : 'x-doc-selected'                  ,store          : new Ext.data.SimpleStore({                  	fields : ['email', 'type'],                  	data : records                    })					,tpl	: new Ext.XTemplate(					'<div class="x-form-item">',                    '<table width=100% cellspacing=0 cellpadding=0 >',					'<tpl for=".">',                    '<tr style="font-size:8pt" class="x-doc-select">',					'<td style="padding:3px">{email}&nbsp;{[this.getMsg(values.type)]}</td>',                      //'<td>{[this.getMsg(values.type)]}</td>',					'<td style=" class="add-contact">',                        '<tpl if="this.isFail(values.type) == false">',                        '<a href="#" title="add to contact" class="add-contact" style="margin-left:16px;">',                        '<img class="add-contact" src="'+Eve.Resource.getIcon('add-to-contact', 'mail')+'"  width=16 height=19>',                        '</a>',                        '</tpl>',                      '</td>',                       '</tr>',					'</div>',					'</tpl>',                    '</table>',					'</div>',                    {                    isFail: function(type)                    {                        if(type == 'failedSends' || !Eve.Preference.getBoolean('MyContacts'))                          return true;                        return false;                                              }                                        ,getMsg: function(type)                    {                      switch (type){                                              case 'otherCC':                            return 'has been CC\'d ';                                                    case 'otherBCC':                            return 'has been BCC\'d ';                                                  case 'otherTO':                            return 'has been sent';                                                   case 'directSends':                             return 'has been instantly sent';                                                  case 'failedSends':                              return 'couldn\'t be deliverd';                                                                  }                    }                    })                                        ,listeners:{                      render: function(){                        contactDV.el.on('click', function(e, item){                          var rec = contactDV.getRecord( Ext.get(item).up(contactDV.itemSelector).dom );                          if( Ext.get(item).dom.className.split(' ')[0] == 'add-contact' ){                                var mailAdd = "";                                 var fName = "";                                var lName = "";                                var fullName ="";                                var mailIndex = -1;                                var fr = rec.get('email').trim() ;                                fr = fr.replace("<", " " ).replace(">", "  " ).replace("&gt;", " " ).replace("&lt;", " " ).replace("&quot;", " " ).replace('"', " " );                                var fromAr = fr.match(/[ ]*(((.*?)[ ]+)?(.*?)[ ]+)?(.*)/i);                                if(fromAr[5].indexOf("@") != -1 )                                  mailIndex =  5 ;                                                                       if( mailIndex>= 0)                                  mailAdd = fromAr[mailIndex].trim();                                for (var i = 3; i< mailIndex; i++)                                {                                    if(i == 3){                                      if(fromAr[i])                                        fName = fromAr[i].trim();                                    }                                    else if(i == 4){                                      if(fromAr[i])                                        lName = fromAr[i].trim();                                    }                                }                                          fullName = fName + " " + lName;                                                                                 					  var func = function(){                                    var data = {                                      mode        :'create',                                      mail        : mailAdd,                                      fName       : fName,                                      lName       : lName,                                      fullName    : fullName,                                      isFromMail  : true,                                      info    : {id:0,parentId: 0, path: '\\',root:'personal'}                                    };                                    Eve.Resource.superbridge.broadcast( window, 'contact_create_from_mail_dlg', data)                                };                    						Eve.Resource.superbridge.broadcast (window, 'proxy_dialog', { type:'contact', func:func } );                                                                        }                          });                                                                  }                    }              });                		var win = new Ext.Window({          			title		: ' Sent Message Confirmation'          			,resizable	: false          			,width	: 400                 ,modal  :true          			,items	: [{                  layout: 'form'                  ,frame: true                  ,items:[new Eve.FormPanel({          				layout	    : 'form'          				,height	    :120                  ,autoScroll : true                  ,style  :'background-color:#fff; padding:3px;border:1px solid'          				,border	: false          				,items	: [ contactDV ]                  })                  ]}                  ]});                  win.show();              }            }                         if(Ext.getCmp('mail_grid'))              Requests.reloadMailboxGrid();                        if(Ext.getCmp('mail-search-grid')){              var st = Ext.getCmp('mail-search-grid').store;              if(st.lastOptions)                st.reload();            }          }		  ,failure: function(){			that.dirty = false;			that.forceRemove = true;			that.windowClose = true;			mask.hide();		  }        });      },      detachFile: function(fileName, composeMailForm, uniqueId) {        statusBar.showBusy("Removing file, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.detachFile,            fileName: fileName          },          success: function(response, options) {            try{              statusBar.clearStatus();              }catch(e){/*it means the statusBar has'nt  been created yet- usage in desktop*/}            var data = xml2json(response.responseXML).data;            composeMailForm.attachedFileNames.remove(fileName);            composeMailForm.attachments.removeKey(fileName);            //fileNamesField.setValue(composeMailForm.attachedFileNames.join(" - "));            var string = "file_row_" + data.fileName;            Ext.get(string).remove();		var cmp = Ext.get('frm_compose_'+uniqueId);		var attachContainer = Ext.get('file-list-table' + uniqueId  ).dom;		var len = attachContainer.getElementsByTagName('tr').length;		if(len < 4 ){			console.log("Heigth>>>>", cmp.getSize().height - 20);			cmp.setHeight(cmp.getSize().height - 20);		}		composeMailForm.doLayout();          }        });      },      loadContactWin : function(groupId){          UI.contactPanel.getForm().load({              url: Eve.url,              params:{                  event: ServiceEvents.getPersonalContact              },              success: function(){                  Requests.MailCompose.getUserContact(UI.addContacts);              },              scope: this          });      },            getUserContact: function(handlerFn, groupId, folderId){            Ext.Ajax.request({            url: Eve.url,            params: {              event   : (groupId === undefined || groupId == '0' )? ServiceEvents.getPersonalContact: ServiceEvents.getGroupContact,              groupId : groupId || 0,              folderId: folderId || 0,              usernameOnly: true            },            success: handlerFn          });      },          getCatList: function(groupId){          Ext.Ajax.request({            url: Eve.url,            params: {              event   : ( groupId == '0' )? ServiceEvents.getPersonalContact: ServiceEvents.getGroupContact,              groupId : groupId            },            success: function(response, options) {              var catNodes = Ext.DomQuery.select('folderId', response.responseXML);              var store = UI.cmbContactFolder.store;              store.removeAll();              store.add( store.reader.readRecords(catNodes).records );              var selected = Ext.DomQuery.selectValue( 'selectedValue', catNodes[0], '' );              UI.cmbContactFolder.setValue( selected );              Requests.MailCompose.getUserContact(UI.addContacts, groupId, selected);            }            });            },            getAllContacts: function(successFn){           Ext.Ajax.request({            url: Eve.url,            params: {              event   : ServiceEvents.getAllContacts            },            success: successFn          });           }        },    MailFolder: {      remove: function(confirmButtonId) {        var confirmButtonId = confirmButtonId || null;        //If user answers NO to the deletion operation        if(confirmButtonId === "no") {          return;        }        var node = mailFolders.rightClickedNode;        statusBar.showBusy("Deleting folder, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.deleteMailFolder,            id: processId(node.id)          },          success: function(response, options) {            State.mailFolderTree_Dirty = true;            State.mailFolderFullTree_Dirty = true;            statusBar.clearStatus();            if( node.parentNode.id == 'MPF_-1'){              node.parentNode.firstChild.select();              Requests.loadMailboxGrid(node.parentNode.firstChild.id.split("_")[1]);            }            else               mailFolders.fireEvent('click',node.parentNode);               node.remove();            var items = [];            for(var i=0; i<mailCenter.items.items.length; i++){                if( mailCenter.items.items[i].parentId == node.id )                  items.push(mailCenter.items.items[i].id);                            }            for( var i=0; i<items.length; i++){                                var tempEl = Ext.getCmp(items[i]);                  mailCenter.remove(tempEl);                  Caches.mailItemCache.removeFromCache(items[i].split("-")[2]);            }          }        });      },      purgeMessages: function(confirmButtonId) {        var confirmButtonId = confirmButtonId || null;        //If user answers NO to the deletion operation        if(confirmButtonId === "no") {          return;        }        var node = mailFolders.rightClickedNode;        statusBar.showBusy("Deleting all folder messages, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.purgeMailFolder,            id: processId(node.id)          },          success: function(response, options) {            statusBar.clearStatus();            Requests.reloadMailboxGrid();            //to refresh the number of emails on  tree node            var node = mailFolders.getSelectionModel().getSelectedNode();            node.attributes.unread = 0            UI.updateTreeUnreadCount(mailFolders.root);          }        });      },      rename: function(node, newName) {        statusBar.showBusy("Renaming folder, please wait...");        var oldText = node.attributes.title;        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.editMailFolder,            id: processId(node.id),            parentId: processId(node.parentNode.id),            title: newName //New Name          },          success: function(response, options) {            State.mailFolderTree_Dirty = true;            State.mailFolderFullTree_Dirty = true;            statusBar.clearStatus();            var data = xml2json(response.responseXML);            if(data.code === "0") {				var tempText = newName;				var tempCount = node.attributes.unread;				if(tempCount > 0) {				  tempText += " <span style='color: blue;'>(" + tempCount + ")</span>";				}				node.attributes.text = tempText;				node.attributes.title = newName;				node.setText(tempText);				UI.updateGeneralTabTitle();            }            else {              Ext.tools.msg("Failed", "There was a problem renaming the folder", 3);            }          },          failure: function() {            statusBar.clearStatus();            node.attributes.text = oldText;            node.attributes.title = oldText;            node.attributes.title = oldText;            node.setText(oldText);          }        });      },      properties: function(node) {        statusBar.showBusy("Loading folder properties, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.mailFolderProperties,            id: processId(node.id)          },          success: function(response, options) {            statusBar.clearStatus();            UI.mailFolderProperties(node, xml2json(response.responseXML).data);          }        });      },      create: function(nodeId, folderName) {        statusBar.showBusy("Creating new folder, please wait...");        var node = mailFolders.getNodeById("MPF_" + nodeId);        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.editMailFolder,            title: folderName,            parentId: nodeId          },          success: function(response, options) {			State.mailFolderTree_Dirty = true;			State.mailFolderFullTree_Dirty = true;            var resp = xml2json(response.responseXML);                          if(node) {              var newNode = new Ext.tree.TreeNode({                id: resp.data.id,                text: folderName,                leaf: true,                cls: 'mail-tree-user-folder-node',                loader: mailFolders_TreeLoader,                per: {                  Select: true,                  New: true,                  Edit: true,                  Delete: true                },                system: "",                //path: node.attributes.path + "/" + folderName,                path: "",                title: folderName              });              var isInsert = false;                            node.eachChild(function(childNode){                if(isInsert)                  return;                if(childNode.attributes.system.length > 0)                  return;                if(newNode.attributes.text.toLowerCase() < childNode.attributes.text.toLowerCase()){										node.insertBefore(newNode, childNode);                    isInsert = true;                }                },this);                            if(!isInsert)                node.appendChild(newNode);              newNode.attributes.unread = 0;              node.leaf = false;              newNode.getUI().show();              node.expand();            }            statusBar.clearStatus();              },          failure: function() {            statusBar.clearStatus();          }        });      },      move: function(targetNodeId, destinationNodeId) {        statusBar.showBusy("Moving folder, please wait...");        var targetNode = mailFolders.getNodeById(targetNodeId);        var previouseParent = targetNode.parentNode;        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.editMailFolder,            id: processId(targetNodeId),            parentId: processId(destinationNodeId),            title: targetNode.attributes.title          },          success: function(response, options) {            State.mailFolderTree_Dirty = true;            State.mailFolderFullTree_Dirty = true;            statusBar.clearStatus();            var data = xml2json(response.responseXML);							            /*  var attr	= {};              attr.id		= targetNode.id;							attr.text	= targetNode.text;							// If Target node is colapsed on tree...							if (mailFolders.getNodeById(attr.id) === undefined) {								attr.leaf	= false;							}							else {								attr.leaf = mailFolders.getNodeById(attr.id).isLeaf();							}								// TODO: change this								attr.per = {									Select	: true									,New	: true									,Edit	: true									,Delete	: true								}							attr.cls = 'mail-tree-user-folder-node';              targetNode.parentNode.removeChild(targetNode);							// Bingo, add the node to the tree.               var destinationNode = mailFolders.getNodeById(destinationNodeId);               destinationNode.expand();							destinationNode.appendChild(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr));							destinationNode.leaf = false;							// Update the target UI.							destinationNode.getUI().updateExpandIcon();                            */                                                      if(data.code === "0") {							/* Commented By Majid              //Cloning targetNode before removing it from it's previous parent              var newNode = new Ext.tree.AsyncTreeNode({                id: targetNode.id,                text: targetNode.text,                leaf: targetNode.isLeaf(),                cls: 'mail-tree-user-folder-node',                loader: mailFolders_TreeLoader,                per: {                  Select: true,                  New: true,                  Edit: true,                  Delete: true                },                system: "",                path: "",                title: targetNode.attributes.title              });              previouseParent.removeChild(targetNode);              var destinationNode = mailFolders.getNodeById(destinationNodeId);              if(typeof destinationNode !== "undefined") {                destinationNode.appendChild(newNode);                destinationNode.leaf = false;                newNode.getUI().show();                destinationNode.expand();              }							*/// changed by majid							if (targetNode)								targetNode.remove();              var destinationNode = mailFolders.getNodeById(destinationNodeId);              if(typeof destinationNode !== "undefined") {								if (!destinationNode.reload){									var attr = destinationNode.attributes;									var parent = destinationNode.parentNode;									var n = new Ext.tree.AsyncTreeNode(attr);									n.leaf = false;									n.id = destinationNode.id;									var next = destinationNode.nextSibling;									destinationNode.remove();									if(next){										parent.insertBefore(n, next);									}									else{										if(parent.hasChildNodes()){											parent.appendChild(n);										}										else{											parent.appendChild(n);											parent.expand();										}									}									parent.getUI().updateExpandIcon();									n.expand();								}									else{									destinationNode.reload();								}                if(targetNode){                                   var selectTargetNode = function(){          			    if ( mailFolders.getNodeById(targetNode.id) ){                      var target = mailFolders.getNodeById(targetNode.id);                      mailFolders.fireEvent('click',target);          			    }else{          				    setTimeout( selectTargetNode, 100 );          			    }                      };			                  selectTargetNode();                                                                      }  							}            }            else {              Ext.tools.msg("Failed", "There was a problem moving the folder", 3);            }          },          failure: function() {            statusBar.clearStatus();          }        });      },      getFirstLevelTree: function(handler) {        if(State.mailFolderTree_Dirty === true) {          statusBar.showBusy("Loading folder details, please wait...");                              Ext.Ajax.request({            url: Eve.url,            params: {              event : ServiceEvents.getTreeNodeChildren,              Id    : -1            },            success: function(response, options) {              statusBar.clearStatus();             // var resp = xml2json(response.responseXML);              var treeInfo = mailFolders.loader.reader.readRecords(response.responseXML).records;              State.mailFolderTree_Fill(treeInfo);              handler();            }          });        }        else {          handler();        }      },	  	  getFullTree: function(handler){		  statusBar.showBusy("Loading folder details, please wait...");          Ext.Ajax.request({            url: Eve.url,            params: {              event : ServiceEvents.getFullTree            },            success: function(response, options) {              statusBar.clearStatus();              var treeInfo = mailFolders.loader.reader.readRecords(response.responseXML).records;              State.mailFolderFullTree_Fill(treeInfo);			  handler();            }          });	 }	      },    Search: {      mail: function(fields, options) {        var requestParams = {};		if(options.gridNumber == "3"){			requestParams.userNames = fields.userNames;			requestParams.allUsers = fields.allUsers;		}		        requestParams.from = fields.from;        requestParams.toCC = fields.toCC;        requestParams.subject = fields.subject;        requestParams.startDate = fields.startDate;        requestParams.endDate = fields.endDate;        requestParams["new"] = fields.newMessage;        requestParams.flagged = fields.flagged;        requestParams.folderId = fields.folderId;        requestParams.forceSelect = true;        requestParams.event = ServiceEvents.modifyFilter;        requestParams.start = options.start;        requestParams.limit = options.limit;        //requestParams.gridNumber = options.gridNumber;        dataStores.searchMailGridStore.load({          params: requestParams,          callback: function(r, options, success){            if(success){              var visibleCol = Ext.DomQuery.selectValue('displaymode',dataStores.searchMailGridStore.reader.xmlData, 'from/to');              var cm = Ext.getCmp('mail-search-grid').getColumnModel();              var index1 = cm.getIndexById('from-to');              var index2 = cm.getIndexById('from');              var index3 = cm.getIndexById('to');              switch(visibleCol){                case 'from':                  cm.setHidden(index1,true);                  cm.setHidden(index2,false);                  cm.setHidden(index3,true);                  break;                                  case 'to':                  cm.setHidden(index1,true);                  cm.setHidden(index2,true);                  cm.setHidden(index3,false);                  break;                                  case 'from/to':                  cm.setHidden(index1,false);                  cm.setHidden(index2,true);                  cm.setHidden(index3,true);                  break;                                          }            }          },          scope: this        });      },      loadForm: function(gridNumber) {        statusBar.showBusy("Loading search, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.searchInitialize          },          success: function(response, options) {            statusBar.clearStatus();            var data = xml2json(response.responseXML);            var rows = data.data;            if(Ext.getCmp('mail-search-grid'))            var cm = Ext.getCmp('mail-search-grid').getColumnModel();            UI.searchMail({gridNumber: gridNumber, folders:rows.row});          }        });      }    },    POPAccount: {      create: function(params, currentModalWindow) {        statusBar.showBusy("Creating new POP account, please wait...");        params.event = ServiceEvents.createAccount_POP;        if(params.defaultFrom === 0) {          delete params.defaultFrom;        }        Ext.Ajax.request({          url: Eve.url,          params: params,          success: function(response, options) {            statusBar.clearStatus();            var resp = xml2json(response.responseXML);			var dq = Ext.DomQuery;            var newNode = new Ext.tree.TreeNode({              id: resp.data.id,              text: [dq.selectValue('username', response.responseXML), '[',dq.selectValue('servername', response.responseXML) ,']'].join(''),              cls: 'mail-tree-user-folder-node',              leaf: true            });			//Add to FromField store			var rec = Ext.data.Record.create(['value']);			UI.fromFieldComboStore.add(new rec( {value: filters.mail(resp.data.popEmailAddress)}));            popAccounts.root.appendChild(newNode);            popAccounts.root.expand();            currentModalWindow.close();            //that.dirty = false;            //mailCenter.remove(that);            //mask.hide();            //Ext.tools.msg("Success", "Your mail was saved in drafts.", 3);          }        });        //Ext.getCmp("new-pop-account-window");      },      remove: function(node) {        statusBar.showBusy("Deleting POP Account, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.deleteAccount_POP,            id: processId(node.id)          },          success: function(response, options) {            statusBar.clearStatus();            node.remove();          }        });      },      loadEdit: function(node) {        statusBar.showBusy("Loading edit POP Account, please wait...");        Ext.Ajax.request({          url: Eve.url,          params: {            event: ServiceEvents.editAccount_POP,            id: processId(node.id)          },          success: function(response, options) {            statusBar.clearStatus();            UI.editPOPAccount(node, xml2json(response.responseXML).data);          }        });      },      edit: function(node, params, currentModalWindow, oldEmailAddress) {		          statusBar.showBusy("Creating new POP account, please wait...");        params.event = ServiceEvents.createAccount_POP;        params.id = processId(node.id);        if(params.defaultFrom === 0) {          delete params.defaultFrom;        }        Ext.Ajax.request({          url: Eve.url,          params: params,          success: function(response, options) {            statusBar.clearStatus();            var resp = xml2json(response.responseXML);			var dq = Ext.DomQuery;            node.setText(dq.selectValue('username', response.responseXML) +"["+dq.selectValue('server', response.responseXML)+"]");            currentModalWindow.close();			//Edit FromField store			var index = UI.fromFieldComboStore.find('value', oldEmailAddress);			if(index != -1)				UI.fromFieldComboStore.getAt(index).set('value', filters.mail(options.params.POPEmailAddress));            //that.dirty = false;            //mailCenter.remove(that);            //mask.hide();            //Ext.tools.msg("Success", "Your mail was saved in drafts.", 3);          }        });        //Ext.getCmp("new-pop-account-window");      }    }  };  var Helpers = {    moveMenuFiller: function(params /*holderMenu, menuItemHandler, moreMenuItemHandler, nodeID, item*/) {      params.holderMenu.menu.removeAll();      params.holderMenu.menu.add({        text: 'Loading...',        icon: Eve.Resource.getIcon('loading','mail')      });      Requests.MailFolder.getFirstLevelTree(        function () {          params.holderMenu.menu.removeAll();          Helpers.moveMenuFillerRequestCompleteHandler(params/*holderMenu, menuItemHandler, moreMenuItemHandler, nodeID, item*/);        } /* handler */      );    },    tabPreview: function(responseData, generatedId, popMail){              var data = responseData.data;              data.row.body = UI.defaultBodyStyle + filters.mail(data.row.body);              data.row.to = Ext.util.Format.htmlEncode(filters.mail(data.row.to));              data.row.cc = Ext.util.Format.htmlEncode(filters.mail(data.row.cc));              data.row.from = Ext.util.Format.htmlEncode(filters.mail(data.row.from));              data.row.subject = filters.mail(responseData.data.row.subject);                if(popMail === true) {                  var popAccountId = popAccounts.getSelectionModel().getSelectedNode().id;                }                               var fromCache = Caches.mailItemCache.getFromCache(generatedId);                        if(fromCache){                    var panel = Ext.getCmp('mailbox-panel-' + generatedId);                    if(panel !== undefined) {                      statusBar.clearStatus();                      mailCenter.setActiveTab(panel);                      if(Ext.getCmp('mail-preview-panel').collapsed == false )                          UI.previewMessage(fromCache.data.row, popMail );                                  return;                    }                }                  UI.previewMessageInTab(data.row, {}, generatedId, popMail);                                    if(Ext.getCmp('mail-preview-panel').collapsed == false)                    UI.previewMessage(data.row, popMail );                var store = mailGridPanel.getStore();                var rec = store.getById(generatedId);                if( data.row.isNew == "1"){                  if(rec){                    rec.set('new',"0");                    store.commitChanges();                    mailGridPanel.getView().refresh();                  }                    State.updateCountOfNew(1, "0");                }                data.row.isNew = "0";                Caches.mailItemCache.putInCache(generatedId, responseData);            },        moveMenuFillerRequestCompleteHandler: function(params/*holderMenu, menuItemHandler, moreMenuItemHandler, nodeID, item*/) {      var treeInfo = State.mailFolderTree_Data;      var mailFolders_MenuItems = [];      var count = 0;       treeInfo.each(function(item) {        if(count > 16)          return;        if(item.depth === "1") {          this.push({            id: item.id,            text: item.title,            path: item.path,//path is required            title: item.title,            depth: item.depth,            icon: Helpers.getIcon(item.id),            handler: params.menuItemHandler          });          count++        }      }, mailFolders_MenuItems);      var items = mailFolders_MenuItems;      items.push(        '-',        {          text: 'Expanded Folder View ...',          handler: params.moreMenuItemHandler        }      );      //added by Ghazal      params.disableFolder = (params.disableFolder === undefined)? true : params.disableFolder;	  if( params.nodeID === undefined)        params.nodeID = processId(State.getCurrentSelectedFolderId()); 		  for(var i=0, len=items.length; i<len; i++) {			if(params.popMail != true){			  if(params.parentId !== undefined ){				if( params.disableFolder && params.parentId.split("_")[1] == items[i].id )				  items[i].disabled = true;			  }			  else if (params.disableFolder && items[i].id == params.nodeID/*processId(State.getCurrentSelectedFolderId())*/ ) {				items[i].disabled = true;			  }			}			params.holderMenu.menu.add(items[i]);		  }		if(params.gridData){			if(Eve.Preference.getBoolean('mytasks') || Eve.Preference.getBoolean('sharedtasks')){				params.holderMenu.menu.add('-',{				  text: 'Convert to Task',				  id: 'mailgrid_converttotask',				  icon: Eve.Resource.getIcon('new-project','task'),				  disabled: (mailGridPanel.getSelectionModel().getCount()>1)? true : false,				  cls: 'x-btn-text-icon',				  handler: function() {					params.gridData.convertToTask = Requests.Mail.convertToTask;					Eve.Resource.superbridge.broadcast(this, 'open_task_tree_dlg', params.gridData);										}				});			}		}	      },    getIcon: function(folderId) {      var node = mailFolders.getNodeById("MPF_" + folderId);      var nodeName = "";      var iconName = null;      if(typeof node !== "undefined") {        nodeName = node.attributes.system;      }      else {        return 'folder.gif';      }      switch(nodeName) {        case 'Trash':          iconName = Eve.Resource.getIcon('folder-trash','mail');          break;        case 'Inbox':          iconName = Eve.Resource.getIcon('folder-inbox','mail');          break;        case 'Drafts':          iconName = Eve.Resource.getIcon('folder-drafts','mail');          break;        case 'Sent Items':          iconName = Eve.Resource.getIcon('folder-sent-items','mail');          break;        case 'Spam':          iconName = Eve.Resource.getIcon('folder-spam','mail');          break;        case 'Quarantine':          iconName = Eve.Resource.getIcon('folder-quarantine','mail');          break;        default:          iconName = Eve.Resource.getIcon('folder','mail');          break;      }      return iconName;    },    getRightClickedRecords: function(grid, rowIndex) {      var selectionCount = grid.getSelectionModel().getCount();      var records = [];      if(selectionCount === 0) {        //If no rows selected, return the row which was right-clicked        records = [grid.getStore().getAt(rowIndex)];      }      else {        //Ignore the right-clicked node if multiple rows are selected        records = grid.getSelectionModel().getSelections();      }      //console.log("records: ", records);      return records;    }  };  var UI = {    defaultBodyStyle: "<style>body{font-family: tahoma; font-size: 12px;}</style>",    //To specify contact window was popped by what field    targetField : null,        fromStore : null,	fromFieldComboStore : new Ext.data.SimpleStore({			fields : ['value'],			data : []	  }),      contactsStore: null,        mailUpdater: null,        showedDialogs: [],//To prevent from opening more than one  [reply, compose, forward, replytoall] dialog	attachFiles: [],        updatePreviewDummy: function(type) {      switch(type) {        case "normal":        default:          var count = mailGridPanel.getSelectionModel().getCount();          var header = Ext.get("mail-preview-header");          var frm = Ext.get("mailBodyFrame");           //          if(frm === undefined || !frm){//            Ext.get('mail-preview-body').dom.innerHTML = '<iframe src="/hyperoffice2nd/views/Styles/ModernStyle/mail/blank.html" name="mailBodyFrame" id="mailBodyFrame" style="width: 100%; height: 100%; border: none;"></iframe>'//            frm = Ext.get("mailBodyFrame");//          }          break;        case "pop":          var count = popMailGridPanel.getSelectionModel().getCount();          var header = Ext.get("pop-mail-preview-header");          var frm = Ext.get("popMailBodyFrame");          break;      }      var headerHtml;      if (count === 0)        headerHtml = "click on a message in the above frame to view it.<br /><br /><br />"      else           headerHtml = count + " messages selected<br /><br /><br />";     try{		 header.dom.innerHTML = '<div style="text-align:center;padding-top:28px;">'+headerHtml+'</div>';		 if(type =="normal"){		  var headerPanel = Ext.getCmp('mail-previewpanel-header');		  headerPanel.setHeight('auto');		 }		  Ext.getCmp('mail-preview-panel').doLayout();		  Eve.MailHelper.setIFrameContent(frm.dom, "");	 }catch(e){}    },        openFullHeader: function(data, id){     var data = xml2json(data).data;     data.id = id;        var panel = {          html: Templates.fullHeaderTemplate.apply(data)          ,region: 'center'          ,autoScroll:true          ,bodyBorder:false          ,border:false        };                var fullHeaderWin = new Ext.Window({          layout: 'fit'			,modal		: true			,resizable	: false			,width    : 400            ,height   : 300			,items : [{                			layout 		: 'border'      			,border		: false				,width    : 400				,height   : 300      			,bodyBorder : false      			,autoScroll : false      			,closeAction: 'close'            ,constrainHeader: true      			,items 		: [panel,{              region:'south'              ,bodyStyle:'background-color:#F5F5F5; padding: 2px 5px; border-top: 1px solid #CCCCCC;'              ,bodyBorder: false              ,border:false              ,height:25              ,html:'<a href="'+Eve.url + '?event=mail.single.rawMessage&id='+data.id+'&CFID='+Eve.CFId+'&CFTOKEN='+Eve.CFToken+'">[Raw Message]</a>'              }]                    }]    			,y 			  : 100         });                  fullHeaderWin.show();             },        previewMessage: function(data, popMail) {	  data.previewType = 'panel';	  data.attachments = data.attachments || '';      State.buildAttachmentInfo(data);	  data.popMail = popMail;      var headerHtml = Templates.PremailHeaderTemplate.apply(data);      if(popMail === true) {        //[TODO] Unknown size returned from back-end. Resolve issue.        data.sizeText = "Unknown";        //Encapsulate the mail message body in an iframe to prevent CSS conflicts        //mailBodyFrame.document.body.innerHTML = data.body;        var mailBodyFrame = Ext.get("popMailBodyFrame");        var header = Ext.get("pop-mail-preview-header");      }      else {        data.sizeText = (data.size == "Unknown") ? data.size : Ext.util.Format.fileSize(data.size);        //Encapsulate the mail message body in an iframe to prevent CSS conflicts        //mailBodyFrame.document.body.innerHTML = data.body;        var mailBodyFrame = Ext.get("mailBodyFrame");        var header = Ext.get("mail-preview-header");        var headerPanel = Ext.getCmp('mail-previewpanel-header');               	headerPanel.on('resize', this.truncateFields);		headerPanel.setHeight('auto');               }      setTimeout(function() {		 Eve.BODY = data.body;         Eve.MailHelper.setIFrameContent(mailBodyFrame.dom, data.body);      }, 10);      header.dom.innerHTML = headerHtml;      State.currentPreviewItemId = data.id;      Ext.getCmp('mail-preview-panel').doLayout();     },    updateGeneralTabTitle: function() {      var count = mailGridPanel_DataStore.totalLength;      var countMessage = "";      if(count == 0) {        countMessage = "No Messages";      }      else {        if(count == 1) {          countMessage = "1 Message";        }        else {          countMessage = count + " Messages";        }      }      /*      if(typeof State.getCurrentSelectedFolderNode().attributes.originalText === "undefined") {        State.getCurrentSelectedFolderNode().attributes.originalText = State.getCurrentSelectedFolderNode().attributes.text;      }      */      var selectedNode = State.getCurrentSelectedFolderNode();      if(selectedNode !== null) {        var textToDisplay = Ext.util.Format.ellipsis(selectedNode.attributes.title, 20);        generalTab.setTitle( textToDisplay + " (" + countMessage + ")" );      }      //generalTab.correspondingTreeNode = State.getCurrentSelectedFolderNode();    },	truncateFields: function(e, t, o) {    	    	/** Commented by Syavash for now...		var subjectSelect = Ext.query('.subject-span');        for (var i = 0 ; i < subjectSelect.length; i++){            var el = Ext.get(subjectSelect[i]);            if (el) {				el.dom.innerHTML = Ext.util.Format.ellipsis(el.dom.getAttribute('title'), e.getSize().width/9);             }        }        **/        e.setHeight('auto');    },	previewMessageInTab: function(data, gridData, generatedId, popMail) {       statusBar.clearStatus();      //Plz, don't use gridData       //it seems it's not correct when it's called by nextPreHdl function	  data.previewType = 'tab';	  data.popMail = popMail;      data.sizeText = (data.size == "Unknown") ? data.size : Ext.util.Format.fileSize(data.size);      State.buildAttachmentInfo(data);      //var sendId = (popMail === true)? gridData.itemNumber: gridData.id;      var mailViewPanel_Body = {        region: 'center',        border: false,                html:          '<iframe src="/hyperoffice2nd/views/Styles/ModernStyle/mail/blank.html" name="mailBody_' +          generatedId +          '" id="mailBody_' +          generatedId +          '" style="width: 100%; height: 100%; border: none;"></iframe>'      };	      var headerHtml = Templates.PremailHeaderTemplate.apply(data);      var mailViewPanel_Header = {        region: 'north',		height: 'auto',        id: 'header_' + data.id,        border: false,        listeners: {        	resize: this.truncateFields        },        bodyStyle: 'background-color: #f5f5f5; border-bottom: 1px solid gray; font-family: arial; font-size: 12px;padding:5px;',        html: headerHtml      };      var isInSpam = (State.getSpamFolderInfo().id === data.parentId);      var spamButton = new Ext.Button({        text: isInSpam? 'Remove from Spam': 'Move to Spam',        pressed: isInSpam? true: false,        icon: isInSpam? Eve.Resource.getIcon('remove-from-spam','mail') : Eve.Resource.getIcon('move-to-spam','mail'),        cls: 'x-btn-text-icon',        disabled: (data.gridNumber == "3") ? true : false,        enableToggle: true,        handler: function() {          var text = spamButton.getText();          if(text === "Move to Spam") {            Requests.Mail.spamMessage(generatedId, data.gridNumber);          }          else {            Requests.Mail.unspamMessage(generatedId, data.gridNumber);          }        }      });      var loadMailFormHandler = (popMail === true)? Requests.loadPOPMailForm: Requests.loadMailForm;      //var processedSendId = (popMail === true)? sendId: processId(sendId);      var moveToolbarItem = new Ext.Toolbar.Button({        text: 'Move To',        icon: Eve.Resource.getIcon('move-to','mail'),        cls: 'x-btn-text-icon',        disabled: (data.gridNumber == "3") ? true : false,        menu: new Ext.menu.Menu({ items: [] })      });      moveToolbarItem.on('menushow', function(button, e) {        var params = {           holderMenu: moveToolbarItem          ,menuItemHandler: function(item) {Requests.moveSingleMessage(generatedId.split("_")[1], item, popMail,data.gridNumber); }          ,moreMenuItemHandler: function() { UI.openMoveMessagesFolder(generatedId.split("_")[1], popMail);}                  };        if(popMail === false){          var tempData =  Caches.mailItemCache.getFromCache(generatedId);          if(tempData)            params.parentId =tempData.data.row.parentId;                   }          else{          params.popMail = true;		}        Helpers.moveMenuFiller(params);      });      var object = {        grid:       mailGridPanel,        data: data,        tabType:    'tab',        popMail:    popMail,		gridNumber:  data.gridNumber      };      var nextButton = {          text: 'Next >',          disabled: (data.nextItemNumber == "0")? true : false,          handler: function(){            object.curTab = Ext.getCmp('mailbox-panel-' + generatedId);            object.mode = 'next';            Requests.Mail.nextPreHdl(object);          }      }      var previousButton = {        text: '< Previous',        disabled: (data.prevItemNumber == "0")? true: false,        handler: function(){            object.curTab = Ext.getCmp('mailbox-panel-' + generatedId);            object.mode = 'previous';            Requests.Mail.nextPreHdl(object);          }      };            var tempEl = Ext.getCmp('mailbox-panel-' + generatedId);       if(tempEl)          mailCenter.remove(tempEl);            var tab = new Ext.Panel({        dirty: false,        id: 'mailbox-panel-' + generatedId,        parentId: data.parentId,        closable: true,        title: Ext.util.Format.ellipsis(data.subject, 20),        tabTip: data.subject,        layoutOnTabChange	: true,        layout: 'border',        items: [          mailViewPanel_Header,          mailViewPanel_Body        ],        tbar: [          {            text: 'Delete',            icon: Eve.Resource.getIcon('folder-trash','mail'),            cls: 'x-btn-text-icon',            disabled: (data.gridNumber == "3") ? true : false,            handler: function() {                            if(popMail === false && State.isInTrashFolder(data.parentId) === true) {                dialogs.confirmDelete("Are you sure you want to delete this message?", function(confirmButtonId) {                  var confirmButtonId = confirmButtonId || null;                  //If user answers NO to the deletion operation                  if(confirmButtonId === "no") {                    return;                  }                  var id = generatedId;                                   Requests.deleteMessage(id, popMail, data.gridNumber);                });              }              else {               Requests.deleteMessage(generatedId, popMail, data.gridNumber);              }            }          },          '-',          {            text: 'Reply',            icon: Eve.Resource.getIcon('reply','mail'),            cls: 'x-btn-text-icon',            handler: function() {              loadMailFormHandler('reply', generatedId.split("_")[1], {gridNumber: data.gridNumber});            }          },          {            text: 'Reply to All',            icon:Eve.Resource.getIcon('reply-all','mail'),            cls: 'x-btn-text-icon',            handler: function() {              loadMailFormHandler('replytoall', generatedId.split("_")[1], {gridNumber: data.gridNumber});            }          },          {            text: 'Forward',            icon: Eve.Resource.getIcon('forward','mail'),            cls: 'x-btn-text-icon',            handler: function() {              loadMailFormHandler('forward', generatedId.split("_")[1], {gridNumber: data.gridNumber});            }          },          '-',          moveToolbarItem,          '-',          {            text: 'Print',            icon: Eve.Resource.getIcon('print', 'general'),            cls: 'x-btn-text-icon',            handler: function() {              UI.openPrintTab(data);            }          },            spamButton,          '-',          previousButton,          nextButton,          '->',          {            text: '',            icon:Eve.Resource.getIcon('pop-out','mail'),            cls: 'x-btn-text-icon',            tooltip: { title: '', text: 'Pop Out'},            handler: function() {              UI.previewMessageInNewWindow(data);            }          }                  ]      });      var mailBodyFrame = null;      var fillFrame = function() {        if(mailBodyFrame.dom.contentDocument === null) {          return;        }        else {          setTimeout(function(){Eve.MailHelper.setIFrameContent(mailBodyFrame.dom, data.body)},300);        }      };      var loadFrameContent = function() {        var iFrameName = "mailBody_" + generatedId;        mailBodyFrame = Ext.get(iFrameName);        //Make sure iframe is created, otherwise wait and try again        if(mailBodyFrame === null) {          setTimeout(loadFrameContent, 10);        }        else {          //After the iframe is created wait a while to make sure it's in the DOM and ready to be injected with markup          setTimeout(fillFrame, 10);        }         Ext.getCmp('mail-preview-panel').doLayout();      };      tab.on('show', loadFrameContent);      tab.on('beforedestroy', function() {        var iFrameName = "mailBody_" + generatedId;        //delete window[iFrameName];        document.getElementById(iFrameName).parentNode.removeChild( document.getElementById(iFrameName) );      });                mailCenter.add(tab);      mailCenter.setActiveTab(tab);      Ext.getCmp('mail-preview-panel').doLayout();            if (Ext.getCmp('header_' + data.id))      	Ext.getCmp('header_' + data.id).ownerCt.doLayout();    },    previewMessageInNewWindow: function(data, isModal, body/*when called from loadMail*/) {	 data.previewType = 'window';	 data.sizeText = (data.size == "Unknown") ? data.size : Ext.util.Format.fileSize(data.size);     State.buildAttachmentInfo(data);     var body = body || data.body;      //[TO DO ]      var mailHeader = Templates.PremailHeaderTemplate.apply(data);	  var mailHtml1, mailHtml2;      mailHtml1 =      '<html>' +        '<head>' +        '<style>' +        '.mail-header { background-color: #f5f5f5; border-bottom: 1px solid gray; font:11px tahoma,arial,helvetica,sans-serif; padding: 10px; }' ;        if(isModal !== true)        mailHtml1 += '.btn-visibility{display:none}';                mailHtml2 ='</style>' +        '</head>' +        '<body style="margin: 0px;"><div class="mail-header">' +          mailHeader +          '</div><div style="padding: 10px;height:100%;overflow:auto;">' +          body +          '</div>' +        '</body>' +      '</html>';            var mailHtml = mailHtml1+ mailHtml2;            var popoutHdl = function(){        var win = window.open("about:blank", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=800, height=500");        win.focus();        win.document.open();        mailHtml = mailHtml1 +'.btn-visibility{display:none}' +mailHtml2;        win.document.write(mailHtml);                 }            if( isModal == true){          var previewWin =  new Ext.Window({    			width 		: 690    			,modal		: true    			,layout 	: 'fit'    			,height 	: 500    			,y 			: 20    			,border		: false    			,resizable	: true    			,bodyBorder : false    			,autoScroll : true    			,closeAction: 'close'    			,items 		: {                    xtype: 'panel',                    html: mailHtml          },          tools:[          {             id			: 'restore',    				qtip		: "Popout",            handler : popoutHdl          }          ],    			title		: 'Mail'    		});    		previewWin.show();      }      else{          popoutHdl();      }    },        updateNewStatus: function(gridItemIndex, status) {      var status = status || 'off';      status = ( status=="on" )? "1": "0";      var changedCounter = 0;      //Convert to an array if a single row was selected      if(typeof gridItemIndex === "number") {        gridItemIndex = [gridItemIndex];      }      try{      for(var i=0, len=gridItemIndex.length; i<len; i++) {        if(mailGridPanel.getStore().data.items[gridItemIndex[i]].data['new'] !== status) {          mailGridPanel.getStore().data.items[gridItemIndex[i]].data['new'] = status;          changedCounter++;        }      }      }catch(e){};      mailGridPanel.getView().refresh();      State.updateCountOfNew(changedCounter, status);    },    updateFlagStatus: function(gridItemIndex, status) {      var status = status || 'off';      status = ( status=="on" )? "1": "0";      for(var i=0, len=gridItemIndex.length; i<len; i++) {        if(mailGridPanel.getStore().data.items[gridItemIndex[i]])          mailGridPanel.getStore().data.items[gridItemIndex[i]].data.isflagged = status;      }      mailGridPanel.getView().refresh();      mailGridPanel.store.commitChanges();    },    updateTreeUnreadCount: function(root) {      var tempText = "";            for(var i=0, len=root.childNodes.length; i<len; i++) {        var tempCount = root.childNodes[i].attributes.unread;        /*        if (!root.childNodes[i].attributes.originalText) {          root.childNodes[i].attributes.originalText = root.childNodes[i].attributes.text;        }        */        tempText = root.childNodes[i].attributes.title;        if(tempCount > 0) {          tempText += " <span style='color: blue;'>(" + tempCount + ")</span>";        }        root.childNodes[i].setText(tempText);        UI.updateTreeUnreadCount(root.childNodes[i]);      }    },    disableDeleteMark: function() {      deleteToolbarItem.disable();      markToolbarItem.disable();    },    enableDeleteMark: function() {      deleteToolbarItem.enable();      markToolbarItem.enable();    },    disableReplyForward: function() {      replyToolbarItem.disable();      replyAllToolbarItem.disable();      forwardToolbarItem.disable();    },    enableReplyForward: function() {      replyToolbarItem.enable();      replyAllToolbarItem.enable();      forwardToolbarItem.enable();    },    disableSpam: function() {      spamToolbarItem.disable();    },    enableSpam: function() {      spamToolbarItem.enable();    },    disableMove: function() {      moveToolbarItem.disable();    },    enableMove: function() {      moveToolbarItem.enable();    },    openPrintTab: function(data) {      var win = window.open("about:blank", "mail_print", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=500");      self.focus();      win.document.open();      win.document.write(Templates.printTemplate.apply(data));      win.document.close();      win.print();      //win.close();    },    openMoveMessagesFolder: function(rightClickedRowId,isPopMail, grid) {	  grid = grid || mailGridPanel;      var moveMsgs_TreeLoader = new Ext.tree.TreeLoader({          dataUrl: Eve.url,          section: 'mail',          baseParams: {            event: ServiceEvents.getTreeNodeChildren,            Id: -1          },          preloadChildren: true        });      moveMsgs_TreeLoader.on('beforeload', function(obj, node, callback) {        obj.baseParams.Id = processId(node.id);      });      var rootNode = new Ext.tree.AsyncTreeNode({        text: 'All',        id: 'MPF_-1',        cls: 'ev-hide',        draggable: false,        expanded: true,        per: {          Edit: false,          Delete: false        },        system: 'All'      });      var moveMsgs = new Ext.tree.TreePanel ({        rightClickedNode: null,        width: 400,        minWidth: 100,        border: false,        rootVisible: true,        autoScroll: true,	        loader: moveMsgs_TreeLoader,        root: rootNode      });                                 var moveMessages_Handler = function() {        var node = moveMsgs.getSelectionModel().getSelectedNode();        if(!node)          return;        var nodeId = node.id.split("_")[1];        if(isPopMail === undefined || !isPopMail)          Requests.moveSelectedMessages({id: nodeId, title: node.attributes.title, path: node.attributes.path}, rightClickedRowId, grid );//Path is required        else          Requests.moveSingleMessage(rightClickedRowId, {id: nodeId, title: node.attributes.title, path: node.attributes.path}, isPopMail);//Path is required                moveMessagesWindow.close();      }      var moveMessagesWindow = new Ext.Window({        id: 'message-move-window',        title: 'Move Messages to...',		height: 350,		width: 460,        layout: 'form',        resizable: false,        modal: true,        keys: {          key: 13,          fn: moveMessages_Handler        },        items: [{      		frame		: false,      		autoScroll : true,      		bodyStyle	: 'padding: 10px',      		style		: 'background-color: white;',      		//width		: 430,      		height	: 280,          items   : moveMsgs                    }        ],        buttons: [          {            text: 'Move Messages',            handler: moveMessages_Handler          },          {            text: 'Cancel',            handler: function() {              moveMessagesWindow.close();            }          }        ]      });      moveMessagesWindow.show();    },    openNewMailboxFolder: function(node) {	  var mailFolders_ComboStore = State.mailFolderFullTree_Data;			  var newFolderDlg = function(){		  var activeNode = node;		  var tempWindow = Ext.getCmp('folder-create-window');		  if(tempWindow) {			Ext.getCmp('create-folder-name').focus();			return;		  }		  var folderNameTextField = new Ext.form.TextField({			id: 'create-folder-name',			allowBlank: false,			fieldLabel: 'Folder name',			anchor: '99%'		  });		  var defaultValue = parseInt(processId(activeNode.id), 10);	// changed by majid		  var folderNameCombo = new Ext.form.ComboBox({			forceSelection: true,			anchor: '99%',			mode: 'local',			triggerAction: 'all',			fieldLabel: 'Parent folder',			store: mailFolders_ComboStore,			value: defaultValue,			valueField: 'id',			allowBlank: false,			displayField: 'title',			tpl: Eve.indentComboXTemplate('title')		  });		  var createFolder_Handler = function() {			var nodeId = null;			var value = folderNameTextField.getValue();			if(value === "") {			  folderNameTextField.focus();			  folderNameTextField.markInvalid();			}			else if( folderNameCombo.getValue() === "" ){			  folderNameCombo.focus();			  folderNameCombo.markInvalid();			}			else {			  nodeId = folderNameCombo.getValue();			  Requests.MailFolder.create(nodeId, value);			  createFolderWindow.close();			}		  }		  var createFolderWindow = new Ext.Window({			id: 'folder-create-window',			title: 'Create New Mail Folder',			layout: 'form',			bodyStyle: 'padding: 20px;',			width: 450,			modal: true,			keys: {			  key: 13,			  fn: createFolder_Handler			},			items: [			  folderNameCombo,			  folderNameTextField			],			buttons: [			  {				text: 'Create Folder',				handler: createFolder_Handler			  },			  {				text: 'Cancel',				handler: function() {				  createFolderWindow.close();				}			  }			]		  });		  createFolderWindow.show();		   folderNameCombo.focus();	  }	  	if(State.mailFolderFullTree_Dirty)			Requests.MailFolder.getFullTree(newFolderDlg);		else			newFolderDlg();    },    openMoveMailboxFolder: function(node) {//------------------        var moveFolders_TreeLoader = new Ext.tree.TreeLoader({    dataUrl: Eve.url,    section: 'mail',    baseParams: {      event: ServiceEvents.getTreeNodeChildren,      Id: -1,      sourceId: node.id.split("_")[1]    },    preloadChildren: true  });  moveFolders_TreeLoader.on('beforeload', function(obj, node, callback) {    obj.baseParams.Id = processId(node.id);  });  var rootNode = new Ext.tree.AsyncTreeNode({    text: 'All',    id: 'MPF_-1',    //cls: 'ev-hide',    draggable: false,    expanded: true,    per: {      Edit: false,      Delete: false    },    system: 'All'  });  var moveFolders = new Ext.tree.TreePanel ({    rightClickedNode: null,    width: 400,    minWidth: 100,    border: false,    rootVisible: true,    autoScroll: true,	    loader: moveFolders_TreeLoader,    root: rootNode  });                    //-------------------          /*var folderNameCombo = new Ext.form.ComboBox({        editable: false,        forceSelection: true,        anchor: '100%',        mode: 'local',        triggerAction: 'all',        fieldLabel: 'Parent folder',        store: State.mailFolderMoveTree_St,        displayField: 'title',        valueField : 'id',        value: -1,        tpl: new Ext.XTemplate(          '<tpl for=".">',          '<div class="x-combo-list-item" style="padding-left:{[this.getPadding(values.depth)]};font-size:9pt; font-family:tahoma;">',					'{title}',          '</div>',          '</tpl>',          {  					getPadding: function(depth){  			           // var depth = parseInt(values.depth);  			            var paddingLeft = (depth == 1)? 3 : (depth*7);  			            return (paddingLeft);  					}          }        )      });*/      var moveFolder_Handler = function() {        //var destinationNodeId = mailFolders.getNodeById("MPF_" + folderNameCombo.getValue());        var destinationNode = moveFolders.getSelectionModel().getSelectedNode();        if(!destinationNode)          return;        var destinationNodeId = destinationNode.id;        var targetNodeId = node.id;                Requests.MailFolder.move(targetNodeId, destinationNodeId);        moveFolderWindow.close();      }      var moveFolderWindow = new Ext.Window({        id: 'folder-move-window',        title: 'Move Mail Folder',        modal   : true,        resizable: false,        items: [{      		frame		: false,      		autoScroll : true,      		bodyStyle	: 'padding: 10px',      		style		: 'background-color: white;',      		width		: 450,      		height	: 300,                    items   : moveFolders                    }        ],        keys: {          key: 13,          fn: moveFolder_Handler        },        buttons: [          {            text: 'Move Folder',            handler: moveFolder_Handler          },          {            text: 'Cancel',            handler: function() {              moveFolderWindow.close();            }          }        ]      });      moveFolderWindow.show();    },    createContactWin : function(){             this.cmbGroup =  new Ext.form.ComboBox({	      	xtype			: 'combo',		    hiddenName		: 'groupId',	      	mode			: 'local',	      	fieldLabel 	    : 'Address Book',			lazyInit		: false,			valueField		: 'value',	    	displayField	: 'text',		    labelSeparator  : '',		    typeAhead		: true,		    selectOnFocus 	: true,		    triggerAction 	: 'all',		    anchor 		    : '98%',            listeners       :{               select: function(cmp, rec, idx){                    Requests.MailCompose.getCatList(rec.get('value'));                }                           }	  });              this.cmbContactFolder =  new Ext.form.ComboBox({            xtype			    : 'combo',            hiddenName		: 'folderId',            mode			    : 'local',            fieldLabel 	  : 'Categories',            lazyInit		  : false,            valueField		: 'id',            displayField	 : 'title',            labelSeparator : '',            typeAhead		    : true,            selectOnFocus 	: true,            triggerAction 	: 'all',            anchor 		    : '98%',            listeners       :{                select: function(cmp, rec, idx){                    var groupId = UI.cmbGroup.getValue();                    Requests.MailCompose.getUserContact(UI.addContacts, groupId, rec.get('id'));                }            }                    }) ;                  this.itemSelector = new Ext.ux.ItemSelector({      xtype		: 'itemselector'      ,name   : 'contacts'      ,hideLabel	: true      ,msWidth	: 280      ,msHeight	: 200      ,width		: 580      ,height		: 200      ,id		    : 'lstContact'      ,valueField	: 'contactEmail'      ,displayField: 'contact'      ,fromLegend	: 'Contact(s)'      ,toLegend	: 'Mail To Addresses'      ,dataFields	: ['contact', 'contactEmail']      ,fromData	: []      ,toData		: []      ,drawUpIcon	: false      ,drawBotIcon: false      ,drawTopIcon: false      ,drawDownIcon: false      });      //To prevent reloading toStore       this.isSetStore = false;            this.contactPanel = new Eve.FormPanel({        frame: true,        bodyStyle		: 'padding: 5px 5px 0',                items: [            this.cmbGroup,            this.cmbContactFolder,            this.itemSelector            ]      });            this.contactWindow =  new Ext.Window({ 			layout		: 'fit',			modal		  : true,			border 	  : false,			id			  : 'contact_dialog',			width 		: 620,			height 	  : 350,			y 			  : 100,			resizable	: false,			bodyBorder  : false,			autoScroll  : false,			closeAction : 'hide',			items 		  : this.contactPanel,			title		    : 'Contact',            buttons     : [{                text: 'Clear',                handler: function(){                    UI.itemSelector.toStore.each(function(rec){                    UI.itemSelector.fromStore.add(rec);                    UI.itemSelector.toStore.remove(rec);                  });                }            },            {                text: 'Accept Addresses',                handler: function(){                    var str = [];                    str.push(UI.itemSelector.toStore.data.keys);                    UI.targetField.setValue(Ext.util.Format.htmlDecode(str.join(',')));                    UI.contactWindow.hide();                                    }                            }            ,{                text: 'Cancel',                handler: function(){                    UI.contactWindow.hide();                }            }]                  });            this.contactWindow.on('hide', function(){        this.itemSelector.toStore.removeAll();        UI.isSetToStore = false;      }, this);    },    showContactWin: function(field){        this.contactWindow.show();        UI.targetField = field;        Requests.MailCompose.loadContactWin();            },        addContacts: function(response, options){        var element = UI.itemSelector;        var node = Ext.DomQuery.select('contacts', response.responseXML);		var fromStore = new Ext.data.Store({			fields	: ['contact', 'contactEmail']			,data	: []			,reader	: new Ext.data.XmlReader({				record	: "row"				,id		: "contactEmail"			}, [ 'contact', 'contactEmail'])		});				element.fromStore = fromStore;		element.fromMultiselect.view.setStore(fromStore);		element.fromMultiselect.store = fromStore;		element.displayField	= 'contact';		element.valueField		= 'contactEmail';		element.triggerAction	= 'all';		element.mode			= 'local';		element.editable		= false;       if(UI.isSetStore == false){        UI.isSetStore = true;    		var toStore = new Ext.data.Store({    			fields	: ['contact', 'contactEmail']    			,data	: []    			,reader	: new Ext.data.XmlReader( {    				record	: "row"    				,id		: "contactEmail"    			}, [ 'contact', 'contactEmail'])    		});    		    		if ( element.toStore ){	    			element.toStore.un('add', this.valueChanged );    			element.toStore.un('remove', this.valueChanged );    			element.toStore.un('load', this.valueChanged );    		}    		    		toStore.on('add', element.valueChanged, element );    		toStore.on('remove', element.valueChanged, element );    		toStore.on('load', element.valueChanged, element );    		    		element.toStore = toStore;    		element.toMultiselect.view.setStore( toStore );    		element.toMultiselect.store = toStore;    		element.displayField	= 'contact';    		element.valueField		= 'contactEmail';    		element.triggerAction	= 'all';    		element.mode			= 'local';    		element.editable		= false;  }		try		{      var temp = UI.targetField.getValue().trim();            if(temp != "" && !UI.isSetToStore){          UI.isSetToStore = true;          if(temp.charAt(temp.length - 1) == ",")            temp = temp.substr(0,temp.length-1);          var inputedContacts = temp.split(",");          var record = Ext.data.Record.create(['contact', 'contactEmail']);          var rec, contact;          for( var i=0; i< inputedContacts.length; i++){             contact = Ext.util.Format.htmlEncode(inputedContacts[i]);            rec = new record({              contact: contact              ,contactEmail: contact            });            rec.id = contact;            element.toStore.add(rec);                    }      }      element.fromStore.removeAll();			element.fromStore.add( fromStore.reader.readRecords(node).records);			return true;		}		catch(e)		{			return false;		}    },	composeMail: function(type, data) {      var uniqueId = [data.id,type].join('') //: Ext.id();      console.log("composeMail----data.id----",data.id);      if(Ext.getCmp(uniqueId) !== undefined){          mailCenter.setActiveTab(uniqueId);          return;       }      //For setting height 	 var setFormHeigth = function(){		var cmp = Ext.get('frm_compose_'+uniqueId);		var attachContainer = Ext.get('file-list-table' + uniqueId  ).dom;		var len = attachContainer.getElementsByTagName('tr').length;		if(len < 4 ){			cmp.setHeight(cmp.getSize().height + 23);		}			composeMailForm.doLayout();	 }      var appendFileRow = function(file) {        var o = {          name: file.name,          size: file.size        };        var fileTpl;        fileTpl = new Ext.XTemplate(          '<tr id="file_row_{name}">',            '<td id="icon_cell_{name}" style="width: 20px;">',              '<img src="' +Eve.Resource.getIcon('loading', 'mail') + '" />',            '</td>',            '<td id="name_cell_{name}">',              '<span  style="white-space:nowrap;" title="{name}">{[this.formatName(values.name)]}</span>',            '</td>',            '<td id="size_cell_{name}" style="width: 60px; text-align: right;">',              '{size}',            '</td>',            '<td id="detach_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;">',            '</td>',			'<td id="download_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;">',            '</td>',          '</tr>',		  {			  formatName: function(name){				  return Ext.util.Format.ellipsis(name, 100);			  }		  }        );        fileTpl.append(attachmentListTBODY.dom, o, true);		setFormHeigth();      };            var isReplyForward = ( (type === "reply") || (type === "replytoall") || (type === "forward") )? true: false;      var isReply = ( (type === "reply") || (type === "replytoall") )? true: false;      var isDraft = (type === "draft")? true: false;      var defaultSubject_Value = (isReplyForward || isDraft)? data.subject: undefined;      var defaultBody_Value = (isReplyForward || isDraft)? data.body: "<p><br/></p>";            if( Eve.Preference.get('signature') !== undefined && !isReplyForward && !isDraft && Eve.Preference.get('signature') !="" )        defaultBody_Value += "<br/>" + Eve.Preference.get('signature').replace(/\\'/g, "'");          var rec = Ext.data.Record.create(['value']);      var defaultFromAccount = data.from;	  	        if(typeof data.popAccount !== "undefined") {		  UI.fromFieldComboStore.removeAll();		  UI.fromFieldComboStore.add(new rec( {value: data.from} ));		  if(data.popAccount.length === undefined){			  UI.fromFieldComboStore.add(new rec( {value:data.popAccount.popEmailAddress} ));			  if(data.popAccount.defaultFrom === "1") {				UI.defaultFromAccount = data.popAccount.popEmailAddress;			  }		  }		  else {			for(var i=0, len=data.popAccount.length; i<len; i++) {				  UI.fromFieldComboStore.removeAll();				  UI.fromFieldComboStore.add(new rec( {value:filters.mail(data.popAccount[i].popEmailAddress)} ));				  if(data.popAccount[i].defaultFrom === "1") {					UI.defaultFromAccount = filters.mail(data.popAccount[i].popEmailAddress);				  }			}		  }      }	  defaultFromAccount = (UI.defaultFromAccount) ? UI.defaultFromAccount : defaultFromAccount;      //-- FROM FIELD --      var fromField = new  Ext.form.ComboBox({        fieldLabel: 'From',        name: 'from',        anchor: '99%',        editable: false,        triggerAction: 'all',        store: UI.fromFieldComboStore,		mode: 'local',        forceSelection: false,        value: defaultFromAccount,		valueField		: 'value',		displayField	: 'value',        tabIndex: 1,		tpl	:	new Ext.XTemplate(		'<tpl for=".">',			'<div class="x-combo-list-item" >{[this.getVal(values)]}</div>',		'</tpl>',		{			getVal: function(values) {				return Ext.util.Format.htmlEncode(values.value)			}		}		),        enableKeyEvents: true      });	//When landing page is Mail Eve.registery.allContacts is undefined;	  var addressBookStore = Eve.Cache.get('allContacts');//Eve.registery.allContacts;	  addressBookStore.on('load', function(){			  return false;		});	  var beforeSelectHandler = function(cmb, record, index){		  if(record.get('type') == "member")			record.set("emailValue", record.data[cmb.displayField].match(/\((.*?)\)/)[1])		return true	  }	  var FilterByFn = function(record, id){			return record.get(this.displayField).replace(/"/g, "").match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));			//return record.get(this.displayField).match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));     };     //show contact window by clickong on label(To, cc, bcc)      var attachHandler = function(cmp){        var label = Ext.get(cmp.container.dom).prev();        label.on('click', function(){          this.showContactWin(cmp);        }, this);            };                     var toField = new Ext.form.ComboBoxMulti({        fieldLabel: '<span style="padding:0px" class="mail-header2"><a href="#" onclick="return false;">To</a></span>',        name: 'to',        anchor: '99%',        enableKeyEvents: true,        sep:',',        editable: true,        lazyInit: false,        mode: 'local',        triggerAction	: 'all',        store:addressBookStore,        valueField		: 'emailValue',        displayField	: 'email',        hideTrigger: true,           value: (isReply || isDraft || data.isContact)? data.to: "",        tabIndex: 2,        filterByFn: FilterByFn,        listeners: {          render: attachHandler		  ,beforeSelect: beforeSelectHandler          ,scope: this        }      });      var ccField = new Ext.form.ComboBoxMulti({        fieldLabel: '<span style="padding:0px" class="mail-header2"><a href="#" onclick="return false;">CC</a></span>',        name: 'cc',        anchor: '99%',        //cls: 'wickEnabled',        //height: 20,        tabIndex: 3,        enableKeyEvents: true,        value: data.cc,//ccFieldComboStore,        sep:',',        editable: true,        lazyInit: false,        mode: 'local',        triggerAction	: 'all',        store:addressBookStore,        hideTrigger: true,        valueField		: 'emailValue',        displayField	: 'email',        filterByFn: FilterByFn,        listeners: {          render: attachHandler		  ,beforeSelect: beforeSelectHandler          ,scope: this        }              });      var ccLayout = new Ext.form.FormPanel({				layout  : 'column',        border  : false,        hidden  : false,				items      : [				{					columnWidth : .953,          border : false,          layout : 'form',					items  :[ccField]				}				,{					columnWidth  : .045,					//style 		: 'margin-left:-1px',          border    : false,					items     : [{              xtype: 'button',              text: '&nbsp;&nbsp;&nbsp;&nbsp;',              icon: Eve.Resource.getIcon('btn-cc', 'mail'),              listeners: {                  click: function(){                      this.showContactWin(ccField);                                        },                  scope: this              }        }]				}]			}      );            var bccField = new Ext.form.ComboBoxMulti({        fieldLabel: '<span style="padding:0px" class="mail-header2"><a href="#" onclick="return false;">BCC</a></span>',        name: 'bcc',        anchor: '99%',        //cls: 'wickEnabled',        //height: 20,        tabIndex: 4,        enableKeyEvents: true,        sep:',',        editable: true,        lazyInit: false,        mode: 'local',        triggerAction	: 'all',        store:addressBookStore,        hideTrigger: true,        valueField		: 'emailValue',        displayField	: 'email',        filterByFn: FilterByFn,        listeners: {          render: attachHandler		  ,beforeSelect: beforeSelectHandler          ,scope: this        }              });      var bccLayout = new Ext.form.FormPanel({		layout  : 'column',        border  : false,        hidden  : true,		items   : [				{					columnWidth : .953,					border : false,					layout : 'form',					items  :[bccField]				}				,{					columnWidth     : .045,         					//style 		: 'margin-left:-1px',					border    : false,					items     : [{					  xtype: 'button',					  text: '&nbsp;&nbsp;&nbsp;&nbsp;',					  icon: Eve.Resource.getIcon('btn-bcc', 'mail'),					  listeners: {						  click: function(){							  this.showContactWin(bccField);						  },						  scope: this					  }				}]				}]			});           //-- SUBJECT FIELD --      var subjectField = new Ext.form.TextField({        fieldLabel: 'Subject',        name: 'subject',        anchor: '99%',        allowBlank: true,        value: defaultSubject_Value,        tabIndex: 5,        enableKeyEvents: true      });      subjectField.on('keyup', function(textField, e) {        var subjectText = textField.getValue();        var tempText = (subjectText === "")? "Compose (no subject)": subjectText;        newComposeMail.setTitle(Ext.util.Format.ellipsis(tempText, 35));      });      //[DELETE DRAFT]      var deleteDraftAfterSendCheckbox = new Ext.form.Checkbox({        boxLabel: 'Delete Draft After Sending',        name: 'deletedraft',        checked: true,        style: 'padding-top: 5px;'      });      var saveCopyCheckbox = new Ext.form.Checkbox({        boxLabel: 'Save a copy of this message',        name: 'savecopy',        style: 'padding-top: 5px;',        checked: (Eve.Preference.getBoolean('saveCopy') == true)? true : false      });     var  mailBodyEditor = new Ext.ux.TinyMCE({       // height: '80%',        hideLabel: true,        tabIndex:6,        anchor: '100% 100%',        id: 'siatest1',        tinymceSettings: {          id: 'siatest2',          gecko_spellcheck : true,          theme : "advanced",          content_css: "/hyperoffice2nd/views/Styles/ModernStyle/javascript/Ext/ux/tiny_mce/starting.css",          //plugins: "safari,iespell,paste",          //plugins: "spellchecker",          plugins: "cfmspell",          force_br_newlines : true,		  force_p_newlines : false,          forced_root_block : '', // Needed for 3.x          mode: "textareas",          //theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",          //theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",          //theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|",          //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",          theme_advanced_buttons1 : "justifyleft,justifycenter,justifyright,justifyfull,|,cut,copy,paste,|,sub,sup,|,removeformat,|,bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,link,|,backcolor,forecolor",          theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,|,cfmspell,code",          theme_advanced_buttons3 : "",          convert_fonts_to_spans: false,          theme_advanced_toolbar_location : "top",          theme_advanced_toolbar_align : "left",          theme_advanced_statusbar_location : "none",          theme_advanced_resizing : false,          extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",          //template_external_list_url : "example_template_list.js"          spellchecker_languages : "+English=en",          	setup : function(ed) {    	 		ed.onPostProcess.add(function(ed, o) {	  	            var value = Eve.Preference.getInteger('fontSize');	  	            var fontColor = Eve.Preference.get('fontColor');	  	            var _value;	  	            switch(value){	  	              case 1 :	  	                _value = "8pt";	  	                break;	  	                	  	              case 2 :	  	                _value = "10pt";	  	                break;	  	                	  	              case 3 :	  	                _value = "12pt";	  	                break;	  	                	  	              case 4 :	  	                _value = "14pt";	  	                break;            	  	              	  	              case 5 :	  	                _value = "18pt"; 	  	                break;	  	                	  	              case 6 :	  	                _value = "24pt"; 	  	                break;	  	                	  	              case 7:	  	                _value = "36pt"	  	                break;	  	            }	  	            	  	            var fontSize = _value;		  	            if (type == 'reply' || type == 'replytoall' || type == 'forward')	  	            	o.content = '<span style="font-family: ' + Eve.Preference.get('fontFamily') + '; font-size: ' + fontSize + '; color: ' + fontColor + ';"><span id="cursor_holder"></span><br />' + o.content + '</span>';    	 			else	  	            	o.content = '<span style="font-family: ' + Eve.Preference.get('fontFamily') + '; font-size: ' + fontSize + '; color: ' + fontColor + ';"><br />' + o.content + '</span>';    	 			    	 		});  	     	}        	          	            //spellchecker_rpc_url: ""        	          },        value: defaultBody_Value      });     Eve.editor = mailBodyEditor;      var setPref =function(){        try{        	//            mailBodyEditor.ed.controlManager.controls[mailBodyEditor.ed.id + '_forecolor'].setColor(value);            //mailBodyEditor.ed.contentDocument.activeElement.style.color = value;            //mailBodyEditor.ed.execCommand("forecolor", false, value);                        //mailBodyEditor.ed.contentDocument.activeElement.style.fontSize = _value;            //            mailBodyEditor.ed.controlManager.controls[mailBodyEditor.ed.id + '_fontsizeselect'].selectByIndex(value -1);                        //value = Eve.Preference.get('fontFamily');            //mailBodyEditor.ed.contentDocument.activeElement.style.fontFamily = value;            //            mailBodyEditor.ed.controlManager.controls[mailBodyEditor.ed.id +'_fontselect'].select(value);        	            if (type == 'reply' || type == 'replytoall' || type == 'forward')            {            	tinyMCE.execCommand("mceSelectNode",false,mailBodyEditor.ed.dom.select('#cursor_holder')[0]);            	mailBodyEditor.ed.dom.remove(mailBodyEditor.ed.dom.select('#cursor_holder')[0]);            }            else            	toField.focus();                        mailBodyEditor.ed.onClick.add(function(ed, e) {              toField.collapse();              ccField.collapse();              bccField.collapse();            });       }        catch(e){          setTimeout(setPref ,1000 );        } 	}	setPref();      var composeMailForm;      var fp;      var attachmentsPanelItem = fp =  new Eve.UploadFormPanel({		fileUpload	: true        ,border     :false		,bodyStyle	: 'background: transparent;height:22px;'		,items		: [{xtype		: 'browsebutton'        ,buttonOnly: true		,hideLabel	:true        ,text: '<a>Attach From Local</a>'        ,iconCls	: 'eve-upload-icon'		,inputFileName		: 'filename_1'        ,id     : 'filename_1'        , handler: function(cmp){            var comp = cmp;            var uploadingFileName = cmp.inputFileEl.getValue();			UI.attachFiles.push(uploadingFileName);            appendFileRow({name: uploadingFileName, size: ""});			fp.getForm().submit({				url		  : Eve.url,                fileName: uploadingFileName				,params	: {					event	: ServiceEvents.attachFile					,m_shariat_m:true				}				,success: function(fp, o) {									  UI.attachFiles.remove(o.options.fileName);					                        comp.inputFileEl.dom.form.reset();                      newComposeMail.dirty = true;                      var iconCell = Ext.get("icon_cell_" + o.options.fileName);                                            if(xml2json(o.response.responseXML).data !== undefined){                        var data = xml2json(o.response.responseXML).data.uploaded;                        iconCell.dom.innerHTML = '<img src="' + Eve.Resource.getIcon('checked', 'general') + '" />';                        iconCell.set({id: "icon_cell_" + data.fileName});                        var detachCell = Ext.get("detach_cell_" + o.options.fileName);                        detachCell.dom.innerHTML = '<a class="detach" id="' + data.fileName + '" href="#">Remove</a>';                        detachCell.set({id: "detach_cell_" + data.fileName});                        var downloadCell = Ext.get("download_cell_" + o.options.fileName);                        downloadCell.dom.innerHTML = '<a class="download" id="' + data.fileName + '" href="#">Preview</a>';                        downloadCell.set({id: "download_cell_" + data.fileName});                        var nameCell = Ext.get("name_cell_" + o.options.fileName);                        nameCell.dom.innerHTML = ['<span title="'+data.fileName+'">',												  Ext.util.Format.ellipsis(data.fileName, 100),												  '</span>'].join('');                        nameCell.set({id: "name_cell_" + data.fileName});                        var sizeCell = Ext.get("size_cell_" + o.options.fileName);                        sizeCell.dom.innerHTML = data.fileSize;                        sizeCell.set({id: "size_cell_" + data.fileName});                        var row = Ext.get("file_row_" + o.options.fileName);                        row.set({id: "file_row_" + data.fileName});                        composeMailForm.attachedFileNames.push(data.fileName);                        composeMailForm.attachments.add(data.fileName, {name: data.fileName, size: data.fileSize});                      //fileNamesField.setValue(composeMailForm.attachedFileNames.join(" - "));                      }                      else{						UI.attachFiles.remove(o.options.fileName);                        iconCell.dom.innerHTML = '<img src="' +Eve.Resource.getIcon('upload-fail', 'mail')+ '" width=16/>';                        var detachCell = Ext.get("detach_cell_" + o.options.fileName);                        detachCell.dom.innerHTML = '<a class="detach" id="' +o.options.fileName + '" href="#">Remove</a>';						var downloadCell = Ext.get("download_cell_" + o.options.fileName);                        downloadCell.dom.innerHTML = '<a class="download" id="' +o.options.fileName + '" href="#">Remove</a>';                        var text = o.response.responseText;						Ext.Msg.alert('Error', text);                      }								}                ,failure: function(res, o){					                  //console.log('In failure');                }							});                           }				}]			});      var composeMailToolbar = [        new Ext.Button({          text: 'Send',          icon: Eve.Resource.getIcon('btn-send', 'mail'),          cls: 'x-btn-text-icon',          handler: function() {            if(fromField.getRawValue() === "") {              fromField.markInvalid();              fromField.focus();              return;            }            if(!bccField.validate()) {              bccField.focus();                          return;            }                        if(toField.getRawValue() === "") {              toField.markInvalid();              toField.focus();              return;            }			if(UI.attachFiles.length > 0 ){				Ext.Msg.alert('Warning', 'Please wait while your attachments finish uploading.');				return;			}            var that = newComposeMail;            var maskContainer = newComposeMail.getEl();            var mask = new Ext.LoadMask(maskContainer, {msg: 'Sending mail, please wait...'});            mask.show();            var mailFields = {              from: fromField.getValue(),              id: data.id.split("_")[1] || 0,              to: toField.getRawValue(),              cc: ccField.getRawValue(),              bcc: bccField.getRawValue(),              subject: subjectField.getValue(),              body: "<html><body>" + mailBodyEditor.getValue() + "</body></html>" ,              attachments: composeMailForm.attachments,              isHTML: 1,              save_copy: (saveCopyCheckbox.getValue() === true)? 1: 0,              delete_after_send: (deleteDraftAfterSendCheckbox.getValue() === true)? 1: 0,              draftId: data.draftId,              type: type            }            if(composeMode == 'interlink')                var ilParams = data.ilParams;                            Requests.MailCompose.send(mask, that, mailFields, ilParams);          },          scope: newComposeMail        }),        '-',        new Ext.Button({          text: 'Save Draft',          handler: function() {            if(fromField.getValue() === "") {              fromField.markInvalid();              fromField.focus();              return;            }                        if(!bccField.validate()) {              bccField.focus();              return;            }                        if(toField.getValue() === "") {              toField.markInvalid();              toField.focus();              return;            }            if(subjectField.getValue() === "") {              subjectField.markInvalid();              subjectField.focus();              return;            }            var that = newComposeMail;            var maskContainer = newComposeMail.getEl();            var mask = new Ext.LoadMask(maskContainer, {msg: 'Saving draft, please wait...'});            mask.show();            var mailFields = {              from: fromField.getValue(),              to: toField.getValue(),              cc: ccField.getValue(),              bcc: bccField.getValue(),              subject: subjectField.getValue(),              body: "<html><body>" + mailBodyEditor.getValue()+ "</body></html>",              isHTML: 1,              save_copy: (saveCopyCheckbox.getValue() === true)? 1: 0,              //delete_after_send: (deleteDraftAfterSendCheckbox.getValue() === true)? 1: 0,			  attachments: composeMailForm.attachments,              type: type            }            Requests.saveDraft(mask, that, mailFields);          },          scope: newComposeMail        }),        new Ext.Button({          text: 'Save Backup',          handler: function() {            if(fromField.getValue() === "") {              fromField.markInvalid();              fromField.focus();              return;            }            if(!bccField.validate()) {              bccField.focus();              return;            }                        if(toField.getValue() === "") {              toField.markInvalid();              toField.focus();              return;            }            if(subjectField.getValue() === "") {              subjectField.markInvalid();              subjectField.focus();              return;            }            var that = newComposeMail;            var maskContainer = newComposeMail.getEl();            var mask = new Ext.LoadMask(maskContainer, {msg: 'Saving backup, please wait...'});            mask.show();            var mailFields = {              from: fromField.getValue(),              to: toField.getValue(),              cc: ccField.getValue(),              bcc: bccField.getValue(),              subject: subjectField.getValue(),              body: "<html><body>" + mailBodyEditor.getValue() + "</body></html>",              isHTML: 1,              save_copy: (saveCopyCheckbox.getValue() === true)? 1: 0,              //delete_after_send: (deleteDraftAfterSendCheckbox.getValue() === true)? 1: 0,              type: type,			  attachments: composeMailForm.attachments            }                          Requests.saveBackup(mask, that, mailFields);          },          scope: newComposeMail        }),        '-',        new Ext.Button({          text: 'Clear Message',          handler: function() {            Ext.MessageBox.confirm('Confirm Action', 'Are you sure you want to clear the message body?', function(btn) {              if(btn == 'yes'){                mailBodyEditor.setValue("");              }            }, this);          }        }),        '-',        attachmentsPanelItem,                new Ext.Button({          text: 'Attach From Portal',          icon: Eve.Resource.getIcon('paper-clip', 'mail'),          //minWidth: 130,          //cls: 'x-btn-icon',          cls: 'x-btn-text-icon',          disabled: false,          handler: function() {                    Eve.Resource.superbridge.broadcast(Eve.Mail,'open_attachment_dlg',{ func: function(file) {                    var o = {                      name: file.name,                      size: file.size                    };                    var fileTpl;                    fileTpl = new Ext.XTemplate(                      '<tr id="file_row_{name}">',                        '<td id="icon_cell_{name}" style="width: 20px;">',                          '<img src="' + Eve.Resource.getIcon('loading', 'mail') + '" />',                        '</td>',                        '<td id="name_cell_{name}">',                          '<span style="white-space:wrap;" title="{name}">{[this.formatName(values.name)]}</span>',                        '</td>',                        '<td id="size_cell_{name}" style="width: 60px; text-align: right;">',                          '{size}',                        '</td>',                        '<td id="detach_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;">',                        '</td>',                        						'<td id="download_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;">',                        '</td>',                      '</tr>',					  {						  formatName: function(name){							  return Ext.util.Format.ellipsis(name, 100);						  }					  }                    );                      fileTpl.append(attachmentListTBODY.dom, o, true);					  setFormHeigth();                       var requestParams = { event: 'modern.mail.personal.attachDocumentFile', id: file.id, title: file.name, size: file.size };                       UI.attachFiles.push(file.name);					   Ext.Ajax.request({                            waitMessage: "Uploading file, please wait...",                            url: Eve.url,                            params: requestParams,                            success: function(o, fp) {							//							  UI.attachFiles.remove(fp.params.title);						                              newComposeMail.dirty = true;                              //statusBar.clearStatus();                              if(o.responseXML){                                var data = xml2json(o.responseXML).data.uploaded;                                var iconCell = Ext.get("icon_cell_" + fp.params.title);                                iconCell.dom.innerHTML = '<img src="' + Eve.Resource.getIcon('checked','general')+ '" />';                                iconCell.set({id: "icon_cell_" + data.fileName});                                var detachCell = Ext.get("detach_cell_" + fp.params.title);                                detachCell.dom.innerHTML = '<a class="detach" id="' + data.fileName + '" href="#">Remove</a>';                                detachCell.set({id: "detach_cell_" + data.fileName});								var downloadCell = Ext.get("download_cell_" + fp.params.title);                                downloadCell.dom.innerHTML = '<a class="download" id="' + data.fileName + '" href="#">Preview</a>';                                downloadCell.set({id: "download_cell_" + data.fileName});                                var nameCell = Ext.get("name_cell_" + fp.params.title);                                nameCell.dom.innerHTML = ['<span title="'+data.fileName+'">',												  Ext.util.Format.ellipsis(data.fileName, 100),												  '</span>'].join('');                                nameCell.set({id: "name_cell_" + data.fileName});                                var sizeCell = Ext.get("size_cell_" + fp.params.title);                                sizeCell.dom.innerHTML = data.fileSize;                                sizeCell.set({id: "size_cell_" + data.fileName});                                var row = Ext.get("file_row_" + fp.params.title);                                row.set({id: "file_row_" + data.fileName});                                composeMailForm.attachedFileNames.push(data.fileName);                                composeMailForm.attachments.add(data.fileName, {name: data.fileName, size: data.fileSize});                              }                              else{                                 var iconCell = Ext.get("icon_cell_" + fp.params.title);                                iconCell.dom.innerHTML = '<img src="' + Eve.Resource.getIcon('upload-fail', 'mail')+ '" width=16/>';                                var detachCell = Ext.get("detach_cell_" + fp.params.title);                                detachCell.dom.innerHTML = '<a class="detach" id="' + fp.params.title + '" href="#">Remove</a>';                                 var downloadCell = Ext.get("download_cell_" + fp.params.title);                                downloadCell.dom.innerHTML = '<a class="download" id="' + fp.params.title + '" href="#">Preview</a>';								var text = o.responseText;                                Ext.Msg.alert('Error', text);                                                                                          }                              },                              failure: function(res, o){								//								UI.attachFiles.remove(o.params.title);								//                                var iconCell = Ext.get("icon_cell_" + o.params.title);                                iconCell.dom.innerHTML = '<img src="' + Eve.Resource.getIcon('upload-fail', 'mail')+ '" width=16/>';                                var detachCell = Ext.get("detach_cell_" + o.params.title);                                detachCell.dom.innerHTML = '<a class="detach" id="' + o.params.title + '" href="#">Remove</a>';								var downloadCell = Ext.get("download_cell_" + o.params.title);                                downloadCell.dom.innerHTML = '';                                var text = res.responseText;                                Ext.Msg.alert('Error', text);                                                              }                              });                                            } });              }        }),        '-',        new Ext.Button({          text: 'Cc',          pressed: true,          enableToggle: true,          listeners:{            toggle: function(button, pressed) {			  var cmp = Ext.getCmp('frm_compose_'+uniqueId);              if(pressed == true){				  cmp.setHeight(cmp.getSize().height + 25);				  ccLayout.show();			  }			  else{				   cmp.setHeight(cmp.getSize().height - 25 );				   ccLayout.hide();			  }              composeMailForm.doLayout();            }          }        }),        new Ext.Button({          text: 'Bcc',          enableToggle: true,                    listeners:{            toggle: function(button, pressed) {              var cmp = Ext.getCmp('frm_compose_'+uniqueId);              if(pressed == true){				  cmp.setHeight(cmp.getSize().height + 25 );				  bccLayout.show();			  }			  else{				   cmp.setHeight(cmp.getSize().height - 25);				   bccLayout.hide();			  }              composeMailForm.doLayout();            }          }        }),        '->',        saveCopyCheckbox      ];      if(isDraft === true) {        composeMailToolbar.push('-', deleteDraftAfterSendCheckbox);      }      composeMailForm = new Ext.Panel({        attachedFileNames: [],        attachments: new Ext.util.MixedCollection(),        closable: true,        border: false,		autoScroll: false,                defaults: {          labelWidth: 100,          width: 800        },        tbar: composeMailToolbar,        layout: 'border',        anchor: '100% 100%',        items: [{          layout: 'form',		  id	: 'frm_compose_'+uniqueId,		  deferHeight : false,          border:false,          bodyStyle: 'padding:15px;',          region: 'north',		  height: 130,          items:[          fromField,			{				layout  : 'column',				border   : false,				items      : [				{					columnWidth : .953,					border : false,					layout : 'form',					items  :[toField]				}				,{					columnWidth : .045,					//style 		: 'padding-left:-1px',					border    : false,					items     : [{                        xtype: 'button',                        text: '&nbsp;&nbsp;&nbsp;&nbsp;',                        icon: Eve.Resource.getIcon('btn-to', 'mail'),                        listeners: {                            click: function(){                                this.showContactWin(toField);                                                            },                            scope: this                        }                    }]				}]			} ,                // toField,          ccLayout,          bccLayout,          subjectField,          //attachmentsPanelItem,          new Ext.Panel({            bodyStyle: "background: transparent; padding: 10px;",            anchor: '99%',            border: false,            html: ['<div  class="attachment-container" style="max-height:60px;margin-top:-10px; width:101%; overflow-y:auto;overflow-x:hidden;">',					'<table id="file-list-table' + uniqueId + '" style="width:100%;font-size: 10px; font-family: tahoma;"><tbody>',					'</tbody></table>'].join('')          })	]},{		     region: 'center',			 items:   mailBodyEditor,			 layout: 'fit',			 border: false		}        ]      });      var draftId = null;      if(typeof data.type !== undefined) {        if(data.type === "draft") {          draftId = data.draftId;        }      }      var newComposeMail = new Ext.Panel({        id: uniqueId,        dirty: false,		autoScroll	: false,        editor: mailBodyEditor,        tabType: 'compose_' + type, // custom attribute        title: (type !== "new")? Ext.util.Format.ellipsis(data.subject, 35): 'Compose (no subject)',        layout: 'form',        closable: true,        lastSaveBackupId: data.id.split("_")[1],        draftId: draftId,        items: [          composeMailForm        ]      });	    //If any of the field values change, mark the compose tab as unsaved (dirty)      fromField.on('keypress', function() { newComposeMail.dirty = true; } );      toField.on('keypress', function() { newComposeMail.dirty = true; } );      ccField.on('keypress', function() { newComposeMail.dirty = true; } );      bccField.on('keypress', function() { newComposeMail.dirty = true; } );      subjectField.on('keypress', function() {newComposeMail.dirty = true; } );      //mailBodyEditor.on('textmodified', function() { newComposeMail.dirty = true; } );      if(type == 'newWin'/*|| Eve.Preference.getBoolean('compose') == true*/)	  {  		  var popWin =  new Ext.Window({  			width 		: 950  			//,modal		: true        ,autoScroll	: true        ,constrainHeader: true        ,minimizable: true  			,layout 	: 'fit'  			,height 	: 510  			,y 			: 20  			,border		: false  			,resizable	: true  			,bodyBorder : false  			,closeAction: 'close'  			,items 		: [newComposeMail]  			,title		: 'Compose'        ,listeners: {          beforeClose: function(cmp){      			if(newComposeMail.windowClose)      				return true;			            if(mailBodyEditor.isDirty() || newComposeMail.dirty ){              Ext.MessageBox.confirm('Confirm Action', 'You are about to close an unsaved mail. Are you sure?', function(btn) {                if(btn == 'yes'){                  newComposeMail.dirty = false;				  newComposeMail.windowClose = true;                  cmp.close();                }              }, this);              return false;            }          }                    ,minimize: function( win ){            win.hide();            var btn = statusBar.items.items[1];            btn.handler = function(cmp) {                            win.show();                                btn.hide();             }            btn.show();                        }          ,scope: this        }  		});  		popWin.show();      UI.showedDialogs.remove(uniqueId);	  }	  else	  {      mailCenter.add(newComposeMail);      mailCenter.setActiveTab(newComposeMail);      UI.showedDialogs.remove(data.id+type);	  }      newComposeMail.doLayout();            var attachmentListTabel = null;      var attachmentListTBODY = null;      var attachmentListTabel = Ext.get("file-list-table" + uniqueId);      attachmentListTBODY = attachmentListTabel.select('tbody').item(0);      attachmentListTabel.on({        click: {          fn: function(e, target) {			if(target.className == "detach")				Requests.MailCompose.detachFile(target.id, composeMailForm, uniqueId);			else if(target.className == "download"){				var action = {					 CFID	: Eve.CFId					,CFTOKEN: Eve.CFToken					,title: target.id					,event: ServiceEvents.downloadFile				}				Eve.downloadFile(action);			}          },          delegate:'a'        }      });      var attach = (data.attachments) ? data.attachments.split("|") : [];      if(attach.length > 0 ){      var appendAttach = function(file) {        var o = {          name: file.name,          size: file.size        };        var fileTpl;        fileTpl = new Ext.XTemplate(          '<tr id="file_row_{name}">',            '<td id="icon_cell_{name}" style="width: 20px;">',              '<img src="' +Eve.Resource.getIcon('checked', 'general') + '" />',            '</td>',            '<td id="name_cell_{name}">',              '<span style="white-space:wrap;" title="{name}">{[this.formatName(values.name)]}</span>',            '</td>',            '<td id="size_cell_{name}" style="width: 60px; text-align: right;">',              '{size}',            '</td>',            '<td id="detach_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;"> ',            '<a id="{name}" href="#" class="detach">Remove</a>',            '</td>',            '<td id="download_cell_{name}" style="width: 55px; text-align: center; font-size: 10px; text-decoration: underline;"> ',            '<a id="{name}" class="download" href="#">Preview</a>',            '</td>',          '</tr>',		  {			  formatName: function(name){				  return Ext.util.Format.ellipsis(name, 100);			  }		  }        );          fileTpl.append(attachmentListTBODY.dom, o, true);		  setFormHeigth();      };                    for(var i=0, len=attach.length; i<len; i++){          if(attach[i] == "")            return;           appendAttach({name: attach[i], size: ""});            composeMailForm.attachedFileNames.push(attach[i]);           composeMailForm.attachments.add(attach[i], {name: attach[i], size: ""});        }      }         },	createNewPOPAccount: function() {     // var defaults = defaults2;      var mailServer_TextField = new Ext.form.TextField({        fieldLabel: 'Mail Server',        allowBlank: false      });      var userName_TextField = new Ext.form.TextField({        fieldLabel: 'Username',        allowBlank: false      });      var password_TextField = new Ext.form.TextField({        fieldLabel: 'Password',        inputType: 'password',        allowBlank: false      });      var port_TextField = new Ext.form.TextField({        fieldLabel: 'Port',        value: 110,        allowBlank: false      });      var emailAddress_TextField = new Ext.form.TextField({        fieldLabel: 'E-Mail Address',        allowBlank: false,		validator  : function(val){			if(val.indexOf('@') == -1)				return false;			return true;		}      });      var defaultFrom_TextField = new Ext.form.Checkbox({        boxLabel: 'Set as default',        hideLabel: true        //labelSeparator : '',        //checked: defaults.defaultFrom      });      var popAccountForm = new Ext.FormPanel({        defaultType: 'textfield',        bodyStyle: 'background: transparent;',        border: false,        defaults: {width: '95%'},        anchor: '99%',        items: [          mailServer_TextField,          userName_TextField,          password_TextField,          port_TextField,          emailAddress_TextField,          defaultFrom_TextField        ]      });      var popAccountWindow = new Ext.Window({        id: 'new-pop-account-window',        title: 'Create New POP Account',        width: 500,        height: 230,        modal: true,        bodyStyle: 'padding: 10px 10px 10px 10px;',        items: [          popAccountForm        ],        buttons: [          {            text: 'Create Account Entry',            handler: function() {              //Verify if all the required fields are filled-up              if(mailServer_TextField.isValid() === false) { mailServer_TextField.focus(); return ;}              if(userName_TextField.isValid() === false) { userName_TextField.focus(); return; }              if(password_TextField.isValid() === false) { password_TextField.focus(); return; }              if(port_TextField.isValid() === false) { port_TextField.focus(); return; }              if(emailAddress_TextField.isValid() === false) { emailAddress_TextField.focus(); return; }              var params = {                server: mailServer_TextField.getValue(),                userName: userName_TextField.getValue(),                password: password_TextField.getValue(),                port: port_TextField.getValue(),                POPEmailAddress: emailAddress_TextField.getValue(),                LeaveMessagesOnServer: 1,                defaultFrom: (defaultFrom_TextField.getValue())? 1: 0              };              Requests.POPAccount.create(params, popAccountWindow);            }          },          {            text: 'Cancel',            handler: function() {              popAccountWindow.close();            }          }        ]      });      popAccountWindow.show();      mailServer_TextField.focus(false,500);    },    editPOPAccount: function(node, data) {      var mailServer_TextField = new Ext.form.TextField({        fieldLabel: 'Mail Server',        value: filters.mail(data.server)      });      var userName_TextField = new Ext.form.TextField({        fieldLabel: 'Username',        value: filters.mail(data.username)      });      var password_TextField = new Ext.form.TextField({        fieldLabel: 'Password',        inputType: 'password',        value: data.password      });      var port_TextField = new Ext.form.TextField({        fieldLabel: 'Port',        value: filters.mail(data.port)      });      var emailAddress_TextField = new Ext.form.TextField({        fieldLabel: 'E-Mail Address',        value: filters.mail(data.popEmailAddress),		validator: function(val){			if(val.indexOf('@') == -1)				return false;			return true;		}      });      var defaultFrom_TextField = new Ext.form.Checkbox({        boxLabel: 'Set as default',        hideLabel: true,        //labelSeparator : '',        checked: (data.defaultFrom === "1")? true: false      });      var popAccountForm = new Ext.FormPanel({        defaultType: 'textfield',        bodyStyle: 'background: transparent;',        border: false,        defaults: {width: '95%'},        anchor: '99%',        items: [          mailServer_TextField,          userName_TextField,          password_TextField,          port_TextField,          emailAddress_TextField,          defaultFrom_TextField        ]      });      var popAccountWindow = new Ext.Window({        id: 'edit-pop-account-window',        title: 'Edit POP Account',        width: 550,        height: 230,        modal: true,        bodyStyle: 'padding: 10px 10px 10px 10px;',        items: [          popAccountForm        ],        buttons: [          {            text: 'Save',            handler: function() {			  if(!popAccountForm.getForm().isValid())				return;              var params = {                server: mailServer_TextField.getValue(),                userName: userName_TextField.getValue(),                password: password_TextField.getValue(),                port: port_TextField.getValue(),                POPEmailAddress: emailAddress_TextField.getValue(),                LeaveMessagesOnServer: 1,                defaultFrom: (defaultFrom_TextField.getValue())? 1: 0              };              Requests.POPAccount.edit(node, params, popAccountWindow, data.popEmailAddress);            }          },          {            text: 'Cancel',            handler: function() {              popAccountWindow.close();            }          }        ]      });      popAccountWindow.show();      mailServer_TextField.focus(false,500);    },    fillSearchFoldersStore : function( object ){		object.cmbFolderSt.removeAll();		var data	= Ext.data.Record.create([ 'value', 'depth', 'title']);		object.cmbFolderSt.insert(0, new data({value: 0, title: '[ Search All Folders ]', depth: 1}, 0));		for(var i=0, len=object.folders.length; i<len; i++) {				var record	= new data({					value:  object.folders[i].id					,depth: object.folders[i].depth					,title: object.folders[i].title				});				record.id = object.folders[i].id				object.cmbFolderSt.add(record)      }	},	searchMail: function(object) {      var searchForm = Ext.getCmp('mail-search-form');	  var searchTitle = (object.gridNumber == "2") ? 'Search' : 'Search In Archive';	  if( UI.gridNumber && searchForm && (UI.gridNumber != object.gridNumber))			Ext.getCmp('mail-search-grid').store.removeAll();			  UI.gridNumber = object.gridNumber;      if(searchForm) {		UI.fillSearchFoldersStore({folders: object.folders, cmbFolderSt:Ext.getCmp('mail_folders_combo').store});		var el = Ext.getCmp('userContainer');		if(object.gridNumber == '3' && Eve.Preference.getInteger('accountLevel')>= 155)			el.show();		else			el.hide();		searchForm.setTitle	(searchTitle);        mailCenter.setActiveTab(searchForm);		searchForm.doLayout();		return;      }      var newMessagesComboBox_Store = [        [2, "Search All Messages"],        [1, "Search Only New Messages"],        [0, "Search Only Read Messages"]      ];      var flaggedMessagesComboBox_Store = [        [2, "Search All Messages"],        [1, "Search Flagged Messages"],        [0, "Search Unflagged Messages"]      ];	  var folderComboBox_Store = new Ext.data.Store();	  UI.fillSearchFoldersStore({folders: object.folders, cmbFolderSt:folderComboBox_Store});      var newMessageComboBox = new Ext.form.ComboBox({        editable: false,        fieldLabel: 'New',        store: newMessagesComboBox_Store,        mode: 'local',        triggerAction: 'all',        value: newMessagesComboBox_Store[0][0]      });      var flaggedMessageComboBox = new Ext.form.ComboBox({        editable: false,        fieldLabel: 'Flagged',        store: flaggedMessagesComboBox_Store,        mode: 'local',        triggerAction: 'all',        value: flaggedMessagesComboBox_Store[0][0]      });      var folderComboBox = new Ext.form.ComboBox({        editable: true,		id: 'mail_folders_combo',        forceSelection: true,        fieldLabel: 'Folder',        store: folderComboBox_Store,        mode: 'local',        triggerAction: 'all',        value: 0,		valueField: 'value',        allowBlank: false,	    displayField: 'title',		tpl: Eve.indentComboXTemplate('title')      });      var searchStartDateField = new Ext.form.DateField({        fieldLabel: 'Date Range',        anchor: '99%',		format: Eve.Preference.get('dateFormat')|| 'n/j/y'      });            var searchEndDateField = new Ext.form.DateField({       hideLabel: true,       labelSeperator: '',        anchor: '99%',		format: Eve.Preference.get('dateFormat') || 'n/j/y'      });      var dt = new Date();      searchStartDateField.setValue(dt.add(Date.MONTH, -3));      searchEndDateField.setValue(dt);      var searchFn = function(){		  if(!searchMailForm.getForm().isValid())                            return false;                                                      var startDate =                            (searchStartDateField.getValue() === "")?                            "":                            searchStartDateField.getValue().format('n/j/y');                          var endDate =                            (searchEndDateField.getValue() === "")?                            "":                            searchEndDateField.getValue().format('n/j/y')+ " 23:59:59";                                              var fields = {                            from: Ext.getCmp('search-from-field').getValue(),                            toCC: Ext.getCmp('search-tocc-field').getValue(),                            subject: Ext.getCmp('search-subject-field').getValue(),                            startDate: startDate,                            endDate: endDate ,                            newMessage: newMessageComboBox.getValue(),                            flagged: flaggedMessageComboBox.getValue(),                            folderId: folderComboBox.getValue()                          };						  if(UI.gridNumber == "3"){								fields.userNames = Ext.getCmp('searchUserCombo').getValue();								fields.allUsers = Ext.getCmp('searchAllUsers').getValue();						  }                          Requests.Search.mail(fields, {start: 0, limit: 20, gridNumber: UI.gridNumber});	  };	  var userStore = new Ext.data.Store({						reader	: new Ext.data.XmlReader({							record	: 'row'						}, [ 'email', 'id', 'type', 'emailValue' ])	  });	  Eve.Cache.get('allContacts').filter('type', 'member');	  userStore.add(Eve.Cache.get('allContacts').data.items);	  Eve.Cache.get('allContacts').clearFilter();      var searchMailForm = new Ext.form.FormPanel({        bodyStyle: 'padding: 15px;',        style: 'border-bottom: 1px solid #D0D0D0;',        border: false,        region: 'north',        height: 145,        collapsible: true,		keys:{key:Ext.EventObject.ENTER,fn:searchFn},        items: [          {			layout		: "column",			id			: 'userContainer',			hidden		: (object.gridNumber == "3" && Eve.Preference.getInteger('accountLevel')>= 155)  ? false : true,			border		: false,			items		: [{				columnWidth	: .845,				layout		: "form",				labelWidth	: 95,				border		: false,				items		: [new Ext.form.ComboBoxMulti({						anchor: '99%',						id	: 'searchUserCombo',						fieldLabel: 'Users',						//forceSelection: true,						labelStyle: 'width: 95px',						enableKeyEvents: true,						editable: true,						lazyInit: false,						mode: 'local',						hideTrigger: true,						triggerAction	: 'all',						store			: userStore,						valueField		: 'emailValue',						displayField	: 'email',						sep: ',',						filterByFn: function(record, id){							return record.get(this.displayField).replace(/"/g, "").match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));						},						listeners:{							beforeSelect: function(cmb, record, index){								  if(record.get('type') == "member")									record.set("emailValue", record.data[cmb.displayField].match(/\((.*?)\)/)[1])								return true							}						}				  })]			}, {				columnWidth	: .155				,layout		: "form"				,border		: false				,items		: [{								  xtype: 'checkbox'								  ,id: 'searchAllUsers'								  ,boxLabel: 'All users'								  ,hideLabel		: true								  ,labelSeparator : ''								  ,listeners: {										check: function(checkbox, checked)										{											var cmb = Ext.getCmp('searchUserCombo');											if (checked) {												cmb.disable();												cmb.clearValue();											} else {												cmb.enable();											}										}								  }							  }]			}]			  },{            layout: 'column',            border: false,            items: [              {                columnWidth: 0.46,                layout: 'form',                labelPad: 0,                defaults: {                  anchor: '90%',                  labelStyle: 'width: 70px'                },                border: false,                items: [                  {                    id: 'search-from-field',                    xtype: 'textfield',                    fieldLabel: 'From'                  },                  {                    id: 'search-tocc-field',                    xtype: 'textfield',                    fieldLabel: 'To/CC'                  },                  {                    id: 'search-subject-field',                    xtype: 'textfield',                    fieldLabel: 'Subject'                  }                ]              },              {                columnWidth: 0.05,                border: true,                bodyStyle: "border: 1px solid white;"              },              {                columnWidth: 0.45,                layout: 'form',                border: false,                labelPad: 0,                defaults: {                  anchor: '90%',                  labelStyle: 'width: 70px'                },                items: [                  flaggedMessageComboBox,                  newMessageComboBox,                  folderComboBox                ]              }            ]          },{          		layout  	: 'column'                ,border   : false          			,items		: [{                  layout      : 'form',                   labelWidth  : 95,                         border      : false,                  style       : 'padding-right:26px;',          				columnWidth : .305,          				items		: searchStartDateField          			}, {                  layout  : 'form',                         border  : false,          				columnWidth : .14,          				items      : searchEndDateField          			}, {                   columnWidth: .47,                   border: false,                   items: {html:'&nbsp;', border:false}                                   },{                         width: 60,                  border: false,                  items:[ new Ext.Button({                        text: 'Search',						id: 'btnSearchMail',                        handler: searchFn                      })]                      }]                  }]      });      var searchMailGrid_DataStore = new Ext.data.Store({        url: Eve.url,        remoteSort: true,        reader: searchGrid.XmlReader      });      searchMailGrid_DataStore.setDefaultSort('sendDate', 'DESC');      searchMailGrid_DataStore.on('beforeload', function(store, options) {		this.baseParams.gridNumber = UI.gridNumber;		if(typeof options.params.forceSelect !== "undefined") {          delete options.params.forceSelect;          return true;        }        if(typeof options.params.forcePaging !== "undefined") {           options.params.event = ServiceEvents.changeStartItemNumber;          delete options.params.forcePaging;          return true;                    }			 options.params.event = ServiceEvents.changeOrderBy;        return true;      });            dataStores.searchMailGridStore = searchMailGrid_DataStore;      //searchMailGrid_DataStore.load({params: {id: -1} });      var searchMailGrid = new Ext.grid.GridPanel({        border: false,        region: 'center',        loadMask: true,        id :'mail-search-grid',        stripeRows: true,        enableHdMenu: false,		viewConfig: {emptyText: 'Nothing found'},        bbar: new Ext.PagingToolbar({          store: searchMailGrid_DataStore        }),		enableDragDrop: true,		ddGroup: 'ddMail',        store: searchMailGrid_DataStore,        cm: searchGrid.ColumnModel_From,        sm: new Ext.grid.CheckboxSelectionModel()      });	  searchMailGrid_DataStore.on('load', function(){		    var hdCheckbox = Ext.getCmp('mail-search-grid').getEl().select('.x-grid3-hd-checker-on');			if(hdCheckbox) hdCheckbox.removeClass('x-grid3-hd-checker-on');	  })      searchMailGrid.on('rowdblclick', function(grid, rowIndex, e) {        if(e.shiftKey) {          //Open selected mail message in a new browser tab if Shift + DoubleClick          Requests.Mail.open( grid,rowIndex, true /* from search grid */, "window", false /* pop */ );        }        else {          Requests.Mail.open(grid, rowIndex, true /* from search grid */, "tab", false /* pop */);        }      });      searchMailGrid.on('rowcontextmenu', function(grid, rowIndex, e) {           e.stopEvent();                        var row = grid.getStore().getAt(rowIndex);            var gridData = row.data;            var selectionCount = grid.getSelectionModel().getCount();            if( selectionCount > 1 )                grid.getSelectionModel().selectRow(rowIndex, true);            else                grid.getSelectionModel().selectRow(rowIndex);            var gridId = gridData.id;            var id     = processId(gridData.id);            // Menu Items            var open_MenuItem = {              text: (State.isDraftsFolderSelected() === true)? 'Edit Draft': 'Open',              icon: Eve.Resource.getIcon('opened-mail','mail'),              disabled: (selectionCount > 1)? true: false,              handler: function() {                  Requests.Mail.open(grid, rowIndex, true, "tab", false);              }            };                        var openInWin_MenuItem = {              text: 'Open in New Window',              disabled: (selectionCount > 1)? true: false,              icon: Eve.Resource.getIcon('open-new-win','mail'),              handler: function() {                  Requests.Mail.open(grid, rowIndex, true, "window", false, true);                                }            };                        var delete_MenuItem = {              text: 'Delete',			  disabled: (UI.gridNumber == "3")? true: false,              icon: Eve.Resource.getIcon('folder-trash','mail'),              handler: function() {				 Requests.deleteSelectedMessages(true, searchMailGrid);              }            };            var move_MenuItem = new Ext.menu.Item({              text: 'Move To',			  disabled: (UI.gridNumber == "3")? true: false,              icon: Eve.Resource.getIcon('move-to', 'mail'),              cls: 'x-btn-text-icon',              menu: []            });            var activateHandler = function(baseItem) {                            var params = {                 holderMenu: move_MenuItem                ,menuItemHandler: function(item) { Requests.moveSelectedMessages(item, id, Ext.getCmp("mail-search-grid")); }                ,moreMenuItemHandler: function() { Requests.MailFolder.getFirstLevelTree(                                                    function() {                                                      UI.openMoveMessagesFolder(id,false, grid /* right clicked row id */);                                                    } /* handler */                                                  );}               ,disableFolder	: false              };                              Helpers.moveMenuFiller(params);            };            move_MenuItem.on('activate', activateHandler);			if(Eve.Preference.getBoolean('MyContacts') || Eve.Preference.getBoolean('SharedContacts')){				var addSenderToContacts_MenuItem = {				  text: 'Add Sender to Contacts',				  disabled: (selectionCount > 1)? true: false,				  icon: Eve.Resource.getIcon('add-to-contact','mail'),				  handler: function() {					var func = function(){						var mailAdd = "";						var fName = "";						var lName = "";						var fullName ="";						var mailIndex = -1;						var fr = row.data.from.trim() ;						fr = fr.replace("<", " " ).replace(">", "  " ).replace("&gt;", " " ).replace("&lt;", " " ).replace("&quot;", " " ).replace('"', " " );						var fromAr = fr.match(/[ ]*(((.*?)[ ]+)?(.*?)[ ]+)?(.*)/i);						if(fromAr[5].indexOf("@") != -1 )						  mailIndex =  5 ;						if( mailIndex>= 0)						  mailAdd = fromAr[mailIndex];						for (var i = 3; i< mailIndex; i++)						{							if(i == 3){							  if(fromAr[i])								fName = fromAr[i];							}							else if(i == 4){							  if(fromAr[i])								lName = fromAr[i];							}						}						fullName = fName + " " + lName;						Eve.Resource.superbridge.broadcast( window, 'contact_create_from_mail_dlg',{mode:'create',isFromMail: true, mail: ''+mailAdd+'',fName:''+fName+'',lName:''+lName+'',fullName:''+fullName+'',info: {id:0,parentId: 0, path: '\\',root:'personal'}});					  }					  Eve.Resource.superbridge.broadcast (window, 'proxy_dialog', { type:'contact', func: func } );				  }				};			}			            var reply_MenuItem = {              text: 'Reply',              icon: Eve.Resource.getIcon('reply','mail'),              disabled: (selectionCount > 1)? true: false,              handler: function() {                Requests.loadMailForm('reply', id, {gridNumber: UI.gridNumber});              }            };            var replyToAll_MenuItem = {              text: 'Reply to All',              icon: Eve.Resource.getIcon('reply-all','mail'),              disabled: (selectionCount > 1)? true: false,              handler: function() {                Requests.loadMailForm('replytoall', id, {gridNumber: UI.gridNumber});              }            };            var forward_MenuItem = {              text: 'Forward',              icon: Eve.Resource.getIcon('forward','mail'),              disabled: (selectionCount > 1)? true: false,              handler: function() {                Requests.loadMailForm('forward', id, {gridNumber: UI.gridNumber});              }            };            var moveToSpam_MenuItem = {              text: (State.getSpamFolderInfo().id === row.get('parentId'))?'Remove from Spam': 'Move to Spam',              icon: (State.getSpamFolderInfo().id === row.get('parentId'))? Eve.Resource.getIcon('remove-from-spam','mail'): Eve.Resource.getIcon('move-to-spam','mail'),              disabled: (UI.gridNumber == "3")? true: false,              handler: function() {                if(State.getSpamFolderInfo().id === row.get('parentId')){                  mailFolders.getRootNode().eachChild(function(node){                    if(node.attributes.system === 'Inbox'){                      var desId = node.id;                      Requests.moveSelectedMessages({id: desId.split('_')[1], title: 'In-Box', path: node.attributes.path}, id);                    }                  });                                   }                 else{                  Requests.Mail.spamSelectedMessages(grid);                  }              }            };            var markAsRead_MenuItem = {              text: 'Mark as Read',			  id: 'searchgrid_mark_read',              icon: Eve.Resource.getIcon('mark-read','mail'),              cls: 'x-btn-text-icon',			  disabled: (UI.gridNumber == "3")? true: false,              hidden: true,              handler: function() {                Requests.markSelectedMessages('read', id, grid);              }            };            var markAsUnread_MenuItem = {              text: 'Mark as Unread',			  id: 'searchgrid_mark_unread',              icon: Eve.Resource.getIcon('mark-unread','mail'),              cls: 'x-btn-text-icon',			  disabled: (UI.gridNumber == "3")? true: false,              hidden:true,              handler: function() {                Requests.markSelectedMessages('unread', id, grid);              }            };            var flag_MenuItem = {              text: 'Flag',			  id: 'searchgrid_flag',              icon: Eve.Resource.getIcon('flag-red','mail'),			  disabled: (UI.gridNumber == "3")? true: false,              hidden:true,                    handler: function() {                Requests.markSelectedMessages('flag', id, grid);              }            };            var clearFlag_MenuItem = {              text: 'Clear Flag',			  id: 'searchgrid_unflag',              icon: Eve.Resource.getIcon('flag-clear','mail'),              cls: 'x-btn-text-icon',			  disabled: (UI.gridNumber == "3")? true: false,              hidden:true,                    handler: function() {                Requests.markSelectedMessages('unflag', id, grid);              }            };			var convertToTask_MenuItem = {			  text: 'Convert to Task',			  id: 'searchgrid_converttotask',			  icon: Eve.Resource.getIcon('new-project','task'),			  disabled: (selectionCount > 1 || UI.gridNumber == "3")? true: false,			  cls: 'x-btn-text-icon',			  handler: function() {					gridData.convertToTask = Requests.Mail.convertToTask;					gridData.fromSearchGrid = true;					Eve.Resource.superbridge.broadcast(this, 'open_task_tree_dlg', gridData);			  }			};            var menuItems = [];            menuItems.push( open_MenuItem );            //if (State.isDraftsFolderSelected() !== true){              menuItems.push( openInWin_MenuItem ) ;           // }                        menuItems.push(               delete_MenuItem,              move_MenuItem                         )			   		   if( Eve.Preference.getBoolean('MyContacts') || Eve.Preference.getBoolean('SharedContacts'))			   menuItems.push(addSenderToContacts_MenuItem)                        menuItems.push(              '-',              reply_MenuItem,              replyToAll_MenuItem,              forward_MenuItem            );            menuItems.push(              '-',              moveToSpam_MenuItem            );            menuItems.push('-', markAsRead_MenuItem, markAsUnread_MenuItem);            menuItems.push('-', flag_MenuItem, clearFlag_MenuItem);		   if( Eve.Preference.getBoolean('mytasks') || Eve.Preference.getBoolean('SharedTasks'))			   menuItems.push('-',convertToTask_MenuItem)			var menu = new Ext.menu.Menu({              items: menuItems            });                      if( State.isDraftsFolderSelected() ){              for( var i =5; i < 9; i++){                menu.items.items[i].hide();              }                        }            else {              for( var i =5; i < 9; i++){                menu.items.items[i].show();              }            }                                    var rec = grid.store.getAt(rowIndex);			if(rec.get('new') == 0 ){			  menu.items.get('searchgrid_mark_unread').show();			  menu.items.get('searchgrid_mark_read').hide();			}			else			{			  menu.items.get('searchgrid_mark_read').show();			  menu.items.get('searchgrid_mark_unread').hide();			 }		   if(rec.get('isflagged') == 0 ){			  menu.items.get('searchgrid_unflag').hide();			  menu.items.get('searchgrid_flag').show();			}			else			{			 menu.items.get('searchgrid_flag').hide();			  menu.items.get('searchgrid_unflag').show();			 }            menu.showAt(e.getXY());                      });      var searchMailPanel = new Ext.Panel({        title: 'Search Mail',        closable: true,        id: 'mail-search-form',        layout: 'border',        items: [          searchMailForm,          searchMailGrid        ]      });      mailCenter.add(searchMailPanel);	  searchMailPanel.setTitle(searchTitle);      mailCenter.setActiveTab(searchMailPanel);      searchMailPanel.doLayout();    },	mailFolderProperties: function(node, data) {      var template = new Ext.XTemplate(        '<table cellspacing="10px" class="mail-properties-table">',        '<tr><td class="title">Folder Name</td><td>{title}</td></tr>',        '<tr><td class="title">Total Size</td><td>{size}</td></tr>',        '<tr><td class="title">Total Messages</td><td>{messageCount}</td></tr>',        '<tr><td class="title">Unread Messages</td><td>{unreadMessageCount}</td></tr>',        '</table>'      );      var html = template.apply(data);      var buttons = [];      if(node.attributes.title === "Trash") {        var purgeButton = new Ext.Button({          text: 'Purge Trash',          handler: function() {            //Requests.MailFolder.purgeMessages(node);            dialogs.confirmDelete('Are you sure you want to delete all the contents of the "' + node.attributes.title + '" folder?', Requests.MailFolder.purgeMessages);          }        });        buttons.push(purgeButton);      }      if(node.attributes.title === "Spam" || node.attributes.title === "Quarantine" ) {        var deleteAllMessagesButton = new Ext.Button({          text: 'Delete All Messages',          handler: function() {            //Requests.MailFolder.purgeMessages(node);            dialogs.confirmDelete('Are you sure you want to delete all the contents of the "' + node.attributes.title + '" folder?', Requests.MailFolder.purgeMessages);          }        });        buttons.push(deleteAllMessagesButton);      }      //Close button      var okButton = new Ext.Button({        text: 'Close',        handler: function() {          myWindow.close();        }      });      buttons.push(okButton);      var myWindow = new Ext.Window({        animateTarget: node.ui.elNode,        width: 300,        height: 200,        resizable: false,        title: 'Properties',        modal: true,        items: [          new Ext.Panel({            bodyStyle: 'background: transparent;',            border: false,            html: html          })        ],        buttons: buttons      });      myWindow.show();    }  };  var processId = function(rawId) {    return parseInt(rawId.split('_')[1], 10);  };  var getSelectedMessages = function(grid) {    //console.log("mailGridPanel is visible: ", mailGridPanel.isVisible());    //console.log("popMailGridPanel is visible: ", popMailGridPanel.isVisible());    grid = grid || Ext.getCmp('mail_grid');    return grid.getSelectionModel().getSelections();  };  //Pass in the rowIndex in case row/s aren't selected but catch the specific row which was right-clicked  var getSelectedMessageIds = function(grid) {    grid = grid || Ext.getCmp('mail_grid');    var tempSelection = grid.getSelectionModel().selections.keys;    var selection = [];    for(var i=0, len=tempSelection.length; i<len; i++) {      selection.push(processId(tempSelection[i]));    }    return selection;  };  // Pass in the rowIndex in case row/s aren't selected but catch the specific	// row which was right-clicked  var getSelectedMessageCurFolderIds = function(grid) {    grid = grid || Ext.getCmp('mail_grid');    var items = grid.getSelectionModel().selections.items;    var selection = [];    for(var i=0, len=items.length; i<len; i++) {    	if (items[i].data['parentId'] === undefined )    		continue;      selection.push(processId(items[i].data['parentId']));    }    return selection;  };    // ------------------------------------------ Center Section	// -------------------------------------  // *************** Grid Panel  var mailGridPanel_DataStore = new Ext.data.Store({    url: Eve.url,    remoteSort: true,    reader: mailGrid.XmlReader  });  mailGridPanel_DataStore.setDefaultSort('sendDate', 'DESC');  mailGridPanel_DataStore.on("beforeload", function(store, options) {    if(options.params && typeof options.params.forcePaging !== "undefined") {      this.baseParams.event = ServiceEvents.changeStartItemNumber;      delete options.params.forcePaging;      return true;    }        if(options.params && typeof options.params.forceSelect !== "undefined") {      this.baseParams.event = ServiceEvents.getMailboxItems;      delete options.params.forceSelect;      return true;    }    this.baseParams.event = ServiceEvents.changeOrderBy;    return true;  });  mailGridPanel_DataStore.on('load', function(store, records, options) {    UI.updateGeneralTabTitle();    UI.updatePreviewDummy("normal");    var hdCheckbox = Ext.getCmp('mail_grid').getEl().select('.x-grid3-hd-checker-on');    if(hdCheckbox) hdCheckbox.removeClass('x-grid3-hd-checker-on');		if (!store.lastOptions){		var selectedNode = 	mailFolders.getSelectionModel().getSelectedNode();		store.lastOptions = {};		store.lastOptions.params = {};		try {			store.lastOptions.params.event	= ServiceEvents.changeStartItemNumber;			store.lastOptions.params.id		= selectedNode.attributes['id'].split("_")[1];			store.lastOptions.params.limit	= Eve.Preference.get('itemsperpage');			store.lastOptions.params.start	=  0;		} catch(e) {}	}    /*    var count = mailGridPanel_DataStore.totalLength;    var countMessage = "";    if(count == 0) {      countMessage = "No Messages";    }    else {      if(count == 1) {        countMessage = "1 Message";      }      else {        countMessage = count + " Messages";      }    }    if(typeof State.getCurrentSelectedFolderNode().attributes.originalText === "undefined") {      State.getCurrentSelectedFolderNode().attributes.originalText = State.getCurrentSelectedFolderNode().attributes.text;    }    generalTab.setTitle( State.getCurrentSelectedFolderNode().attributes.originalText + " (" + countMessage + ")" );    */  });  var mailGridPanel_ColumnModel_From = mailGrid.ColumnModel_From;  var mailGridPanel_ColumnModel_To = mailGrid.ColumnModel_To;  var mailGridPanel_PagingToolbar = new Ext.ux.mail.PagingToolbar({    store: mailGridPanel_DataStore,    pageSize: 20,	refreshText: 'Refresh Mail',    displayInfo: true,	items: [		'-',{        text: (Eve.Preference.getBoolean('mailViewingStyle') == false)?'Show Preview': 'Hide Preview',		id: 'btn_show_hide_preview',        handler: function(btn, pressed){			if(btn.getText() == 'Show Preview'){				mailPreviewPanel.expand();			}			else {				mailPreviewPanel.collapse();			}		}    }	],    displayMsg: 'Displaying messages {0} - {1} of {2}',    emptyMsg: "No messages to display"      });  var mailGridPanel = new Ext.grid.EditorGridPanel({    id: 'mail_grid',    region: 'center',    border: false,    style: 'border-bottom: 1px solid #D0D0D0;',    stripeRows: true,    loadMask: true,    enableHdMenu: false,    enableDragDrop: true,    ddGroup: 'ddMail',    plugins: flagColumn,     store: mailGridPanel_DataStore,    sm: new Ext.grid.CheckboxSelectionModel(),    cm: mailGrid.ColumnModel_From,    bbar: mailGridPanel_PagingToolbar  });  //Timer used to prevent two single click events when doing a double click  var doubleClickTimer = null;  mailGridPanel.on('render', function(){	if(Eve.Preference.get('mailgrid')){		mailGridPanel.store.loadData(Eve.Preference.get('mailgrid'));	}  });  mailGridPanel.on('rowdblclick', function(grid, rowIndex, e) {    clearTimeout(doubleClickTimer);    doubleClickTimer = null;    if(State.isDraftsFolderSelected()) {      var row = grid.getStore().getAt(rowIndex);      var gridData = row.data;      var gridId = gridData.id;      var id     = processId(gridData.id);      Requests.loadMailForm("draft", id);      return;    }    if(e.shiftKey) {      //Open selected mail message in a new browser tab if Shift + DoubleClick      Requests.Mail.open(grid, rowIndex, false, "window", false);    }    else {      Requests.Mail.open(grid, rowIndex, false, "tab", false);    }  });  var hdlColResizeMove = function(oldIdx, newIdx){  	var columns = mailGridPanel.getColumnModel().config;		var data	= [];				for (var i = 0; i < columns.length; ++i) {			var col = columns[i];						if (col.dataIndex != '') {				data.push(col.dataIndex + ':' + col.width);			}		}				var tree	= Eve.Preference.get('tree');		var nodes	= tree['mail'].nodes;		var id		= 0;				for (var i = 0; i < nodes.length; ++i) {			var node = nodes[i];						if (id == nodes[i].id.split('_')[1]) {							node.set('columns', data.join(','));				node.set('columnsChanged', true);				break;			}		}     };  mailGridPanel.on('columnresize', hdlColResizeMove);  mailGridPanel.on('columnmove', hdlColResizeMove);    //Setting Mail      mailGridPanel.on('rowclick', function(grid, rowIndex, e) {        //[TODO] Find a more fool-proof solution for distinguishing between the row being selected by the checkbox or not        var isCheckboxClicked = ( (e.getTarget().className.match(/\w*row-checker/) === null) && (e.getTarget().className.match(/\w*td-checker/) === null) ) ? false: true;        if( processId(grid.getStore().getAt(rowIndex).id) == State.currentPreviewItemId) {          return;        }        if(e.shiftKey || e.ctrlKey || isCheckboxClicked) {          UI.updatePreviewDummy("normal");          State.currentPreviewItemId = null;        }        else {          if(doubleClickTimer === null) {            doubleClickTimer = setTimeout(function() {              mailGridPanel.getSelectionModel().clearSelections();              mailGridPanel.getSelectionModel().selectRow(rowIndex);              Requests.Mail.preview(grid, rowIndex);              clearTimeout(doubleClickTimer);              doubleClickTimer = null;            }, 500);          }        }      }, this, { buffer: 10 }); //}  mailGridPanel.on('rowcontextmenu', function(grid, rowIndex, e) {    e.stopEvent();		    var row = grid.getStore().getAt(rowIndex);    var gridData = row.data;    var selectionCount = grid.getSelectionModel().getCount();    if( selectionCount > 1 )        grid.getSelectionModel().selectRow(rowIndex, true);    else        grid.getSelectionModel().selectRow(rowIndex);                var gridId = gridData.id;    var id     = processId(gridData.id);    // Menu Items    var open_MenuItem = {      text: (State.isDraftsFolderSelected() === true)? 'Edit Draft': 'Open',      icon: Eve.Resource.getIcon('opened-mail','mail'),      disabled: (selectionCount > 1)? true: false,      handler: function() {        if(State.isDraftsFolderSelected()) {          Requests.loadMailForm("draft", id);        }        else {          Requests.Mail.open(grid, rowIndex, false, "tab", false);        }      }    };        var openInWin_MenuItem = {      text: 'Open in New Window',      icon: Eve.Resource.getIcon('open-new-win','mail'),	  disabled: (selectionCount > 1)? true: false,      handler: function() {          Requests.Mail.open(grid, rowIndex, false, "window", false, true);                }    };        var delete_MenuItem = {      text: 'Delete',      icon: Eve.Resource.getIcon('folder-trash','mail'),      handler: function() {        if( State.isTrashFolderSelected() ) {          dialogs.confirmDelete("Are you sure you want to delete the selected messages?", function(confirmButtonId) {            var confirmButtonId = confirmButtonId || null;            //If user answers NO to the deletion operation            if(confirmButtonId === "no") {              return;            }            Requests.deleteSelectedMessages();          });        }        else {          Requests.deleteSelectedMessages();        }      }    };    var move_MenuItem = new Ext.menu.Item({      text: 'Move To',      icon: Eve.Resource.getIcon('move-to','mail'),      cls: 'x-btn-text-icon',      menu: []    });    var activateHandler = function(baseItem) {            var params = {         holderMenu: move_MenuItem        ,menuItemHandler: function(item) { Requests.moveSelectedMessages(item, id); }        ,moreMenuItemHandler: function() { Requests.MailFolder.getFirstLevelTree(                                            function() {                                              UI.openMoveMessagesFolder(id /* right clicked row id */);                                            } /* handler */                                          );}      };              Helpers.moveMenuFiller(params);    };    move_MenuItem.on('activate', activateHandler);		if(Eve.Preference.getBoolean('MyContacts') || Eve.Preference.getBoolean('SharedContacts')){		var addSenderToContacts_MenuItem = {		  text: 'Add Sender to Contacts',		  disabled: (selectionCount > 1)? true: false,		  icon: Eve.Resource.getIcon('add-to-contact','mail'),		  handler: function() {			var func = function(){				var mailAdd = "";				var fName = "";				var lName = "";				var fullName ="";				var mailIndex = -1;				var fr = row.data.From.trim() ;				fr = fr.replace("<", " " ).replace(">", "  " ).replace("&gt;", " " ).replace("&lt;", " " ).replace("&quot;", " " ).replace('"', " " );				/*var fromAr = fr.match(/[ ]*(((.*?)[ ]+)?(.*?)[ ]+)?(.*)/i);								if(fromAr[5].indexOf("@") != -1 )				  mailIndex =  5 ;				if( mailIndex>= 0)				  mailAdd = fromAr[mailIndex];				for (var i = 3; i< mailIndex; i++)				{					if(i == 3){					  if(fromAr[i])						fName = fromAr[i];					}					else if(i == 4){					  if(fromAr[i])						lName = fromAr[i];					}				}				fullName = fName + " " + lName;				*/			   				var mailAdd = "";				var fName = "";				var mName = "";				var lName = "";				var fullName ="";				var mailIndex = -1;				var fr = row.data.From.trim() ;					fr = fr.replace(/[ ]+/g, ' ');				var arr = fr.split(' ');				if (arr[arr.length - 1].indexOf("@") !== -1)				{					 mailAdd = arr[arr.length - 1];					arr.pop();					fr = arr.join(' ');				}				else					return									if (fr.split(' ').length >= 1)		                fName = fr.split(' ')[0];		            if (fr.split(' ').length == 2)		            {		                lName = fr.split(' ')[1];		            }		            else if (fr.split(' ').length > 2)		            {		                mName = fr.split(' ')[1];		                lName = fr.split(' ')[2];		            }				fullName = fName + (mName ? ' ' + mName : '') + ' ' + lName;								Eve.Resource.superbridge.broadcast( window, 'contact_create_from_mail_dlg',{mode:'create',isFromMail: true, mail: ''+mailAdd+'',fName:''+fName+'',mName:''+mName+'',lName:''+lName+'',fullName:''+fullName+'',info: {id:0,parentId: 0, path: '\\',root:'personal'}});			  }			  Eve.Resource.superbridge.broadcast (window, 'proxy_dialog', { type:'contact', func: func } );		  }		};	}	    var reply_MenuItem = {      text: 'Reply',      icon: Eve.Resource.getIcon('reply','mail'),      disabled: (selectionCount > 1)? true: false,      handler: function() {        Requests.loadMailForm('reply', id);      }    };    var replyToAll_MenuItem = {      text: 'Reply to All',      icon: Eve.Resource.getIcon('reply-all','mail'),      disabled: (selectionCount > 1)? true: false,      handler: function() {        Requests.loadMailForm('replytoall', id);      }    };    var forward_MenuItem = {      text: 'Forward',      icon: Eve.Resource.getIcon('forward','mail'),      disabled: (selectionCount > 1)? true: false,      handler: function() {        Requests.loadMailForm('forward', id);      }    };    var moveToSpam_MenuItem = {      text: (State.isSpamFolderSelected() === true)?'Remove from Spam': 'Move to Spam',      icon: (State.isSpamFolderSelected() === true)? Eve.Resource.getIcon('remove-from-spam','mail'): Eve.Resource.getIcon('move-to-spam','mail'),      //disabled: (State.isSpamFolderSelected() === true)? true: false,      handler: function() {        if(State.isSpamFolderSelected() === true){          mailFolders.getRootNode().eachChild(function(node){            if(node.attributes.system === 'Inbox'){              var desId = node.id;              Requests.moveSelectedMessages({id: desId.split('_')[1], title: 'In-Box', path: node.attributes.path}, id);//path is required            }          });                   }         else{          Requests.Mail.spamSelectedMessages();          }      }    };    var markAsRead_MenuItem = {      text: 'Mark as Read',	  id: 'mailgrid_mark_read',      icon: Eve.Resource.getIcon('mark-read','mail'),      cls: 'x-btn-text-icon',      hidden: true,      handler: function() {        Requests.markSelectedMessages('read', id);      }    };    var markAsUnread_MenuItem = {      text: 'Mark as Unread',	  id: 'mailgrid_mark_unread',      icon: Eve.Resource.getIcon('mark-unread','mail'),      cls: 'x-btn-text-icon',      hidden:true,      handler: function() {        Requests.markSelectedMessages('unread', id);      }    };    var flag_MenuItem = {      text: 'Flag',	  id: 'mailgrid_flag',      icon: Eve.Resource.getIcon('flag-red','mail'),      hidden:true,            handler: function() {        Requests.markSelectedMessages('flag', id);      }    };    var clearFlag_MenuItem = {      text: 'Clear Flag',	  id: 'mailgrid_unflag',      icon: Eve.Resource.getIcon('flag-clear','mail'),      cls: 'x-btn-text-icon',      hidden:true,            handler: function() {        Requests.markSelectedMessages('unflag', id);      }    };    var menuItems = [];    menuItems.push( open_MenuItem );    //if (State.isDraftsFolderSelected() !== true){      menuItems.push( openInWin_MenuItem ) ;   // }	var convertToTask_MenuItem = {	  text: 'Convert to Task',	  id: 'mailgrid_converttotask',	  icon: Eve.Resource.getIcon('new-project','task'),	  disabled: (selectionCount > 1)? true: false,	  cls: 'x-btn-text-icon',	  handler: function() {			gridData.convertToTask = Requests.Mail.convertToTask;			Eve.Resource.superbridge.broadcast(this, 'open_task_tree_dlg', gridData);	  }	};		    menuItems.push(       delete_MenuItem,      move_MenuItem   ) ;	if(Eve.Preference.getBoolean('MyContacts') || Eve.Preference.getBoolean('SharedContacts')){		menuItems.push( addSenderToContacts_MenuItem )	}        menuItems.push(      '-',      reply_MenuItem,      replyToAll_MenuItem,      forward_MenuItem    );    menuItems.push(      '-',      moveToSpam_MenuItem    );    menuItems.push('-', markAsRead_MenuItem, markAsUnread_MenuItem);    menuItems.push('-', flag_MenuItem, clearFlag_MenuItem);    if(Eve.Preference.getBoolean('mytasks')|| Eve.Preference.getBoolean('sharedtasks')){		menuItems.push('-', convertToTask_MenuItem);	}    var menu = new Ext.menu.Menu({      items: menuItems    });      if( State.isDraftsFolderSelected() ){      for( var i =5; i < 9; i++){        menu.items.items[i].hide();      }        }    else {      for( var i =5; i < 9; i++){        menu.items.items[i].show();      }    }    var rec = grid.store.getAt(rowIndex);    if(rec.get('new') == 0 ){      menu.items.get('mailgrid_mark_unread').show();      menu.items.get('mailgrid_mark_read').hide();    }    else    {      menu.items.get('mailgrid_mark_read').show();      menu.items.get('mailgrid_mark_unread').hide();     }   if(rec.get('isflagged') == 0 ){      menu.items.get('mailgrid_unflag').hide();      menu.items.get('mailgrid_flag').show();    }    else    {     menu.items.get('mailgrid_flag').hide();      menu.items.get('mailgrid_unflag').show();     }       menu.showAt(e.getXY());  });  // ************ Preview Panel    //Setting Mail  var mailPreviewPanel_Body = {    autoScroll: false,    region: 'center',    border: false,    bodyStyle: 'font-family: arial; font-size: 14px; padding: 0px;',    html: '<div id="mail-preview-body"><div id="ghazal_attach"></div></div><iframe src="/hyperoffice2nd/views/Styles/ModernStyle/mail/blank.html" name="mailBodyFrame" id="mailBodyFrame" style="width: 100%; height: 100%; border: none;"></iframe><div>'    //html: (Ext.isGecko) ?'<div id="mail-preview-body"></div>' :    //'<div id="mail-preview-body"><iframe src="/hyperoffice2nd/views/Styles/ModernStyle/mail/blank.html" name="mailBodyFrame" id="mailBodyFrame" style="width: 100%; height: 100%; border: none;"></iframe></div>'};  var mailPreviewPanel_Header = {    region: 'north',    height: 110,    id    : 'mail-previewpanel-header',    border: false,    bodyStyle: 'background-color: #f5f5f5; border-bottom: 1px solid gray; font-family: arial; font-size: 12px; padding: 10px;',    html: '<div id="mail-preview-header"><div style="text-align:center;padding-top:28px;">click on a message in the above frame to view it.</div></div>'  };  var mailPreviewPanel = new Ext.Panel({    region: 'south',    id:'mail-preview-panel',	collapsedCls: 'ghazalZZ',    split: true,    border: false,    collapsed: (Eve.Preference.getBoolean('mailViewingStyle') == false)? true : false,    style: 'border-top: 1px solid #D0D0D0;',    height: 300,    collapsible: true,    autoScroll: true,    collapseMode: 'mini',    title:'Preview',    layout: 'border',    items: [      mailPreviewPanel_Header,      mailPreviewPanel_Body    ]  });  mailPreviewPanel.on('collapse', function() {	//For mail setting	Eve.Preference.set('mailViewingStyle', false);	Ext.getCmp('btn_show_hide_preview').setText('Show Preview');  });    mailPreviewPanel.on('expand', function() {	//For mail setting	Eve.Preference.set('mailViewingStyle', true);	Ext.getCmp('btn_show_hide_preview').setText('Hide Preview');    var currentSelectedRecord = mailGridPanel.getSelectionModel().getSelected();    if(typeof currentSelectedRecord === "undefined") {      return;    }    var currentSelectedRecordId = currentSelectedRecord.id;    var fromCache = Caches.mailItemCache.getFromCache(currentSelectedRecordId);    if(fromCache !== false) {      UI.previewMessage(fromCache.data.row, false /* popMail */);    }    else {      Requests.Mail.preview(mailGridPanel, mailGridPanel.getStore().indexOfId(currentSelectedRecordId));    }  });  var previewPanelMask = null;  //==============  var deleteToolbarItem = new Ext.Toolbar.Button({    text: 'Delete',    icon: Eve.Resource.getIcon('folder-trash','mail'),    cls: 'x-btn-text-icon',    tooltip: { title: 'Delete', text: 'Move selected messages to trash folder' },    disabled: true,    handler: function() {      if( State.isTrashFolderSelected() ) {        dialogs.confirmDelete("Are you sure you want to delete the selected messages?", Requests.deleteSelectedMessages);      }      else {        Requests.deleteSelectedMessages();      }    }  });  var markToolbarItem = new Ext.Toolbar.Button({    text: 'Mark',    disabled: true,    icon: Eve.Resource.getIcon('mark','mail'),    cls: 'x-btn-text-icon',    menu: new Ext.menu.Menu({      items: [        {          text: 'Flag',          icon: Eve.Resource.getIcon('flag-red','mail'),          handler: Requests.markSelectedMessages.createDelegate(this, ['flag'])        },        {          text: 'Clear Flag',          icon: Eve.Resource.getIcon('flag-clear','mail'),          handler: Requests.markSelectedMessages.createDelegate(this, ['unflag'])        },        '-',        {          text: 'Mark as Read',          icon: Eve.Resource.getIcon('mark-read','mail'),          handler: Requests.markSelectedMessages.createDelegate(this, ['read'])        },        {          text: 'Mark as Unread',          icon: Eve.Resource.getIcon('mark-unread','mail'),          handler: Requests.markSelectedMessages.createDelegate(this, ['unread'])        }      ]    })  });  var selectToolbarItem = new Ext.Toolbar.Button({    text: 'Select',    disabled: false,    menu: new Ext.menu.Menu({      items: [        {          text: 'All',          handler: function() {            mailGridPanel.getSelectionModel().selectAll();          }        },        {          text: 'None',          handler: function() {            mailGridPanel.getSelectionModel().clearSelections();          }        },        '-',        {          text: 'All Flagged',          disabled: true        },        {          text: 'All Unflagged',          disabled: true        },        '-',        {          text: 'All Read',          disabled: true        },        {          text: 'All Unread',          disabled: true        }      ]    })  });  var replyToolbarItem = new Ext.Toolbar.Button({    text: 'Reply',    icon: Eve.Resource.getIcon('reply','mail'),    cls: 'x-btn-text-icon',    tooltip: { title: 'Reply', text: 'Reply back to the sender of the selected message' },    disabled: true,    handler: function() {      var id = processId(mailGridPanel.getSelectionModel().getSelected().data.id);      Requests.loadMailForm('reply', id);    }  });  var replyAllToolbarItem = new Ext.Toolbar.Button({    text: 'Reply to All',    icon: Eve.Resource.getIcon('reply-all','mail'),    cls: 'x-btn-text-icon',    tooltip: { title: 'Reply to All', text: 'Reply to all recepients of the selected message' },    disabled: true,    handler: function() {      var id = processId(mailGridPanel.getSelectionModel().getSelected().data.id);      Requests.loadMailForm('replytoall', id);    }  });  var forwardToolbarItem = new Ext.Toolbar.Button({    text: 'Forward',    icon: Eve.Resource.getIcon('forward','mail'),    cls: 'x-btn-text-icon',    tooltip: { title: 'Forward', text: 'Forward the message to new recepient/s' },    disabled: true,    handler: function() {      var id = processId(mailGridPanel.getSelectionModel().getSelected().data.id);      Requests.loadMailForm('forward', id);    }  });  var spamToolbarItem = new Ext.Toolbar.Button({    text: 'Move to Spam',    icon: Eve.Resource.getIcon('move-to-spam','mail'),    cls: 'x-btn-text-icon',    disabled: true,    id: 'mail_spam_toolbar',    handler: function() {      if(State.isSpamFolderSelected() === true){          var id = processId(mailGridPanel.getSelectionModel().getSelected().data.id);                mailFolders.getRootNode().eachChild(function(node){            if(node.attributes.system === 'Inbox'){              var desId = node.id;              Requests.moveSelectedMessages({id: desId.split('_')[1], title: 'In-Box', path: node.attributes.path}, id);//path is required            }          });     }     else{            Requests.Mail.spamSelectedMessages();     }    }  });     var moveToolbarItem = new Ext.Toolbar.Button({    text: 'Move To',    icon:Eve.Resource.getIcon('move-to','mail'),    cls: 'x-btn-text-icon',    disabled: true,    menu: new Ext.menu.Menu({ items: [] })  });  moveToolbarItem.on('menushow', function(button, e) {		var params = {      holderMenu: moveToolbarItem      ,menuItemHandler: function(item) {        Requests.moveSelectedMessages(item);                 }      ,moreMenuItemHandler: function() { UI.openMoveMessagesFolder(); }	  ,gridData : mailGridPanel.getSelectionModel().getSelected().data    };    Helpers.moveMenuFiller(/*moveToolbarItem, function(item) {Requests.moveSelectedMessages(item); }, function() { UI.openMoveMessagesFolder(); }*/params );  });    var generalTab_Toolbar = new Ext.Toolbar({    items: [      new Ext.Toolbar.SplitButton({        text: 'New',        icon: Eve.Resource.getIcon('new', 'general'),        cls: 'x-btn-text-icon',        tooltip: { title: 'Compose', text: 'Compose a new email message' },        handler: function() {          Requests.loadMailForm('new');        },        menu : [{					text 	: 'Email',          icon: Eve.Resource.getIcon('compose','mail'),          cls: 'x-btn-text-icon',					handler: function(){Requests.loadMailForm('new');}				}, {					text 	: 'Folder',          icon: Eve.Resource.getIcon('folder','mail'),          cls: 'x-btn-text-icon',					handler: function(){Requests.MailFolder.getFirstLevelTree(function() { UI.openNewMailboxFolder(rootNode); } );}				}]      }),      '-',      deleteToolbarItem,      spamToolbarItem,      '-',      replyToolbarItem,      replyAllToolbarItem,      forwardToolbarItem,      '-',      //selectToolbarItem,      markToolbarItem,      moveToolbarItem,      '-',      /*{        text: 'Search',        disabled: false,        icon: Eve.Resource.getIcon('btn-search','mail'),        cls: 'x-btn-text-icon',        tooltip: { title: 'Search', text: 'Search for messages within your mailboxes' },        handler: function() {          //UI.searchMail();          Requests.Search.loadForm();        }      },*/	  new Ext.Toolbar.SplitButton({				text 		: 'Search'				,handler	: function() {					Requests.Search.loadForm(2 /*gridNumber*/);				}				,menu 		: [{					text 		: 'Search'					,handler	: function() {						Requests.Search.loadForm(2/*gridNumber*/);					}				}, {					text 		: 'Search In Archive'					,hidden		: (Eve.Preference.get('archive') == "0") ? true : false					,handler	: function() {						var data = [							{id:'1', title: 'Inbound', depth: '0'},							{id:'2', title: 'Outbound', depth: '0'}						]						UI.searchMail({gridNumber: 3, folders: data});					}				}]			})/*,      '->',      { text: 'Settings', disabled: true }*/    ]  });    mailGridPanel.getSelectionModel().on('selectionchange', function() {    var count = mailGridPanel.getSelectionModel().getCount();    if(count !== 1 || this.__last > 1 ) {      UI.updatePreviewDummy("normal");      State.currentPreviewItemId = null;    }    if (count == 1 && (this.__last == 0 || this.__last === undefined)){          UI.updatePreviewDummy("normal");          State.currentPreviewItemId = null;    }        if(count <= 0) {        UI.disableDeleteMark();      UI.disableReplyForward();      UI.disableSpam();      UI.disableMove();    } else {      /*if(!State.isSpamFolderSelected()) {        UI.enableSpam();      }*/      UI.enableSpam();      UI.enableDeleteMark();      UI.enableMove();      if(count > 1) {        UI.disableReplyForward();      }      else {        UI.enableReplyForward();      }    }    this.__last = count;  }, this, { buffer: 50 } );  var generalTab = new Ext.Panel({    id: 'general-tab',    title: 'In-Box',    layout: 'border',    closable: false,    //correspondingTreeNode: null,    tbar: generalTab_Toolbar,    items: [      mailGridPanel,      mailPreviewPanel	  //{region:'south', title:'hi'}    ]  });  // **************** POP Accounts Grid Panel  var popMailGridPanel_DataStore = new Ext.data.Store({    url: Eve.url,    remoteSort: true,    reader: popMailGrid.XmlReader  });  popMailGridPanel_DataStore.setDefaultSort('sendDate', 'DESC');  popMailGridPanel_DataStore.on("beforeload", function(store, options) {    if(typeof options.params.forcePaging !== "undefined") {      this.baseParams.event = ServiceEvents.changeStartItemNumber_POP;      delete options.params.forcePaging;      return true;    }    if(typeof options.params.forceSelect !== "undefined") {      this.baseParams.event = ServiceEvents.getMailboxItems_POP;      delete options.params.forceSelect;      return true;    }    this.baseParams.event = ServiceEvents.changeOrderBy_POP;    return true;  });  popMailGridPanel_DataStore.on('load', function(store, records, options) {  if( Ext.getCmp('mail-preview-panel').collapsed == false )    UI.updatePreviewDummy("pop");  });  var popMailGridPanel_PagingToolbar = new Ext.PagingToolbar({    store: popMailGridPanel_DataStore,    pageSize: 20,    displayInfo: true,    displayMsg: 'Displaying messages {0} - {1} of {2}',    emptyMsg: "No messages to display"  });  var popMailGridPanel = new Ext.grid.GridPanel({    //id: 'mail-grid-panel',    region: 'center',    border: false,    style: 'border-bottom: 1px solid #D0D0D0;',    stripeRows: true,    loadMask: true,    enableHdMenu: false,    enableDragDrop: true,    store: popMailGridPanel_DataStore,    sm: new Ext.grid.CheckboxSelectionModel(),    cm: popMailGrid.ColumnModel,    bbar: popMailGridPanel_PagingToolbar  });  /////////////////////////////////////////////  //Timer used to prevent two single click events when doing a double click  var doubleClickTimer = null;  popMailGridPanel.on('rowdblclick', function(grid, rowIndex, e) {    clearTimeout(doubleClickTimer);    doubleClickTimer = null;    e.stopEvent();    if(e.shiftKey) {      //Open selected mail message in a new browser tab if Shift + DoubleClick      Requests.Mail.open(grid, rowIndex, false, "window", true);    }    else {      Requests.Mail.open(grid, rowIndex, false, "tab", true);    }  });      popMailGridPanel.on('rowclick', function(grid, rowIndex, e) {              var d = new Date();         var lastTime = Date.UTC( d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds() );                              var isCheckboxClicked = ( (e.getTarget().className.match(/\w*row-checker/) === null) && (e.getTarget().className.match(/\w*td-checker/) === null) ) ? false: true;        if ( !this.lastTime )      		this.lastTime = lastTime;                        if( processId(grid.getStore().getAt(rowIndex).id) == State.currentPreviewItemId) {          return;        }        if(e.shiftKey || e.ctrlKey || isCheckboxClicked) {          UI.updatePreviewDummy("pop");          State.currentPreviewItemId = null;        }        else {           if ( Math.abs( this.lastTime- lastTime ) < 500 ){      			this.lastTime = lastTime;		      			return false;           }            else if(doubleClickTimer === null) {            doubleClickTimer = setTimeout(function() {              Requests.Mail.preview(grid, rowIndex, "pop");              clearTimeout(doubleClickTimer);              doubleClickTimer = null;            }, 500);          }        }      }, this);  ////////////////////////////////////////  popMailGridPanel.on('rowcontextmenu', function(grid, rowIndex, e) {    e.stopEvent();    var selectionCount = grid.getSelectionModel().getCount();    if( selectionCount > 1 )        grid.getSelectionModel().selectRow(rowIndex, true);    else        grid.getSelectionModel().selectRow(rowIndex);            var startItemNumber = rowIndex + 1;    var menu = new Ext.menu.Menu({      items: [        {          text: 'Open',          icon: Eve.Resource.getIcon('opened-mail','mail'),          handler: function() {            Requests.Mail.open(grid, rowIndex, false, "tab", true);          }        },        {          text: 'Delete',          icon: Eve.Resource.getIcon('folder-trash','mail'),          handler: function() {            Requests.deleteMessage(startItemNumber, true);          }        },        '-',        {          text: 'Reply',          icon: Eve.Resource.getIcon('reply','mail'),          disabled: false,          handler: function() {            Requests.loadPOPMailForm('reply', startItemNumber);          }        },        {          text: 'Reply to All',          icon: Eve.Resource.getIcon('reply-all','mail'),          disabled: false,          handler: function() {            Requests.loadPOPMailForm('replytoall', startItemNumber);          }        },        {          text: 'Forward',          icon: Eve.Resource.getIcon('forward','mail'),          disabled: false,          handler: function() {            Requests.loadPOPMailForm('forward', startItemNumber);          }        }      ]    });    menu.showAt(e.getXY());  });  // ************ POP Account Tab Preview Panel  var popMailPreviewPanel_Body = {    autoScroll: true,    region: 'center',    border: false,    bodyStyle: 'font-family: arial; font-size: 14px; padding: 0px;',    html: '<div id="pop-mail-preview-body"><iframe src="/hyperoffice2nd/views/Styles/ModernStyle/mail/blank.html" name="popMailBodyFrame" id="popMailBodyFrame" style="width: 100%; height: 100%; border: none;"></iframe><div>'  };  var popMailPreviewPanel_Header = {    region: 'north',    height: 110,    border: false,    bodyStyle: 'background-color: #f5f5f5; border-bottom: 1px solid gray; font-family: arial; font-size: 12px; padding: 10px;',    html: '<div id="pop-mail-preview-header" ><div style="text-align:center;padding-top:28px;">click on a message in the above frame to view it.</div></div>'  };  var popMailPreviewPanel = new Ext.Panel({    region: 'south',    collapsed: ( Eve.Preference.getBoolean('mailViewingStyle')  == false)? true : false,    split: true,    border: false,    style: 'border-top: 1px solid #D0D0D0;',    height: 300,    collapsible: true,    autoScroll: true,    collapseMode: 'mini',    title:'Preview',    //hideCollapseTool: true,    layout: 'border',    items: [      popMailPreviewPanel_Header,      popMailPreviewPanel_Body    ]  });    popMailPreviewPanel.on('expand', function() {      var currentSelectedRecord = popMailGridPanel.getSelectionModel().getSelected();      if(typeof currentSelectedRecord === "undefined") {        return;      }      var currentSelectedRecordId = currentSelectedRecord.id;      var fromCache = Caches.mailItemCache.getFromCache(currentSelectedRecordId);      if(fromCache !== false) {        UI.previewMessage(fromCache.data.row, true /* popMail */);      }      else {        Requests.Mail.preview(popMailGridPanel, popMailGridPanel.getStore().indexOfId(currentSelectedRecordId), "pop");      }    });    var popPreviewPanelMask = null;  //==============  var popAccountTab = new Ext.Panel({    id: 'pop-account-tab',    title: 'POP (In-Box)',    layout: 'border',    closable: false,    hidden:true,    closable: true,    //correspondingTreeNode: null,    //tbar: generalTab_Toolbar,    items: [      popMailGridPanel,      popMailPreviewPanel    ]  });  //-----------------------------------------------------------------------------------------------  var statusBar; /*new Ext.StatusBar({    busyText: 'Please wait...'  });*/    var mailCenter = new Ext.TabPanel({    region: 'center',	//ctCls: 'ghazalZZ',    activeTab: 0,    deferredRender: false,    enableTabScroll : true,    cls: 'mail-tabpanel',    items: [      generalTab,      popAccountTab    ]        /* Override the default behaviour for "Close" action of tabs */    ,onStripMouseDown : function(e){        if(e.button != 0){            return;        }        e.preventDefault();        var t = this.findTargets(e);        if(t.close){            if ( t.item == popAccountTab ){               this.setActiveTab( generalTab );               this.hideTabStripItem( popAccountTab );               return false;            }            this.remove(t.item);            return;        }        if(t.item && t.item != this.activeTab){            this.setActiveTab(t.item);        }    }        ,listeners: {      'render': {        'fn': function( comp ){          comp.hideTabStripItem(popAccountTab);		  statusBar = Eve.StatusBar.get();        }      }    }    //bbar: statusBar  });  mailCenter.on('beforeremove', function(container, component) {    if(typeof component.editor === "undefined") {      //If receiving a non-compose tab      return true;    }    if(typeof component.forceRemove !== "undefined") {      return true;    }    if(component.editor.isDirty() || component.dirty) {      Ext.MessageBox.confirm('Confirm Action', 'You are about to close an unsaved mail. Are you sure?', function(btn) {        if(btn == 'yes'){          component.forceRemove = true;          container.remove(component);        }      }, this);      return false;    }    else {      return true;    }  });  //mailCenter.on('tabchange', WICK.hideSmartInputFloater);   mailCenter.on('tabchange', function(tabpanel, tab){	 Ext.getCmp('mail-preview-panel').doLayout();	 try{	 if(tab.id.indexOf('MPI_0new')!= -1)		tab.items.items[0].items.items[0].items.items[1].items.items[0].items.items[0].focus();	 }catch(e){}  });  //------------------------------------------- West Section --------------------------------------  var mailFolders_TreeLoader = new Ext.tree.TreeLoader({    dataUrl: Eve.url,    section: 'mail',    baseParams: {      event: ServiceEvents.getTreeNodeChildren,      Id: -1    },    preloadChildren: true  });  mailFolders_TreeLoader.on('beforeload', function(obj, node, callback) {    obj.baseParams.Id = processId(node.id);  });  mailFolders_TreeLoader.on('load', function(treeLoader, node, response) {    var tree = xml2json(response.responseXML, '').data.node;    State.folderTree = tree;  });  var rootNode = new Ext.tree.AsyncTreeNode({    text: 'All',    id: 'MPF_-1',    cls: 'ev-hide',    draggable: false,    expanded: true,    loaded  : true,    per: {      Edit: false,      Delete: false    },    system: 'All'  });  var mailFolders = new Ext.tree.TreePanel ({    region: 'center',    rightClickedNode: null,    width: 200,    minWidth: 100,    border: false,    rootVisible: true,    autoScroll: true,    enableDD: true,    ddGroup: 'ddMail',    ddAppendOnly: true,    loader: mailFolders_TreeLoader,    root: rootNode,  	listeners: {  		beforenodedrop: function(e) {        var src = e.target;        var dest = e.dropNode;        if (!e.dropNode) {                var title;          var text = e.target.attributes.system;          switch( text.toLowerCase() ){                        case'inbox':              title = 'In-Box';              break;            case 'sent items':              title = 'Sent-Mail';              break;            default:              title = e.target.attributes.title;              break;          }          //path is required          var folder = {id: e.target.id.split("_")[1], title:title, path: e.target.attributes.path};		           Requests.moveSelectedMessages(folder, null, e.data.source);        }        else{           Requests.MailFolder.move(e.dropNode.id, e.target.id/* destination node id */)        }  		},            nodedragover: function(e){          var src = e.target;          var dest = e.dropNode;          if(dest){            if (src.parentNode.id === dest.id)        			return false;                        if(src.id === dest.parentNode.id)              return false;          }        },            render: function(){        var menu = new Ext.menu.Menu({          items: [            {              text: 'New Folder...',              icon: Eve.Resource.getIcon('folder','mail'),              handler: function() {                Requests.MailFolder.getFirstLevelTree(function() { UI.openNewMailboxFolder(rootNode); } /* handler */);              }            }          ]        });                    mailFolders.el.on('contextmenu', function(e, el) {          if(Ext.get(el).dom.className.indexOf('x-panel-body') != -1){            e.stopEvent();            menu.showAt(e.getXY());          }        });                //*********load mail folders from cache      var folders = Eve.Preference.get('mailfolders');		  for(var i=0, len = folders.length; i< len; i++){			var record = folders[i]			//if (record.get('depth') == 1 || record.get('type') == 'group') {				var node = mailFolders_TreeLoader.createNode(record, mailFolders);				if(record.get('parentId') == "MPF_-1")					rootNode.appendChild(node)				else{					var parentNode = mailFolders.getNodeById(record.get('parentId'))					parentNode.appendChild( node );					parentNode.loaded = true;				}			//}		  }              },            expandnode : function(node){        UI.updateTreeUnreadCount(node);      }  	}  });  mailFolders.on('expandnode', function(node){	if(node.text === "All"){		mailFolders.suspendEvents();		node.firstChild.select();		mailFolders.resumeEvents();	}  }, this);    mailFolders.on('load', function(node) {    //var nodeId = processId(mailFolders.root.firstChild.id);    if(node.text === "All") {      var nodeId = processId(node.firstChild.id);      setTimeout(function() {node.firstChild.select(); }, 10); //cause a delay for the tree nodes to be added into the DOM      Requests.loadMailboxGrid(nodeId);      UI.updateTreeUnreadCount(mailFolders.root);    }    //else       //mailFolders.fireEvent('click',node)  });    mailFolders.on('contextmenu', function(node, e) {    mailFolders.rightClickedNode = node;    var menu = null;   // node.select();    mailFolders.fireEvent('click',node);    if(node.id == "MPF_-1") {      //return;      //If node is "All" only allow new folder to be created      menu = new Ext.menu.Menu({        items: [          {            id: 'new-folder',            text: 'New Folder...',            icon: Eve.Resource.getIcon('folder','mail'),            handler: function() {              Requests.MailFolder.getFirstLevelTree(function() { UI.openNewMailboxFolder(rootNode); } /* handler */);            }          }        ]      });    }    else {      var menuItems = [];      menuItems.push({        id: 'refresh',        text: 'Refresh',        icon: Eve.Resource.getIcon('refresh','mail'),        handler: function() {          node.select();            var index1 = mailGrid.ColumnModel_From.getIndexById('mail-cm-from');            var index2 = mailGrid.ColumnModel_From.getIndexById('mail-cm-to');          if( node.attributes.system == "Sent Items" ) {            //Hide the 'From' column and Un-hide the 'To' column in the grid            mailGrid.ColumnModel_From.setHidden(index1, true);            mailGrid.ColumnModel_From.setHidden(index2, false);            //mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_To);          }          else {            //Hide the 'To' column and Un-hide the 'From' column in the grid            mailGrid.ColumnModel_From.setHidden(index1, false);            mailGrid.ColumnModel_From.setHidden(index2, true);            //mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_From);          }          var nodeId = processId(node.id);          Requests.loadMailboxGrid(nodeId);          //Requests.loadTreeNodeChildren(nodeId);          if(!State.isGeneralTabSelected()) {            mailCenter.setActiveTab(generalTab);          }        }      });      menuItems.push({        id: 'new-folder',        text: 'New Folder...',        icon: Eve.Resource.getIcon('folder','mail'),        handler: function() {          Requests.MailFolder.getFirstLevelTree(function() { UI.openNewMailboxFolder(mailFolders.rightClickedNode); } /* handler */);        }      });      //Delete permission      if(node.attributes.per.Delete === true) {        menuItems.push({          id: 'delete',          text: 'Delete',          icon: Eve.Resource.getIcon('delete', 'general'),          handler: function() {			var msg = (node.hasChildNodes())?				['You are attempting to delete the "', node.attributes.title, '" folder, ',				 'this will delete all of the emails in this folder and all of its sub-folders as well as all email contained in them.<br/>',				 ' Are you sure you want to proceed?'].join(''):				 'Are you sure you want to delete the "' + node.attributes.title + '" folder?';            dialogs.confirmDelete( msg, Requests.MailFolder.remove);          }        });      }      //Edit permission      if(node.attributes.per.Edit === true) {        menuItems.push({          id: 'rename',          text: 'Rename...',          handler: function() {            mailTreeEditor.startEdit(node.ui.textNode, node.attributes.title);          }        });        var moveMenuItem = new Ext.menu.Item({          id: 'move',          text: 'Move To',          icon:Eve.Resource.getIcon('move-to','mail'),          cls: 'x-btn-text-icon',          disabled: false,          menu: []        });                moveMenuItem.on('activate', function(baseItem) {			//debugger;          //Helpers.moveMenuFiller(moveMenuItem, function(item) {Requests.moveSelectedMessages(item); });          var params = {             holderMenu: moveMenuItem            ,menuItemHandler: function(item) {Requests.MailFolder.move(node.id /* target node id */, "MPF_" + item.id /* destination node id */)}            ,moreMenuItemHandler: function() { Requests.MailFolder.getFirstLevelTree(function() { UI.openMoveMailboxFolder(node); } /* handler */, node);}            ,nodeID: this.rightClickedNode.id.split('_')[1]          };          Helpers.moveMenuFiller(            params            /*moveMenuItem,            function(item) {              Requests.MailFolder.move(node.id , "MPF_" + item.id );            },            function() {              Requests.MailFolder.getMoveTree(function() { UI.openMoveMailboxFolder(node); }, node);            },                        this.rightClickedNode.id.split('_')[1]*/          );        },this);        menuItems.push(moveMenuItem);      }      menuItems.push({        id: 'properties',        text: 'Properties...',        icon: Eve.Resource.getIcon('information_frame','mail'),        disabled: false,        handler: function() {          Requests.MailFolder.properties(node);        }      });      if(node.attributes.system === "Spam" || node.attributes.system === "Quarantine") {        menuItems.push({          id: 'delete-all',          text: 'Delete All Messages',          disabled: false,          handler: function() {            dialogs.confirmDelete('Are you sure you want to delete all the contents of the "' + node.attributes.title + '" folder?', Requests.MailFolder.purgeMessages);          }        });      }      if(node.attributes.system === "Trash") {        menuItems.push({          id: 'delete-all',          text: 'Purge Trash',          disabled: false,          handler: function() {            dialogs.confirmDelete('Are you sure you want to delete all the contents of the "' + node.attributes.title + '" folder?', Requests.MailFolder.purgeMessages);          }        });      }      menu = new Ext.menu.Menu({        items: menuItems      });    }    menu.showAt(e.getXY());  });  mailFolders.on('beforeclick', function(node, e) {    //Prevent any actions when clicking on "All"    var returnValue = (node.text === "All")? false: true;    return returnValue;  });  mailFolders.on('click', function(node, e) {    mailFolders.rightClickedNode = node;    //Prevent reloading the grid if the same folder is selected again    if( (node.isSelected()) && (mailCenter.getActiveTab().id == "general-tab") ) {      return;    }    if(node.id === 'MPF_-1') {      setTimeout(function() {node.firstChild.select(); }, 10); //cause a delay for the tree nodes to be added into the DOM      Requests.reloadMailboxGrid();      return;    }        var index1 = mailGrid.ColumnModel_From.getIndexById('mail-cm-from');    var index2 = mailGrid.ColumnModel_From.getIndexById('mail-cm-to');    var index3 = mailGrid.ColumnModel_From.getIndexById('expireIn');    if( node.attributes.system == "Sent Items" ) {      //Hide the 'From' column and Un-hide the 'To' column in the grid        mailGrid.ColumnModel_From.setHidden(index1, true);        mailGrid.ColumnModel_From.setHidden(index2, false);      //mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_To);    }    else {      //Hide the 'To' column and Un-hide the 'From' column in the grid      //mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_From);      mailGrid.ColumnModel_From.setHidden(index1, false);      mailGrid.ColumnModel_From.setHidden(index2, true);     }       if(node.attributes.system == "Trash")        mailGrid.ColumnModel_From.setHidden(index3, false);      else        mailGrid.ColumnModel_From.setHidden(index3, true);      //Spam toolbar Item      var btn = Ext.getCmp('mail_spam_toolbar');      if(node.attributes.system == "Spam"){       btn.setText('Remove from spam');       btn.setIcon(Eve.Resource.getIcon('remove-from-spam','mail'));      }else{        btn.setText('Move to spam');       btn.setIcon(Eve.Resource.getIcon('move-to-spam','mail'));      }     var nodeId = processId(node.id);    Requests.loadMailboxGrid(nodeId);    //Requests.loadTreeNodeChildren(nodeId);    if(!State.isGeneralTabSelected()) {      mailCenter.setActiveTab(generalTab);    }  });  //Inline TreeEditor for renaming mailbox folders  var mailTreeEditor = new Ext.tree.TreeEditor(    mailFolders,    new Ext.form.TextField({      allowBlank: false    }),    {		completeOnEnter: true,		ignoreNoChange: true,		triggerEdit : function(node, defer){			this.completeEdit();			if(node.attributes.editable !== false){				this.editNode = node;				if(this.tree.autoScroll){					Ext.fly(node.ui.getEl()).scrollIntoView(this.tree.body);				}				var value = node.attributes.title || '';				if (!Ext.isGecko && Ext.isEmpty(node.text)){					node.setText(' ');				}				this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, value]);				return false;			}		}    }  );  mailTreeEditor.on('beforestartedit', function(editor, boundElement, value) {    try{		if(mailFolders.rightClickedNode.attributes.per.Edit === false) {      return false;		}	}catch(e){return false;}  });  mailTreeEditor.on('complete', function(editor, value, startValue) {    Requests.MailFolder.rename(mailFolders.rightClickedNode, value);    return false;  });  mailFolders.on('startdrag', function(tree, node, e) {    //console.log("START DRAG (tree), (node), (e): ", tree, node, e);    if(node.attributes.per.Edit === false) {      //console.log("Not allowed to drag");      return false;    }  });  mailFolders.on('nodedragover', function(dragOverEvent) {    //console.log("NODE DRAGGED OVER (dragOverEvent): ", dragOverEvent);    //dragOverEvent.target.attributes.permission  });  // ************ POP Accounts Tree  var popAccounts_TreeLoader = new Ext.tree.TreeLoader({    dataUrl: Eve.url,    section: 'mail',    baseParams: {      event: ServiceEvents.getAccountMails_POP,      Id: -2    },    preloadChildren: true  });  var popAccounts_TreeRoot = new Ext.tree.AsyncTreeNode({    id: 'pop-all',    text: 'All',    draggable: false,    expanded: true,	loaded: true,    cls: 'folder-node'  });  try{	  if(Eve.Preference.get('mailpopaccout')){		  var popNodes = popAccounts_TreeLoader.reader.readRecords(Eve.Preference.get('mailpopaccout')).records		  for(var i = 0; i< popNodes.length; i++){			var newNode = new Ext.tree.TreeNode({			  id: popNodes[i].get('id'),			  text: popNodes[i].get('text'),			  cls: 'mail-tree-user-folder-node',			  leaf: true			});			popAccounts_TreeRoot.appendChild(newNode);		  }	  }  }catch(e){	  popAccounts_TreeRoot.loaded = false;  };  var popAccounts = new Ext.tree.TreePanel({    region: 'south',    border: false,    collapsible: true,	collapsed: ( Eve.Preference.getBoolean('mailPopSidebar')  == false)? true : false,	split		: true,    title: '<b>POP Accounts</b>',    tools:[{      id			: 'plus',      qtip		: 'New pop account',      handler	: function() {        UI.createNewPOPAccount();      }		}    ],	plugins: new Ext.ux.collapsedPanelTitlePlugin(),    height: 150,    root: popAccounts_TreeRoot,    rootVisible: false,    loader: popAccounts_TreeLoader,	listeners: {	  expand: function(){		if ( Eve.Preference.getBoolean('mailPopSidebar') !== undefined )			Eve.Preference.set('mailPopSidebar', true);	  },	  collapse: function(){		if ( Eve.Preference.getBoolean('mailPopSidebar') !== undefined )			Eve.Preference.set('mailPopSidebar', false);	  }	  	}  });    popAccounts.on('contextmenu', function(node, e) {    var menu = null;	    if(node.id === "pop-all") {      menu = new Ext.menu.Menu({        items: [          {            text: 'New Account...',            handler: function() {              UI.createNewPOPAccount();            }          }        ]      });    }    else {      menu = new Ext.menu.Menu({        items: [          {            //id: '',            text: 'Delete',            icon: Eve.Resource.getIcon('delete', 'general'),            handler: function() {              dialogs.confirmDelete('Are you sure you want to delete the "' + node.text + '" POP account?', function(confirmButtonId) {                var confirmButtonId = confirmButtonId || null;                //If user answers NO to the deletion operation                if(confirmButtonId === "no") {                  return;                }                Requests.POPAccount.remove(node);              });            }          },          {            //id: '',            text: 'Edit...',            handler: function() {              Requests.POPAccount.loadEdit(node);            }          }        ]});    }    menu.showAt(e.getXY());  });  popAccounts.on('click', function(node, e) {    //Prevent reloading the grid if the same folder is selected again    if( (node.isSelected()) && (mailCenter.getActiveTab().id == "pop-account-tab") ) {      return;    }    if(node.id === "pop-all") {      if(node.firstChild !== null) {        setTimeout(function() {node.firstChild.select(); }, 10); //cause a delay for the tree nodes to be added into the DOM      }      return;    }    /*    if( node.attributes.system == "Sent Items" ) {      //Hide the 'From' column and Un-hide the 'To' column in the grid      mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_To);    }    else {      //Hide the 'To' column and Un-hide the 'From' column in the grid      mailGridPanel.reconfigure(mailGridPanel_DataStore, mailGrid.ColumnModel_From);    }    */    var nodeId = processId(node.id);    mailCenter.unhideTabStripItem( popAccountTab );        Requests.loadPOPMailboxGrid(nodeId);    //Requests.loadTreeNodeChildren(nodeId);    /*    if(!State.isPOPAccountTabOpen()) {      mailCenter.add(popAccountTab);      mailCenter.doLayout();    }    */    if(!State.isPOPAccountTabSelected()) {      popAccountTab.show();      mailCenter.setActiveTab(popAccountTab);    }  });  // ----------------------------------------------------------------------------------------------  return {    //Public methods	getCenter: function() {      return mailCenter;    },    getWest: function() {      return{        width: 200,        collapsible: true,		hideCollapseTool: true,		collapseMode: 'mini',        title: 'Mail Folders',        tools:[{			id	: 'gear',			qtip: 'Mail Setting',			handler: function(){				var obj  = {					info: {						id: ''					}				};				Eve.Resource.superbridge.broadcast(this, 'proxy_dialog',{type: 'personal',func: function(){						Eve.Resource.superbridge.broadcast(this, 'personal_mail_setting_dlg', {})}} );							}		},{			id			: 'refresh',			qtip		: 'Refresh',			handler	: function() {				mailFolders.root.reload();			}    	},{          id			: 'plus',          qtip		: 'New mail folder',          handler	: function() {             Requests.MailFolder.getFirstLevelTree(function() { UI.openNewMailboxFolder(rootNode); } );          }    		}        ],            split: true,        border: true,        region: 'west',        layout: 'border',                collapsed: ( Eve.Preference.getBoolean('mailFolderSidebar') == false)? true : false,        items: [ mailFolders,popAccounts],		listeners: {			expand: function(){				//For mail setting				Eve.Preference.set('mailFolderSidebar', true);			},			collapse: function(){				//For mail setting				Eve.Preference.set('mailFolderSidebar', false);			}		}	  }    },      getSouth: function() {      return statusBar;    },	  	newComposeDlg: function(type, toField, obj, mode){          composeMode = "newWin";          if(mode == 'interlink'){              composeMode = 'interlink';                            ilParam.forwardURL =  ["modern.interlink.personal.prepareToCreate",              											"&objTypeId=", obj.info.typeId,              											"&objId=", obj.info.objId,              											"&toGroupId=", 0,              											"&toObjTypeId=", 6,              											"&linkback=", obj.info.linkBack,              											"&doGetGrid=true"].join('');             Requests.loadMailForm('newWin', "", {ilParams: obj});                }else if(toField === undefined ){                Requests.loadMailForm('newWin');            }            else{                Requests.loadMailForm('newWin',"",{toField: toField});              }  	    	},        showFullHeader: function(id){        Requests.Mail.loadFullHeader(id);    },        createContactWin: function(){        UI.createContactWin();    },        mailPopUp: function(id){        Requests.loadMail(id);    },        uploadDoc: function(obj){        },        mailExit: function() {},    mailEnter: function() {},        selectFolder: function(obj){      var path = obj.path.split('/');      path.unshift('All');      var callback = function( node ){ window._node = arguments[0]; setTimeout( function(){ mailFolders.fireEvent('click',node); }, 1000 ) };      var depth = 0;      var expand = function( n, p ){          var next = p.shift();          // check if it is the right one...          if ( n.attributes.text.split('<span')[0].trim() == next ){              if ( p.length == 0 ){                callback( n );                return true;              }                            if ( !n.isExpanded() ){                p.unshift( next );                n.on('expand', expand.createDelegate( this, [p], true ), this, { single: true } );                                if ( n.isExpandable() )                  n.expand();                return true;              }                            n.eachChild( function( child ){                 expand( child, p );              } );                            return true;          }                    p.unshift( next );          return false;      }            expand( mailFolders.root, path);    },        openItem: function(obj){          var event;      var info = {          id: obj.id          ,groupId: obj.groupId          ,path: '\\'          ,parentId: '0'      };                  if( obj.type == 'voting'){        event = 'vote_screen_dlg';      }        else{        event = 'task_edit_item_dlg';        info.root = 'group';      }         var func = function() {  			Eve.Resource.superbridge.broadcast(this, event , { info: info});  		};      Eve.Resource.superbridge.broadcast(window,'proxy_dialog', {type: obj.type, func: func});          },        updater: function(){                    var st = Ext.getCmp("mail_grid").getStore();                    Ext.Ajax.request({            url: Eve.url,            params: {              event : ServiceEvents.getTreeNodeChildren,              Id: -1            },            success: function( response, options){              State.mailFolderTree_Dirty = true;              State.mailFolderFullTree_Dirty = true;              var data = xml2json(response.responseXML).data;              var root = mailFolders.getRootNode();              for(var i=0,len= root.childNodes.length; i<len; i++){                node = root.childNodes[i];                try{                  rec = data.node[i];                  if(parseInt(rec.unread) > 0)                    node.setText(rec.title+ " <span style='color: blue;'>("+ rec.unread+")</span>");                }                catch(e){console.log("It doesn't find this node")}              }            }            });                        var func = function(opt, sucess, response){            	var ldate0 = (new Date()).getTime()/1000;              //Eve.GridUpdator.resetTaskRunner();          		var xml = response.responseXML ;          		var records = st.reader.readRecords(xml).records;          		var keys = st.fields['keys'];          		var j =0;          		var rec;          		var ids =  [];          		var indexes = [];          		for(var j=0, len=records.length; j<len; j++){          			var rec = st.getById(records[j].id);          			if(rec !== undefined){          				/*          				for(var i=0, length=keys.length; i<length; i++){          					rec.set(keys[i], records[j].get(keys[i]));          				}          				*/          				try{          					rec.set('itemNumber',rec.get('itemNumber'))          				}          				catch(e){		        				console.log('update mail grid: exception 1')          				}          			}          			else{               			//st.add(records[j]);          				indexes.push(j);          			}          			ids.push(records[j].id);          		}          	  st.each(function(rec){          			if(ids.indexOf(rec.id) ==-1)          				st.remove(rec);          		});            	var ldate1 = (new Date()).getTime()/1000;            	console.log('update mail grid: 1st phase=',ldate1-ldate0)          		st.sortData('itemNumber');          		          		try {	          		for(var k=0, len=indexes.length; k<len; k++){	          			var rec = records[indexes[k]];	          			var index = rec.get('itemNumber') - 1;						        st.insert(index, rec);	          		}          		        			} catch(e){        				console.log('update mail grid: exception 2')        			}          		            	var ldate2 = (new Date()).getTime()/1000;            	console.log('update mail grid: 2nd phase=',ldate2-ldate0)		            	st.commitChanges();			}		   var selectedNode = 	mailFolders.getSelectionModel().getSelectedNode();			if( st.lastOptions && st.lastOptions.params && selectedNode.attributes.system.toLowerCase() == "inbox"){			  Ext.Ajax.request({					url			: Eve.url					,params		: st.lastOptions.params					,callback	: func					,scope  	: this				});			}    }        ,checkUpdater: function(section, data){        if(section == "mail"){                      if(UI.mailUpdater){              Ext.TaskMgr.start(UI.mailUpdater.task);            }              else{              UI.mailUpdater = new Eve._GridUpdator("mail");              UI.mailUpdater.delayStart.delay(Eve.GhazalTime)            }                  }          else{          if(UI.mailUpdater){            Ext.TaskMgr.stop(UI.mailUpdater.task);            UI.mailUpdater.delayStart.cancel();          }                  }        }  };};//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Eve.lib.Mail.Factory = function() {}Ext.extend( Eve.lib.Mail.Factory, Eve.lib.Factory, {  	section: 'mail'  ,createBefore : function(superbridge) {    Eve.Mail = Eve._Mail();		// Section Manager	this.manager = new Eve.lib.SectionBridge(this.section);	superbridge.addBridge(this.manager);        superbridge.addBridge( Eve.DragDrop );    Eve.DragDrop.init({superbridge: superbridge, section: this.section});	  	var mailBrdg = new Eve.lib.Mail();  	superbridge.addBridge(mailBrdg);      	    mailBrdg.init({  		superbridge: superbridge  		,section: this.section		,manager: this.manager  	});	 this.manager.registerComponents(mailBrdg);  },  createWest  : function( brdg ) {    var view = {      get : function() {return [{}]}    };    return {      view: view,      config:  Eve.Mail.getWest()    };	return Eve.Mail.getWest();  },  createCenter: function( brdg ) {    var view = {      get : function() {return [{}]}    };    return {      view: view,      config: {        border: false,        layout: 'fit',        items: [          Eve.Mail.getCenter()        ]      }    };  },  createMenus : function( brdg ) {},    createDialogs : function(superbridge) {		Eve.Mail.createContactWin();		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.Document.AttachPortalTreeBridge();				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: 'document'			,prefix		: 'D'		});    		var attachDlg = new Eve.widgets.AttachmentDlgBridge();		superbridge.addBridge(attachDlg);				attachDlg.init({			superbridge	: superbridge			,section	: this.section			,tree		: view.get()		});		view = new Eve.vc.TreePanel();		bridge	= new Eve.Task.TaskTreeBridge();		superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: 'task'			,prefix		: 'T'		});		var convertToTaskDlg = new Eve.widgets.ConvertToTaskDlgBridge();		superbridge.addBridge(convertToTaskDlg);		convertToTaskDlg.init({			superbridge	: superbridge			,section	: this.section			,tree		: view.get()		});  },  createRest : function( brdg ) {}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\desktop/Desktop.js *//*--------------------------------------------------*/Eve.DesktopBridge = Ext.extend( Eve.lib.Bridge, { 	init: function( obj ){ 		// Add this as a superbridge		Eve.DesktopBridge.superclass.init.call(this, obj);		this.settingDlg = Eve.Desktop.SettingDlg(); 		this.factory = new Eve.Desktop.PortletFactory();		 		this._lookup = { 			 3 : 'News' 			,10: 'Notes' 			,9 : 'Links' 			,2 : 'Tasks' 			,8 : 'MyGroups' 			,12: 'MyOffice' 			,5 : 'Messages' 			,4 : 'CompanyAnnouncments' 			,1 : 'Schedule' 			,11: 'Reminders' 		}; 		 		this._prefLookup = { 			 3 : 'News' 			,10: 'Notes' 			,9 : 'myLinks' 			,2 : ['myTasks', 'sharedTasks'] 			,8 : 'MyGroups' 			,12: 'MyOffice' 			,5 : 'mail' 			,4 : 'CompanyAnnouncments' 			,1 : ['myCalendar', 'sharedCalendar'] 			,11: 'Reminders' 		}; 		var activeModuleBtn = this.createActiveModulesButton(); 		this.view = new Eve.Portal({ 			id: 'Desktop_portal_container'			,anchor: '99%' 			,listeners: { 				'render': { 					fn: function(){ 						this.getConfig( this.createPortals, this ); 					} 					,scope: this				} 			} 		});		// The view without... whatever		var desktopHeaderImgSrc = (Eve.Preference.get('desktopImage'))? Eve.Preference.get('desktopImage') :Eve.Resource.getIcon("header","desktop") ;		this.semiView = new Ext.Panel( {			layout: 'anchor'			,anchor: '99%' 			,bodyStyle: 'height: 100%;overflow-y: auto;'			,items: [{xtype:'panel',id : 'desktop_header', height:'auto', baseCls: 'desktop-header', html:'<img style="margin:4px"src="'+desktopHeaderImgSrc+'">'}, this.view ]			,tbar: new Ext.Toolbar({ 				items: activeModuleBtn				,hidden: Eve.Preference.getBoolean('lockDesktop')? true : false 			})		} ); 		this.ItemCache = {};		if ( !Eve.Desktop.Dispatcher ){			// Create a new dispatcher			Eve.Desktop.Dispatcher = new Eve.Desktop.DispatcherSingleton();		}		if ( !Eve.Desktop.ModeManager ){			Eve.Desktop.ModeManager = new Eve.Desktop.ModeSingleton();			Eve.Desktop.ModeManager.onChange( Eve.Desktop.Dispatcher, Eve.Desktop.Dispatcher.changeMode );			Eve.Desktop.ModeManager.onChange( Eve.PortletManager, Eve.PortletManager.toggleFunc );		} 	}	,forceLoad: function(data){		this.factory.getDesktopContent(this);	}	,setSharedSection : function(data)	{		this.sharedSection = data.sharedSection;	}		,saveConfig: function(){		var a = this.ItemCache;		var columns = this.view.items.items;		var result  = [ [], [], [] ];		for ( var i = 0, len = columns.length; i < len; ++i ){			var col = columns[i];			var items = col.items.items;			for ( var j = 0, jlen = items.length; j < jlen; ++j ){				var b = items[j].backendId;				var s = items[j].isVisible();				if ( s )					result[i].push( b );				else					result[i].push( b + 's' );					//result[i].push( b + (s)?'':'s' );			}		}		Ext.Ajax.request( { url: 'index.cfm?event=modern.desktop.createModify', params: { id: -1						 																   , col1: result[0].join(',')																						   , col2: result[1].join(',')																						   , col3: result[2].join(',')																						   , desktop_refresh_interval: 60																						   , wrapcontent: true } } );	} 	,createActiveModulesButton: function(){ 		var l = this._lookup; 		var btns = []; 		for ( var i in l ){ 			btns.push( new Ext.menu.CheckItem({ 				id		: 'desktop_active_btn_' + l[i] 				,text	: l[i] 				,listeners: { 					checkchange: { 						fn: function( btn, toggle ){ 							var mName = btn.getId().split( '_' ); 							mName = mName[mName.length-1]; 							this.showModule( mName, toggle ); 						} 						,scope: this 					} 				} 				,checked: true 			}) ); 		}		var that = this; 		return [ {				 xtype: 'button',				 text: 'Desktop Setting',				 handler: function(){					 that.settingDlg.show();					 Ext.getCmp('cmbDesktopInterval').setValue(Eve.Preference.get('desktopRefreshInterval'));				 }				},'->', {				 xtype: 'button',				 enableToggle : true,				 id: 'desktop_edit_mode',				 text: 'Modify the desktop'				 , toggleHandler: function( btn, state ){				   		if ( state == true ){							btn.setText('Save Layout');							Eve.Desktop.ModeManager.changeMode( 'edit' );						}else{                            btn.setText('Modify the desktop');							Eve.Desktop.ModeManager.changeMode( 'default' );							that.saveConfig();						}				   }				 }, { xtype : 'tbsplit', 				  menu  : new Ext.menu.Menu({ items: btns} ), 				  text  : 'Modules', 				  id	: 'desktop_active_modules_menu', 				  hidden: true 			   }]; 	} 	,showModule: function( moduleName, show ){ 		var func = show ? 'show' : 'hide'; 		var item = (this.ItemCache[moduleName]); 		if ( item ){ 			item[func](); 			var menuBar = Ext.getCmp('desktop_active_modules_menu'); 			menuBar.menu.items.each( function(r){ 				if ( r.id.indexOf( moduleName ) != -1 ){ 					r.setChecked( show ); 					return false; 				} 			}); 		} 	} 	,getView: function(){ 		return this.semiView; 	}	 	,execute: function( callee, type, object ){ 		switch( type ){ 			case 'desktop_close_portlet': 				this.showModule( object.obj.section, false ); 				break;                			default:				if ( type.indexOf( '_success_' ) !== -1 &&					 type.indexOf('update_grid') == -1 &&					 Eve.activeSec == 'desktop'){					var extractSection = function( type ){						var o = type.split('_')[0];						switch( o ){							case 'task':								return 'Tasks';							case 'note':								return 'Notes';							case 'link':								return 'Links';							case 'reminder':								return 'Reminders';							case 'calendar':								return 'Schedule';							case 'mail':								return 'Messages';														}						return '';					};					var it = this.ItemCache[ extractSection( type ) ];					if ( it ){						it.xhr.sendRequest( it.section );					}				} 		} 	}	 ,lookup: function( id ){ 		if ( typeof id != 'number' ) 			return id; 		return this._lookup[id]; 	} 	,getConfig: function( func, scope ){		Ext.Ajax.request( { url: 'index.cfm?event=modern.desktop.editdesktop'		 , success: function( r, opt ){			 var xml = r.responseXML;			 var dq  = Ext.DomQuery;			 // WORST CODE EVER....			 var columns = dq.selectValue( 'column', xml );			 var c = columns.split( '|' );			 var numC = c.length;			 var renderC = [];			 var toHide  = [];			 var toDisable = [];			 			 for ( var i = 0; i < numC-1; ++i ){				 var cs = c[i].split( ',' );				 var k  = [];				 if ( cs[0] == "" )				 	continue;				for ( var j = 0;j < cs.length; ++j ){			 		if( Eve.Preference.getBoolean( this._prefLookup[parseInt(cs[j])] ) == true ){						if ( (cs[j]).substr(cs[j].length-1, 1) == 's' )						toHide.push( parseInt( cs[j] ) );						k.push( parseInt( cs[j] ) );					}					else{					        toDisable.push(this._lookup[ parseInt(cs[j]) ]);					        toHide.push( parseInt( cs[j] ) );							k.push( parseInt( cs[j] ) );					}				}				renderC.push( k );			 }			// Render the modules			func.apply( scope || this, [renderC] );			// Hide the modules now...			for ( var i = 0; i < toHide.length; ++i )				this.showModule( this.lookup( toHide[i] ), false );			var menuBar = Ext.getCmp('desktop_active_modules_menu');			// Disable checkbox			for(var i = 0; i< toDisable.length; ++i){	 			menuBar.menu.items.each( function(r){	 				if ( r.id.indexOf( toDisable[i] ) != -1 ){	 					r.setDisabled(true);	 					return false;	 				}	 			}); 			}		}, failure: function(){					}, scope: this } ); 	} 	,createPortals: function( conf ){ 		// Create columns 		this.view.createColumns( conf.length ); 		// Create the portlets		for ( var col = 0, clen = conf.length; col < clen; ++col ){			var its = conf[col];			var c   = this.view.items.get(col);			for ( var row = 0, rlen = its.length; row < rlen; ++row ){				var item = this.lookup(its[row]);				this.ItemCache[item] = this.factory.create( item, its[row] );				c.add( this.ItemCache[item] );			}			//this.view.items.get(col).doLayout();		}		if ( this.view.layout && this.view.layout.layout )			this.view.doLayout();			//Commented by Ghazal, it's called by forceLoad		//this.factory.getDesktopContent();		// Now change the mode to whatever you wanted		Eve.Desktop.ModeManager.changeMode.defer( 500, Eve.Desktop.ModeManager, ['default'] ); 	} });//--------------------------------------// Portlet Factory//--------------------------------------Eve.Desktop.PortletFactory = function(){this.renderers = [];};Eve.Desktop.PortletFactory.prototype = {	create: function( portletName, id ){		this.isRendered = true;		portletName = this.uCase( portletName );		// Create the portlet initiator		var initiator = null;		if ( Eve.Desktop[portletName + 'Initiator'] ){			initiator = new Eve.Desktop[portletName + 'Initiator']( portletName );		}else{			initiator = new Eve.Desktop.Initiator( portletName );		}		// Create the portlet Dialog Configuration		var dialog = null;		if ( Eve.Desktop[portletName + 'Dialog'] ){			dialog = new Eve.Desktop[portletName + 'Dialog']( portletName );		}else{			dialog = new Eve.Desktop.Dialog( portletName );		}		// Create the Portlet Renderer		var renderer = null;		if ( Eve.Desktop[portletName + 'Renderer']){			renderer = new Eve.Desktop[portletName + 'Renderer']( portletName );		}else{			renderer = new Eve.Desktop.Renderer( portletName );		}		this.renderers[portletName] = renderer;		// Create the request Handler		var request = null;		if ( Eve.Desktop[portletName + 'Request'] ){			request = new Eve.Desktop[portletName + 'Request']( portletName );		}else{			request = new Eve.Desktop.Request( portletName );		}				var mode = null;		if ( Eve.Desktop[portletName+'Mode'] ){			mode= new Eve.Desktop[portletName + 'Mode']( portletName );		}else{			mode = new Eve.Desktop.Mode( portletName );		}		// Set the requestor for the dialogs		dialog.setRequest( request );		// Set the renderer for the request handler		request.setRenderer( renderer );		// set the base params		param = {			 xhr		: request			,dialog		: dialog			,section	: portletName			,renderer	: renderer			,mode		: mode		};		initiator.augment( param, portletName );		// The mode needs to know about every single variable in a portlet inorder to control them		var portlet = new Eve.Portlet( param );		portlet.on('contextmenu', function(cmp, e){			console.log('contextMenu----', cmp, 'e----', e);		});		// set the portlet of mode and request		mode.setPortlet( portlet );		request.setPortlet( portlet );				// Listen for the new Mode...		Eve.Desktop.ModeManager.onChange( mode, mode.update );		//		portlet.backendId = id;		portlet.portletName = portlet;		return portlet;	}	,getDesktopContent: function(that){					/* Majid: Wait : next lines was commented */        Eve.mask.show(Ext.fly('MainCardLayout'));		Ext.Ajax.request( {				url: 'index.cfm?event=modern.desktop.getAllcontents'				,success: function(resp){					var Modules = [					['Tasks', 'Tasks']					,['Links', 'Links']					,['News', 'News']					,['Notes', 'Notes']					,['MyGroups', 'Groups']					,['MyOffice', 'Office']					,['Messages', 'Mails']					,['Schedule', 'Calendar']					,['Reminders', 'Reminders']					,['CompanyAnnouncments', 'GroupNews']					];					var dq = Ext.DomQuery;					for(var i=0; i< Modules.length;  i++){					    var xml = dq.selectNode(Modules[i][1]+"Module", resp.responseXML);					if(xml){                         if(this.renderers[Modules[i][0]])							this.renderers[Modules[i][0]].render(xml);					}					}					/* Majid: Wait : next lines was commented */					Eve.mask.hide();					Ext.getBody().unmask();					that.manager.loadFinished(that);					Eve.done = true;				}									/* Majid: Wait : next lines was commented */				,failure: function(){ Eve.mask.hide(); }				,scope: this		} );	}		,uCase : function(s) {		return s.charAt(0).toUpperCase() + s.substr( 1, s.length );	}};//--------------------------------------////--------------------------------------Eve.Desktop.ModeSingleton = function(){	this.modeArr = [];};Eve.Desktop.ModeSingleton.prototype = {	onChange: function( mode, func ){		this.modeArr.push( { mode: mode, func: func } );		if ( func )			// Notify the mode of the current State			func.apply( mode, [ { mode: this.curMode }] );	}	,changeMode: function( newMode ){		this.curMode = newMode;		if ( this.curMode == 'edit' )			Ext.getCmp('desktop_active_modules_menu').show();		else			Ext.getCmp('desktop_active_modules_menu').hide();		for ( var i = 0, len =  this.modeArr.length; i < len; ++i ){			this.modeArr[i].func.apply( this.modeArr[i].mode, [ { mode: this.curMode } ] );		}	}};//--------------------------------------// Mode :(((((//--------------------------------------Eve.Desktop.Mode = function( section ){	this.sec = section;};Eve.Desktop.Mode.prototype = {	update: function( params ){		if ( params.mode == 'edit' ){			this.portlet.setBorders( true );		}else{			this.portlet.setBorders( false );		}	}	,setPortlet : function( portlet ){		this.portlet = portlet;	}};//--------------------------------------// Dispatchers and extracts correct events for objects//--------------------------------------Eve.Desktop.DispatcherSingleton = function(){	this.sec = arguments[0];};Eve.Desktop.DispatcherSingleton.prototype = {	onClick: function(){		//var params = this.renderer.extractParams();		// Boardcast the event		if ( !this.enable )			Eve.Resource.superbridge.broadcast.apply( Eve.Resource.superbridge, arguments );	}	,changeMode: function( params ){		if ( params.mode == 'edit' )			this.enable = true;		else			this.enable = false;	}};//--------------------------------------// Customises the parameters of each module//--------------------------------------Eve.Desktop.Initiator = function(){	this.sec = arguments[0];};Eve.Desktop.Initiator.prototype = {	augment: function( param, section ){		Ext.applyIf( param, {			height: 150			,title: section		} );		return param;	}};//--------------------------------------// Configuration dialog of each portlet...//--------------------------------------Eve.Desktop.Dialog = function(){	this.sec = arguments[0];	// Bind the panel to the correct Dialog	Eve.Desktop.ItemPanels.bindTo( this.sec, this );};Eve.Desktop.Dialog.prototype = {	// func: callback function for applying the configuration in the dialog	popDialog: function( content, func ){/*		for ( var i in content ){			// Get the item and set its content			var item = Ext.getCmp( 'desktop_dialog_' + this.sec.toLowerCase() + '_' + i );			if ( item ){				item.setValue( content[i] );			}		}		return null;*/		Eve.Desktop.ItemPanels.showPanel( this.sec );	},	//-------------------------------------	//	//-------------------------------------	validate: function(){		// By default all of the panels are filled out correctly		return true;	},	//-------------------------------------	// The basic collect method	//-------------------------------------	collect: function( aForm ){		this.request.sendDialogRequest( 'collect', { params: aForm.getForm().getValues( false )												   , failure: function(){ console.log( 'Collection Error' ); }												   , success: function(){ this.request.sendRequest(); /* reload the content of the module */ }												   , scope  : this}									   );	},	//-------------------------------------	// Return the validation error	//-------------------------------------	validationError: function(){		return '';	},	//-------------------------------------	// Loads the dialog	//-------------------------------------	load: function( aF ){		aF.getForm().load( { url: this.request.loadUrl(), params: { dummy: 'data' }, success: function(){ console.log( arguments ); }, scope: this } );	/*		this.request.sendDialogRequest( 'load', { params: {}							   , failure: function(){ console.log( 'Loading Error' ); }							   , success: function( response ){							   	var form   = aF.getForm();							   	var fields = form.getValues();							   	var dq	   = Ext.DomQuery;							   	var xml	   = response.responseXML;							   	for ( var i in fields ){							   		form.findField( i ).setValue( dq.selectValue( i, xml ) );							   	}							     }							   }						);	*/},	//-------------------------------------	// Set the request handler for the dialog	//-------------------------------------	setRequest: function(){		this.request = arguments[0];	}};//--------------------------------------////--------------------------------------Eve.Desktop.Request = function(){	this.sec = arguments[0];};Eve.Desktop.Request.prototype = { 	sendRequest: function(){		if ( this.portlet && !this.portlet.isVisible() )			return false;		this.isLoaded = true;		if ( !window.Testing ){			this.renderer.mask();			// send a request to wherever you like			Ext.Ajax.request( {				url: this.getUrl()				,success: this.successFetch				,failure: this.failureFetch				,scope: this			} );		} 	}	//-------------------------------------	// send the dialog request	//------------------------------------- 	,sendDialogRequest: function( type, params ){ 		if ( type == 'collect' ) 			this._saveRequest( params ); 		else 			this._loadRequest( params ); 	}	,setPortlet: function( portlet ){		this.portlet = portlet;				this.portlet.on( 'show', this.firstTimeLoad, this );	}		,firstTimeLoad: function(){		if ( this.isLoaded )			return false;		this.sendRequest();	}	//-------------------------------------	// Private methods for handling dialogs	//------------------------------------- 	,_saveRequest: function( params ){ 		// configuration to send 		var config = { 			url: this.collectUrl() 		}; 		Ext.applyIf( config, params ); 		// send a request to wherever you like		if ( !window.Testing ) 			Ext.Ajax.request( config ); 	} 	,_loadRequest: function( params ){ 		// configuration to send 		var config = { 			url: this.loadUrl() 		}; 		Ext.applyIf( config, params ); 		// send a request to wherever you like		if ( !window.Testing )	 		Ext.Ajax.request( config );	}	//-------------------------------------	//	//------------------------------------- 	,successFetch: function( response ){ 		this.renderer.render( response.responseXML ); 	} 	,getUrl: function(){ 		return 'index.cfm?event=modern.desktop.get' + this.sec + 'content'; 	} 	,collectUrl: function(){ 		return 'index.cfm?event=modern.desktop.createModify&id=-1'; 	} 	,loadUrl: function(){	 	return 'index.cfm?event=modern.desktop.edit' + this.sec; 	} 	,failureFetch: function(){ 		this.renderer.rawRender( 'Coming Soon...' ); 	} 	,setRenderer: function( r ){ 		this.renderer = r; 	}};//--------------------------------------////--------------------------------------Eve.Desktop.Renderer = function(){	this.sec = arguments[0];	this.createTemplate();	this.createContentTemplate();};Eve.Desktop.Renderer.prototype = {	setTarget : function( target ){		this.target = target;	}	,getDispatcher: function(){		return 'Eve.Desktop.Dispatcher';	}	,getConfig: function(){		return {			activeImg 	: false			,sectionName: false			,checkbox   : false			,newBtn     : false      		,itemStyle  : ''		};	}	,createTemplate: function(){		var that = this;		var config = this.getConfig();			Eve.Desktop.Renderer.BaseTemplate = new Ext.XTemplate(				'<div>',				'<div>',				  	'<img src="{icon}" style="margin:-8px 3px 5px 3px; float:left"/>',				  	'<img border="0" src="{title}" style="vertical-align:bottom; float:left;{[this.getStyle()]}" onclick="{[this.changeSec(values)]}" />',				    '<div nowrap="" class="" style="float:right">',				        '{[this.createNewBtn(values)]}',				    '</div>',					'<div style="clear:both"/>',				'</div>',				'<div  style="border-bottom: 1px solid #999999;"></div>',				'<div class="desktoptc"></div>',				'</div>'				      				,{					getStyle: function(){						if(config.sectionName != false)							return 'cursor:pointer';						 else return;					}					,changeSec: function(values){						if(config.sectionName){							if(config.sectionName == 'Homepage'){								return 'Eve.Resource.superbridge.broadcast(window, \'show_group_select\', {func: function(){'												+'Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName:\'Homepage\'});'												+'}})';							}							else{								if ( Eve.activeSec == 'homepage' && values.path !== undefined){									var info = ['groupPath:\''+values.path.replace( /\\/g, '\\\\')+'\'', 'groupId:\''+values.groupId+'\''].join(',');									return ['Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \'',config.sectionName,											'\',forceLoad:true, info:{'+info+'}})'].join('');				    			}							    else{						          	var info = ['groupPath:\'', '\\\\','\',groupId:','0'].join('');  									return ['Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \'',config.sectionName,											'\',forceLoad:true, info:{'+info+'}})'].join('');							   }							}						}					}										,createNewBtn: function(values){						if(config.newBtn){								//TODO							var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \''+values.sec+'_create_item_dlg\',{mode:\'create\',info: {id:0,parentId: 0, path: \'\\\\\',root:\'personal\'}})}';						var t = that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + values.sec + '\', func:' + func + ' } )';       						return '<span  onclick="'+t+'"><img src=" '+Eve.Resource.getIcon(config.newBtn, 'desktop')+'" style="margin-top:-3px;cursor:pointer;"></span>';						}						else return '';					}				}			);		//}		this.baseTemplate = Eve.Desktop.Renderer.BaseTemplate;	}	,createContentTemplate: function(){		//if ( !Eve.Desktop.Renderer.ContentTemplate ){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px;">{[this.createTitle(values)]}</div></b><div style="padding-left: 10px;" class="portlet{[this.getBlockClass(values)]}">',					'<tpl for="content"><div>',						'<tpl if="this.checkText( values.image )">',							'{[this.createImage( values.imageUrl, values.imageTarget, values.image )]}',						'</tpl>',						'<tpl if="this.checkText( values.text )">',						    '<tpl>{[this.createActiveImg(values)]}</tpl>',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}',						'</tpl>',						'<tpl if="this.checkText( values.details )">',							'<font color="#707070">',								'<div class="{values.detailsCls}" style="padding-left:15px;margin-top:-3px;">',									'{details}',								'</div>',							'</font>',							//'<br/>',						'</tpl>',					'</div></tpl></div>',					'<div style="">{[this.checkContent( values )]}</div>',				 '</tpl>',				 '<tpl><div margin-left:10px;margin-top:-10px;>{[this.createMore(values[0])]}</div></tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}				 	,getBlockClass: function(values) {						return (config.blockCls ? (' ' + config.blockCls) : '');		 					 	}					,createTitle : function( values ){						if(values.title !== undefined )						{							if( config.sectionName == 'MyTasks')							    return values.title;							else if(config.sectionName == 'MyCalendar'){								var date = '';								var func = 	'function(){Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \'MyCalendar\'});'        									+'Eve.Resource.superbridge.broadcast(\'window\', \'change_calendar_section\',{section:\'daily\',date:Date.parseDate( &quot;' + values.date + '&quot;, \'n/j/y\' )});'											+'  }';								var text = '<a href="#" onclick="return false;">'+values.title+'</a>';								return '<span  onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'calendar\', func:' + func + ' } );" class ="">' + text + '</span>';							}														else if(config.sectionName.toLowerCase() == 'mail'){								var func = 	'function(){Eve.Mail.Path = &quot;' + values.content[0].path + '&quot;'											+';Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \'Mail\'});'        									+'Eve.Resource.superbridge.broadcast(\'window\', \'mail_select_folder\',{id:\''+values.content[0].id+'\',path:&quot;' + values.content[0].path + '&quot;});'											+'  }';								var text = '<a href="#" onclick="return false;">'+values.title+'</a>';								return '<span  onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'mail\', func:' + func + ' } );" class ="">' + text + '</span>';							}							var text = '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">'							            +values.title							            +'</a>';							return text;						}						return '';					}										,checkContent: function( values ){						if ( !values.content || values.content.length == 0  ){							if(values.title === undefined || values.title == ""){								if( config.emptyMessage )									return config.emptyMessage;															}							else return'';						}						return '';					}					,createActiveImg: function(values){						if(config.checkbox== true){								var img =  Eve.imagePath+'/ajax/unchecked.gif' ;								var arr = ['id', 'groupId', 'root' ];								var clean = function( str ){									str = str || '';									return str.replace( /\\/g, '\\\\' );								};								for ( var i = 0; i < arr.length; ++i ){									arr[i] = arr[i] + ':\'' + (clean(values[arr[i]]) || '') + '\'';								}								var event = 'modern.task.'+values.root+'.updateCustomFields';								var t = 'info: {' + arr.join(',') + '},params:{enforcedPredecessors:\''+values.enforcedPredecessors+'\' ,endSuccessors:\''+values.endSuccessors+'\',completed:\'' + (values.completed == '1' ? 'false' : 'true') + '\'},section:\''+config.section+'\', event:\''+event+'\'';								var func = 'function(){' + that.getDispatcher() + '.onClick( window, \'task_before_update_item\', {' + t + '} ); }';								if (config.section == 'task')									return '<input type="checkbox" ' + (values.completed == '1' ? 'CHECKED' : '') + ' style="margin-right:3px;float:left" onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + values.sectionType + '\', func:' + func + ' } );">';								else									return '<input type="checkbox" style="margin-right:3px;float:left" onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + values.sectionType + '\', func:' + func + ' } );">';							}							else return '';					}										,createMore: function(values){						if(values && values.more && values.more !='0')              return '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">[' + values.more + ' more ...]</a>';						else						    return '';					}					,createImage: function( url, textTarget, image ){						textTarget = (textTarget == '0') ? '_self' : '_blank';						if ( url ){							var extra = 'style="padding-top:3px; padding-right:3px;"';							return ['<a href="', url, '" target="' + '_self' + '" >', '<img src="', url, '" ' + extra + ' height=32 width=32 align="middle"/>', '</a>'].join('');						}						return '<img src="' + url + '" />';					}					,createUrl: function( url, textTarget, text, textCls, all ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['id', 'typeId', 'parentId', 'groupId', 'root', 'path', 'reminderId' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						};						for ( var i = 0; i < arr.length; ++i ){							arr[i] = arr[i] + ':\'' + (clean(all[arr[i]]) || '') + '\'';						}						var t = 'info: {' + arr.join(',') + '}, section: \''+config.section+'\'';						var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \'' + all.eventName + '\', {' + t + '} ); }';						if(config.hyperlink){							text = '<a href="#" onclick="return false;" class="'+config.itemStyle+'"><div>'+text+'</div></a>';												return '<div style="line-height:20px;overflow:hidden;" onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + all.sectionType + '\', func:' + func + ' } );" class ="">' + text + '</div>';						}						 return text;					}				 }							 );		//}		//this.contentTemplate = Eve.Desktop.Renderer.ContentTemplate;	}	,sanitize: function( section ){		section = section || this.sec;		return (this.sec.match( /(.*)s$/ ) ? this.sec.substr( 0, this.sec.length-1 ) : this.sec).toLowerCase();	}	,extractContent: function( content ){		var xml	    = content;		var dq		= Ext.DomQuery;		var sections = dq.select( 'section', xml );		if ( dq.select( 'data', xml )[0] !== undefined && dq.select( 'data', xml )[0].textContent == '' ){			return false;		}		var temp	 = [];		for ( var sec = 0, sec_len = sections.length; sec < sec_len; ++sec ){			var cur = sections[sec];			var section = {};			section['title'] 	= dq.selectValue( 'title', cur );			section['more']  	= dq.selectValue( 'more', cur);			section['date']  	= dq.selectValue('date', cur);			section['path']  	= dq.selectValue('path', cur);			section['groupId'] 	= dq.selectValue('id', cur);			var contents = dq.select( 'content', cur );			section['content'] = [];			for ( var c = 0, c_len = contents.length; c < c_len; ++c ){				section['content'].push( { text			: dq.selectValue( 'text', contents[c]  )										 , details		: dq.selectValue( 'description', contents[c] )										 , textUrl		: dq.selectValue( 'textUrl', contents[c] )										 , textTarget	: dq.selectValue( 'textTarget', contents[c] )										 , imageTarget	: dq.selectValue( 'imageTarget', contents[c] )										 , textCls		: ''										 /* Required for Popping dialogs */										 , id			: dq.selectValue( 'ID', contents[c] )										 , groupId		: dq.selectValue( 'groupID', contents[c] )										 , root			: dq.selectValue( 'mode', contents[c] )										 , path			: dq.selectValue( 'path', contents[c] )										 , reminderId	: dq.selectValue( 'reminderID', contents[c] )										 , completed	: dq.selectValue( 'completed', contents[c] )										 , endSuccessors			: dq.selectValue( 'endSuccessors', contents[c], '0' )										 , enforcedPredecessors	: dq.selectValue( 'enforcedPredecessors', contents[c], 'false' )										 , typeId		: dq.selectValue( 'typeID', contents[c] )										 , parentId		: dq.selectValue( 'parentID', contents[c] ) 										 , eventName	: this.getDialogEvent()										 , sectionType	: this.sanitize()										 /* Till here */										 , image	: dq.selectValue( 'image', contents[c] )										 , imageUrl	: dq.selectValue( 'imageUrl', contents[c] )										 , detailsCls: '' } );			}			temp.push( section );		}		return temp;	}	,getDialogEvent: function(){		return ((this.sec.match( /(.*)s$/ ) ? this.sec.substr( 0, this.sec.length-1 ) : this.sec) + '_edit_item_dlg').toLowerCase();	}	,getNewEventPref: function(){		return ((this.sec.match( /(.*)s$/ ) ? this.sec.substr( 0, this.sec.length-1 ) : this.sec)).toLowerCase();	}		,getIconPath: function(){		return 'links.png';	}	,getTitlePath: function(){		return 'links_desktop_title.png';	}	,getBasePath: function(){		return Eve.imagePath + 'desktop/';	}		,getDataTarget: function(){		// Wiee.... :))) Goes to the &nbsp;		try{			//return this.target.dom.firstChild.firstChild.firstChild.lastChild.firstChild.lastChild.lastChild.firstChild;		    return this.target.dom.firstChild.firstChild.lastChild;		}catch(e){			// Make sure the target exists			this.preRender();			//return this.target.dom.firstChild.firstChild.firstChild.lastChild.firstChild.lastChild.lastChild.firstChild;			return this.target.dom.firstChild.firstChild.lastChild;		}	}	,preRender: function(){		this.target.dom.innerHTML = this.baseTemplate.apply({ icon: this.getBasePath() + this.getIconPath(), title: this.getBasePath() + this.getTitlePath(), sec: this.getNewEventPref()});	}	,render: function( content, target ){		var t = target || this.target;		t.unmask();		var c = this.extractContent( content );				if ( c && c.length != 0){			if(Eve.activeSec == 'homepage' && c[0]!== undefined)			{				t.dom.innerHTML = this.baseTemplate.apply({ icon: this.getBasePath() + this.getIconPath(), title: this.getBasePath() + this.getTitlePath(), sec: this.getNewEventPref(), path: c[0].path, groupId: c[0].groupId});			}			this.getDataTarget().innerHTML = this.contentTemplate.apply( c );		}		else{			if(Eve.activeSec == 'homepage')				Eve.HomepageBrdg.showModule(this.sec, false);						this.getDataTarget().innerHTML = 'Not available right now.';		}		if ( this.getDataTarget().scrollHeight == 0 ){			// Get the panel and correct the height			Ext.getCmp( this.target.up('.x-panel').id ).setHeight( 'auto' /*this.getDataTarget().scrollHeight + 50*/ );		}else{			Ext.getCmp( this.target.up('.x-panel').id ).setHeight( 'auto' /*this.getDataTarget().scrollHeight + 50*/ );		}	}	,rawRender: function( content, target ){		var t = target || this.target;		t.unmask();		this.getDataTarget().innerHTML = 'Not available';	}	,mask: function(){		this.target.mask( 'Loading...', 'x-mask-loading' );	}	,extractParams: function( node ){		return {};	}};/*--------------------------------------------------------------------*/// Custom Requests for modules/*--------------------------------------------------------------------*/Eve.Desktop.ScheduleRequest = Ext.extend( Eve.Desktop.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.desktop.getcalendarcontent'; 	}});Eve.Desktop.CompanyAnnouncmentsRequest = Ext.extend( Eve.Desktop.Request, {	getUrl: function(){		return 'index.cfm?event=modern.desktop.getGroupNewsContent';	}} );Eve.Desktop.MyGroupsRequest = Ext.extend( Eve.Desktop.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.desktop.getgroupscontent'; 	}});Eve.Desktop.MyOfficeRequest = Ext.extend( Eve.Desktop.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.desktop.getOfficeContent'; 	}});Eve.Desktop.MessagesRequest = Ext.extend( Eve.Desktop.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.desktop.getmailscontent'; 	}	,loadUrl: function(){	 	return 'index.cfm?event=modern.desktop.editmail'; 	}});/*--------------------------------------------------------------------*/// Custom Renderer for modules/*--------------------------------------------------------------------*/Eve.Desktop.ScheduleRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'schedules.png';	}	,getTitlePath: function(){		return 'schedules_title.png';	}	,getConfig: function(){		return{			more       	: true			,sectionName     	: 'MyCalendar'			,newBtn     : 'new_schedule'			,hyperlink  : true			,emptyMessage:'There are no events scheduled...'			,section: 'calendar'		};	}	,sanitize: function(){		return "calendar";	}	,getDialogEvent: function(){		return 'calendar_edit_item_dlg';	}	,getNewEventPref: function(){		return "calendar";	}});Eve.Desktop.CompanyAnnouncmentsRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'company.png';	}	,getTitlePath: function(){		return 'company_title.png';	}	,getConfig: function(){		return{			emptyMessage: 'There are no news headlines...'		};	}	,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px;">{title}</div></b><div style="padding-left: 10px;" class="portlet">',					'<tpl for="content"><div>',						'<tpl if="this.checkText( values.text )">',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}',						'</tpl>',					'</div></tpl></div>',				 '</tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,createUrl: function( url, textTarget, text, textCls, all ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['id', 'typeId', 'parentId', 'groupId', 'root', 'path', 'reminderId' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						};						for ( var i = 0; i < arr.length; ++i ){							arr[i] = arr[i] + ':\'' + (clean(all[arr[i]]) || '') + '\'';						}						var t = 'info: {' + arr.join(',') + '}';						text = '<a href="#" onclick="return false;" class="'+config.itemStyle+'"><div>'+text+'</div></a>';						return '<div style="line-height:20px;overflow:hidden;" onclick="Eve.Desktop.CompanyAnnouncmentsRenderer.showDlg({' + t + '} );" class ="">' + text + '</div>';					}				 }							 );	}});Eve.Desktop.CompanyAnnouncmentsRenderer.showDlg = function(data){		Ext.Ajax.request({			url		: Eve.url			,params	: {				event	: 'modern.news.group.edit'				,id		: data.info.id				,goupId	: data.info.groupId			}			,success: function(response) {				var xml = response.responseXML;				var dq	= Ext.DomQuery;				if (dq.selectValue('code', xml) == 0) {					var title	= dq.selectValue('title', xml);					var posted	= dq.selectValue('posted', xml);					var body	= dq.selectValue('body', xml);					var html	=						'<div style="padding: 10px;">' +							'<div>' +								'<b>' + title + '</b> <br />' + posted +							'</div>' +							'<div>' +								'<br /><hr /><br />' +								'<p>' + body + '</p>' +							'</div>' +						'</div>';					var win = new Ext.Window({						layout		: 'fit'						,frame		: true						,modal		: true						,floating	: true						//,autoHeight	: true						,height     : 200						,width		: 300						,autoScroll : true						,items		: [{							xtype   	: 'panel'							,layout		: 'anchor'							,anchor     : '100%'							,autoScroll : true							,html		: html						}]					})					win.show();				}			}			,scope	: this		});}Eve.Desktop.MyGroupsRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'groups.png';	}	,getTitlePath: function(){		return 'groups_title.png';	}	,getConfig: function(){		return {			more       	: true			,sectionName     	: 'Homepage'			,newBtn     : false			,hyperlink  : true		};	}  ,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px">{title}</div></b><div style="padding-left: 10px;" class="portlet">',					'<tpl for="content"><div>',						'<tpl if="this.checkText( values.image )">',							'{[this.createImage( values.imageUrl, values.imageTarget, values.image )]}',						'</tpl>',						'<tpl if="this.checkText( values.text )">',						    '<span style="margin-left:{[this.getMargin(values)]}px;">',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}<br/>',							'</span>',						'</tpl>',						'<tpl if="this.checkText( values.details )">',							'<font color="#707070">',								'<span class="{values.detailsCls}">',									'{details}',								'</span>',							'</font>',							'<br/>',						'</tpl>',					'</div></tpl></div>',				 '</tpl>',				 '<tpl><div>{[this.createMore(values[0])]}</div></tpl>',				 {					getMargin: function(values){						if( values.path ){							var depth = values.path.split('\\').length-2;							var marginLeft = (depth == 1)? 0 : (depth*7);							return marginLeft;						}						return '';					}				,checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,createMore: function(values){						if(values && values.more && values.more !='0')							return '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">[' + values.more + ' more ...]</a>';						else						    return '';					}					,createImage: function( url, textTarget, image ){						textTarget = (textTarget == '0') ? '_self' : '_blank';						if ( url ){							var extra = 'style="padding-top:3px; padding-right:3px;"';							return ['<a href="', url, '" target="' + '_self' + '" >', '<img src="', url, '" ' + extra + ' height=32 width=32 align="middle"/>', '</a>'].join('');						}						return '<img src="' + url + '" />';					}					,createUrl: function( url, textTarget, text, textCls, all ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['id', 'name'];						var clean = function(str) {							str = str || '';							return str.replace( /\\/g, '\\\\' );						};           				var temp = [];						var t	 = {};						for ( var i = 0; i < arr.length; ++i ){	      					temp['id']	 = all['id'];	      					temp['name'] =  all['text'];							t[arr[i]]	 = (clean(temp[arr[i]]) || '');													}						t['path'] =  all['path'];						t.func = function(){Eve.Resource.superbridge.broadcast(this,'load_section',{sectionName: 'Homepage'})};						if (config.hyperlink)							text = '<a href="#" onclick="return false;">' + text + '</a>';						var n  = "_desktopGroupHandler" + Ext.id().split('-')[1];						Eve.Desktop[n] = function() {							Eve.Preference._prefs['landinggroupid']		= t.id;							Eve.Preference._prefs['landinggrouppath']	= t.path;							Eve.Resource.superbridge.broadcast(this, 'direct_group_select', t);						}						return "<span onclick='Eve.Desktop." + n + "()' >" + text + "</span>";					}				 }			);		}});Eve.Desktop.NewsRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'news.png';	}	,getTitlePath: function(){		return 'news_title.png';	}		,createContentTemplate: function(){			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px;">{[this.createTitle(values)]}</div></b><div style="padding-left: 10px;" class="portlet">',					'<tpl for="content"><div>',						'<tpl if="this.checkText( values.text )">',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}',						'</tpl>',						'<tpl if="this.checkText( values.details )">',							'<font color="#707070">',								'<div class="{values.detailsCls}" style="padding-left:15px;margin-top:-3px;">',									'{details}',								'</div>',							'</font>',						'</tpl>',					'</div></tpl></div>',					'<div style="">{[this.checkContent( values )]}</div>',				 '</tpl>',				 '<tpl><div margin-left:10px;margin-top:-10px;></div></tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,createTitle : function( values ){						return '';					}					,checkContent: function( values ){						if ( !values.content || values.content.length == 0  ){							if(values.title === undefined || values.title == ""){									return 'You have no news ...';							}							else return'';						}						return '';					}					,createUrl: function( url, textTarget, text, textCls, all ){						text = '<a href="'+url+'" target="_new"><div>'+text+'</div></a>';						return '<div style="line-height:20px;overflow:hidden;"  class ="">' + text + '</div>';					}				 });	}});Eve.Desktop.TasksRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'tasks.png';	}	,getTitlePath: function(){		return 'tasks_title.png';	}	,getConfig: function(){		return {			more       		: true			,sectionName      	: 'MyTasks'			,newBtn			: 'new_task'			,checkbox       : true			,hyperlink  	: true			,emptyMessage 	: 'You have no tasks...'			,section    	: 'task'		};	}});Eve.Desktop.LinksRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'links.png';	}	,getTitlePath: function(){		return 'links_title.png';	}  ,getConfig: function(){		return {			sectionName      	: 'MyLinks'			,newBtn		: 'new_link'			,hyperlink  : true			,emptyMessage : 'You have no notes... '		};	}	,getDialogEvent: function(){		return 'link_open_link';	}  ,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><br /><b><div style="padding:3px">{title}</div></b><div style="padding-left: 10px;margin-top:-20px" class="portlet">',                        '<table width="100%">',						'<tpl for="content"><tr>',						'<tpl if="this.checkText( values.image )">',							'<td  style=" border:1px solid;" height=33 width="30">{[this.createImage( values.textUrl, values.imageTarget, values.imageUrl, values)]}</td>',						'</tpl>',						'<tpl if="!this.checkText( values.image )"><td width="33"><div style="width:39px;float:left">&nbsp;</div></td></tpl>',						'<tpl if="this.checkText( values.text )">',							'<td>{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}</td>',						'</tpl>',					'</tr></tpl><table></div>',					'{[this.checkContent( values )]}',				 '</tpl>',				 '<tpl><div style="margin-left:8px;margin-top:8px">{[this.createMore(values[0])]}</div></tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,checkContent: function( values ){						if ( !values.content || values.content.length == 0  )								return '<div style="margin-top:-12px">There are currently no links...</div>';						return'';					}					,createMore: function(values){						if(values && values.more && values.more !='0')							return '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">[' + values.more + ' more ...]</a>';						else						    return '';					}					,createImage: function( url, imageTarget, imageUrl, all ){						textTarget = (imageTarget == '0') ? '_self' : '_blank';						if ( url ){							 return this.createUrl(url, all.textTarget, all.text, all.textCls, all, true);						}						return '<img src="' + imageUrl + '" />';					}					,createUrl: function( url, textTarget, text, textCls, all, isImage ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['url', 'objId', 'spawnNewWindow', 'autoLogin' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						};            			var temp=[];						for ( var i = 0; i < arr.length; ++i ){			              	temp['url'] = all['textUrl'];			              	temp['objId'] = 'PLI_' + all['id'];			              	temp['spawnNewWindow'] = all['textTarget'];			              	temp['autoLogin'] = all['imageTarget'];							arr[i] = arr[i] + ':\'' + (clean(temp[arr[i]]) || '') + '\'';						}						var t = 'info: {rec:{data:{' + arr.join(',') + '}}}';						var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \'' + all.eventName + '\', {' + t + '} ); }';						if(isImage){							text =['<a href="', url, '" target="' + '_self' + '" onclick="return false;" >',							'<img  style="margin-top:0px; margin-right:0px;" src="', all.imageUrl, '"  height=32 width=37 align="middle"/>',							'</a>'].join('');						}						else if(config.hyperlink)							text = '<a href="' + url + '" onclick="return false;">'+text+'</a>';						return '<span  onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + all.sectionType + '\', func:' + func + ' } );" >' + text + '</span>';					}				 }							 );  }});Eve.Desktop.RemindersRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'reminders.png';	}	,getTitlePath: function(){		return 'reminders_title.png';	}	,getConfig: function(){		return {			sectionName      	: 'Reminders'			,newBtn     : 'new_reminder'			,hyperlink  : true      		,itemStyle  : 'bold-item'			,emptyMessage : 'There are no reminder'		};	}});Eve.Desktop.MyOfficeRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'myoffice.png';	}	,getTitlePath: function(){		return 'myoffice_title.png';	}	,getConfig: function(){		return {			newBtn: false			,sectionName: false			,blockCls: 'motd-block'		};	}});Eve.Desktop.MessagesRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'messages.png';	}	,getTitlePath: function(){		return 'messages_title.png';	}	,getConfig: function(){		return {			sectionName      : 'Mail'			,newBtn     : 'new_message'		};	}	,getNewEventPref: function(){		return "mail";	}});Eve.Desktop.NotesRenderer = Ext.extend( Eve.Desktop.Renderer, {	getIconPath: function(){		return 'notes.png';	}	,getTitlePath: function(){		return 'notes_title.png';	}	,getDialogEvent: function(){		return 'note_load_icon_popup';	}	,getConfig: function(){		return {			sectionName: 'Notes'			,newBtn     	: 'new_note'			,hyperlink  	: true			,emptyMessage	:'You have no notes... '			,section        : 'note'		};	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\desktop/DesktopFactory.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Desktop.Factory = function(){  }Ext.extend( Eve.lib.Desktop.Factory, Eve.lib.Factory, {	section: 'desktop'	 	,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);	}		,createCenter : function( superbridge ) {		var view = {			get : function() {return [{}]}		}		Eve.desktop = new Eve.DesktopBridge();		superbridge.addBridge(Eve.desktop);		this.manager.registerComponents(Eve.desktop);		Eve.desktop.init({			superbridge	: superbridge			,view		: view			,section	: this.section			,manager    : this.manager		});				return { view : view, config: { border: false, items : Eve.desktop.getView(), bodyStyle: 'overflow-y:auto;' } };	}		,createWest : function(brdg) { }	,createDialogs : function() {	}	 });/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\desktop/DesktopDialog.js *//*--------------------------------------------------*/var store =  new Ext.data.SimpleStore({	fields : ['value', 'text'],	data : [		 ['1', '1']		,['2', '2']		,['3', '3']		,['4', '4']		,['5', '5'] 		,['6', '6']		,['7', '7']		,['14', '14']		,['31', '31']	]});	var t = new Ext.data.Store( {fields:['text','value'], data:[], reader:new Ext.data.XmlReader( {			record: "row"		}, [ 'text', 'value' ] )} );var taskSt =  new Ext.data.SimpleStore({	fields : ['value', 'text'],	data : [		 ['5', '5']		,['6', '6']		,['7', '7']		,['8', '8']		,['9', '9']	 	,['10', '10']		,['11', '11']		,['12', '12']		,['13', '13']		,['14', '14']		,['15', '15']		,['16', '16']		,['17', '17']		,['18', '18']	 	,['19', '19']		,['20', '20']		,['21', '21']		,['22', '22']		,['23', '23']		,['24', '24']		,['25', '25']		,['26', '26']		,['27', '27']		,['28', '28']		,['29', '29']		,['30', '30']	]});Ext.ns( 'Eve', 'Eve.Desktop' );Ext.reg( 'xform', Eve.FormPanel );Eve.Desktop.ItemPanels = new Ext.Window({	layout: 'card'	,height: 200	,width : 400	,closeAction: 'hide'	,modal : true	,title : 'Windows'	,border: false		,defaults :{		frame: true		,xtype: 'xform'	}	,y	   : 100	,buttons: [{		text: 'Save'				,handler: function(){			console.log( Eve.Desktop.ItemPanels.collect() );			Eve.Desktop.ItemPanels.hide();		}	},{		text: 'Cancel'		,handler: function(){			Eve.Desktop.ItemPanels.hide();		}	}]		//-------------------------------------	// Binds a dialog to a formName	//-------------------------------------	,bindTo: function( formName, dialog ){		this._binds = this._binds || {};				this._binds[ formName ] = dialog;	}		// Finds a specific panel	,findPanel: function( name ){		var f = 0;		this.items.each( function( r ){			if ( r.formName != name ){				return ++f;			}						return false;		} );				return ( f == this.items.items.length ) ? -1 : f;	}		//-------------------------------------	// Shows a specific panel	//-------------------------------------	,showPanel: function( activeItem ){		var panel = activeItem;		if ( typeof activeItem == 'string' ){			if ( ( panel = this.findPanel( activeItem ) ) == -1 ){				return false;			}		}				this.setTitle( this.items.items[panel].formName );				// First make sure the dialog is already rendered		this.show();				// Set the activePanel		this.layout.setActiveItem( panel );				//		var aF = this.activeForm();						// Load the content of the dialog		if ( this._binds && this._binds[ aF.formName ] ){			if ( this._binds[ aF.formName ].validate() )				return this._binds[ aF.formName ].load( aF );					}			}		//-------------------------------------	// returns the active form	//-------------------------------------	,activeForm: function(){		return this.layout.activeItem;	}		//-------------------------------------	// Collects the active Form in the card layout	//-------------------------------------	,collect: function(){		var aF = this.activeForm();				// Check if a form is binded to the form		if ( this._binds && this._binds[ aF.formName ] ){			if ( this._binds[ aF.formName ].validate() )				return this._binds[ aF.formName ].collect( aF );						return false;		}				return aF.getForm().getValues( false );	}		//-------------------------------------	// Validates the data entered by the user	//-------------------------------------	,validate: function(){		return true;	}		//-------------------------------------	// Loads the data from the backend	//-------------------------------------	,load: function(){		// Check if a form is binded to the form		if ( this._binds && this._binds[ aF.formName ] ){			return this._binds[ aF.formName ].load( aF );		}						return false;	}		//-------------------------------------	// Fetches the validation error	//-------------------------------------	,validationError: function(){		return 'Validation Error...';	}		,items:[		{			layout: 'form'			,formName: 'Schedule'			,items:[new Ext.form.ComboBox({					store			: store					,mode			: 'local'					,xxtype			: 'combo'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Days To Display'  					//,labelStyle 	: 'width: 70px'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_schedule_days'					,typeAhead		: true					//,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			})]		},		{			layout: 'form'			,formName: 'Reminders'			,items:[new Ext.form.ComboBox({					store			: store					,mode			: 'local'					,xxtype			: 'combo'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Days To Display'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_reminder_days'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			})]		},		{			layout: 'form'			,formName: 'Tasks'			,items:[{					xtype			: 'combo'					,xxtype			: 'combo'					,store			: new Ext.data.SimpleStore({						fields : ['status', 'statusText'],						data : [							 ['0', 'All Completed']							,['1', 'All Incompleted']							,['2', 'All']						]					})					,mode			: 'local'					,valueField		: 'status'					,displayField	: 'statusText'					,value			: '0'					,fieldLabel		: 'Status'					,hiddenName			: 'desktop_task_status'					,name			: 'desktop_task_status'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'				},{					xtype			: 'combo'					,xxtype			: 'combo'					,store			: new Ext.data.SimpleStore({						fields : ['value', 'text'],						data : [							 ['0', 'From All Groups']							,['1', 'From Personal Only']							,['2', 'From Personal and All Groups']						]					})					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,value			: '0'					,fieldLabel		: 'Show Items'					,hiddenName			: 'desktop_task_show_items'					,name			: 'desktop_task_show_items'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'				},{					xtype			: 'combo'					,xxtype			: 'combo'					,store			: new Ext.data.SimpleStore({						fields : ['assign', 'assignText'],						data : [							 ['0', 'To Me']							,['1', 'By Me']							,['2', 'All']						]					})					,mode			: 'local'					,valueField		: 'assign'					,displayField	: 'assignText'					,value			: '0'					,fieldLabel		: 'Assigned'					,hiddenName			: 'desktop_task_assign'					,name			: 'desktop_task_assign'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'				},{			 	   xtype           : 'combo'					,store			: taskSt					,mode			: 'local'					,xxtype			: 'combo'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Items To Display'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_tasks'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			}			/*{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_tasks_folder'	      		,mode			: 'local'	      		,fieldLabel 	: 'Folder'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true				,forceSelection : true		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'		    	,store 			: new Ext.data.Store({	            	reader 	: new Ext.data.XmlReader({	               	record 	: 'row'	               ,id		:'value'	               },['value', 'text', 'depth'])            				})				,tpl			: Eve.indentComboXTemplate()						}*/]},			{				layout: 'form'				,formName: 'Notes'				,items:[new Ext.form.ComboBox({					store			: taskSt					,mode			: 'local'					,xxtype			: 'combo'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Item To Display'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_notes'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			}),			{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_notes_folder'	      		,mode			: 'local'	      		,fieldLabel 	: 'Folder To Display'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true				,forceSelection : true		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'		    	,store 			: new Ext.data.Store({	            	reader 	: new Ext.data.XmlReader({	               	record 	: 'row'	               ,id		:'value'	               },['value', 'text', 'depth'])				})				,tpl			: Eve.indentComboXTemplate()						}]},			{				layout: 'form'				,formName: 'Links'				,items:[{			 	    xtype           : 'combo'					,store			: taskSt					,mode			: 'local'					,valueField		: 'value'					,xxtype			: 'combo'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Item To Display'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_links'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			},			{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_links_folder'	      		,mode			: 'local'	      		,fieldLabel 	: 'Folder To Display'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true				,forceSelection : true		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'		    	,store 			: new Ext.data.Store({	            	reader 	: new Ext.data.XmlReader({	               	record 	: 'row'	               ,id		:'value'	               },['value', 'text', 'depth'])				})				,tpl			: Eve.indentComboXTemplate()			}]},			{				layout: 'form'				,formName: 'Messages'				,items:[{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_mail_folderA'	      		,mode			: 'local'	      		,fieldLabel 	: 'Mail Folder A'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true		    	,editable		: false		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'			},			{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_mail_folderB'	      		,mode			: 'local'	      		,fieldLabel 	: 'Mail Folder B'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true		    	,editable		: false		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'			},			{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_mail_folderC'	      		,mode			: 'local'	      		,fieldLabel 	: 'Mail Folder C'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true		    	,editable		: false		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'			},			{	      		xtype			: 'combo'		    	,hiddenName		: 'desktop_mail_folderD'	      		,mode			: 'local'	      		,fieldLabel 	: 'Mail Folder D'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true		    	,editable		: false		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'			}]}		,{			layout: 'form'			,formName: 'News'			,items:[new Ext.form.ComboBox({	      		xtype			: 'combo'		    	,hiddenName		: 'news_feeds'	      		,mode			: 'local'	      		,fieldLabel 	: 'Select News Feed'				,lazyInit		: false				,valueField		: 'value'	    		,displayField	: 'text'		      	,labelSeparator : ''		    	,typeAhead		: true		    	,editable		: false		    	,selectOnFocus 	: true		    	,triggerAction 	: 'all'		    	,anchor 		: '98%'			})]		}								]	,activeItem : 0});Eve.Desktop.SettingDlg = function(){	var intervalStore = new Ext.data.SimpleStore({		fields : ['value', 'text'],		data : [			 ['120', ' 2 minutes ']			,['240', ' 4 minutes ']			,['360', ' 6 minutes ']			,['480', ' 8 minutes ']			,['600', ' 10 minutes']		]	});	var settingPanel = new Ext.FormPanel ({		frame		: true		,border		: false		,bodyStyle	: 'padding:5px 5px 0'		,width		: 400		,defaults	: {			anchor		: '95% 100%'		}		,items 		: [{					xtype			: 'combo'					,id				: 'cmbDesktopInterval'					,store			: intervalStore					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,value			: '600'					,fieldLabel		: 'Refresh Interval'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			}		]	});return new Ext.Window({		height: 150		,width : 400		,closeAction: 'hide'		,modal : true		,title : 'Desktop Setting'		,border: false		,frame: true		,layout: 'fit'		,y	   : 100		,items: [settingPanel]		,buttons: [{			text: 'Save'			,handler: function(){				var interval = Ext.getCmp('cmbDesktopInterval').getValue();				Eve.Preference.set('desktopRefreshInterval', interval);				this.ownerCt.hide();				Eve.Resource.superbridge.broadcast(this, 'modify_desktop_setting', {interval: interval});			}		},{			text: 'Cancel'			,handler: function(){				this.ownerCt.hide();			}		}]	})}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\homepage/HomePage.js *//*--------------------------------------------------*/Eve.FrameWrapper = Ext.extend( Eve.lib.Bridge, {	init: function( obj ){  Eve.FrameWrapper.superclass.init.call(this, obj);				this.view = new Ext.Container( {			autoEl: { tag: 'iframe', src: 'about:blank', style: 'height: 100%; width: 100%; border: 0px none solid;', frameborder: 'no' }, layout: 'fit'		} );				this.view.on('render', function( cmp ){ cmp.el.setHeight('100%');} );		this.view.setSize = function(){			//that.view.prototype.setSize.apply( that.view, arguments );		}	}		,setSource: function( src ){		if ( this.view.rendered )			this.view.el.dom.setAttribute( "src", src );		else			this.view.autoEl.src = src;	}		,getView: function(){		return this.view;	}} );Eve.HomepageBridge = Ext.extend( Eve.DesktopBridge, {		pageId: 0	,init: function( obj ){ 				Eve.HomepageBridge.superclass.init.call(this, obj); 		this.factory = new Eve.Homepage.PortletFactory(); 		 		this._lookup = { 			 1 : 'News' 			,2 : 'TasksAssignedToOther' 			,3 : 'TasksAssignedToMe' 			,4 : 'Links' 			,5 : 'Voting' 			,6 : 'Calendar' 			,7 : 'Documents' 			,8 : 'MyOffice' 			,9 : 'MessageOftheDay'			,10: 'Admin' 			/*,1 : 'Schedule' 			,11: 'Reminders' 			,7 : 'Movies' 			,6 : 'Weather'*/ 		}; 		 		var activeModuleBtn = this.createActiveModulesButton(); 		this.view = new Eve.Portal({ 			id: 'Homepage_portal_container'			,anchor: '100%' 		});		// The view without... whatever		this.semiView = new Ext.Panel( {			layout: 'anchor'			,items: [{xtype:'container', id:'menu-div-wrapper',						autoEl: { tag: 'div', style: 'position:absolute;top:0px;left:0px;width:100%;' }				},{xtype:'panel',id : 'homepage_header', height:122, baseCls: 'homepage-header'}				, this.view ]				 			,bodyStyle: 'height: 100%; overflow-y: auto;'			,tbar:new Ext.Toolbar({				id: 'homepage-admin-toolbar'				,hidden : (Eve.GroupSelect.IsAdmin == "1")? false : true			 	,items: [activeModuleBtn,'->',{				xtype: 'button'				,text: 'Switch Homepage'				,handler: function(){					Eve.Homepage.popOptionsDlg();				}			}] 			})		} );				this.semiView.setSize = function(){}		this.iFrame = new Eve.FrameWrapper();		obj.superbridge.addBridge(this.iFrame)		this.iFrame.init( {			superbridge	: obj.superbridge			,section	: null		} );		var overflow = 'overflow-y:hidden';		this.parentView = new Ext.Panel( {			layout: 'card',			deferredRender: false,			items: [this.semiView, this.iFrame.getView() ]			,activeItem: 1 			,bodyStyle: 'height: 100%; border:0px none;'+ overflow 			,cls: 'homepage-mainpanel-fix'            ,border: false		} ); 		this.ItemCache = {};				if ( !Eve.Homepage.Dispatcher ){			// Create a new dispatcher			Eve.Homepage.Dispatcher = new Eve.Homepage.DispatcherSingleton();		}				if ( !Eve.Homepage.ModeManager ){			Eve.Homepage.ModeManager = new Eve.Homepage.ModeSingleton();			Eve.Homepage.ModeManager.onChange( Eve.Homepage.Dispatcher, Eve.Homepage.Dispatcher.changeMode );			Eve.Homepage.ModeManager.onChange( Eve.PortletManager, Eve.PortletManager.toggleFunc );		} 	}	,forceLoad: function(data){		this.reload();	}		,setSharedSection : function(data)	{		this.sharedSection = data.sharedSection;	}	 	,reload: function(){				this.shouldRerender = false;		this.pageId = Eve.GroupSelect.PageId;		this.groupId = Eve.GroupSelect.GroupId;		this.homepage = Eve.GroupSelect.Homepage;		if ( !this.runner ){			var task = {			    run: function(){				this.reappendView();			    },			    interval: 1000 //1 second			    ,scope: this			}						this.runner = new Ext.util.TaskRunner();			this.runner.start(task);		}		var toolbar = Ext.getCmp('homepage-admin-toolbar');				if ( this.homepage == "0" ){			if ( this.parentView.rendered ){				this.parentView.layout.setActiveItem( 0 );				this.parentView.body.setStyle('overflow-y', 'auto' );				if ( Ext.getCmp('Homepage_portal_container').rendered ){					for ( var i in this.ItemCache ){						this.ItemCache[i].destroy();					}					this.ItemCache = {};					this.getConfig( this.createPortals, this );				}			/*	if ( !this.__firstTime ){					this.initPublisher();					this.__firstTime = 1;				}*/								if ( Eve.GroupSelect.IsAdmin == "0" ){		              // Disable the Publisher		              //Pub.MenuBar.disable();		              toolbar.hide();		          }else{		              //Pub.MenuBar.enable();		              toolbar.show();		          }							            }else{				this.parentView.activeItem = 0;				if ( Ext.getCmp('Homepage_portal_container').rendered ){					for ( var i in this.ItemCache ){						this.ItemCache[i].destroy();					}					this.ItemCache = {};					this.getConfig( this.createPortals, this );				}            }		}else{						var newUrl = Eve.url;			var eventName;			if(this.homepage == '1')				eventName = 'event=wiki.home';			else if(this.homepage == '2'){				eventName = 'event=modern.publisher.view&pageId=' + this.pageId + '&groupId='  + this.groupId;			}			if (newUrl.indexOf('CFID') == -1 && newUrl.indexOf('CFTOKEN') == -1){				if(Eve.CFId.length !=0 && Eve.CFToken.length !=0)					newUrl += (newUrl.indexOf('?') != -1 ? '&' : '?') + "CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;			}			newUrl += (newUrl.indexOf('?') != -1 ? '&' : '?') + eventName;			if ( this.parentView.rendered ){				this.parentView.layout.setActiveItem( 1 );				this.parentView.body.setStyle('overflow-y', 'hidden' );				this.iFrame.setSource( newUrl );			}else{				this.parentView.activeItem = 1;				var that = this;				this.parentView.on('render', function(){ 					this.parentView.body.setStyle('overflow-y', 'hidden' );					that.iFrame.setSource( newUrl );					}, this );			}		} 	}		,initPublisher: function(){/*		Pub.Connector.setBaseParams( { CFID: Eve.CFId, CFTOKEN: Eve.CFToken } );		Ext.QuickTips.init()		Pub.PageWizard = new Pub._PageWizard();		var st = new SiteTree.Window( { title: 'Sitetree'									 , height: 390									 , width: 687									 , y: 100									 , modal: true									 , closeAction: 'hide' 									 , border	  : false									} );				var np	= new SiteTree.Page.New( { y: 100, modal: true });				var ShowSiteTreeFunc = function( arg ){			st.show( arg );		}				var ShowPageWizard = function( arg ){			Pub.PageWizard.show( arg );		}				// change the zindex of the menu-div for the Pub.MenuBar		st.on('show', function(){		   Pub.MenuBar.setZIndex( st.el.getStyle('z-index') - 1 );		} );		// Bridge between Template window, and SiteTree Window		var obs = new Ext.util.Observable();				obs.addEvents( 'show_site_tree', 'show_template_tree', 'hide_window', 'reload_tree' );				obs.on( 'show_site_tree', st.showSiteTree, st );		obs.on( 'page_wizard', ShowPageWizard, Pub.PageWizard );				Pub.PageWizard.submitSuccess = function( xml, cfg ){			var dq	= Ext.DomQuery;			var id  = dq.selectValue( 'id', xml );						if ( window.parent ){				window.parent.open( Pub.Connector.baseUrl( {												 event : 'modern.publisher.publisher'												,pageId: id.replace(/(TM_|PG_)/g, '')												,isTemplate: cfg.is_template												,Freeform   : (cfg.mode == 'freeform' || cfg.mode == '')											   } ) );			}else{				window.open( Pub.Connector.baseUrl( {													 event : 'modern.publisher.publisher'													,pageId: id.replace(/(TM_|PG_)/g, '')													,isTemplate: cfg.is_template													,Freeform	   : (cfg.mode == 'freeform' || cfg.mode == '')												   } ) );			}			obs.fireEvent( 'create_new_page', cfg, undefined, xml );			this.hide();		}				st.setObserver( obs );		np.setObserver( obs );				Pub.MenuBar.init();					Pub.HelpWindow = new Ext.Window( {			 title	: ''			,width	: 600			,height	: 400			,y		: 100			,bodyStyle: 'padding: 5px'			,closeAction: 'hide'			,html	: '<B>Did you know that you can edit this page and add other pages to create customized pages, intranets and extranets? The Site Publisher allows you to customize your group in almost any way imaginable. </B><BR><BR><BR>You can:<BR><BR>1. Design pages with the content you want to show to your group members<BR>2. link to sections in your group<BR>3. link to specific items in your group<BR>4. even link to external resources you want to expose to your group members.<BR><BR><BR>To get started:<BR><BR>1. Click on \"Add a page\"<BR>2. Select a template<BR>3. Click \"next\" on the bottom right<BR>4. Follow the wizard<BR><BR>You can also learn more about this topic by watching <a href=\"http://collaboration.hyperoffice.com/training-videos/159-site-publisher/522-site-publisher-tour.html\" target=\"_new\">this video</a>'		} )				if ( Eve.DesignPageUrl )			Pub.MenuBar.addItem( { iconCls: 'template-page'	, text:'Design this page'	, handler: function(){ window.open( Eve.DesignPageUrl );   } } );					Pub.MenuBar.addItem( { iconCls: 'new-page'		, text:'Add a Page'   		, handler: function( e ){ obs.fireEvent( 'page_wizard', e.target );   } } );		Pub.MenuBar.addItem( { iconCls: 'open-page'		, text:'Site Tree'		 	, handler: function( e ){ obs.fireEvent( 'show_site_tree', e.target ); } } );		Pub.MenuBar.addItem( { iconCls: 'help-page'		, text:'Help', float: 'right', handler: function( e ){ Pub.HelpWindow.show();   } } );	*/	}	,createActiveModulesButton: function(){ 		var l = this._lookup; 		var btns = []; 		 		for ( var i in l ){ 			btns.push( new Ext.menu.CheckItem({ 				id		: 'homepage_active_btn_' + l[i] 				,text	: l[i] 				,listeners: { 					checkchange: { 						fn: function( btn, toggle ){ 							var mName = btn.getId().split( '_' ); 							mName = mName[mName.length-1]; 							this.showModule( mName, toggle ); 						} 						,scope: this 					} 				} 				,checked: true 			}) ); 		} 		 	/*	return [ { xtype: 'button', enableToggle : true, text: 'Modify the homepage'				 , id: 'homepage-modify-btn'				 , toggleHandler: function( btn, state ){				   		if ( state == true ){							Eve.Homepage.ModeManager.changeMode( 'edit' );						}else{							Eve.Homepage.ModeManager.changeMode( 'default' );						}				   }				 }, { xtype : 'tbsplit',  				  menu  : new Ext.menu.Menu({ items: btns} ), 				  text  : 'Modules', 				  id	: 'homepage_active_modules_menu', 				  hidden: true			}];*/			 		return [ { xtype: 'button', enableToggle : true, text: 'View Mode'				 , id: 'homepage-view-mode-btn'				 ,allowDepress: false				 ,pressed: true				 , toggleHandler: function( btn, state ){				   		if ( state == true ){							Ext.getCmp('homepage-edit-mode-btn').toggle(false, true);							Eve.Homepage.ModeManager.changeMode( 'default' );						}				   }				 }, { xtype: 'button', enableToggle : true, text: 'Edit Mode'				 	 ,id: 'homepage-edit-mode-btn'					 ,allowDepress: false		 			 ,toggleHandler: function( btn, state ){				   		if ( state == true ){         					Eve.Homepage.ModeManager.changeMode( 'edit' );							Ext.getCmp('homepage-view-mode-btn').toggle(false, true);						}				   }			}]; 	} 	 	,showModule: function( moduleName, show ){ 		var func = show ? 'show' : 'hide'; 		var item = (this.ItemCache[moduleName]);		 		if ( item ){ 			item[func](); 			/*var menuBar = Ext.getCmp('homepage_active_modules_menu'); 			menuBar.menu.items.each( function(r){ 				if ( r.id.indexOf( moduleName ) != -1 ){ 					r.setChecked( show ); 					return false; 				} 			});*/ 		} 	} 	 	,getView: function(){ 		return this.parentView; 	} 		,reloadObject: function( callee, type, object ){		if ( this.homepage == "0" || this.homepage == 0 ){			var it;			var extractSection = function( type ){				var o = type.split('_')[0];				switch( o ){					case 'calendar':						return 'Calendar';					case 'voting':						return 'Voting';					case 'news':						return 'News';				}				return '';			};			if( type.indexOf('update_grid') == -1 && type.split('_')[0] == 'task'){				it = this.ItemCache[ 'TasksAssignedToOther'];				if(it)				it.xhr.sendRequest( it.section );								it = this.ItemCache[ 'TasksAssignedToMe'];				if(it)				it.xhr.sendRequest( it.section );			}				 it = this.ItemCache[ extractSection( type ) ];			if ( it ){				it.xhr.sendRequest( it.section );			}		}else if ((this.homepage == '2' || this.homepage == 2)&& this.pageId != "0"){			this.shouldRerender = true;			this.reappendView();		}	}		,reappendView: function(){		var newUrl = Eve.url;		if (newUrl.indexOf('CFID') == -1 && newUrl.indexOf('CFTOKEN') == -1){			if(Eve.CFId.length !=0 && Eve.CFToken.length !=0)				newUrl += (newUrl.indexOf('?') != -1 ? '&' : '?') + "CFID="+Eve.CFId+"&CFTOKEN="+Eve.CFToken;		}		newUrl += (newUrl.indexOf('?') != -1 ? '&' : '?') + '&event=modern.publisher.view&pageId=' + this.pageId + '&groupId='  + this.groupId;		if ( this.pageId != '0' && this.pageId != 0 && this.shouldRerender == true && Eve.activeSec == "homepage" ){			this.iFrame.setSource( 'about:blank' );				this.iFrame.setSource( newUrl );				this.shouldRerender = false;		}	}	,showNews: function(data){		Ext.Ajax.request({			url		: Eve.url			,params	: {				event	: 'modern.news.group.edit'				,id		: data.info.id				,goupId	: data.info.groupId			}			,success: function(response) {				var xml = response.responseXML;				var dq	= Ext.DomQuery;				if (dq.selectValue('code', xml) == 0) {					var title	= dq.selectValue('title', xml);					var posted	= dq.selectValue('posted', xml);					var body	= dq.selectValue('body', xml);					var html	=						'<div style="padding: 10px;">' +							'<div>' +								'<b>' + title + '</b> <br />' + posted +							'</div>' +							'<div>' +								'<br /><hr /><br />' +								'<p>' + body + '</p>' +							'</div>' +						'</div>';					var win = new Ext.Window({						layout		: 'fit'						,frame		: true						,modal		: true						,floating	: true						//,autoHeight	: true						,height     : 200						,width		: 300						,autoScroll : true						,items		: [{							xtype   	: 'panel'							,layout		: 'anchor'							,anchor     : '100%'							,autoScroll : true							,html		: html						}]					})					win.show();				}			}			,scope	: this		});	}	 	,execute: function( callee, type, object ){		Eve.HomepageBridge.superclass.execute.apply(this,arguments); 		switch( type ){ 			case 'homepage_close_portlet': 				this.showModule( object.section, false ); 				break;			case 'open_news_dlg':				this.showNews(object);                break;			    			default:				if (Eve.activeSec == 'homepage' && type.indexOf( '_success_' ) !== -1 ){					/* Something success has occured */					this.reloadObject.apply( this, arguments );				}				break;				 		} 	} 	 	,lookup: function( id ){ 		if ( typeof id != 'number' ) 			return id; 			 		return this._lookup[id]; 	} 	 	,getConfig: function( func, scope ){		var firstCol = [8, 1];		var secondCol = [];		var temp = [['mail', 9], ['sharedCalendar', 6], ['voting', 5]];		for ( var i = 0; i< 3; i++){			if( Eve.Preference.getBoolean(temp[i][0]))			    firstCol.push(temp[i][1]);		}				var temp = [['sharedTasks', 2],['sharedTasks', 3], ['sharedDocuments', 7], ['sharedLinks', 4], ['sharedCalendar', 10]];		for ( var i = 0; i< 5; i++){			if( Eve.Preference.getBoolean(temp[i][0]))			    secondCol.push(temp[i][1]);		}				 		func.apply( scope || this, [[firstCol, secondCol]] ); 	} 	 	,createPortals: function( config ){ 		// Create columns	    if ( this.view.items )      this.view.items.clear();       		this.view.createColumns( config.length ); 		 		// Create the portlets		for ( var col = 0, clen = config.length; col < clen; ++col ){			var its = config[col];			var c   = this.view.items.get(col);						for ( var row = 0, rlen = its.length; row < rlen; ++row ){				var item = this.lookup(its[row]);					this.ItemCache[item] = this.factory.create( item );								c.add( this.ItemCache[item] );			}			//this.view.items.get(col).doLayout();		}				if ( this.view.layout && this.view.layout.layout )			this.view.doLayout();					this.factory.getHomepageContent(this);		// Now change the mode to whatever you wanted		Eve.Homepage.ModeManager.changeMode.defer( 500, Eve.Homepage.ModeManager, ['default'] ); 	} });//--------------------------------------// Portlet Factory//--------------------------------------Eve.Homepage.PortletFactory = function(){this.renderers = [];};Eve.Homepage.PortletFactory.prototype = {	create: function( portletName ){		portletName = this.uCase( portletName );				// Create the portlet initiator		var initiator = null;		if ( Eve.Homepage[portletName + 'Initiator'] ){			initiator = new Eve.Homepage[portletName + 'Initiator']( portletName );		}else{			initiator = new Eve.Homepage.Initiator( portletName );		}		// Create the portlet Dialog Configuration		var dialog = null;		if ( Eve.Homepage[portletName + 'Dialog'] ){			dialog = new Eve.Homepage[portletName + 'Dialog']( portletName );		}else{			dialog = new Eve.Homepage.Dialog( portletName );		}				// Create the Portlet Renderer		var renderer = null;		if ( Eve.Homepage[portletName + 'Renderer']){			renderer = new Eve.Homepage[portletName + 'Renderer']( portletName );		}else{			renderer = new Eve.Homepage.Renderer( portletName );		}		this.renderers[portletName] = renderer;		// Create the request Handler		var request = null; 		if ( Eve.Homepage[portletName + 'Request'] ){			request = new Eve.Homepage[portletName + 'Request']( portletName );		}else{			request = new Eve.Homepage.Request( portletName );		}				var mode = null;				if ( Eve.Homepage[portletName+'Mode'] ){			mode= new Eve.Homepage[portletName + 'Mode']( portletName );		}else{			mode = new Eve.Homepage.Mode( portletName );		}				// Set the requestor for the dialogs		dialog.setRequest( request );				// Set the renderer for the request handler		request.setRenderer( renderer );				// set the base params		param = {			 xhr		: request			,dialog		: dialog			,section	: portletName			,renderer	: renderer			,mode		: mode		};				initiator.augment( param, portletName );				// The mode needs to know about every single variable in a portlet inorder to control them		var portlet = new Eve.Portlet( param );		mode.setPortlet( portlet );				// Listen for the new Mode...		Eve.Homepage.ModeManager.onChange( mode, mode.update );		// 		return portlet;	}	,getHomepageContent: function(that){				/* Majid: Wait : next lines was commented */        Eve.mask.show(Ext.fly('MainCardLayout'));		Ext.Ajax.request( {				url: 'index.cfm?event=modern.homepage.group.getAllcontents'				,success: function(resp){					var Modules = [					['TasksAssignedToOther', 'TasksAssignToOteher']					,['TasksAssignedToMe', 'TasksAssignToMe']					,['Links', 'Links']					,['News', 'News']					,['MyOffice', 'Group']					,['Calendar', 'Calendar']					,['Voting', 'Voting']					,['Documents', 'Documents']					,['MessageOftheDay', 'MessageOfTheDay']					,['Admin', 'Admin']					];					var dq = Ext.DomQuery;					for(var i=0; i< Modules.length;  i++){					    var xml = dq.selectNode(Modules[i][1]+"Module", resp.responseXML);					if(xml)					    if(this.renderers[Modules[i][0]])							this.renderers[Modules[i][0]].render(xml);					}					/* Majid: Wait : next lines was commented */					Eve.mask.hide();					that.manager.loadFinished(that);				}				/* Majid: Wait : next lines was commented */				,failure: function(){ Eve.mask.hide(); }				,scope: this		} );	}	,uCase : function( s ){		return s.substr(0, 1).toUpperCase() + s.substr( 1, s.length );	}};//--------------------------------------// //--------------------------------------Eve.Homepage.ModeSingleton = function(){	this.modeArr = [];};Eve.Homepage.ModeSingleton.prototype = {	onChange: function( mode, func ){		this.modeArr.push( { mode: mode, func: func } );		if ( func )			// Notify the mode of the current State			func.apply( mode, [ { mode: this.curMode }] );	}		,changeMode: function( newMode ){		this.curMode = newMode;		/*		if ( this.curMode == 'edit' )			Ext.getCmp('homepage_active_modules_menu').show();		else			Ext.getCmp('homepage_active_modules_menu').hide();		*/		for ( var i = 0, len =  this.modeArr.length; i < len; ++i ){			this.modeArr[i].func.apply( this.modeArr[i].mode, [ { mode: this.curMode } ] );		}	}};//--------------------------------------// Mode :(((((//--------------------------------------Eve.Homepage.Mode = Ext.extend( Eve.Desktop.Mode, {} );//--------------------------------------// Dispatchers and extracts correct events for objects//--------------------------------------Eve.Homepage.DispatcherSingleton = Ext.extend( Eve.Desktop.DispatcherSingleton, {} );/*Eve.Homepage.DispatcherSingleton = function(){	this.sec = arguments[0];};Eve.Homepage.DispatcherSingleton.prototype = {	onClick: function(){		//var params = this.renderer.extractParams();				// Boardcast the event		if ( this.enable )			Eve.Resource.superbridge.broadcast.apply( Eve.Resource.superbridge, arguments );	}		,changeMode: function( params ){		if ( params.mode == 'edit' )			this.enable = true;		else			this.enable = false;	}};*///--------------------------------------// Customises the parameters of each module//--------------------------------------Eve.Homepage.Initiator = Ext.extend( Eve.Desktop.Initiator, {} );//--------------------------------------// Configuration dialog of each portlet...//--------------------------------------Eve.Homepage.Dialog = function(){	this.sec = arguments[0];		// Bind the panel to the correct Dialog	 Eve.Homepage.ItemPanels.bindTo( this.sec, this );};Eve.Homepage.Dialog.prototype = {	// func: callback function for applying the configuration in the dialog	popDialog: function( content, func ){/*		for ( var i in content ){			// Get the item and set its content			var item = Ext.getCmp( 'homepage_dialog_' + this.sec.toLowerCase() + '_' + i );			if ( item ){				item.setValue( content[i] );			}		}		return null;*/		Eve.Homepage.ItemPanels.showPanel( this.sec );	},		//-------------------------------------	//	//-------------------------------------	validate: function(){		// By default all of the panels are filled out correctly		return true;	},		//-------------------------------------	// The basic collect method	//-------------------------------------	collect: function( aForm ){		this.request.sendDialogRequest( 'collect', { params: aForm.getForm().getValues( false )												   , failure: function(){ console.log( 'Collection Error' ); }												   , success: function(){ this.request.sendRequest(); /* reload the content of the module */ } 												   , scope  : this} 									   );	},		//-------------------------------------	// Return the validation error	//-------------------------------------	validationError: function(){		return '';	},		//-------------------------------------	// Loads the dialog	//-------------------------------------	load: function( aF ){		aF.getForm().load( { url: this.request.loadUrl(), params: { dummy: 'data' }, success: function(){ console.log( arguments ); }, scope: this } );	},		//-------------------------------------	// Set the request handler for the dialog	//-------------------------------------	setRequest: function(){		this.request = arguments[0];	}};//--------------------------------------////--------------------------------------Eve.Homepage.Request = function(){	this.sec = arguments[0];};Eve.Homepage.Request = Ext.extend( Eve.Desktop.Request, {	 getUrl: function(){		return 'index.cfm?event=modern.homepage.group.get' + this.sec + 'content&groupId='+Eve.HomepageBrdg.groupId;	}/*	,sendRequest: function(){ 		this.renderer.mask(); 		// send a request to wherever you like 		Ext.Ajax.request( { 			url: this.getUrl() 			,success: this.successFetch 			,failure: this.failureFetch 			,scope: this 		} ) 	}*/ 		,collectUrl: function(){		return 'index.cfm?event=modern.homepage.createModify&id=-1';	}	,loadUrl: function(){		return 'index.cfm?event=modern.homepage.edit' + this.sec;	} 	} );Eve.Homepage.CalendarRequest = Ext.extend(Eve.Homepage.Request,{	collectUrl: function(){		return 'index.cfm?event=modern.desktop.createModify&id=-1';	}	,loadUrl: function(){		return 'index.cfm?event=modern.desktop.editSchedule';	}})//--------------------------------------////--------------------------------------Eve.Homepage.Renderer =Ext.extend( Eve.Desktop.Renderer, {   getDispatcher: function(){ return 'Eve.Homepage.Dispatcher'; }  ,getBasePath: function(){		return Eve.imagePath + 'homepage/';  }  ,getConfig: function(){		return {			activeImg 	: false			,sectionName: false			,checkbox   : false			,newBtn     : false      		,itemStyle  : ''		};    }  } );        /*--------------------------------------------------------------------*/// Custom Requests for modules/*--------------------------------------------------------------------*/Eve.Homepage.TasksAssignedToOtherRequest = Ext.extend( Eve.Homepage.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.homepage.group.getTasksAssignToOteherContent&groupId='+Eve.HomepageBrdg.groupId; 	}} );Eve.Homepage.TasksAssignedToMeRequest = Ext.extend( Eve.Homepage.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.homepage.group.getTasksAssignToMeContent&groupId='+Eve.HomepageBrdg.groupId; 	}} );Eve.Homepage.MyOfficeRequest = Ext.extend( Eve.Homepage.Request, {	getUrl: function(){ 		return 'index.cfm?event=modern.homepage.group.getGroupContent'; 	}});Eve.Homepage.NewsRequest = Ext.extend( Eve.Homepage.Request, {	getUrl: function(){		return 'index.cfm?event=modern.homepage.group.getNewsContent';	}});/*--------------------------------------------------------------------*/// Custom Renderer for modules/*--------------------------------------------------------------------*/Eve.Homepage.MessageOftheDayRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'motd.png';	}	,getTitlePath: function(){		return 'motd_homepage_Title.png';	}});Eve.Homepage.CalendarRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'calendar_icon.png';	}	,getTitlePath: function(){		return 'schedules_title.png';	}	,getConfig: function(){		return{			more       	: true			,sectionName: 'SharedCalendar'			,newBtn     : false			,hyperlink  : true			,emptyMessage:'There are no events scheduled... '		};	}	,sanitize: function(){		return "calendar";	}	,getDialogEvent: function(){		return 'calendar_edit_item_dlg';	}	,getNewEventPref: function(){		return "calendar";	}});//---------------------- MyOffice------------------------Eve.Homepage.MyOfficeRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'myoffice_homepage_icon.png';	}	,getTitlePath: function(){		return 'myoffice_homepage_title.png';	}	,getConfig: function(){		return {			newBtn: false			,sectionName: false		};	}	,createTemplate: function(){		var that = this;		var config = this.getConfig();			Eve.Desktop.Renderer.BaseTemplate = new Ext.XTemplate(				/*'<table width="100%"><tbody><tr><td width="40" valign="top"><img src="{icon}"/></td><td valign="top">',				    '<table width="100%" cellspacing="0" cellpadding="0" border="0" class="desktoptable">',				      '<tbody><tr class="personaldesktophtrmainsect">',				        '<td nowrap="" class="personaldesktophtcmainsectlt">',						  	'<img border="0" src="{title}"/> | <span class="portlet bold-item" id="home-group-name" style="position:absolute;top:19px;padding-left:5px"></span>',				        '</td>',				        '<td nowrap="" class="personaldesktophtcmainsectrt">',				        '</td>',				      '</tr>',				      '<tr class="desktoptr">',				        '<td class="desktoptc" colspan="2">&nbsp;',				        '</td>',				      '</tr>',				    '</tbody></table></td></tr>',				'</tbody></table>'*/				//For wrapping long text				'<div>',				'<div>',				  	'<img src="{icon}" style="margin:-8px 3px 5px 3px; float:left"/>',				  	'<img border="0" src="{title}" style="vertical-align:bottom; float:left;" />',				    '<div nowrap="" class="" style="float:left;margin:-4px 2px 5px 4px;">',				    '| <span class="portlet bold-item" id="home-group-name" style=""></span>',				    '</div>',					'<div style="clear:both"/>',				'</div>',				'<div  style="border-bottom: 1px solid #999999;"></div>',				'<div class="desktoptc"></div>',				'</div>'			);		this.baseTemplate = Eve.Desktop.Renderer.BaseTemplate;	}	,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><br /><b><div style="padding:3px">{title}</div></b><div style="padding-left: 10px" class="portlet">',					'<tpl for="content"><div>',					'{[this.setGroupName(values)]}',                    '{text}',					'</div></tpl></div>',				 '</tpl>',				 {					setGroupName: function(val){						//To set custom Logo						var src = (val.image !== undefined)? val.image : Eve.Resource.getIcon('default-image','homepage') ;    					Ext.get('homepage_header').dom.innerHTML = '<img src="'+src+'">';						var el = Ext.get('home-group-name');						el.dom.innerHTML = val.textUrl;						return '';					}				 });	}});//----------------------  News --------------------------Eve.Homepage.NewsRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'news_icon.png';	}	,getTitlePath: function(){		return 'Group_news_homepage_Title.png';	}	,getConfig: function(){		return{			emptyMessage: 'There are no news headlines...'			,newBtn: 'new_headline'		};	}	,getDialogEvent: function(){		return 'open_news_dlg';	}	,test : function(){		console.log("hi");	}	,createTemplate: function(){		var that = this;		var config = this.getConfig();			Eve.Desktop.Renderer.BaseTemplate = new Ext.XTemplate(				'<div>',				'<div>',				  	'<img src="{icon}" style="margin:-8px 3px 5px 3px; float:left"/>',				  	'<img border="0" src="{title}" style="vertical-align:bottom; float:left;" />',				    '<div nowrap="" class="" style="float:right">',				        '{[this.createNewBtn(values)]}',				    '</div>',					'<div style="clear:both"/>',				'</div>',				'<div  style="border-bottom: 1px solid #999999;"></div>',				'<div class="desktoptc"></div>',				'</div>'				,{					createNewBtn: function(values){						if(Eve.GroupSelect.IsAdmin == "1"){								//TODO							var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \'homepage_create_item_dlg\',{mode:\'create\',info: {id:0,parentId: 0,groupId:'+Eve.GroupSelect.GroupId+', path: \'\\\\\',root:\'group\'}})}';						var t = that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'homepage\', func:' + func + ' } )';       						return '<span  onclick="'+t+'"><img src=" '+Eve.Resource.getIcon(config.newBtn, 'homepage')+'" style="margin-top:-3px;cursor:pointer;"></span>';						}						else return '';					}				}			);		//}		this.baseTemplate = Eve.Desktop.Renderer.BaseTemplate;	}	,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px;">{title}</div></b><div style="padding-left: 10px;" class="portlet">',					'<tpl for="content"><div>',						'<tpl if="this.checkText( values.text )">',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}',						'</tpl>',					'</div></tpl></div>',				 '</tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,createUrl: function( url, textTarget, text, textCls, all ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['id', 'typeId', 'parentId', 'groupId', 'root', 'path', 'reminderId' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						};						for ( var i = 0; i < arr.length; ++i ){							arr[i] = arr[i] + ':\'' + (clean(all[arr[i]]) || '') + '\'';						}						var t = 'info: {' + arr.join(',') + '}, section: \''+config.section+'\'';						text = '<a href="#" onclick="return false;" class="'+config.itemStyle+'"><div>'+text+'</div></a>';						if(Eve.GroupSelect.IsAdmin != "1")							return '<div style="line-height:20px;overflow:hidden;" onclick="Eve.Resource.superbridge.broadcast( window, \'' + all.eventName + '\', {' + t + '} );" class ="">' + text + '</div>';						return ['<div style="line-height:20px;overflow:hidden;float:left;width:400px;white-space:nowrap;"',								' onclick="Eve.Desktop.CompanyAnnouncmentsRenderer.showDlg({' + t + '} );"',								' class ="">' , text , '</div><div style="float:right;">',								'<div style="float:left;margin-right:3px" onclick="Eve.Resource.superbridge.broadcast(this, \'homepage_edit_item_dlg\',{' + t + '} );">',								'<a href="#" onclick="return false;" ><img style="display:inline" src="'+Eve.Resource.getIcon('edit', 'general')+'"></a></div>',								'<div style="float:left;">',								'<a href="#" onclick="Eve.Resource.superbridge.broadcast(this, \'news_delete_item_dlg\',{' + t + '} );" >',								'<img style="display:inline" src=" '+Eve.Resource.getIcon('delete', 'general')+'">',								'</a></div></div><div style="clear:both;"></div>'].join('');					}				 }							 );	}});//---------------------- Task Assigned ----------------------Eve.Homepage.TasksAssignedToMeRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'groups_Tasks_Me_desktop_icon.png';	}	,getTitlePath: function(){		return 'groups_Tasks_Me_desktop_title.png';	}	,getConfig: function(){		return {			more       	: true			,sectionName      : 'SharedTasks'			,checkbox   : true      		,hyperlink  : true			,emptyMessage: 'There are no tasks in this category...'			,section    	: 'task'		};	}	,sanitize: function(){		return "task";	}	,getDialogEvent: function(){		return 'task_edit_item_dlg';	}});//--------------------------- Task -------------------------------------------Eve.Homepage.TasksAssignedToOtherRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'groups_Tasks_Others_desktop_icon.png';	}	,getTitlePath: function(){		return 'groups_Tasks_Others_desktop_title.png';	}	,getConfig: function(){		return {			more       	: true			,sectionName      : 'SharedTasks'			,checkbox   : true			,hyperlink  : true			,emptyMessage: 'There are no tasks in this category...'			,section    	: 'task'		};	}	,sanitize: function(){		return "task";	}	,getDialogEvent: function(){		return 'task_edit_item_dlg';	}});//------------------------ Link --------------------------------Eve.Homepage.LinksRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'links_icon.png';	}	,getTitlePath: function(){		return 'links_homepage_title.png';	}	,getConfig: function(){		return {		  sectionName      : 'SharedLinks'		  ,newBtn    : false		  ,hyperlink : true		};	}	,getDialogEvent: function(){		return 'link_open_link';	}	,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><br /><b><div style="padding:3px">{title}</div></b><div style="padding-left: 10px;margin-top:-20px" class="portlet">',                        '<table width="100%">',						'<tpl for="content"><tr>',						'<tpl if="this.checkText( values.image )">',							'<td width="33" style=" border:1px solid;" height="33">{[this.createImage( values.imageUrl, values.imageTarget, values.image, values )]}</td>',						'</tpl>',						'<tpl if="!this.checkText( values.image )"><td width="33"><div style="width:39px;float:left">&nbsp;</div></td></tpl>',						'<tpl if="this.checkText( values.text )">',							'<td>{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}</td>',						'</tpl>',					'</tr></tpl><table></div>',					'{[this.checkContent( values )]}',				 '</tpl>',				 '<tpl><div style="margin-left:8px;margin-top:8px">{[this.createMore(values[0])]}</div></tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,checkContent: function( values ){						if ( !values.content || values.content.length == 0  )							return 'There are currently no links...';							return'';					}					,createMore: function(values){						if(values && values.more && values.more !='0')							return '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">[' + values.more + ' more ...]</a>';						else						    return '';					}					,createImage: function( url, imageTarget, imageUrl, all ){						imageTarget = (imageTarget == '0') ? '_self' : '_blank';						if ( url ){ 							return this.createUrl(url, all.textTarget, all.text, all.textCls, all, true);						}						return '<img src="' + url + '" />';					}					,createUrl: function( url, textTarget, text, textCls, all, isImage ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['url', 'objId', 'spawnNewWindow', 'autoLogin' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						}; 				 		var temp=[];						for ( var i = 0; i < arr.length; ++i ){				              temp['url'] = all['textUrl'];				              temp['objId'] = 'PLI_' + all['id'];				              temp['spawnNewWindow'] = all['textTarget'];				              temp['autoLogin'] = all['imageTarget'];							  arr[i] = arr[i] + ':\'' + (clean(temp[arr[i]]) || '') + '\'';						}						var t = 'info: {rec:{data:{' + arr.join(',') + '}}}';						var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \'' + all.eventName + '\', {' + t + '} ); }';						if(isImage){							text =['<a href="', url, '" target="' + '_self' + '" onclick="return false;" >',							'<img  style="margin-top:0px; margin-right:0px;" src="', all.imageUrl, '"  height=32 width=37 align="middle"/>',							'</a>'].join('');						}						else if(config.hyperlink)							text = '<a href="#" onclick="return false;">'+text+'</a>';						return '<span  onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + all.sectionType + '\', func:' + func + ' } );" >' + text + '</span>';					}				 }							 );  }});//-------------------------- Document --------------------------Eve.Homepage.DocumentsRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'shared_documents.png';	}	,getTitlePath: function(){		return 'shared_documents_Title.png';	}	,getConfig: function(){		return {		  sectionName      : 'SharedDocuments'		  ,newBtn    : false		  ,hyperlink : true		  ,lock      : true		};	}	,getDialogEvent: function(){		return 'document_item_detail_dlg';	}	,createContentTemplate: function(){			var that = this;			var config = this.getConfig();			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><br /><b><div style="padding:3px">{title}</div></b><div style="padding-left: 10px;margin-top:-20px" class="portlet">',					'<tpl for="content"><div style="padding:5px">',						'<tpl if="this.checkText( values.image )">',							'{[this.createImage( values.imageUrl, values.imageTarget, values.image )]}',						'</tpl>',						'<tpl if="this.checkText( values.text )">',						    '<tpl>{[this.createActiveImg(values)]}</tpl>',							'{[this.createUrl( values.textUrl, values.textTarget, values.text, values.textCls, values )]}<br/>',						'</tpl>',						'<tpl if="this.checkText( values.details )">',							'<font color="#707070">',								'<span class="{values.detailsCls}" style="padding-left:15px;">',									'{details}',								'</span>',							'</font>',							'<br/>',						'</tpl>',					'</div></tpl></div>',					'<div style="margin-top:-5px">{[this.checkContent( values )]}</div>',				 '</tpl>',				 '<tpl><div>{[this.createMore(values[0])]}</div></tpl>',				 {				 	checkText: function( values ){						return ( values != null && values != '' && values != undefined );				 	}					,checkContent: function( values ){						if ( !values.content || values.content.length == 0  )							return 'You do not currently have any locks on shared documents...';							return'';					}					,createActiveImg: function(values){							if(config.lock){								return '<img style="float:left;margin-top:-2px" src="'+Eve.imagePath+'filetypes/LOCK.GIF">';							}							return '';					}					,createMore: function(values){						if(values && values.more && values.more !='0')              return '<a href="#" onclick="Eve.Resource.superbridge.broadcast(window,\'load_section\',{sectionName: \''+config.sectionName+'\'});">[' + values.more + ' more ...]</a>';						else						    return '';					}					,createImage: function( url, textTarget, image ){						textTarget = (textTarget == '0') ? '_self' : '_blank';						if ( url ){							var extra = 'style="padding-top:3px; padding-right:3px;"';							return ['<a href="', url, '" target="' + '_self' + '" >', '<img src="', url, '" ' + extra + ' height=32 width=32 align="middle"/>', '</a>'].join('');						}						return '<img src="' + url + '" />';					}					,createUrl: function( url, textTarget, text, textCls, all ){						textCls = textCls || '';						textTarget = (textTarget == '0') ? '_self' : '_blank';						var arr = ['id', 'typeId', 'parentId', 'groupId', 'root', 'path', 'reminderId' ];						var clean = function( str ){							str = str || '';							return str.replace( /\\/g, '\\\\' );						};						for ( var i = 0; i < arr.length; ++i ){							arr[i] = arr[i] + ':\'' + (clean(all[arr[i]]) || '') + '\'';						}						var t = 'info: {' + arr.join(',') + '}';						var func = 'function(){ ' + that.getDispatcher() + '.onClick( window, \'' + all.eventName + '\', {' + t + '} ); }';						if(config.hyperlink)							text = '<a href="#" onclick="return false;" class="'+config.itemStyle+'">'+text+'</a>';						return '<span  onclick="' + that.getDispatcher() + '.onClick( window, \'proxy_dialog\', { type:\'' + all.sectionType + '\', func:' + func + ' } );" class ="">' + text + '</span>';						/*if ( url ){							return ['<span class="', textCls, '">', '<a href="', url, '" target="' + '_self' + '" >', text, '</a></span>'].join('');						}						return '<span class="' + textCls + '">' + text + '</span>';						*/					}				 }			);	}});//--------------------------- Voting -----------------------------Eve.Homepage.VotingRenderer = Ext.extend( Eve.Homepage.Renderer, {	getIconPath: function(){		return 'voting_icon.png';	}	,getTitlePath: function(){		return 'Voting_homepage_title.png';	}	,getConfig: function(){    return {		sectionName      	: 'Voting'		,newBtn     : false		,hyperlink  : true		,emptyMessage: '<div style="margin-top:-3px;">There are no new voting items... </div>'    };  }});//---------------------------Public Calendar-----------------------------Eve.Homepage.AdminRenderer = Ext.extend( Eve.Homepage.Renderer, {	createTemplate: function(){			var config = this.getConfig();			Eve.Desktop.Renderer.BaseTemplate = new Ext.XTemplate(//				'<div>',//				'<div>',//				  	'<span  style="margin:-8px 3px 5px 3px; float:left"/>',//				  	'<span border="0" style="vertical-align:bottom; float:left;"/>',//				'</div>',//				'<div class="desktoptc"></div>',//				'</div>'				'<div>',				'<div>',				  	'<img src=" '+Eve.Resource.getIcon('administration_icon', 'homepage')+'" style="margin:-8px 3px 5px 3px; float:left"/>',				  	'<img border="0" src=" '+Eve.Resource.getIcon('administration_title', 'homepage')+'" style="vertical-align:bottom; float:left;"  />',				    '<div nowrap="" class="" style="float:right">',				    '</div>',					'<div style="clear:both"/>',				'</div>',				'<div  style="border-bottom: 1px solid #999999;"></div>',				'<div class="desktoptc"></div>',				'</div>'			);		this.baseTemplate = Eve.Desktop.Renderer.BaseTemplate;	}	,createContentTemplate: function(){			this.contentTemplate =  new Ext.XTemplate(				'<tpl for="."><b><div style="padding:3px">Public Calendar URL:</div></b><div style="margin-top:-8px" class="portlet">',					'<tpl for="content"><div style="padding:5px">',						'{[this.check(values)]}',					'</div></tpl></div>',				 '</tpl>',				 {					check: function(val){						return ['<div>', val.text, '</div>', '<span style="font-weight:bold"><br/>', 'Group ID: </span>', Eve.GroupSelect.GroupId].join('');					}				 }			);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\homepage/HomePageFactory.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Homepage.Factory = function(){  this.section = 'homepage';};Ext.extend( Eve.lib.Homepage.Factory, Eve.lib.Factory, {		 createBefore 	: function(superbridge)	{		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);	 }	 	,createWest		: function(brdg)	{}			,createCenter : function( superbridge ) {		view = {			get : function() {return [{}];}		};				Eve.HomepageBrdg = new Eve.HomepageBridge();				superbridge.addBridge(Eve.HomepageBrdg);		this.manager.registerComponents(Eve.HomepageBrdg);		Eve.HomepageBrdg.init({			superbridge	: superbridge			,view		: view			,section	: this.section			,manager    : this.manager		});				return { 			view : view,			config: { 				border: false, 				items : Eve.HomepageBrdg.getView()				//bodyStyle: 'overflow-y:auto;'			} 		};	}		,createRest : function(){}	,createDialogs: function(brdg){		var companyAnnouncments 	= new Eve.Homepage.CompanyAnnouncmentsDialogBridge();		brdg.addBridge(companyAnnouncments);		companyAnnouncments.addPanel(new Eve.vc.CompanyAnnouncementDetails());		companyAnnouncments.init({					superbridge	: brdg					,section	: 'homepage'					,origin		: 'item'		});	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\homepage/HomepageDialog.js *//*--------------------------------------------------*/var store =  new Ext.data.SimpleStore({	fields : ['value', 'text'],	data : [		 ['1', '1']		,['2', '2']		,['3', '3']		,['4', '4']		,['5', '5'] 		,['6', '6']		,['7', '7']		,['14', '14']		,['31', '31']	]});Ext.ns( 'Eve', 'Eve.Homepage' );Ext.reg( 'xform', Eve.FormPanel );Eve.Homepage.ItemPanels = new Ext.Window({	layout: 'card'	,height: 200	,width : 400	,closeAction: 'hide'	,modal : true	,title : 'Windows'	,border: false	,defaults :{		frame: true		,xtype: 'xform'	}	,y	   : 100	,buttons: [{		text: 'Save&Close'		,handler: function(){			Eve.Homepage.ItemPanels.collect();			Eve.Homepage.ItemPanels.hide();		}	},{		text: 'Cancel'		,handler: function(){			Eve.Homepage.ItemPanels.hide();		}	}]	//-------------------------------------	// Binds a dialog to a formName	//-------------------------------------	,bindTo: function( formName, dialog ){		this._binds = this._binds || {};		this._binds[ formName ] = dialog;	}	// Finds a specific panel	,findPanel: function( name ){		var f = 0;		this.items.each( function( r ){			if ( r.formName != name ){				return ++f;			}			return false;		} );		return ( f == this.items.items.length ) ? -1 : f;	}	//-------------------------------------	// Shows a specific panel	//-------------------------------------	,showPanel: function( activeItem ){		var panel = activeItem;		if ( typeof activeItem == 'string' ){			if ( ( panel = this.findPanel( activeItem ) ) == -1 ){				return false;			}		}		this.setTitle( this.items.items[panel].formName );		// First make sure the dialog is already rendered		this.show();		// Set the activePanel		this.layout.setActiveItem( panel );		//		var aF = this.activeForm();		// Load the content of the dialog		if ( this._binds && this._binds[ aF.formName ] ){			if ( this._binds[ aF.formName ].validate() )				return this._binds[ aF.formName ].load( aF );		}	}	//-------------------------------------	// returns the active form	//-------------------------------------	,activeForm: function(){		return this.layout.activeItem;	}	//-------------------------------------	// Collects the active Form in the card layout	//-------------------------------------	,collect: function(){		var aF = this.activeForm();		// Check if a form is binded to the form		if ( this._binds && this._binds[ aF.formName ] ){			if ( this._binds[ aF.formName ].validate() )				return this._binds[ aF.formName ].collect( aF );			return false;		}		return aF.getForm().getValues( false );	}	//-------------------------------------	// Validates the data entered by the user	//-------------------------------------	,validate: function(){		return true;	}	//-------------------------------------	// Loads the data from the backend	//-------------------------------------	,load: function(){		// Check if a form is binded to the form		if ( this._binds && this._binds[ aF.formName ] ){			return this._binds[ aF.formName ].load( aF );		}		return false;	}	//-------------------------------------	// Fetches the validation error	//-------------------------------------	,validationError: function(){		return 'Validation Error...';	}	,items:[		{			layout: 'form'			,formName: 'Calendar'			,items:[new Ext.form.ComboBox({					store			: store					,mode			: 'local'					,xxtype			: 'combo'					,valueField		: 'value'					,displayField 	: 'text'					,value			: '2'					,fieldLabel 	: 'Days To Display'  	  				,labelSeparator : ''					,hiddenName 	: 'desktop_max_schedule_days'					,typeAhead		: true					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '90%'			})]		}		]	,activeItem : 0});//News HeadLine Dialog	Eve.Dialogs.Homepage.CompanyAnnouncementDetails = function(){		return new Eve.FormPanel ({								layout		: 'form'								,frame		: true								,labelWidth	: 75								,border		: false								,bodyStyle	: 'padding:5px 5px 0'								,width		: 430								,defaults	: {									anchor		: '99%'								}								,items		:[{									xtype: 'textfield'									,fieldLabel: 'title'									,name	   : 'title'								},{								xtype		: 'textarea'								,fieldLabel	: 'Description'								,name		: 'body'								,height			: 100							}]							})	}	Eve.vc.createFormPanel( 'CompanyAnnouncementDetails'		, Eve.Dialogs.Homepage.CompanyAnnouncementDetails );	Ext.override( Eve.vc.CompanyAnnouncementDetails, {	  loadEvent 	: function(){ return 'modern.news.group.edit'; }	 ,submitEvent 	: function(){ return 'modern.news.group.createModify'; }	});	Eve.Homepage.CompanyAnnouncmentsDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,init : function(data)	{		Eve.Homepage.CompanyAnnouncmentsDialogBridge.superclass.init.call(this, data);		var items	= ["Details"] ;		var tab		= {			items	: items			,main	: [0]		}		var dialog	= {			width 	: 500			,height : 250			,title	: 'News Headline'		}		this.createDialog({tab: tab ,dialog: dialog});	}	,augment : function(callee) {		var obj = callee.params;		if (this.mode != 'create')			obj.id = this.id;		if (this.root == 'group')			obj.groupId = this.groupId;		obj.parentId = this.parentId;		obj.path	 = this.path;		return callee;	}	,controller : function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;		this.title		= obj.title;		this.panels[0].reset();		this.dialog.show();	}	,execute : function(callee, type, data)	{		switch(type) {			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				this.loadForm(0);				break;			case (this.section + '_create_item_dlg'):				this.mode = 'create';				this.controller(data);				break;			case ('news_delete_item_dlg'):				Ext.Ajax.request({					url		: Eve.url					,params	: {						event	: 'modern.news.group.delete'						,id		: data.info.id						,groupId	: data.info.groupId					}					,success: function(response) {						var dq	 = Ext.DomQuery;						var xml  = response.responseXML;						var code = dq.selectValue("code", xml);						if (code == '0') {							this.fire('news_success_delete_item', {})						}					}					,scope: this				});				break;		}	}	,afterAddButtons : function(btns)	{		var buttons = [];		buttons.push(btns[1], btns[3]);		return buttons;	}	,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {					this.id = dq.selectValue('id', xml).split("_")[1];					var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}					var type = (obj.id == 0 || obj.id === undefined) ? "news_success_create_item" : "news_success_modify_item";					this.fire(type, {info: info, params: obj});		} // End of If	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\homepage/Menu.js *//*--------------------------------------------------*/Ext.ns( 'Pub' );Pub.MenuBar = (function(){	var items = [], menuBar = null;	return {		addItem : function( config ){			if ( config.type == 'spacer' ){				items.push( Ext.DomHelper.append( menuBar, {tag:'div', cls:'menu-item-spacer'				, html:""}, true ) );				return true;			}			// Initialize the menubar-hide button if float is right			Pub.MenuBar.initHideButton();			config.handler = config.handler || Ext.emptyFn;			config.scope   = config.scope || window;			config.iconCls = config.iconCls || '';			config.tip	   = config.tip || '';			config.float   = ( config.float == 'right' )?'float: right;':'float: left;';			var cfg = {tag:'div', cls:'menu-item', style: config.float				, html:"<div class='menu-item-img "+config.iconCls+"' ext:qtip='"+('<b>'+config.text+'</b><br />') + config.tip+"'></div><div class='menu-item-text'>"+config.text+"</div>"}			if ( config.id )				cfg.id = config.id;			items.push( Ext.DomHelper.append( menuBar, cfg, true ) );			var func = config.handler.createDelegate( config.scope );			items[items.length-1].on('click', function(e){ func( e ); e.stopEvent(); } );		}		,initHideButton : function(){		/*	if ( !Ext.get('menubar-hide') ){				var cfg = {tag:'div', style: 'float: right; width: 24px; height: 100%; background:url(' + Eve.imagePath + 'publisher2/go_back_ribbon.png) no-repeat 0 50%;', 'ext:qtip':'<b>Hide the Menubar</b><br />'				, html:"<div></div>"}				cfg.id = 'menubar-hide';				Ext.DomHelper.append( menuBar, cfg, true );				Ext.get('menubar-hide').on('click', function(){ Pub.MenuBar.hide(); } );			}*/		}        ,disable: function(){            Pub.MenuBar.hide();            Pub.MenuBar.isDisabled = 1;            var tbtn = Ext.get('menubar-trigger');            if ( tbtn ){                tbtn.hide();            }        }        ,enable: function(){            Pub.MenuBar.isDisabled = 0;            var tbtn = Ext.get('menubar-trigger');            if ( tbtn ){                tbtn.show();            }        }		,init : function(){			if ( !menuBar ){                menuBar = Ext.DomHelper.insertFirst("menu-div-wrapper", {id:'menu-div'}, true);                menuBar.setStyle( 'visibility', 'hidden' );                //debugger;                Ext.DomHelper. insertBefore(menuBar, {id:'menu-div-wrapper', style: 'height:20px; border:1px solid;position:absolute;top: 0px;left:0px;'}, true);				/*var bar = Ext.DomHelper.insertFirst(document.body, {id:'menubar-trigger'																	,style: 'position:absolute;top: 0px;left:0px; background:url(' + Eve.imagePath + 'publisher2/go_forward_ribbon.jpg); width: 24px; height: 24px; z-index: 100000'}, true);*/	var bar = new Ext.Toolbar({                id:'menubar-trigger' 				,items: [{				xtype: 'button'				,text: 'Switch Homepage'				,renderTo:'menu-div-wrapper'				,handler: function(){					Eve.Homepage.popOptionsDlg();				}			}] 			})				Ext.get('menubar-trigger').on('click', function(){ if(Eve.GroupSelect.IsAdmin != "0"){ Pub.MenuBar.show(); Ext.get('menubar-trigger').hide(); } } );			}		}		,show : function(){			if ( Pub.MenuBar.isVisible || Pub.MenuBar.isDisabled ){				return true;			}			//Pub.MenuBar.initHideButton();			//Ext.get('menubar-hide').show();			menuBar.stopFx();        	menuBar.slideIn( 'l', { easing: 'easeOut', duration: .5, callback : function(){        		Pub.MenuBar.isVisible = true;			} } );        	menuBar.setStyle( 'visibility', '' );		}		,hide : function(){			menuBar.stopFx();			Pub.MenuBar.transition = true;			menuBar.ghost( 'l', {remove:false, callback: function(){				Pub.MenuBar.isVisible = false; 				Pub.MenuBar.transition = false; 				if(Eve.GroupSelect.IsAdmin != "0") {					Ext.get('menubar-trigger').show();				}				Ext.get('menubar-hide').hide();			} } );		}		,setZIndex: function( zIndex ){			menuBar.setStyle( 'z-index', zIndex );		}	}})()/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\forum/ForumDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 January 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/var dlg = Eve.Dialogs.Forum;// * * * * * * * * * * * * * * * * * * * * // Item Categories * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlg.ItemCategories = function(c){	return new Eve.FormPanel({        labelWidth	: 70        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,width		: 400		,height		: 250        ,items 		: [{			xtype		: 'textfield'			,fieldLabel	: 'Subject'        	,labelSeparator : ''			,name		: 'subject'			,maxLength	: 350			,anchor		: '98%'		}, {			xtype		: 'textarea'			,fieldLabel	: 'Description'        	,labelSeparator : ''			,name		: 'description'			,maxLength	: 350			,anchor		: '98%'		},		{      		xtype			: 'combo'	    	,id             : c.section + 'f_cat_cmb'	    	,hiddenName		: 'conferenceId'	    	//,name           : 'categories'      		,fieldLabel 	: 'Category'			,valueField		: 'value'    		,displayField	: 'text'			,lazyInit		: false			,allowBlank		: false	      	,labelSeparator : ''	    	,anchor 		: '98%'		}]    })}// * * * * * * * * * * * * * * * * * * * *// Category  * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlg.CategoryDetails = function(){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 20px'		,width		: 400		,height		: 250		,items 		: [{			xtype		: 'textfield'			,fieldLabel	: 'Name'        	,labelSeparator : ''			,name		: 'conferenceName'			,anchor		: '100%'			,allowBlank: false		}, {			xtype		: 'textarea'			,fieldLabel	: 'Description'        	,labelSeparator : ''			,name		: 'description'			,anchor		: '100%'			//,allowBlank : false		}]	})};// * * * * * * * * * * * * * * * * * * * *// Comment * * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlg.CommentDetails = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 20px'		,width		: 600		,height		: 300		,items 		: [{			xtype			: 'textfield'			,id				: c.section + 'comment_sub'			,fieldLabel		: 'Subject'			,name			: 'msgSubject'			,allowBlank 	: false        	,labelSeparator : ''			,anchor			: '92%'		}, {	     	xtype			: 'htmleditor'	     	,plugins		: [  	     	         		 	new Ext.ux.form.HtmlEditor.Word()	     	         		  ]			,id				: c.section + 'comment_desc'			,fieldLabel		: 'Description'			,name			: 'msgBody'			,height			: 110			,width   		: 420			,enableLinks	: false			,enableAlignments: false	  		,labelSeparator : ''		}, {			xtype			: 'checkbox'			,id				: c.section + 'evaluateAsHTML'			,name			: 'evaluateAsHTML'			,checked		: true			,hidden         : true			,style			: 'display: none;'			,labelSeparator	: ''		}]	})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       ForumDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */ // Items DetailsEve.vc.createFormPanel( 'ForumItemCategories'	, Eve.Dialogs.Forum.ItemCategories );// FoldersEve.vc.createFormPanel( 'ForumCategoryDetails'	, Eve.Dialogs.Forum.CategoryDetails );Eve.vc.createFormPanel( 'ForumCommentDetails'	, Eve.Dialogs.Forum.CommentDetails);Eve.vc.createFormPanel( 'ForumInterlinking'		, Eve.Dialogs.Interlink.Main);Ext.override( Eve.vc.ForumItemCategories,{	 loadEvent		: function() { return 'modern.forum.group.editTopic'; }	,submitEvent	: function() { return 'modern.forum.group.createModifyTopic'; }});Ext.override( Eve.vc.ForumCategoryDetails,{	  loadEvent 	: function() { return 'modern.forum.group.editConference'; }	 ,submitEvent 	: function() { return 'modern.forum.group.createModifyConference'; }});Ext.override( Eve.vc.ForumCommentDetails,{	  loadEvent 	: function() { return 'modern.forum.group.editMessage'; }	 ,submitEvent 	: function() { return 'modern.forum.group.createModifymessage'; }});Ext.override( Eve.vc.ForumInterlinking, {	 loadEvent		: function(){ return 'modern.interlink.group.view'; }	,submitEvent	: function(){ return ''; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\forum/ForumFactory.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 January 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Forum.Factory = function() {}Ext.extend( Eve.lib.Forum.Factory, Eve.lib.Factory, {		section: 'forum'	,prefix	: 'F'		,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}		,createWest  : function(superbridge)	{		this.view	= new Eve.vc.TreePanel();		var conn 	= Eve.widgets.TreeStore;		var bridge	= new Eve.widgets.DefaultTreeBridge();				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Forum'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					this.view.get().root.firstChild.reload();				}				,scope		: this			}]		}		return { view: this.view, config: config };	 }	 	,createCenter: function(superbridge)	{		var view 		= new Eve.vc.EditorGridPanel();		var conn		= new Eve.widgets.GridGroupStore();		var topicView	= new Eve.widgets.Forum.TopicView();		var bridge		= new Eve.widgets.Forum.GridBridge();		conn.setSection('Forum');		superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,manager	: this.manager		});		this.topBar = new Ext.Toolbar(bridge.getToolbar());				superbridge.addBridge(topicView);		topicView.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,west		: this.view			,topBar		: this.topBar			,section	: this.section		});		var topic	= topicView.createLayout();		var config = {			layout		: "card"			,id			: "forumCardLayout"			,activeItem	: 0			,tbar		: this.topBar			,items		: [	view.get(), topic ]		}		return { view: view, config: config };	 }	 	 ,createMenus : function(superbridge) 	 {		 this.amenu = new Eve.widgets.AddForumMenu ();		 this.emenu = new Eve.widgets.ForumGridMenu();		 		 superbridge.addBridge([this.amenu, this.emenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}		 		 this.emenu.init(data);		 this.amenu.init(data);	 }	 	 ,createDialogs : function(superbridge)	 {		var itemDlg 		= new Eve.lib.Forum.ItemDialogBridge();		var categoryDlg 	= new Eve.lib.Forum.CategoryDialogBridge();		var commentDlg  	= new Eve.lib.Forum.CommentDialogBridge();				superbridge.addBridge([itemDlg, categoryDlg, commentDlg]);		itemDlg.addPanel(new Eve.vc.ForumItemCategories());		categoryDlg.addPanel(new Eve.vc.ForumCategoryDetails());		commentDlg.addPanel(new Eve.vc.ForumCommentDetails());		commentDlg.addPanel(new Eve.vc.ForumInterlinking());				itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				categoryDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'folder'		});				commentDlg.init({			superbridge	: superbridge			,section	: this.section		});								// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgForumItem	= new Eve.lib.Forum.ItemDialogBridge();		var dlgForumComment	= new Eve.lib.Forum.CommentDialogBridge();				superbridge.addBridge([dlgForumItem, dlgForumComment]);				dlgForumItem.addPanel(new Eve.vc.ForumItemCategories());		dlgForumComment.addPanel(new Eve.vc.ForumCommentDetails());				dlgForumItem.init({			superbridge	: superbridge			,section	: this.section + '_il'			,origin		: 'folder'		});				dlgForumComment.init({			superbridge	: superbridge			,section	: this.section + '_il'		});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -	 }	 	 ,createRest : function(superbridge)	 {		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	 }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\forum/ForumGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 January 2009 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.widgets.Forum.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge,{	gridSection : 'forum'	,getToolbar : function()	{		return this.toolbar	}	,initLocalVars : function()	{		// Fields for Grid's Reader.		this.fields = [			 { name: 'ConferenceId'				  ,type: 'string' }			,{ name: 'name'						  ,type: 'string' }			,{ name: 'userSubscribed'	  ,type: 'string' }			,{ name: 'id'						  ,type: 'string' }			,{ name: 'author'					  ,type: 'string' }			,{ name: 'postedOn'					  ,type: 'string'	}			,{ name: 'lastPost'					  ,type: 'string'}			,{ name: 'posts'					  ,type: 'int'}			,{ name: 'subject'					  ,type: 'string'}			,{ name: 'groupId'					  ,type: 'string'}			,{ name: 'editPermission'			  ,type: 'boolean'}      		,{ name: 'createPermission'			  ,type: 'boolean'}			,{ name: 'deletePermission'			  ,type: 'boolean'}			,{ name: 'topicsCount'				  ,type: 'string'}			,{ name: 'openTopicsCount'			  ,type: 'string'}			,{ name: 'closed'					  ,type: 'boolean'}			,{ name: 'order'					   ,type: 'int'	}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}		];		// This is grid's reader. You'll see grid itself few more lines down.		this.reader = new Ext.data.XmlReader({			id				: 'id'			,record			: 'topic'			,totalRecords	: 'total'		}, Ext.data.Record.create( this.fields ) );		// Grid's Column Model		this.columns = new Ext.grid.ColumnModel([{			header    : '<img src="' + Eve.Resource.getIcon('user-icon','forum')+ '" height=16/>'			,dataIndex : 'type'			,width 	   : 30			,hidden    : false			,renderer  : function(value) {				return 	'<img src="' + Eve.Resource.getIcon('user-icon','forum') + '" height=16/>'			}		}, {			width			: 100			,dataIndex		: 'name'			,fixed			: true			,menuDisabled	: true			,hidden			: true		}, {			header 		  : 'Author'			,dataIndex 	: 'author'			,width 		  : 120			,sortable   : false		}, {			header  	: 'Subject'			,dataIndex  : 'subject'			,width      : 300			,sortable   : false		}, {			header      : 'Posted On'			,dataIndex  : 'postedOn'			,width      : 110			,sortable   : false		}, {			header      : 'Posts'			,dataIndex  : 'posts'			,width      : 80			,sortable   : false		}, {			header      : 'Last Post'			,dataIndex  : 'lastPost'			,width      : 110			,sortable   : false		},{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);		// New Thread handler		var newThreadHdl = function() {			var info = {				id			: 0,				root		: this.root,				groupId		: this.groupId,				parentId	: this.id,				path		: this.path			}			this.fire('forum_create_item_dlg', {info: info});		};		// Grid's Toolbar.		this.toolbar = {			items: [new Ext.Toolbar.SplitButton({				text 		: 'New'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('new', 'general')				,disabled	: true				,handler	: newThreadHdl.createDelegate(this)				//,tooltip	: Eve.Resource.getToolTip.btnNew				,menu : [{					text 	: 'Category'					,id		: 'mnu_add_cat'					,cls 	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('new-category','forum')					,handler: function()					{						var info = {							id			: 0,							root		: this.root,							groupId		: this.groupId,							parentId	: this.id,							path		: this.path						}						this.fire('forum_create_folder_dlg', {info: info});					}					,scope	: this				}, {					text 	: 'Thread'					,cls 	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('new-thread','forum')					,handler: newThreadHdl					,scope	: this				}]			}), '->', new Ext.SplitButton({				text 	: 'View By:Category'				,id  	: 'forum_folderItem'				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('view-list','forum')				//,tooltip: Eve.Resource.getToolTip.btnSwitchView				,handler: function() { this.showMenu() }				,menu	: new Ext.menu.Menu({					items	: [						{							text	: 'View By:Category'							,group	: 'fi'              ,icon	: Eve.Resource.getIcon('view-list','forum')							,handler: function(e)							{								Ext.getCmp('forum_folderItem').setText('View By:Category');								var mode = {									base	: 'folder_item'									,branch	: 'flatView'								}								var info = {									parentId	: this.id									,groupId	: this.groupId									,root		: this.root									,id			: 0								}								//this.fire( 'forum_filter', { mode: mode, info: info}, true );								var grid = this.view.get();								grid.view.destroy();								// swap the view								grid.view = this.gridGroupView;								this.gridGroupView.init( grid );								grid.store.removeAll();								Ext.getCmp('mnu_add_cat').enable();								this.gridMode = "cat";								this.fetchData();								if ( !this.gridGroupView.mainbody ){									this.gridGroupView.renderUI();								}								// reconfigure the grid								grid.reconfigure( grid.store, this.columns );							}							,scope	: this						}						,{							text	: 'View By:Thread'							,group	: 'fi'              ,icon	: Eve.Resource.getIcon('view-list','forum')							,handler: function(e) {								Ext.getCmp('forum_folderItem').setText('View By:Thread');								var mode = {									base	: 'folder_item'									,branch	: 'itemsOnly'								}								var info = {									parentId	: this.id									,groupId	: this.groupId									,root		: this.root									,id			: 0								}								//this.fire( 'forum_filter', { mode: mode, info: info}, true );								var grid = this.view.get();								grid.view.destroy();								// swap the view								grid.view = this.gridNormalView;								// Hide the 1337 record								/*grid.view.getRowClass  =function(row, index,p, st){									if(parseInt(row.data.id.split("_")[1]) < 0 )return 'x-grid-group-body-hide';								}*/								Ext.getCmp('mnu_add_cat').disable();								this.gridMode = 'thread';								grid.store.removeAll();								this.fetchData();								this.gridNormalView.init( grid );								if ( !this.gridNormalView.mainbody ){									this.gridNormalView.renderUI();								}								// reconfigure the grid								grid.reconfigure( grid.store, this.columns );							}							,scope	: this						}					]				})			})		]}	}	,init : function(obj)	{		Eve.widgets.Forum.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();		var conf = {groupField : 'name', sortField : 'name'};		this.gridMode = "cat";		this.conn.init(this.reader, conf);		var store = this.conn.getStore();		//------------------------------------		// Filter on before load of store		//------------------------------------		store.load_prototype = store.load;		var that = this;		store.fillCategories = function( response ){			var store = that.conn.getStore();			// Holy crap... LoL			var xml = response.responseXML || response;			var dq	= Ext.DomQuery;			// Select the Category...			var cats = dq.select( 'conference', xml );			var storeRecord = Ext.data.Record.create( that.fields );			//			store.removeAll();			var a = -3;			for ( var c = 0, clen = cats.length; c < clen; ++c ){				// Select the topics				var topics      = dq.select( 'topic', cats[c] );				var confId      = dq.selectValue( 'id', cats[c] );				var confName    = dq.selectValue( 'name', cats[c] );				var userSubscribed = dq.selectValue( 'userSubscribed', cats[c] );				var confDesc    = dq.selectValue( 'description', cats[c] );				var openTopics  = dq.selectValue( 'openTopicsCount', cats[c] );				var topicsCount = dq.selectValue( 'topicsCount', cats[c] );		        var cEditPermission	= (dq.selectValue( 'editPermission', cats[c] ) =="false")? false:true;		        var cDeletePermission= (dq.selectValue( 'deletePermission', cats[c] )=="false")? false:true;		        var cCreatePermission= (dq.selectValue( 'createPermission', cats[c] ) =="false")? false:true;				if ( topics.length > 0 ){					for ( var t = 0, tlen = topics.length; t < tlen; ++t ){						//"TopicId,TopicCreationDate,OwnerName,CountOfMessages,TopicDesc,subject">						var rec = new storeRecord({							ConferenceId 	: confId,							name			: confName,							userSubscribed	: userSubscribed,							topicsCount		: topicsCount,							openTopicsCount : openTopics,							id				: dq.selectValue( 'id', topics[t] ) || '',							author			: dq.selectValue( 'author', topics[t] ) || '',							postedOn		: dq.selectValue( 'postedOn', topics[t] ) || '',							lastPost		: dq.selectValue( 'lastPost', topics[t] ) || '',							posts			: dq.selectValue( 'posts', topics[t] ) || '',							subject			: dq.selectValue( 'subject', topics[t] ) || '',							groupId			: dq.selectValue( 'groupId', topics[t] ) || '',							closed			: dq.selectValue( 'closed', topics[t] ) || '',							editPermission	: (dq.selectValue( 'editPermission', topics[t] ) =="false")? false:true,							deletePermission: (dq.selectValue( 'deletePermission', topics[t] )  =="false")? false:true,							createPermission: (dq.selectValue( 'createPermission', topics[t] ) =="false")? false:true,							order			: dq.selectValue( 'order', topics[t] ) || ''						})						rec.id = dq.selectValue( 'id', topics[t] );						store.add( rec );						store.commitChanges();					}				}else{					// Create the 1337 special record for hiding :P					var rec = new storeRecord({							ConferenceId 	: confId,							name			: confName,							userSubscribed	: userSubscribed,							topicsCount		: topicsCount,							openTopicsCount : '',							id				: 'FGT_' + a--,							author			: '<b>No threads defined.',							postedOn		: '',							lastPost		: '',							posts			: '',							subject			: '',							groupId			: '',							closed			: '',							editPermission	: cEditPermission,							createPermission	: cCreatePermission,							deletePermission: cDeletePermission						}) ;					rec.id = 'FGT_-' + confId.split("_")[1];					store.add( rec );				}			}			store.commitChanges();		};		store.fillTopic = function(response){			var recs = this.reader.readRecords(response.responseXML).records;			this.removeAll();			for (var i = 0 ; i < recs.length;){				for (var j = 1, temp = recs.length; j < temp+1; ){					if(recs[i].get('order') == j){						this.add(recs[i])						recs.splice(i, 1);						j++;						i = -1;					}					i++				}			}			this.commitChanges();		};		store.load = function(opt){			opt = opt || {params: {}};			var callback = (that.gridMode == 'cat')? this.fillCategories : this.fillTopic;            this.storeOptions(opt);			if ( opt && opt.params  ){				var event = '';				Ext.applyIf( opt.params, this.params );				event = opt.params.event.split('.');				event = event[event.length-1].toLowerCase();				var pn = this.paramNames;				if ( this.sortInfo ){	                opt.params["sort"] = this.sortInfo.field;	                opt.params["dir"] = this.sortInfo.direction;				}				switch( event ){					case 'changeorderby':					case 'changestartitemnumber':					case 'modifyfilter':					case 'selectfolder':						Ext.Ajax.request( {							url		: this.url,							params	: opt.params,							success : function(){								callback.apply( this, arguments );								that.setFilterParams( this, [], opt );							},							scope	: this						} );						return;				}			}			this.load_prototype.apply( this, arguments );		};		//------------------------------------		// End of Filter		//------------------------------------		// To group expander behaves correctly		Ext.override(Ext.grid.GroupingView, {			renderUI : function(){			          Ext.grid.GroupingView.superclass.renderUI.call(this);			          this.mainBody.on('click', this.interceptMouse, this);			          if(this.enableGroupingMenu && this.hmenu){			              this.hmenu.add('-',{			                  id:'groupBy',			                  text: this.groupByText,			                  handler: this.onGroupByClick,			                  scope: this,			                  iconCls:'x-group-by-icon'			              });			              if(this.enableNoGroups){			                  this.hmenu.add({			                      id:'showGroups',			                      text: this.showGroupsText,			                      checked: true,			                      checkHandler: this.onShowGroupsClick,			                      scope: this			                  });			              }			              this.hmenu.on('beforeshow', this.beforeMenuShow, this);			          }			      }		});		this.gridGroupView = new Ext.grid.GroupingView({		        forceFit:false		        // custom grouping text template to display the number of items per group		        ,groupTextTpl: '{values.gvalue}  ({[values.rs[0].id.split("_")[1] <= -3 ? 0 : values.rs.length]} {[values.rs.length > 1 ? "Threads" : "Thread"]}{[values.rs[0].id.split("_")[1] <= -3 ? "" : " - "+values.rs[0].data.openTopicsCount+" Open"]})'		        /*,getRowClass    : function(row, index,p, st){					// Hide the 1337 record					if(parseInt(row.data.id.split("_")[1]) < 0 )return 'x-grid-group-body-hide';		        }*/				,enableGroupingMenu : false				,startCollapsed 	: true  			});		this.gridNormalView = new Ext.grid.GridView({				autoFill: true   		});		this.view.init({			id 				: 'forum_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false,  singleSelect: true})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Forum'			})			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,view       	: this.gridGroupView		});		this.registerView();	}	,calculateIndex : function(index){		var store = this.conn.getStore();		var confIndex = 0;		var preConfId = -1000;		//var fn = function(rec){		var rec;		for(var topicIndex = 0, len = store.getCount(); topicIndex< len; topicIndex++){				rec = store.getAt(topicIndex);				if(rec.get('ConferenceId') != preConfId){					confIndex ++;					if( confIndex == index){						return( topicIndex);					}					preConfId = rec.get('ConferenceId');				}		};		return (topicIndex);	}	,createRecordAt: function(data){		var dq 			= Ext.DomQuery;		var store 		= this.conn.getStore();		var index;		var cats 		= dq.select( 'conference', data.info.xml );		var topics      = dq.select( 'topic', cats[0] );		var storeRecord = Ext.data.Record.create( this.fields );		if(this.gridMode == 'cat'){		var index = this.calculateIndex (parseInt(dq.selectValue( 'index', cats[0] ) ));		if(data.params.event.split('.')[3] == "createModifyTopic" ||  data.params.event.split('.')[3] == "getGrid"){			index = index + parseInt(dq.selectValue('index',topics[0]))-1;			if(data.mode == "create"){				var fakeRec = store.getById("FGT_-"+ data.info.confId);				if( fakeRec )					store.remove(fakeRec);			}		}				// Select the topics				var confId      = dq.selectValue( 'id', cats[0] );				var confName    = dq.selectValue( 'name', cats[0] );				var userSubscribed = dq.selectValue( 'userSubscribed', cats[0] );				var confDesc    = dq.selectValue( 'description', cats[0] );				var openTopics  = dq.selectValue( 'openTopicsCount', cats[0] );				var topicsCount = dq.selectValue( 'topicsCount', cats[0] );		        var cEditPermission	= (dq.selectValue( 'editPermission', cats[0] ) =="false")? false:true;		        var cDeletePermission= (dq.selectValue( 'deletePermission', cats[0] )=="false")? false:true;		        var cCreatePermission= (dq.selectValue( 'createPermission', cats[0] ) =="false")? false:true;				if ( topics.length > 0 ){					for ( var t = 0, tlen = topics.length; t < tlen; ++t ){						//"TopicId,TopicCreationDate,OwnerName,CountOfMessages,TopicDesc,subject">						var rec = new storeRecord({							ConferenceId 	: confId,							name			: confName,							userSubscribed	: userSubscribed,							topicsCount		: topicsCount,							openTopicsCount : openTopics,							id				: dq.selectValue( 'id', topics[t] ) || '',							author			: dq.selectValue( 'author', topics[t] ) || '',							postedOn		: dq.selectValue( 'postedOn', topics[t] ) || '',							lastPost		: dq.selectValue( 'lastPost', topics[t] ) || '',							posts			: dq.selectValue( 'posts', topics[t] ) || '',							subject			: dq.selectValue( 'subject', topics[t] ) || '',							groupId			: dq.selectValue( 'groupId', topics[t] ) || '',							closed			: dq.selectValue( 'closed', topics[t] ) || '',							editPermission	: (dq.selectValue( 'editPermission', cats[0] ) =="false")? false:true,							deletePermission: (dq.selectValue( 'deletePermission', cats[0] )=="false")? false:true,              				createPermission	: (dq.selectValue( 'createPermission', cats[0] ) =="false")? false:true,							order			: dq.selectValue( 'order', topics[t] ) || ''						})						rec.id = dq.selectValue( 'id', topics[t] );						//To update some fields of all records						store.each(function(record){							record.data.openTopicsCount = topicsCount;							record.data.openTopics = openTopics;						},this);						store.insert(index+t,rec );						store.commitChanges();					}				}				else{						// Create the 1337 special record for hiding :P						var rec = new storeRecord({								ConferenceId 	: confId,								name			: confName,								topicsCount		: topicsCount,								userSubscribed	: userSubscribed,								openTopicsCount : '',								id				: 'FGT_-' + confId,								author			: '<b>No threads defined.',								postedOn		: '',								lastPost		: '',								posts			: '',								subject			: '',								groupId			: '',								closed			: '',	  							editPermission	: cEditPermission,	  							createPermission	: cCreatePermission,	  							deletePermission: cDeletePermission							}) ;						rec.id = 'FGT_' + (-confId.split('_')[1]);						store.insert(index, rec );						store.commitChanges();					}					// for interlinking					try {						this.gridGroupView.refresh();					} catch (e) {}			}			else			{				rec = this.reader.readRecords(data.info.xml).records;				store.insert(rec[0].get('order') - 1, rec[0]);				store.commitChanges();				// for interlinking				try {					this.gridNormalView.refresh();				} catch(e) {}			}	}	,deleteObject: function(callee, type, object){		var xml = object.info.xml;		var store = this.conn.getStore();		if( type == 'forum_success_modify_folder' || type == 'forum_success_delete_folder' ){			store.each(function(rec){				if( rec.get('ConferenceId') == object.info.id || rec.get('ConferenceId') == object.info.rawId)				store.remove(rec);			});		}		else		{			if( type == 'forum_success_modify_item'){				store.remove(store.getById("FGT_"+object.info.id));			}			else			{				var rec = object.info.rec;				if(rec.get('topicsCount') == 1){					  var storeRecord = Ext.data.Record.create( this.fields );						var confId 		= rec.get('ConferenceId');						var confName	= rec.get('name');						var userSubscribed = rec.get('userSubscribed');						var index 		= store.find('id', rec.get('id'));						var rec = new storeRecord({								ConferenceId 	: confId,								name			: confName,								userSubscribed	: userSubscribed,								topicsCount		: 0,								openTopicsCount : '',								id				: 'FGT_-' + confId,								author			: '<b>No threads defined.',								postedOn		: '',								lastPost		: '',								posts			: '',								subject			: '',								groupId			: '',								editPermission	: rec.get('editPermission'),								deletePermission: rec.get('deletePermission'),								createPermission:rec.get('createPermission'),								order			: ''							}) ;						rec.id = 'FGT_' + (-confId.split('_')[1]);						store.insert(index, rec );						store.commitChanges();						this.gridGroupView.refresh();				}        else{            store.each(function(record){              if(rec.get('ConferenceId') == record.get('ConferenceId'))                record.data.openTopicsCount --            })        }				store.remove(store.getById(object.info.id));        this.view.get().view.refresh()			}		}	}	,registerView : function(){		Eve.widgets.Forum.GridBridge.superclass.registerView.call(this);		var grid = this.view.get();		// - - - - - - - - - - - - - - - - - -		// Custom Handlers can go here.		// - - - - - - - - - - - - - - - - - -	  grid.on('rowdblclick',function(grid,index,e) {		 var rec = grid.store.getAt(index);		this.id 		= rec.get('id').split('_')[1];		if(rec.get('author') == "<b>No threads defined.")			return		this.record    	= rec;		//this.typeId		= obj.info.typeId;			var data = {				//title	: this.title				info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}		this.fire('forum_open_topic', data);		},this);		grid.on('contextmenu', function(e) {		      e.stopEvent();		      var target = e.getTarget('div.x-grid-group-hd');			  try{					var content = target.id.split('name-')[1];					this.confName = content.split('-')[0];				}catch(e){				}		      if(target !== null) {				if(this.menu === undefined){			        this.menu = new Ext.menu.Menu({			          items: [			            {			              text: 'New Thread'						  ,icon: Eve.Resource.getIcon('new', 'general')			              ,handler: function() {			                var index = grid.store.find('name', this.confName);							 var confId = grid.store.getAt(index).get('ConferenceId');        							//var confId = grid.store.getAt(index).get('id');        							var data = {        								title	: this.confName        								,info:  {        									id			: confId.split('_')[1]        									,rawId		: this.rawId        									,typeId		: 'folder'        									,parentId 	: this.parentId        									,groupId 	: this.groupId        									,root		: this.root        									,path		: this.path        								}        							};        							this.fire('forum_create_item_dlg', data);			              }						  ,scope: this			            },			            {							text: 'Edit Category'							,icon: Eve.Resource.getIcon('edit', 'general')							,handler: function() {          							var index = grid.store.find('name', this.confName);          							var confId = grid.store.getAt(index).get('ConferenceId');          							//var confId = grid.store.getAt(index).get('id');          							var data = {          								title	: this.confName          								,info:  {          									id			: confId.split('_')[1]          									,rawId		: this.rawId          									,typeId		: 'folder'          									,parentId 	: this.parentId          									,groupId 	: this.groupId          									,root		: this.root          									,path		: this.path          								}          							};          							this.fire('forum_edit_folder_dlg'  , data );			              }						  ,scope: this			            }			           ,{							text: 'Delete Category'							,icon: Eve.Resource.getIcon('delete', 'general')							,handler: function(item, e) {			                var index = grid.store.find('name', this.confName);        							var confId = grid.store.getAt(index).get('ConferenceId');        							//var confId = grid.store.getAt(index).get('id');        							var data = {        								title	: this.confName        								,info:  {        									id			: confId.split('_')[1]        									,rawId		: this.rawId        									,typeId		: 'folder'        									,parentId 	: this.parentId        									,groupId 	: this.groupId        									,root		: this.root        									,path		: this.path        								}        							};        							this.fire('forum_delete_folder_dlg'  , data );			              }						 ,scope: this			            }						,'-',{							text: 'Notify Me'							,id: 'forum_cat_notify'							,icon: Eve.Resource.getIcon('notified', 'forum')							,handler: function(item, e){								var index = grid.store.find('name', this.confName);								var rec = grid.store.getAt(index);								var confId = rec.get('ConferenceId');								var data = {									info:{									 conferenceId	: confId.split('_')[1]									,groupId 	: this.groupId									,state		: (rec.get('userSubscribed') == '0' || rec.get('userSubscribed') == 'false')? "1" : "0"									}									,rec		: rec								}								this.fire('forum_notify_category'  , data )							}							,scope: this						}			          ]			        });				}        var index = grid.store.find('name', this.confName);        var rec = grid.store.getAt(index);        this.menu.showAt(e.getXY());        (rec.get('createPermission') == false)?          this.menu.items.items[0].disable():          this.menu.items.items[0].enable();        (rec.get('editPermission') == false)?          this.menu.items.items[1].disable() :          this.menu.items.items[1].enable();        (rec.get('deletePermission') == false)?          this.menu.items.items[2].disable() :          this.menu.items.items[2].enable();				var cmp = Ext.getCmp('forum_cat_notify');		if(rec.get('userSubscribed') == '0' || rec.get('userSubscribed') == 'false'){				cmp.icon = Eve.Resource.getIcon('notified', 'forum');				cmp.setText('Notify Me');		}		else{				cmp.icon = Eve.Resource.getIcon('not-notified', 'forum')				cmp.setText('Stop Notify');		}		this.menu.items.items[4].enable();		if(this.confName == '[No Category]'){			this.menu.items.items[1].disable();			this.menu.items.items[2].disable();			//this.menu.items.items[3].disable();			this.menu.items.items[4].disable();		}		/*else{			this.menu.items.items[3].enable();		  this.menu.items.items[2].enable();		}*/		}		},this);	}  ,execute: function( callee, type, data)  {     Eve.widgets.Forum.GridBridge.superclass.execute.apply(this,arguments);     switch(type){       case 'forum_set_active_node':            if( data.node !== undefined)          		this.newPer = data.node.attributes.per.New;        break;      }  }});/* * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * *								Topic View* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  * * * * */Eve.widgets.Forum.TopicView = Ext.extend(Eve.lib.Bridge, {	init: function(obj)	{		Eve.widgets.Forum.TopicView.superclass.init.call(this, obj);		this.topBar = obj.topBar;	}	,createLayout: function(){		this.fields = [			{name:	'subject'}			,{name:	'body'}			,{name:	'author'}			,{name:	'postedOn'}			,{name:	'path'}			,{name:	'id'}			,{name: 'index' 			,type: 'int'}			,{name:	'editPermission'	,type: 'boolean'}			,{name:	'deletePermission'	,type: 'boolean'}			,{name: 'linkedItems'		,type: 'int'}			,{name: 'id'}			,{name: 'picture'			,type: 'string', defaultValue: Eve.imagePath + 'forum/no-pic.png' }			];		// Message Tree Store		this.reader =  new Ext.data.XmlReader({			record	: 'row'			,id		: 'id'			}, new Ext.data.Record.create( this.fields ));		this.store = new Ext.data.Store({			reader 	: this.reader			,url	: Eve.url			,scope	: this		});		this.treeView = new Ext.DataView({			store: this.store			,tpl:  new Ext.XTemplate(			'<div class="forum-tree" id="f_tree" style="border-color:#538A00; border-top:none">',			'<tpl  for=".">',			'<div class="search-item" style="margin-left:{[this.getMargin(values)]}px;font-size:9pt; font-family:tahoma;">',			'<span style="cursor:pointer">{subject}</a></div>',			'</tpl>',			'</div>',        {          getMargin: function(val){            var depth = val.path.split('\\').length-2;            var marginLeft = (depth == 1)? 0 : (depth*7);            return marginLeft;          }        }				)			,emptyText: '<div class="forum-tree" style="border-color:#538A00; border-top:none"><i> No items </i></div>'			,itemSelector : 'div.search-item'			,hidden : true			,listeners: {				click: function(dv, index, node, e){					var body = Ext.getCmp('forum-main-wrapper').body;     				var el = Ext.getDom(this.blockView.getNode(index).id);     				var top = Ext.fly(el).getOffsetsTo(body)[1]+ body.dom.scrollTop;     				body.scrollTo('top', top, {duration:.5});				}				,scope: this			}			,scope: this		});		this.bottom = new Ext.Panel({			bodyStyle: 'margin:0 5px;border:1px solid #538A00;background-color:#ECFED3;padding:4px;border-top:none'			,layout: 'anchor'			,html:  '<div id="PlaceHolder_newMsg" style="float:left;margin-right:3px"></div>'					+'<div id="PlaceHolder_add" style="float:left;margin-right:3px"></div>'					+'<div id="PlaceHolder_notify" style="float:left;margin-right:3px"></div>'					+'<div id="PlaceHolder_print" style="float:left;margin-right:3px"></div>'					+'<div id="PlaceHolder_email" style="float:left"></div>'					+'<div id="PlaceHolder_showHide" style="float:right"></div>'			,border: false			,height: 30		});		// Message Blocks		var field = [						{name:'objCategory'}						,{name: 'objId'}						,{name: 'objMode'}						,{name: 'objGroupId'}						,{name: 'objTypeId'}						,{name: 'objType'}						,{name: 'objTitle'}						,{name: 'objPath'}						,{name: 'id'}						,{name: 'details'}						,{name: 'objIcon'}			];		this.ilReader =  new Ext.data.XmlReader({			record	: 'linkedItem'			,id		: 'id'			}, new Ext.data.Record.create( field ));		var path = 'http://'+location.host;		this.subTemplate = new Ext.XTemplate(            '<tpl for="records">',			'<tr>',			'<td><img src="{values.data.objIcon}" /></td>',			'<td><span style="cursor:pointer" class="msg-il-item_{#}" > {[values.data.objTitle]}</span></td>',			'<td>{[values.data.details]}</td>',			'</tr></tpl>'            ,{			getTitle: function(val){				return val.get('objTitle');			}			,scope: this            }		);  	this.blockView = new Ext.DataView({  				store: this.store  				,tpl: new Ext.XTemplate(                  '<div id="Forum_block_lst">',  				'<tpl for=".">',                  '<table style="" width=100% class="forum-block" >',                  '<tr><td style="width:{[this.setWidth(values)]}px"></td>',                  '<td>',                  '<div class="block-msg" id="{id}" style="border:1px solid #00266F; margin:5px 2px; width:99%;background-color:#D3E2FF;">',                  '<table width=100% cellspacing=0 cellpadding=0 class="msg-block" >',  				'<tr>',//                  '<td rowspan=3 width=28% style="text-align:center; border-right: 1px solid #00266F;">',  				'<img src="{picture}" width=100> ',  				'<div>{author}</div><div>{postedOn}</div></td>',                  //'<td style="vertical-align:top"><div style="font-weight:bold">{subject}</div><div>{body}</div></td>',                  '<td style="vertical-align:top"><div style="font-weight:bold">{subject}</div><div>{[this.fixBody(values)]}</div></td>',                  '</tr>',//                  '<tr><td><table>{[this.interlink(values, xindex)]}</table></td></tr>',                  '<tr>',///                  '<td height=5%>',  				'<div class="btn-bar">',  				'<tpl if="this.getReplyPer(values)== true">',  				'<img   class="btn-reply-msg forum-msg-btn btn-visibility" src="' +Eve.Resource.getIcon('reply','forum') + '"  width=70>',  				'</tpl>',  				'<tpl if="this.getDelPer(values)== true">',  				'<img class="btn-del-msg forum-msg-btn btn-visibility" src="' + Eve.Resource.getIcon('delete','forum') + '"  width=70>',  				'</tpl>',  				'<tpl if="this.getEditPer(values)== true">',  				'<img  class="btn-edit-msg forum-msg-btn btn-visibility" src="' + Eve.Resource.getIcon('edit','forum') + '"  width=70>',  				'</tpl>',  				'</div>',  				//'<div>{[this.interlink(values)]}</div>',  				'</td>',                  '</tr>',                  '</table>',                  '</div>',                  '</td></tr>',                  '</table>',                  '</tpl>',  				'</div>',                  {  					interlink:(function(vals, index){  						if (this.currentLayout == 'gridView')  						    return;  						if( vals.linkedItems != "0" ){		                  var index = parseInt(vals.index)-1;		                  var data = this.ilReader.readRecords(this.interlinks.get(index));		                  return this.subTemplate.applyTemplate(  data  );  						}  						return "";  					}).createDelegate(this)					,setWidth: function(val){                      var path =  val.path.split('\\').length-2;                      if(path !== 1 )                        return (path*10);                     else return "0"                    }                  	,fixBody: function(val) {                  		                  		return Eve.fixWordPaste(val.body)                  	}					,getEditPer:(function(val){  						if( val.editPermission == true && parseInt(this.msgRec.get('closed')) == false)  							return true;						return false;  				  }).createDelegate(this)  				  ,getDelPer: (function(val){  						if( val.editPermission == true && parseInt(this.msgRec.get('closed')) == false)							return true;					  	return false;  				  }).createDelegate(this)  				 ,getReplyPer: (function(){  					if( parseInt(this.msgRec.get('closed')) == true)						return false;					return true;  				 }).createDelegate(this)                  }  				)  				,emptyText: '<div style="width:99%;padding:5px"><i>No items</i></div>'  				,itemSelector: 'div.block-msg'  				,selectedClass: 'testingClass'  				//,anchor: '99%'  				,scope: this  		    })    var panel = {  			layout: 'fit'  			,items: [new Ext.Panel({  				title:	'<div id="back-btn" style="float:left"></div>'  						+'<div id="next-topic" style="float:right;margin-left:5px"></div>'  						+'<div id="pre-topic" style="float:right"></div>'  						+'<div style="clear:both"/>'  				,layout: 'anchor'  				,autoScroll: true  				,id         : 'forum-main-wrapper'  				,border: false  				,items: [{  					border:false  					,html:'<div id="f_tree_header" class="forum-tree" style="font:bold 10pt tahoma;margin-top:4px;border-color:#538A00 ">'  							+'<div id="topic_name" style="width:75%;float:left"></div>'  							+'<div id="topic_coId" style="width:15%;float:right;font-weight:normal;"></div>'  							+'<div style="clear:both"></div></div>'  					},this.treeView  					,this.bottom  					,this.blockView]  			})]  		};  		this.registerView();  		return panel;	}	,execute: function(callee, type, data){		switch(type){			case( "forum_open_topic"):			    this.getTopicMessage(data);			    break;			case ( "forum_open_grid_view"):				this.layout.getLayout().setActiveItem(0);				this.fire('forum_set_active_node',{info:{groupId:this.groupId}});				this.topBar.show();				this.currentLayout = 'gridView';				this.interlinks.clear();			    break;			case "forum_reload_discussion_view":			case "forum_reload_interlink_grid":				if(this.currentLayout == 'listView'){                    var info ={ id: this.msgRec.get('id').split("_")[1], groupId: this.msgRec.get('groupId').split("_")[1]}                    this.getTopicMessage({info: info});				}			    break;			case "forum_success_modify_msg":				if(this.currentLayout == 'listView'){					var dq = Ext.DomQuery;					var res = data.response.responseXML;					var msgs = this.reader.readRecords(res);					var rec, id;					for(var i = 0; i< msgs.records.length; i++){						id 	= msgs.records[i].get('id');						rec 	= this.store.getById(id);						rec.beginEdit();							var keys = this.store.fields['keys'];							for (var j=0, length=keys.length; j<length; j++) {								rec.set(keys[j], msgs.records[i].get(keys[j]));							}						rec.endEdit();					}					this.blockView.refresh();					this.treeView.refresh();				}				break;		  case "forum_success_create_msg":			var dq = Ext.DomQuery;	        var res = data.response.responseXML;	        if (this.currentLayout == 'listView' &&	            this.msgRec.get('id') == Ext.DomQuery.selectValue('topicId', res) )	        {						var msgs = this.reader.readRecords(res);						var rec, id, index;						id 	= msgs.records[0].get('id');						rec 	= this.store.getById(id);						if(rec !== undefined){							//update parent node							rec.beginEdit();							var keys = this.store.fields['keys'];							for (var i=0, length=keys.length; i<length; i++) {								rec.set(keys[i], msgs.records[0].get(keys[i]));							}							rec.endEdit();							//interlink update							this.interlinks.insert(parseInt(msgs.records[1].get('index'))-1, dq.select('linkedItemsArray', res)[1]);							index 	= parseInt(msgs.records[1].get('index'))-1;							this.store.insert(index, msgs.records[1]);						}						else{								index 	= parseInt(msgs.records[0].get('index'))-1;								this.store.insert(index, msgs.records[0]);						}						this.blockView.refresh();						this.treeView.refresh();					}     				else			          {			              var data = {			                info:{			                  folderids   : dq.selectValue('conferenceId', res ).split('_')[1]			                  ,groupId  : dq.selectValue('groupId', res ).split('_')[1]			                  //,parentId : dq.selectValue('conferenceId', res ).split('_')[1]			                }			              };			              this.fire('forum_get_grid', data);			          }					break;			case ("forum_set_active_node"):				if (this.currentLayout == 'listView') {					this.layout.getLayout().setActiveItem(0);					this.currentLayout = 'gridView';					this.topBar.show();				}				break;			case ("forum_delete_item"):			    this.delMessage(data);			    break;			case ("forum_success_get_msg"):				this.loadTopicView(data.response);				break;		}	}	,registerView : function(){		this.treeView.on('click', function(dv, index, node, e){		},this);		this.blockView.on('render', function(){			this.blockView.el.on('click', function(e, item){				var rec = this.blockView.getRecord( Ext.get(item).up(this.blockView.itemSelector).dom );				var info = {					path: rec.get('path')					,id : rec.get('id').split('_')[1]					,topicId:this.topicId					,confId : this.confId					,groupId : this.groupId				};				//-------------------Click on interlink---------------------------------				if(Ext.get(item).dom.className.split(' ')[0].indexOf('msg-il-item') != -1){					var index = parseInt( rec.get('index')) -1;					var data = this.ilReader.readRecords(this.interlinks.get(index));					var il_index = parseInt(Ext.get(item).dom.className.split(' ')[0].split('_')[1]) - 1;					var rc = data.records[il_index];					var groupId	= rc.get('objGroupId').split('_')[1];					var objType = rc.get('objType').toLowerCase();					var index	= objType.indexOf('folder');					var sec		= (index == '-1') ? objType : objType.substr(0, index);					var type	= (index == '-1') ? 'item' :  'folder';			  		var event 	=  sec +'_edit_' + type + '_dlg';					var func = function() {						Eve.Resource.superbridge.broadcast(this, event , {							title	: rc.get('objTitle')							,info	: {								id		: rc.get('objId').split('_')[1]								,rawId	: rc.get('objId')								,path	: rc.get('objPath')								,root	: rc.get('objMode')								,groupId: groupId								,rec	: rec							}						});					};					switch( sec.toLowerCase() )					{						case 'event':						    sec = 'calendar';						    event 	= 'calendar_edit_item_dlg';						    break;						case 'link':						    event = 'link_open_link';							break;						case 'contact':						    event = 'contact_load_icon_popup';							break;						case 'mail':						    event = 'mail_il_edit_item_dlg';						    break;						case 'document':						    event = 'document_download_file';						    break;					}					if( sec.toLowerCase() !== 'thread')					    	this.fire('proxy_dialog', {type: sec, func : func });				    return;				}				//----------------------------------------------------------------				switch(Ext.get(item).dom.className.split(' ')[0]){					case( 'btn-reply-msg' ) :						this.fire('forum_edit_comment_dlg', {info: info, mode: 'reply'});						break;					case( 'btn-del-msg' ) :						if(Eve.Preference.getBoolean('delPromptItem') == false ){							this.delMessage({info: info});			            	return;				        }						Ext.Msg.confirm( 'Delete Confirmation',						['Are you sure you want to delete "',rec.get('subject'), '?'].join(''),							function(btn)							{								if (btn == 'yes') {									this.delMessage({info: info});								}							}, this );						break;					case( 'btn-edit-msg') :						this.fire('forum_edit_comment_dlg', {info: info, mode: 'edit'});						break;				}			}, this);		}, this );		var btnMenuHandler = function(btn, e){			var state;			var handler = '.toggleSubscriptionTopic';			var txt = btn.text;			switch (txt){				case ("Notify Me of New Posts"):					state = 1;					this.btnNotify.setIcon(Eve.Resource.getIcon('loading','forum'));					break;				case ("Stop Notifying Me of Posts"):					state = 0;					this.btnNotify.setIcon(Eve.Resource.getIcon('loading','forum'));					break;				case ('Stop Discussion on this thread'):					state = 0;					this.btnDiscussion.setIcon(Eve.Resource.getIcon('loading','forum'));					handler = '.toggleClosedTopic';					break;				case ('Start Discussion on this thread'):					state = 1;					this.btnDiscussion.setIcon(Eve.Resource.getIcon('loading','forum'));					handler = '.toggleClosedTopic';					break;			}			var param ={				conferenceId	: this.confId				,groupId		: this.groupId				,topicId		: this.topicId				,state			: state				,event			: 'modern.forum.group'+handler			};			Ext.Ajax.request({				url: Eve.url				,params: param				,success: function(response, options){    			switch (txt){    				case ("Notify Me of New Posts"):    					this.btnNotify.setText('I am notified');    					this.btnNotify.setIcon(Eve.Resource.getIcon('notified','forum'));    					break;    				case ("Stop Notifying Me of Posts"):    					this.btnNotify.setText('I am not notified');    					this.btnNotify.setIcon(Eve.Resource.getIcon('not-notified','forum'));    					break;    				case ('Stop Discussion on this thread'):    					this.btnDiscussion.setText('Discussion is closed');    					this.btnDiscussion.setIcon(Eve.Resource.getIcon('discussion-close','forum'));    					break;    				case ('Start Discussion on this thread'):    					this.btnDiscussion.setText('Discussion is opened');    					this.btnDiscussion.setIcon(Eve.Resource.getIcon('discussion-open','forum'));    					break;    			}					if(options.params.event.split('.')[3] == 'toggleClosedTopic'){						this.setTopicRec(response.responseXML);						this.store.removeAll();						var rec = this.reader.readRecords(response.responseXML);						for(var i = 0; i< rec.records.length; i++){							this.store.add(rec.records[i]);						}						this.blockView.refresh();					}				}				,scope  : this			});		}      this.btnNotify = new Ext.Button({				text	: 'I am not notified'				,icon	:Eve.Resource.getIcon('not-notified','forum')				,cls	: "x-btn-text-icon"				,handler: function(){this.showMenu()}			   	,menu	: new Ext.menu.Menu({			        items: [						new Ext.menu.CheckItem({							text: 'Notify Me of New Posts'							,group: 'f1'              ,icon	: Eve.Resource.getIcon('notified','forum')							,handler: btnMenuHandler.createDelegate(this)							}),						new Ext.menu.CheckItem({							text: 'Stop Notifying Me of Posts'							,group: 'f1'              ,icon	: Eve.Resource.getIcon('not-notified','forum')							,checked: true							,handler: btnMenuHandler.createDelegate(this)							})			        ]			   	})			});		this.btnDiscussion = new Ext.Button({				text	: 'Discussion is opened'				,icon	: Eve.Resource.getIcon('discussion-open','forum')				,cls	: "x-btn-text-icon"				,handler: function(){this.showMenu()}			   	,menu	: new Ext.menu.Menu({			        items: [						new Ext.menu.CheckItem({							text: 'Start Discussion on this thread'							,icon	: Eve.Resource.getIcon('discussion-open','forum')							,cls	: "x-btn-text-icon"							,group: 'f2'							,checked: true							,handler: btnMenuHandler.createDelegate(this)							}),						new Ext.menu.CheckItem({							text: 'Stop Discussion on this thread'							,icon	: Eve.Resource.getIcon('discussion-close','forum')							,cls	: "x-btn-text-icon"							,group: 'f2'							,handler:  btnMenuHandler.createDelegate(this)							})			        ]			   	})			});		this.bottom.on('render', function(){			this.btnPrint = new Ext.Button({				text: 'Print'				,handler : this.doPrint				,scope: this			});			this.btnShowHide = new Ext.Button({				text: 'Show thread tree'				,icon	: Eve.Resource.getIcon('show-tree-thread','forum')				,cls	: "x-btn-text-icon"				,handler: function(btn, e){					if(btn.getText()== 'Show thread tree'){						this.treeView.show();						btn.setText('Hide thread tree');                    }                    else{						this.treeView.hide();						btn.setText('Show thread tree');                    }				}				,scope: this			})		},this);	}	,delMessage : function(obj){		var param ={			conferenceId	: obj.info.confId			,groupId		: obj.info.groupId			,id				: obj.info.id			,topicId		: obj.info.topicId			,path			: obj.info.path			,event			: 'modern.forum.group.deleteMessage'		};		var fn = function (options, success, response){			var dq = Ext.DomQuery;			var res = response.responseXML;			//Interlink items			var index = this.store.find('id', dq.selectValue('id', res))			this.interlinks.removeAt(index);			//remove deleted node			var rec = this.store.getById("FGM_" + options.params.id);			this.store.remove(rec);			//parent node			rec = this.reader.readRecords(res);			if(rec.records.length > 0){				var parentRecord = this.store.getById(rec.records[0].get('id'));				parentRecord.beginEdit();				var keys = this.store.fields['keys'];				for (var i=0, length=keys.length; i<length; i++) {					parentRecord.set(keys[i], rec.records[0].get(keys[i]));				}				parentRecord.endEdit();				/*this.store.remove(this.store.getById(rec.records[0].get('id')));				index = parseInt(rec.records[0].get('index'))-1;				this.store.insert(index, rec.records[0]);*/			}		};		Ext.Ajax.request({			url			: Eve.url			,params		: param			,callback	: fn			,scope  	: this		});	}	,getTopicMessage : function(obj){		var params = {			event   	: 'modern.forum.group.getMessages'			,topicId    :   obj.info.id			,groupId    : 	obj.info.groupId			,dir    	:   obj.info.related || 0		};    this.fire ('forum_get_msg_topics', {params: params} );	}	,enableDisable : function(r){		var total = parseInt(Ext.DomQuery.selectValue('total', r));		if( total > 0) {			this.btnPrint.enable();		}		else{			this.btnPrint.disable();		}		if(parseInt(this.msgRec.get('closed')) == true){			this.btnDiscussion.setText('Discussion is closed');			this.btnDiscussion.setIcon(Eve.Resource.getIcon('discussion-close','forum'));			this.btnDiscussion.menu.items.items[1].setChecked(true);			//this.btnDiscussion.items.items[0].setActiveItem(1);		}		else{			this.btnDiscussion.setText('Discussion is opened');			this.btnDiscussion.setIcon(Eve.Resource.getIcon('discussion-open','forum'));			this.btnDiscussion.menu.items.items[0].setChecked(true);		}		if(parseInt(this.msgRec.get('userSubscribed')) == true){			this.btnNotify.setText('I am notified');			this.btnDiscussion.setIcon(Eve.Resource.getIcon('notified','forum'));			this.btnNotify.menu.items.items[0].setChecked(true);		}		else{			this.btnNotify.setText('I am not notified');			this.btnNotify.setIcon(Eve.Resource.getIcon('not-notified','forum'));			this.btnNotify.menu.items.items[1].setChecked(true);		}        (this.msgRec.get('disableNext')== 'true')? this.btnNext.disable() : this.btnNext.enable();        (this.msgRec.get('disablePrev')== 'true')? this.btnPre.disable() : this.btnPre.enable();		if(this.msgRec.get('owner') == 'true') {			this.btnDiscussion.enable();			this.btnNew.enable();		}		else{			  this.btnDiscussion.disable();			  this.btnNew.disable();		}	}	,loadTopicView: function( r ){			//set topic record      	this.setTopicRec( r );	    this.layout	= Ext.getCmp("forumCardLayout");		this.layout.getLayout().setActiveItem(1);		this.topBar.hide();  if(typeof this.currentLayout === 'undefined'){			this.btnNotify.render( Ext.get( 'PlaceHolder_notify' ) );		 	this.btnPrint.render( Ext.get( 'PlaceHolder_print' ) );			//this.btnEmail.render( Ext.get( 'PlaceHolder_email' ) );			this.btnDiscussion.render( Ext.get( 'PlaceHolder_add' ) );			this.btnShowHide.render( Ext.get( 'PlaceHolder_showHide' ) );			this.btnNew = new Ext.Button({				text	: 'New Post'				,id     :'forum_new_msg'				,icon	: Eve.Resource.getIcon('no-pic','forum')				//,cls	: "x-btn-text-icon"				,handler: function(){				var info = {					path: '\\'					,topicId:this.topicId					,confId : this.confId					,groupId : this.groupId				};					this.fire( "forum_create_comment_dlg",{info: info, subject: this.msgRec.get('subject')})				}				,scope: this			}).render(Ext.get('PlaceHolder_newMsg'));	        var btnPrint = new Ext.Button({				text	: 'Back to Discussion List'				,icon	: Eve.Resource.getIcon('back-to-discussion-list','forum')				,cls	: "x-btn-text-icon"				,handler: function(){					this.fire('forum_open_grid_view',{},true)				}				,scope: this			}).render(Ext.get( 'back-btn'));			this.btnPre = new Ext.Button({				text	: 'Previous'				,icon	: Eve.Resource.getIcon('previous-discussion','forum')				,cls	: "x-btn-text-icon"				,handler: function(){					var data = {					info:{						groupId	: this.groupId ,						confId	: this.confId ,						id		: this.topicId,						related : -1						}					};					this.fire('forum_open_topic',data,true)				}				,scope: this			}).render(Ext.get( 'pre-topic'));			this.btnNext = new Ext.Button({				text	: 'Next'				,icon	: Eve.Resource.getIcon('next-discussion','forum')				,cls	: "x-btn-text-icon"				,handler: function(){					var data = {						info: {							groupId	: this.groupId ,							confId	: this.confId ,							id		: this.topicId,							related : 1						}					};                    this.fire('forum_open_topic',data,true)				}				,scope: this			}).render(Ext.get( 'next-topic'));		}			this.currentLayout = 'listView';			document.getElementById('topic_name').innerHTML = this.msgRec.get('subject');			document.getElementById('topic_coId').innerHTML = "Discussion#" + this.msgRec.get('discussionId');			this.enableDisable(r);			this.store.removeAll();			this.store.add ( this.store.reader.readRecords(r).records );			this.treeView.refresh();      		this.blockView.refresh();//Stupid trick     if(this.isFirst === undefined)        Ext.getCmp('forum-main-wrapper').body.setHeight(Ext.getCmp('forum-main-wrapper').body.getHeight() - 20 );      this.isFirst = false;	}	,setTopicRec: function(res){		var dq = Ext.DomQuery;		var res = res || dq.select('topic',this.store.reader.xmlData);		//Interlink items		if(this.interlinks === undefined)			this.interlinks =  new Ext.util.MixedCollection();	    this.interlinks.clear();			this.interlinks.addAll ( dq.select('linkedItemsArray', res));		var fields = [			 { name: 'ConferenceId'				,type: 'string' }			,{ name: 'id'						,type: 'string' }			,{ name: 'subject'					,type: 'string'}			,{ name: 'groupId'					,type: 'string'}			,{ name: 'closed'					,type: 'boolean'}			,{ name: 'editPermission'			,type: 'boolean'}			,{ name: 'userSubscribed'			,type: 'boolean'}			,{ name: 'discussionId'				,type: 'string'}			,{ name: 'disableNext'				,type: 'string'}			,{ name: 'disablePrev'				,type: 'string'}		];		var rec = Ext.data.Record.create(fields);		this.msgRec = new rec({					conferenceId 	: dq.selectValue('confId', res)					,id 			: dq.selectValue('id', res)					,subject		: dq.selectValue('subject', res)					,groupId		: dq.selectValue('groupId', res)					,closed			: dq.selectValue('closed', res)					,owner			: dq.selectValue('editPermission', res)					,userSubscribed	: dq.selectValue('userSubscribed', res)					,discussionId	: dq.selectValue( 'discussionId' , res)					,disableNext    : dq.selectValue( 'disableNext' , res)					,disablePrev    : dq.selectValue( 'disablePrev' , res)		});		this.groupId = this.msgRec.get('groupId').split('_')[1];		this.confId = this.msgRec.get('conferenceId').split('_')[1] ;		this.topicId = this.msgRec.get('id').split('_')[1];	}	,doPrint: function(){		var tree = "";		var content = document.getElementById('Forum_block_lst').innerHTML;		var subj = this.msgRec.get('subject');		if(this.btnShowHide.getText() == 'Hide thread tree'){				 tree = '<div class="forum-tree" id="f_tree" style="border-color:#538A00; border-top:none">'			            +document.getElementById('f_tree').innerHTML +'</div>';		}		var printPage = window.open("/hyperoffice2nd/views/Styles/ModernStyle/forum/ForumPrint.html", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600");			setTimeout(function(){if(printPage.document){			var body  = "<div style='font: 9px tahoma; width:100%; height:100%;'>";				body += "<div style=' margin-left:10px; margin-top:35px;'>";				body +='<div id="f_tree_header" class="forum-tree" style="font:bold 10pt tahoma;margin-top:4px;border-color:#538A00 ">'				+subj+'</div>'+tree				body += "<div style='position:absolute; right:10px; top:6px;'>"						+"<input type='submit' value='Print' onclick='window.print();' /></div>";				body += ""+content+"</div>"				body += "</div>";				printPage.focus();				printPage.document.body.innerHTML = body;				printPage.document.body.style.margin = "0px";			}},200);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\forum/ForumMenu.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 March 2009 *  * ghazaleh@hyperoffice.com *  * http://www.hyperoffice.com */// -----------------------------------------------------------------------// Base Forum Grid Context-Menu// -----------------------------------------------------------------------Eve.widgets.BaseForumGridMenu = Ext.extend( Eve.widgets.EditMenu, {  menu: {},	init : function(data)	{		Eve.widgets.BaseForumGridMenu.superclass.init.call(this, data);	}	,registerView : function(brdg) {		this.item_menu.on('itemclick', function(bi) {			var data = {				title	: this.title				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}						switch(bi.id){               	case 'open_discussion_topic':   					this.fire('forum_open_topic', data);  				break;  				case 'del_topic':					this.fire(this.section + '_delete_item_dlg'  , data );  				    break;				case 'edit_topic':				    this.fire(this.section+ '_edit_item_dlg', data);				    break;			}			}, this);	},	execute : function( callee, type, obj ) {		switch( type ) {			case (this.section + '_editmenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId 	= obj.info.parentId;				this.path 		= obj.info.path;				this.record    	= obj.rec;				this.typeId		= obj.info.typeId;				this.title      = obj.rec.get('subject');				if(this.record.get('author') == "<b>No threads defined.")					return				this.item_menu.showAt( obj.pos );				break;		}	}});// -----------------------------------------------------------------------// Forum Grid Context-Menu// -----------------------------------------------------------------------Eve.widgets.ForumGridMenu = Ext.extend( Eve.widgets.BaseForumGridMenu, {	init : function(data)	{		Eve.widgets.ForumGridMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({			items : [        {			text	: 'Open Discussion Topic'			,id		: 'open_discussion_topic'			,icon	: Eve.Resource.getIcon('open-discussion','forum')        }, {			text	: 'Delete Thread'			,id		: 'del_topic'			,icon	: Eve.Resource.getIcon('delete', 'general')        }, {			text	: 'Edit Thread'			,id		: 'edit_topic'			,icon	: Eve.Resource.getIcon('edit', 'general')        }/*,        {          text: 'Print Topic',          id: 'print_topic'        }*/      ]		});		this.registerView();	}});// -----------------------------------------------------------------------// Add Context Menu (Used in Forum)// -----------------------------------------------------------------------Eve.widgets.AddForumMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data)	{		Eve.widgets.AddForumMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{				text: "New Category"				,id	: 'category'				,icon	: Eve.Resource.getIcon('new-category','forum')			},			{				text: "New Thread"				,id : 'contact'				,icon	: Eve.Resource.getIcon('new-thread','forum')			}]		});		this.registerView();	}	,registerView : function()	{		this.menu.on('itemclick', function(bi)		{			var data = {				 info	: {					id			: this.id					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path				}			}			switch(bi.id)			{				case 'category':					this.fire('forum_create_item_dlg', data);					break;				case 'contact':					this.fire('forum_create_item_dlg', data);					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type)		{			case (this.section + '_addmenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.path		= obj.info.path;				this.menu.showAt(obj.pos);				break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\forum/ForumDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Forum section based on ExtJS Library 2.2 January 2009 * * khashayar@hyperoffice.com * * http://www.hyperoffice.com */Eve.lib.Forum.ItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,init : function(data)	{		Eve.lib.Forum.ItemDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ["Thread"]			,main	: [0]		}				var dialog	= {			width 	: 500			,height : 250			,y		: 20			,title	: 'New Thread'		}				this.createDialog({tab: tab ,dialog: dialog})	}	,augment : function(callee)	{		var obj = callee.params;		if (this.mode == 'edit') {			obj.id = this.id;			Ext.getCmp(this.section + 'f_cat_cmb').disable();			obj.closed = this.closed;		}			    if (this.mode !== 'edit') {			obj.conferenceId = this.id			Ext.getCmp(this.section + 'f_cat_cmb').enable();		 } 		obj.groupId	 = this.groupId;		obj.parentId = this.parentId;		obj.path	 = this.path;				return callee;	}	,afterAddButtons : function(btn)	{   if(this.isIL())	        return btn;		 btn.splice(0, 1);		 return btn	}		,controller : function(obj)	{		console.info('Object passed to Forum Item Dialog: ', obj)		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack				this.title		= obj.title;		this.rec        = obj.info.rec				if (this.mode == 'edit')			this.closed		= obj.info.rec.get('closed')				this.panels[0].reset();		this.dialog.show();	}	,execute : function(callee, type, data) {		switch(type) {			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				this.loadForm(0);				break;			case (this.section + '_create_item_dlg'):				this.mode = data.mode || 'create';				this.controller(data);				this.loadForm(0);				break;		}	}	,deleteForm : function(id)	{		var data = {			info	: {				id			: this.id				,groupId	: this.groupId				,parentId	: this.parentId				,root		: this.root				,path		: this.path				,rec        : this.rec			}			,title	: this.title			,dialog : this.dialog		}		this.noPromptNeeded = true;		this.fire(this.section + '_delete_' + this.origin + '_dlg', data);		//this.dialog.hide();	}		,submitSuccess : function( resp, action, obj ) {		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {			// change the mode in case of it was 'create'.			this.mode = 'edit';			//this.showHideCmp();		this.id = dq.selectValue('id', xml).split("_")[1];			var info = {				id 			: this.id				,rawId		: dq.selectValue('id', xml)				,topicId    : this.id				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId				,confId     : dq.selectValue('confId', xml).split('_')[1]				,typeId		: this.typeId			}						var subject = dq.selectValue('subject', xml);			var type = (obj.id == 0 || obj.id === undefined) ? "forum_success_create_item" : "forum_success_modify_item";			var mode = (type == "forum_success_create_item") ? "create" : "edit" ;			this.fire(type, { info: info, params: obj, mode: mode });						if (type === "forum_success_create_item")			    this.fire(this.section + "_create_comment_dlg", { info: info, params: obj, subject : subject} );		}	}});// * * * * * * * * * * * * * * * * * * * *//	Category Dialog// * * * * * * * * * * * * * * * * * * * *Eve.lib.Forum.CategoryDialogBridge = Ext.extend(  Eve.lib.TabDialogController, {	mode	: 'create'	,init : function(data)	{		Eve.lib.Forum.CategoryDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			width 	: 500			,height : 250			,title	: 'Category'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,augment : function(callee)	{		var obj = callee.params;				if (this.mode != 'create')			obj.id = this.id;				obj.groupId = this.groupId;		obj.path	 = this.path;				return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		//this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;		this.rec        = obj.info.rec				this.title		= obj.title;				// We can also write this as a function for all of the panels		this.panels[0].reset();		this.dialog.show();	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ){			case ('forum_edit_folder_dlg'):				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;			case ('forum_create_folder_dlg'):				this.mode = 'create';				this.controller(data);				break;		}	}	,deleteForm : function(id)	{		var data = {			info	: {				id			: this.id				,groupId	: this.groupId				,parentId	: this.parentId				,root		: this.root				,path		: this.path				,rec        : this.rec			}			,title	: this.title		}		this.fire(this.section + '_delete_' + this.origin + '_dlg', data);		this.dialog.hide();	}	,submitSuccess : function( resp, action )	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId				,confId     : dq.selectValue('id', xml).split('_')[1]			}						//this.fire('forum_set_active_node', { info: info, params: obj });			var type = (obj.id == 0 || obj.id === undefined) ? "forum_success_create_folder" : "forum_success_modify_folder";			this.fire(type, { info: info, params: obj });		}	}});//* * * * * * * * * * * * * * * * * * *  * * *//	Comment Dialog//* * * * * * * * * * * * * * * * * * * * * * *Eve.lib.Forum.CommentDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,init : function(data)	{		Eve.lib.Forum.CommentDialogBridge.superclass.init.call(this, data);		var items	= (this.isIL()) ? ['New Comment'] : ['New Comment', 'Linked Items'];		var tab		= {			items	: items		}				var dialog	= {			width 	: 600			,height : 300		}				this.createDialog({tab: tab ,dialog: dialog});	}		,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.dialog.items.items[0].setActiveTab(0);		}				/*		if (this.mode != 'interlink' && !this.isIL())			Eve._il.main.store.removeAll();		*/		// Reset all Flags.		this.clearLoaded();	}	,augment : function(callee)	{		var obj = callee.params;		var idx = this.getIndex(this.getTabPanel().activeTab);				if (this.mode == 'create') {			obj.id = 0;		} else {			obj.id = this.id;		}				obj.topicId			= this.topicId;		obj.conferenceId	= this.conferenceId;		obj.groupId			= this.groupId;		obj.path	 		= this.path;				switch(idx) {			// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				obj.objId		= this.id;				break;		}				return callee;	}		,controller	: function(obj)	{		this.topicId 		= obj.info.topicId;		this.id         	= obj.info.id;		//this.parentId		= obj.info.parentId;		this.groupId 		= obj.info.groupId ;		this.root 			= obj.info.root || 'group';		this.path			= obj.info.path;		this.conferenceId 	= obj.info.confId;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(this.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack		if (!this.isIL()) {			obj.info.root		= this.root;			Eve._il.main.params = obj;		}				this.panels[0].reset();		// Check Elements.		this.dialog.show();	}	,execute : function(callee, type, data)	{		switch(type.toLowerCase())		{			case (this.section + "_edit_comment_dlg"):				this.mode = data.mode;				this.controller(data);				this.panels[0].get().ownerCt.buttons[2].enable();				this.dialog.closable = true;								if (!this.getLoaded(0))					this.loadForm(0);				break;						case (this.section + "_create_comment_dlg"):				this.mode = 'create';				this.controller(data);				this.dialog.setTitle('New Comment in Thread [' + data.subject + ']');								var btnIndex = (this.isIL()) ? 1 : 2;				this.panels[0].get().ownerCt.buttons[btnIndex].disable();								this.dialog.closable = false;				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);				var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}	}		,loadSuccess : function(res){		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			case 0:				var subEl = Ext.getCmp(this.section + 'comment_sub');				if ( this.mode == 'reply') {					var descEl = Ext.getCmp(this.section + 'comment_desc');										this.dialog.setTitle('Post Reply to "'+ subEl.getValue() + '"');										subEl.setValue('Re:' + subEl.getValue());					var created = Ext.DomQuery.selectValue('bodyHeader',res.responseXML);					created = (created === undefined) ? "" : created;										descEl.setValue(created + '<br/>>' + descEl.getValue());					this.mode = 'create';         			 subEl.focus();				}				else {					this.dialog.setTitle('"' + subEl.getValue() + '"');				}				break;						// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res);				break;		}	}		,submitForm : function()	{		var editor = Ext.getCmp(this.section + 'comment_desc');				if (editor.getValue() == '' && this.mode == 'create'){			Ext.tools.msg('Description is required', '');			return;		}				Eve.lib.Forum.CommentDialogBridge.superclass.submitForm.apply(this, arguments);	}	,onDialogBeforeHide : function()	{      var editor = Ext.getCmp(this.section + 'comment_desc');            if (editor.getValue() == '' && this.mode == 'create'){  			Ext.tools.msg('Description is required', '');  			return false;  		}  		 	}	//override BasicDialog	,applyPermissions: function(r){/*To prevent disabling dialog`s buttons*/}	,submitSuccess : function( resp, action )	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		this.mode = 'edit';		this.showHideCmp();				if (code == '0') {			// To enable cancle button after saving  comment			if (!this.isIL()) {				this.panels[0].get().ownerCt.buttons[2].enable();			}			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId			}						//var type =  (obj.id == "0")? "forum_success_create_msg" : "forum_success_modify_msg";			var type = "forum_success_modify_msg";			if (obj.id == 0 || obj.id === undefined){				 type = "forum_success_create_msg"			}			this.fire(type, { info: info, params: obj , response: resp});		}	}})/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Document section based on ExtJS Library 2.2 February 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/var dlgDoc = Eve.Dialogs.Document;// * * * * * * * * * * * * * * * * * * * * // Item Details  * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *dlgDoc.ItemDetails = function(c){	return new Eve.FormPanel({		labelAlign	: 'left'		,autoScroll	: false		,frame		: false		,bodyStyle	: 'padding: 20px'		,items		: [{			xtype		: 'hidden'			,name		: 'currentNotificationSetting'		}, {			layout		: 'form'			,items		: [{				layout		: 'column'				,items		: [{					columnWidth	: .2					,items		: [{						html: '<div id="' + c.section + '_docItemImage"></div>'					}, {						layout	: 'column'						,items	: [{							columnWidth	: .3							,items		: [{								xtype			: 'label'								,name			: 'size'								,text			: 'Size:'							}]						}, {							columnWidth	: .7							,items		: [new Ext.ux.xLabel({								xtype			: 'xlabel'								,text			: ''								,name           : 'size'								,value          : ''							})]						}]					}]				}, {					columnWidth	: .8,					layout		: 'form',					items		: [{						xtype			: 'textfield'						,fieldLabel		: 'Name'						,name			: 'title'						,disabled		: true						,cls			: 'ev-input-readonly'						,anchor			: '90%'					}, {						xtype			: 'textfield'						,fieldLabel		: 'Location'						,name			: 'location'						,cls			: 'ev-input-readonly'						,disabled		: true						,anchor			: '90%'					}, {						xtype			: 'textfield'						,fieldLabel		: 'Created By'						,name			: 'createdBy'						,cls			: 'ev-input-readonly'						,disabled		: true						,anchor			: '90%'					}, {						xtype			: 'textfield'						,id				: c.section + 'detailLastModified'						,fieldLabel		: 'Last Modified By'						,name			: 'lastModified'						,cls			: 'ev-input-readonly'						,disabled		: true						,anchor			: '90%'					}, {						xtype			: 'radiogroup'						,fieldLabel		: 'Change Notifications'						,name			: 'Notify_value'						,items			: [{							boxLabel		: 'On'							,name			: 'Notify_value'							,inputValue		: 'ON'						}, {							boxLabel		: 'Off'							,name			: 'Notify_value'							,inputValue		: 'OFF'						}]					}, {						xtype			: 'radiogroup'						,fieldLabel		: 'File Lock'						,name			: 'Lock_value'						,items			: [{							boxLabel		: 'On'							,name			: 'Lock_value'							,inputValue		: 'true'						}, {							boxLabel		: 'Off'							,name			: 'Lock_value'							,inputValue		: 'false'						}]					}, new Ext.ux.xLabel({						xtype			: 'xlabel'						,id				: c.section + 'detailLockedBy'						,text			: ''						,value			: ''						,name           : 'lockedBy'						,anchor			: '90%'						,labelSeparator	: ''					})]				}]			}, {				html			: '<hr style="margin:5px 0px;" />'			}, {				html			: '<b>Audit Log</b>'			}, {				xtype			: 'panel'				,border			: true				,autoScroll		: true				,height			: 135				,cls			: 'ev-dataview-ct'				,items			: [{					html : 	'<div class="ev-dataview-header" style="width:555px">'								+ '<div style="width:100px;float:left">Action</div>'								+ '<div style="width:200px;float:left" >User</div>'								+ '<div style="width:100px;float:left" >Date</div>'								+ '<div style="width:100px;float:left" >Details</div>'								+ '<div style="clear:both"></div>'							+ '</div>'				}, {					xtype				: 'xdataview'					,id                 : c.section + 'ItemAuditDV'					,name				: 'audit'					,hideLabel			: true					,itemSelector		: 'div.search-item'					,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'					,height				: 110					,store				: new Ext.data.Store({						reader	: new Ext.data.XmlReader({							record	: 'row'							,id		: 'id'						}, ['id', 'auditUserCompleteName', 'action', 'changeDate', 'sourceLocation'])					})					,tpl				: new Ext.XTemplate(						'<div>',						'<tpl for=".">',						'<div style="width:98%; margin: 10px 5px;">',							'<div style="width:100px;float:left">{action}</div>',							'<div style="width:200px;float:left" >{auditUserCompleteName}</div>',							'<div style="width:100px;float:left" >{changeDate}</div>',							'<div style="width:100px;float:left" >{sourceLocation}</div>',						'</div>',						'</tpl>',						'</div>'					)				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Item Versions * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *dlgDoc.storeNumberVersions = function(title) {	var data = [];		for (var i = 1; i < 101; ++i) {		if (i == 1)			data.push([i, i + ' ' + title]);		else			data.push([i, i + ' ' + title + 's']);	}		var ds = new Ext.data.SimpleStore({		fields	: ['value', 'text']		,data	: data	})		return ds;}dlgDoc.ItemVersions = function(c){	return new Eve.FormPanel({        labelWidth	: 70        ,frame		: false        ,autoScroll : true        ,bodyStyle	: 'padding: 20px'        ,items 		: [{			xtype		: 'radiogroup'			,fieldLabel	: 'Versioning'			,name		: 'versioning_value'			,anchor		: '90%'			,items		: [{				boxLabel	: 'On'				,id			: c.section + 'VVOn'				,name		: 'versioning_value'				,inputValue	: 'true'				,listeners	: {					check : function(el, checked) {						if (checked) {							Ext.getCmp(c.section + 'VerCmp').show();							Ext.getCmp(c.section + 'VerCmp').doLayout()							Ext.getCmp(c.section + 'VerTextMsg').hide();						}						else {							Ext.getCmp(c.section + 'VerTextMsg').show();							Ext.getCmp(c.section + 'VerCmp').hide();						}					}				}			}, {				boxLabel	: 'Off'				,id			: c.section + 'VVOff'				,name		: 'versioning_value'				,inputValue	: 'false'				,listeners	: {					check : function(el, checked) {						if (checked) {							Ext.getCmp(c.section + 'VerCmp').hide();							Ext.getCmp(c.section + 'VerCmp').doLayout()							Ext.getCmp(c.section + 'VerTextMsg').show();						}						else {							Ext.getCmp(c.section + 'VerTextMsg').hide();							Ext.getCmp(c.section + 'VerCmp').show();						}					}				}			}]		}, {			html		: '<hr style="margin:5px 0px;" />'		}, {			layout		: 'form'			,id			: c.section + 'VerTextMsg'			,items		: [{				html: '<div style="text-align:center; margin-top:50px;">This document does not have versioning turned on.</div>'			}]		}, {			layout		: 'form'			,id			: c.section + 'VerCmp'			,hidden		: true			,items		: [{				xtype			: 'panel'				,border			: true				,autoScroll		: true				,cls			: 'ev-dataview-ct'				,items			: [{					xtype			: 'xdataview'					,name			: 'revision'					,id				: c.section + '_revision'					,itemSelector	: 'tr.search-item'					,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'					,height			: 80					,hideLabel		: true					,store			: new Ext.data.Store({						reader	: new Ext.data.XmlReader({							record: 'row'							,id	  : 'id'						}, ['id', 'contentLength', 'revisionNumber', 'lastModifiedBy', 'nodeID', 'command'])					})					,tpl			: new Ext.XTemplate(						'<table width="100%" cellpadding="0" cellspacing="0">',							'<tr class="ev-dataview-header">',								'<th>Version Number</th>',								'<th>Size</th>',								'<th>Last Modified</th>',								'<th>Commands</th>',								'<th></th>',							'</tr>',							'<tpl for=".">',								'<tr class="search-item">',									'<td style="cursor: pointer;padding:3px;" class="revision">{revisionNumber}</td>',									'<td style="padding:3px">{contentLength}</td>',									'<td style="padding:3px;">{lastModifiedBy}</td>',									'<td style="{[this.getStyle(values)]};padding:3px;" class="revert">{command}</td>',								'</tr>',							'</tpl>',						'</table>',						{							getStyle: function(val) {								if (val.command != "")								    return 'cursor: pointer';								return '';							}						}					)				}]			}, {				xtype			: 'button'				,text			: 'Collapse All Versions'				,style			: 'margin: 3px 0 15px 0'				,id             : c.section + 'CollapseAll'			}, {				xtype			: 'radio'				,boxLabel		: 'Keep All Versions'				,name			: 'AutoPruningStyle'				,inputValue		: 'B'				,hideLabel		: true				,anchor			: '90%'			}, {				layout			: 'column'				,anchor			: '100%'				,items			: [{					layout			: 'form'					,columnWidth	: .5					,items			: [{						xtype			: 'radio'						,boxLabel		: 'Keep a maximum number of'						,name			: 'AutoPruningStyle'						,inputValue		: 'C'						,hideLabel		: true					}, {						xtype			: 'radio'						,boxLabel		: 'Delete non-current versions older than'						,name			: 'AutoPruningStyle'						,inputValue		: 'D'						,hideLabel		: true					}]				}, {					layout			: 'form'					,columnWidth	: .5					,items			: [{						xtype			: 'combo'						,name			: 'number_versions'						,valueField		: 'value'						,displayField	: 'text'						,store			: dlgDoc.storeNumberVersions('version')						,mode			: 'local'						,value			: '1'						,loadPrevent	: true						//,forceSelection	: true						,allowBlank		: false						,hideLabel		: true						,anchor 		: '90%'						,editable		: false						,triggerAction 	: 'all'					}, {						xtype			: 'combo'						,name			: 'days_versions'						,valueField		: 'value'						,displayField	: 'text'						,store			: dlgDoc.storeNumberVersions('day')						,mode			: 'local'						,value			: '1'						,loadPrevent	: true						,allowBlank		: false						//,forceSelection	: true						,hideLabel		: true						,anchor 		: '90%'						,editable		: false						,triggerAction 	: 'all'					}]				}]			}]		}]    })};// * * * * * * * * * * * * * * * * * * * * // Item Permissions  * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgDoc.cboPermissionEditor = new Ext.form.ComboBox({	store 			: new Ext.data.SimpleStore({		fields	: ['value', 'text']		,data	: [ ['1', 'Allow'], ['-1', 'Deny'] ]	})	,mode         	: 'local'	,valueField		: 'value'	,displayField 	: 'text'	,typeAhead 		: true	,editable		: false	,selectOnFocus 	: true	,triggerAction 	: 'all'});dlgDoc.checkColumnRenderer = function() {		return function(v, p, record){				if (v == '1' || v == 'true' || v == true) {					v = '1';									}				else if (v == '0' || v == 'false' || v == false) {					v = '0';				}				//the +v type converts to a number (json returns a string				//which always evaluates true)				var checkState = (+v) ? '-on' : '';				if(record.get('disabled') == 'True'){					return '<div class="grid-checkbox'+ checkState +' x-grid3-'+this.id+'"> </div>';				}				p.css += ' x-grid3-check-col-td';				return '<div class="grid-checkbox'+ checkState +' x-grid3-cc-'+this.id+'"> </div>';				}}dlgDoc.ItemPermissions = function(c){	dlgDoc.PerCheckColumn = new Ext.grid.CheckColumn({		 header			: "Inherit"		,sortable		: false		,fixed			: true		,menuDisabled	: true		,dataIndex		: 'inherited'		,width			: 50		,editable		: false		,renderer       : dlgDoc.checkColumnRenderer()	});	dlgDoc.PerCheckColumn.on('click', function (element, e, record) {		Ext.getCmp(c.section + 'GridPermission').fireEvent('afteredit');		Ext.getCmp(c.section + 'GridPermission').getStore().commitChanges();	});		return new Eve.FormPanel({        labelWidth	: 70		,layout		: 'border'        ,frame		: false        ,bodyStyle	: 'padding: 10px'        ,items 		: [{			layout		: 'fit'			,region		: 'center'			,items		: [{				xtype			: 'editorgrid'				,id				: c.section + 'GridPermission'				,layout			: 'fit'				,autoScroll 	: true				,viewConfig		: {					forceFit		: true				}				,style			: 'border: 1px solid #CCC;'				,plugins		: [dlgDoc.PerCheckColumn]				,store			: new Ext.data.Store({					reader		: new Ext.data.XmlReader({						record 		: 'row'						,success	: '@success'						,id			: 'groupUserID'						,totalRecords: 'total'					}, ['userCompleteName', 'read', 'write', 'delete', 'isAdministrator', 'isOwner', 'inherited', 'disabled'])				})				,columns		: [{					header			: "User"					,width			: 200					,dataIndex		: 'userCompleteName'					,fixed			: true					,menuDisabled	: true				}, dlgDoc.PerCheckColumn, {					header			: "Read"					,width			: 90					,dataIndex		: 'read'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(new Ext.form.ComboBox ( dlgDoc.cboPermissionEditor.cloneConfig() ))					,renderer		: Eve.comboRenderer(dlgDoc.cboPermissionEditor)				}, {					header			: "Write"					,width			: 90					,dataIndex		: 'write'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(new Ext.form.ComboBox ( dlgDoc.cboPermissionEditor.cloneConfig() ))					,renderer		: Eve.comboRenderer(dlgDoc.cboPermissionEditor)				}, {					header			: "Delete"					,width			: 90					,dataIndex		: 'delete'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(new Ext.form.ComboBox ( dlgDoc.cboPermissionEditor.cloneConfig() ))					,renderer		: Eve.comboRenderer(dlgDoc.cboPermissionEditor)				}]				,listeners		: {					beforeedit		: function(e) {						var val = e.record.get('inherited');						if (val == '1' || val == 'true' || val == true)							return false;					}				}			}]		}]    })};// * * * * * * * * * * * * * * * * * * * * // File Upload * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgDoc.FileUpload = function(){		return new Ext.FormPanel({		labelWidth	: 70		,layout		: 'fit'		,id         : 'upload-document'		,style		: 'background-color: white; border: 1px solid #D0D0D0;'		,frame		: false		,width		: 500		,items 		: [{			xtype			: 'uploadpanel'			,id				: 'documentUploadFilePanel'			,addText		: 'Choose files'			,uploadText		: 'Upload files'			,buttonsAt		: 'body'			,maxLength		: 50			,field_name		: 'filename_l'			,url			: 'index.cfm'			,baseParams		: {event: 'modern.document.personal.attachFile'}			,singleUpload	: false			,enableProgress	: false			,emptyText		: ''//<center>Click on the "Add" button above to begin uploading documents.</center>'		}]	})};dlgDoc.FlashFileUpload = function(){		var fields = [	 			 {name:'id', type:'text', system:true}	 			,{name:'fileName', type:'text', system:true}	 			,{name:'filePath', type:'text', system:true}	 			,{name:'fileCls', type:'text', system:true}	 			,{name:'fileMessage', type:'text', system:true}	 			,{name:'itemNum', type:'text', system:true}	 		];		var store = store = 		new Ext.data.SimpleStore({			 id:0			,fields:fields			,data:[]		});		Eve.Dialogs.Document.flashStore = store;		return new Eve.FormPanel({		labelWidth	: 70		,id         : 'upload-document'		,style		: 'background-color: white; border: 1px solid #D0D0D0;'		,frame		: false		,width		: 500		,items 		: [{			html: 	'<div style="padding: 10px">' +						'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="450" height="21" id="hyperuploader">' +							'<param name="movie" value="/hyperoffice2nd/views/styles/ModernStyle/javascript/uploader/hyperuploader.swf">' + 							'<param name="quality" value="high">' + 							'<param name="flashVars" value="uploadPath=../../../../../global/index.cfm?CFID=' + Eve.CFId + '||CFTOKEN=' + Eve.CFToken + '||hoSecNum=' + Eve.util.getCookie('HOSECNUM') + '">' + 							'<embed name="hyperuploader" flashVars="uploadPath=../../../../../global/index.cfm?CFID=' + Eve.CFId + '||CFTOKEN=' + Eve.CFToken + '||hoSecNum=' + Eve.util.getCookie('HOSECNUM') + '" src="/hyperoffice2nd/views/styles/ModernStyle/javascript/uploader/hyperuploader.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="21"></embed>' + 						'</object>' + 					'</div>'					}, {			 layout		: 'fit'			,items: {				 xtype:'dataview'				,itemSelector:'div.ux-up-item'				,store:store				,selectedClass: 'ux-up-item-selected'				,singleSelect:true				,height: 125				,emptyText:''				,tpl: this.tpl || new Ext.XTemplate(					  '<div style="overflow: auto; height: 125px;">'  					+ '<tpl for=".">'					+ '<div class="ux-up-item">'					+ '<div class="ux-up-icon-file file">&#160;</div>'					+ '<div class="ux-up-text x-unselectable" qtip="{fileName}">{[Ext.util.Format.ellipsis(values.fileName, 50)]}</div>'					+ '<div id="upload-status-{itemNum}" class="ux-up-icon-state ux-up-icon-{fileCls}"'					+ 'qtip="{fileMessage}">&#160;</div>'					+ '<div style="width: 150px; float: right; margin: 2px; margin-right: 4px; height: 14px; border: 1px solid #7777FF">'						+'<div id="upload-progress-{itemNum}" style="width: 0%; background: #A1A1FF; height: 14px;"></div>'					+ '</div>'					+ '</div>'					+ '</tpl>'					+ '</div>'					, {scope:this}				)				,listeners:{click:{scope:this, fn:function() {}}}							}		}]	})};dlgDoc.FlashAddFileToList = function(fileName, fileCls, errorMessage, itemNum) {	var FileRecord = Ext.data.Record.create(['fieldName', 'filePath', 'fileCls', 'fileMessage']);	if (!fileCls) fileCls = 'done'	if (!errorMessage) errorMessage = '';			var myNewRecord = new FileRecord(	    {		fileName: fileName		,filePath: ''		,fileCls: fileCls		,fileMessage: errorMessage		,itemNum: itemNum	    }	);	Eve.Dialogs.Document.flashStore.add(myNewRecord);};dlgDoc.FlashUploadChangeState = function(itemnum, status, message, uploadedBytes, totalBytes){	console.log(itemnum, status, message, uploadedBytes, totalBytes);		if (status)		document.getElementById('upload-status-' + itemnum).className = 'ux-up-icon-state ux-up-icon-' + status;	if (message)		document.getElementById('upload-status-' + itemnum).setAttribute('qtip', message)			if (uploadedBytes > 0 && totalBytes > 0)		var percent = uploadedBytes / totalBytes;	else		var percent = 1;		document.getElementById('upload-progress-' + itemnum).style.width = (percent * 100) + '%';	}// * * * * * * * * * * * * * * * * * * * * // Audit * * * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgDoc.Audit = function(){	return new Eve.FormPanel({		labelWidth	: 30		,fileUpload	: true		,frame		: false		,bodyStyle	: 'padding: 20px;'		,width		: 700		,height		: 300		,items 		: [{			layout		: 'column'			,items		: [{				layout		: 'form'				,columnWidth: .4				,items		: [{					xtype		: 'datefield'					,fieldLabel	: 'From'					,format			:Eve.Preference.get('dateFormat')					,name		: 'dateFrom'					,allowBlank	: false					,anchor		: '90%'				}]			}, {				layout		: 'form'				,columnWidth: .4				,items		: [{					xtype		: 'datefield'					,fieldLabel	: 'To'					,format		:Eve.Preference.get('dateFormat')					,name		: 'dateTo'					,allowBlank	: false					,anchor		: '90%'				}]			}]		}, {			xtype			: 'panel'			,height			: 170			,border			: true			,autoScroll		: true			,cls			: 'ev-dataview-ct'			,items			: [{				html : 	'<div class="ev-dataview-header" style="width:605px;">'							+ '<div style="width:150px;float:left">Location</div>'							+ '<div style="width:120px;float:left">Action</div>'							+ '<div style="width:160px;float:left">User</div>'							+ '<div style="width:70px;float:left">Date</div>'							+ '<div style="width:100px;float:left">Details</div>'							+ '<div style="clear:both"></div>'						+ '</div>'			}, {				xtype				: 'xdataview'				,id					: 'docAuditDV'				,name				: 'audit'				,height				: 146				,hideLabel			: true				,itemSelector		: 'div.search-item'				,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,store				: new Ext.data.Store({					reader	: new Ext.data.XmlReader({						record	: 'row'						,id		: 'id'					}, ['id', 'action', 'sourceLocation', 'changeDate', 'auditUserCompleteName', 'auditDetails'])				})				,tpl				: new Ext.XTemplate(					'<div>',					'<table class="doc-audit" cellspacing=0 cellpadding=0 width=98%>',					'<tpl for=".">',					'<tr class="search-item" style="font-size:9pt;border-bottom:1px dash">',					'<td width="150">{sourceLocation}</td>',					'<td width="120">{action}</td>',					'<td width="160">{auditUserCompleteName}</td>',					'<td width="70">{changeDate}</td>',					'<td width="100">{auditDetails}&nbsp;</td>',					'</tr>',                    '</tpl>',                    '</table>',                    '</div>'									)			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgDoc.CopyMove = function(data){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		//,autoScroll : true		,bodyStyle	: 'padding:10px'		//,style		: 'background-color: white; border: 1px solid #D0D0D0;'		,width		: 500		,height		: 300		,layout		: 'border'		,items 		: [{			layout			:'form'			,id             : data.section + 'attach_field'			,region			: 'north'			,height			: 30			,items          :[{					xtype			: 'textfield'					,id				: data.section + 'attach_name'					/*					 *  Commented By Khashayar					 *  Removing this will cause errors on document					 */					//,name			: 'title'					//,allowBlank	: false					,hiddenName		: 'userGroups'					,mode			: 'local'					,hideLabel		: true					,anchor 		: '50%'			}]			},{	region: 'center'				,layout:'fit'				,autoScroll : true				,style: 'background-color: white; border: 1px solid #D0D0D0;'				,items:data.view			}]	})};// * * * * * * * * * * * * * * * * * * * *// Folder Details  * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgDoc.storeNotification = new Ext.data.SimpleStore({	fields	: ['value', 'text']	,data	: [ ['ON', 'Subscribe to this folder (Change Notifications)'], ['OFF', 'Unsubscribe'] ]});dlgDoc.FolderDetails = function(){	return new Eve.FormPanel({		labelAlign	: 'left'		,frame		: false		,bodyStyle	: 'padding: 5px 5px 0'		,items		: [{			layout		: 'form'			,id			: 'docPersonalFolder'			,items		: [{				layout		: 'column',				items		: [{					columnWidth	: .2					,items		: [{						html: '<div id="docPersonalFolderImage"></div>'					}]				}, {					columnWidth	: .8,					layout		: 'form'					,items		: [{						xtype			: 'textfield'						,fieldLabel		: 'Name'						,name			: 'title'						,setFocus		: true						//,allowBlank		: false						,anchor			: '90%'					}, {						layout			: 'form'						,id				: 'docGroupNotification'						,items			: [{							xtype			: 'combo'							,mode			: 'local'							,fieldLabel		: 'Notifications'							,name			: 'Notify_value'							,valueField		: 'value'							,displayField	: 'text'							,store			: dlgDoc.storeNotification							,mode			: 'local'							,loadPrevent	: true							,editable		: false							,selectOnFocus	: true							,typeAhead		: true							,triggerAction	: 'all'							,anchor			: '90%'						}]					}]				}]			}]		}, {			layout		: 'form'			,id			: 'docGroupFolder'			,items		: [{				layout		: 'column',				items		: [{					columnWidth	: .2,					items		: [{						html: '<div id="docGroupFolderImage"></div>'					}, {						layout	: 'column'						,items	: [{							columnWidth	: .3							,items		: [{								xtype		: 'label'								,text		: 'Size:'							}]						}, {							columnWidth	: .7							,items		: [new Ext.ux.xLabel({								xtype		: 'xlabel'								,text		: ''								,name		: 'size'								,value		: ''							})]						}]					}]				}, {					columnWidth	: .8,					layout		: 'form',					items		: [{						xtype			: 'textfield'						,fieldLabel		: 'Name'						,name			: 'name'						,disabled		: true						,cls			: 'ev-input-readonly'						,anchor			: '90%'					}, {						xtype			: 'textfield'						,fieldLabel		: 'Location'						,name			: 'location'						,disabled		: true						,cls			: 'ev-input-readonly'						,anchor			: '90%'					}, {						xtype			: 'textfield'						,fieldLabel		: 'Created By'						,name			: 'createdBy'						,disabled		: true						,cls			: 'ev-input-readonly'						,anchor			: '90%'					}, {						xtype			: 'radiogroup'						,fieldLabel		: 'Change Notifications'						,name			: 'Notify_value'						,anchor			: '95%'						,items			: [{							boxLabel		: 'On'							,name			: 'Notify_value'							,inputValue		: 'ON'						}, {							boxLabel		: 'Off'							,name			: 'Notify_value'							,inputValue		: 'OFF'						}]					}, {						xtype			: 'textfield'						,fieldLabel		: 'Contains'						,name			: 'contains'						,disabled		: true						,cls			: 'ev-input-readonly'						,anchor			: '90%'					}]				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Folder Permissions  * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *dlgDoc.FolderPermissions = function(){	return new Eve.FormPanel({        labelWidth	: 50        ,frame		: false        ,bodyStyle	: 'padding: 10px'        ,items 		: [{			xtype		: 'label'			,text		: 'Choose the appropriate permissions using the check boxes below and then choose which user to apply them to using the select boxes below.'		}, {			xtype		: 'checkboxgroup'			,id			: 'docFolderPermissionCheckBoxes'			,hideLabel	: true			,style		: 'margin: 5px; padding: 5px; background-color: #D3E2FF; border: 1px dotted;'			,anchor		: '98%'			,items		: [{				boxLabel	: '<font style="position:absolute;">Read</font>'				,name		: 'p_read'			}, {				boxLabel	: '<font style="position:absolute;">Write</font>'				,name		: 'p_write'			}, {				boxLabel	: '<font style="position:absolute;">Delete</font>'				,name		: 'p_delete'			}, {				boxLabel	: '<font size="1" style="position:absolute;">Create&nbsp;Directories</font>'				,name		: 'p_createdir'			}, {				boxLabel	: '<font size="1" style="position:absolute;">Inherit&nbsp;Permissions</font>'				,name		: 'p_removeperms'				,id			: 'docInheritPermissions'				,listeners	: {					check		: function(cmp, checked) {						Ext.getCmp('docFolderPermissionCheckBoxes').setDisabled(checked);												if (checked) {							cmp.setDisabled(false);						}					}				}			}]		}, {			xtype		: 'itemselector'			,hideLabel	: true			,msWidth	: 263			,msHeight	: 130			,width		: 550			,height		: 150			,name		: 'opts2'   			,valueField	: 'id'   	   		,displayField: 'fullName'			,fromLegend	: 'Unassociated'			,toLegend	: 'Associated'			,dataFields	: ['fullName', 'id']			,fromData	: []			,toData		: []			,drawUpIcon	: false			,drawBotIcon: false			,drawTopIcon: false			,drawDownIcon: false			,drawAllRightIcon: false			,drawAllLeftIcon: false		}]    })};// * * * * * * * * * * * * * * * * * * * * // File Search * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *dlgDoc.Search = function(){	this.store = new Ext.data.Store({		baseParams : {			event				: 'modern.document.personal.textSearchFilter'		}		,url		: Eve.url		,reader	: new Ext.data.XmlReader({			record				: 'row'			//,id						: 'id'			,totalRecords	: 'total'		}, ['id', 'type', 'name', 'lastmoddate', 'lastModified', 'linkedItems', 'size', 'groupId', 'groupName',			'versioningCount', 'versioning_value', 'Lock_value', 'subscriptionType', 'image',			'deletePermission', 'editPermission','displayPath', 'createdBy', 'location','contentHighLighted'])	});	return new Eve.FormPanel({		labelWidth	: 50		,frame		: false		,bodyStyle	: 'padding: 20px'		,items 		: [{			layout		: 'column'			,items		: [{				layout		: 'form'				,columnWidth: .0				,items		: [{}/*{					xtype			: 'combo'					,name			: 'searchFieldText'					,id				: 'docSearchTypeCombo'					,fieldLabel		: 'Search'					,valueField		: 'value'					,displayField	: 'text'					,mode			: 'local'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,loadPrevent	: true					,triggerAction 	: 'all'					,anchor 		: '90%'					,store			: new Ext.data.SimpleStore({						fields	: ['text']						,data	: [ ['File Name Only'], ['File Name & Contents'] ]					})				}*/]			}, {				layout		: 'form'				,columnWidth: .9				,items		: [{					xtype			: 'textfield'					,name			: 'searchText'					,id				: 'docSearchTextbox'					,hideLabel		: true					,anchor 		: '99%'				}]			}, {				layout		: 'form'				,columnWidth: .1				,items		: [{					xtype			: 'button'					,text			: 'Search'					,handler		: function() {						var type = 'File Name Only'//Ext.getCmp('docSearchTypeCombo').getValue()						var text = Ext.getCmp('docSearchTextbox').getValue();												Eve.Resource.superbridge.broadcast(this, 'document_search_dlg', 															{															text: text 															,type: type															,info: {																 title			: Ext.getCmp('docTitle').getValue()																,createdBy		: Ext.getCmp('docCreatedBy').getValue()																,author			: Ext.getCmp('docAuthor').getValue()																,searchIn		: Ext.getCmp('docSearchIn').getValue()																,location		: Ext.getCmp('docLocation').getValue()																,lastModifiedBy	: Ext.getCmp('docLastModifiedBy').getValue()																,docType		: Ext.getCmp('docType').getValue()																,sortBy		: Ext.getCmp('docSortBy').getValue()																,sortDir		: Ext.getCmp('docSortDir').getValue()																,groupId		: ((Ext.getCmp('docSearchIn').getValue() == -3) ? this.groupId : Ext.getCmp('docSearchIn').getValue())															}														});					}				}]			}			]		},{			 xtype			: 'fieldset'			,title			: 'Advanced options'			,autoHeight		: true			,collapsible	: true			,collapsed		: true			,listeners		: {				collapse : function(p)				{					this.ownerCt.ownerCt.ownerCt.setHeight(395);						},				expand : function(p)				{					this.ownerCt.ownerCt.ownerCt.setHeight(530);					}			}			,items			: [{				layout		: 'column'				,items		:[{					 layout		: 'form'					,labelWidth : 100					,columnWidth: 0.5					,items		: [{						 xtype		: 'textfield'						,name		: 'DOCNAME'						,id			: 'docTitle'						,fieldLabel : 'Document Title'						,anchor		: '90%'					},{						 xtype		: 'textfield'						,name		: 'CREATEDBY'						,id			: 'docCreatedBy'						,fieldLabel : 'Created By'						,anchor		: '90%'					},{						 xtype		: 'textfield'						,name		: 'AUTHOR'						,id			: 'docAuthor'						,fieldLabel : 'Author'						,anchor		: '90%'					},{						xtype			: 'combo'						,name			: 'sortBy'						,fieldLabel		: 'Sort By'						,id				: 'docSortBy'						,valueField		: 'value'						,displayField	: 'text'						,mode			: 'local'						,typeAhead		: true						,value			: 'score'						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor 		: '90%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ ['score', 'Relevancy'], ['alphaNameSort', 'Name'], ['createdby', 'Created By'], ['lastmodifiedby', 'Last Modified By'], ['author', 'Author'], ['docsize', 'Size'], ['lastmodifiedtime', 'Date Last Modified']]						})					},{						xtype			: 'combo'						,name			: 'groupid'						,fieldLabel		: 'Search In'						,id				: 'docSearchIn'						,valueField		: 'value'						,displayField	: 'text'						,mode			: 'local'						,typeAhead		: true						,value			: -3						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor 		: '90%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ [-3, '[Current Group]'], [-1, '[All Groups]'], [-2, '[All Groups and Personal]']]						})					}]					},{					 layout		: 'form'					,labelWidth : 100					,columnWidth: 0.5					,items		: [{						 xtype		: 'textfield'						,name		: 'DISPLAYPATH'						,fieldLabel : 'Location'						,id			: 'docLocation'						,anchor		: '90%'					},{						 xtype		: 'textfield'						,name		: 'LastModifiedBy'						,fieldLabel : 'Last Modified By'						,id			: 'docLastModifiedBy'						,anchor		: '90%'					},{						 xtype		: 'textfield'						,name		: 'DocType'						,id			: 'docType'						,fieldLabel : 'Document Type'						,anchor		: '90%'					},{						xtype			: 'combo'						,name			: 'sortDir'						,fieldLabel		: 'Sort Dir'						,id				: 'docSortDir'						,valueField		: 'value'						,displayField	: 'text'						,mode			: 'local'						,typeAhead		: true						,value			: 'asc'						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor 		: '90%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ ['asc', 'Ascending'], ['desc', 'Descending']]						})					}									]								}]			}]		}							,{			xtype			: 'panel'			,height			: 250			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF; border: 1px solid;'			,bbar				: new Ext.PagingToolbar({store: this.store, displayInfo: true})			,items			: [new Ext.ux.xDataView ({				xtype				: 'xdataview'				,id					: 'docSearchDV'				,name				: 'searchResults'				,hideLabel			: true				,itemSelector		: 'div.x-doc-select'				,overClass          : 'x-doc-over'				,singleSelect       : true				,emptyText			: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,selectedClass      : 'x-doc-selected'				,store				: this.store				,tpl				: new Ext.XTemplate(					'<div class="x-form-item">', 					'<tpl for=".">', 					'<tpl if="this.isItem(values) == true">',				 	'<div style="margin:0px;padding:9px 2px; width: 98.%;" class="x-doc-select">',					 	'<div style="float:left;">&nbsp;&nbsp;<img src="{image}" width=32></div>',					 	'<div style="float:right;width:90%;">{name} ({size})<br/>',	                    '<span style="font-size: 11px; color: #BBB;">',							'{lastModified}<br/>',							'Created by <b>{createdBy}</b>',							'<span style="float: right; margin-right: 10px; width: 250px;">Location: {[this.showDisplayPath(values)]}</span><br />',						'</span>',						'</div>',						'<div style="clear:both;"></div>',						'{[this.getHighlighted(values)]}',				 	'</div>',				 	'</tpl>',				 	'</tpl>',				 	'</div>',				 	{						showDisplayPath: function(val)						{							if (val.groupName)								return val.displayPath.replace(/^\/groups\/[^\/]*/, val.groupName);							else if (val.displayPath.match(/^\/u[^\/]*\//))								return val.displayPath.replace(/^\/u[^\/]*\//, 'Personal/');									else								return val.displayPath;						},				 		getHighlighted : function(val)				 		{				 			if (val.contentHighLighted != '')								return '<div style="border-top: 1px dotted #e1e1e1; margin-top: 10px; padding: 10px;">' + val.contentHighLighted.replace("<em>","<b>").replace("</em>", "</b>") + '</div>';							return '';				 						 		},						isItem : function(val){							if(val.type == 'item'){								return true							}							else{                                var st = Ext.getCmp('docSearchDV').view.store;                                st.remove(st.getById(val.id));                                return false;							}  						}				 	}				)				,listeners			:{					render       : function(cmp){					cmp.view.on('contextmenu',function(dv, index, node, e){						e.stopEvent();						var st      = dv.store;						var rec		= st.getAt(index);						var type	= rec.get('type');						var root    = (rec.get('groupId') !== '' && rec.get('groupId') !== 'DG_0') ? 'group': 'personal';												var data	= {							pos		: e.getXY()							,type	: type							,title	: rec.get('name')							,rec	: rec							,renameItem: false							,info	: {								id			: rec.get('id').split('_')[1]								,typeId		: Eve.Resource.getTypeId(root, type, this.section)								//,parentId	: this.getId()								,groupId	: rec.get('groupId').split('_')[1]								,root		: root								,rawId		: rec.get('id')								//,reminderId	: rec.data.reminderId	// Used in Reminders							}						}					Eve.Resource.superbridge.broadcast(this,'document_before_editmenu', data);					});					cmp.view.on('dblclick',function(dv, index, node, e){						e.stopEvent();						var rec = dv.store.getAt(index);						var type	= rec.get('type');						var root    = (rec.get('groupId') !== ''&& rec.get('groupId') !== 'DG_0') ? 'group': 'personal';						var data = {  							title	: rec.get('name')							,info	: {									id			: rec.get('id').split('_')[1]									,typeId		: Eve.Resource.getTypeId( root, type, this.section)									//,parentId	: this.parentId									,groupId	: rec.get('groupId').split('_')[1]									,root		: root									//,path		: this.path									,rec        : rec									,rawId      : rec.get('id')							}						};						Eve.Resource.superbridge.broadcast(this, 'document_download_file', data);					});				}				}			})			]		}]	})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       DocumentDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */ // Item DetailsEve.vc.createFormPanel('DocumentItemDetails',			Eve.Dialogs.Document.ItemDetails);// Item VersionsEve.vc.createFormPanel('DocumentItemVersions',			Eve.Dialogs.Document.ItemVersions);// Item PermissionsEve.vc.createFormPanel('DocumentItemPermissions',		Eve.Dialogs.Document.ItemPermissions);// Item CommentsEve.vc.createFormPanel('Comments',						Eve.Dialogs.Comment.Main);// Item InterlinkingEve.vc.createFormPanel('Interlinking',					Eve.Dialogs.Interlink.Main);// Folder DetailsEve.vc.createFormPanel('DocumentFolderDetails',     	Eve.Dialogs.Document.FolderDetails);// Folder PermissionsEve.vc.createFormPanel('DocumentFolderPermissions', 	Eve.Dialogs.Document.FolderPermissions);// File Upload//if (false)	Eve.vc.createFormPanel('DocumentFileUpload',			Eve.Dialogs.Document.FileUpload);//else	if (Eve.isFlashInstalled())		Eve.vc.createFormPanel('DocumentFlashFileUpload',		Eve.Dialogs.Document.FlashFileUpload);// AuditEve.vc.createFormPanel('DocumentAudit',					Eve.Dialogs.Document.Audit);// CopyMoveEve.vc.createFormPanel('DocumentCopyMove',				Eve.Dialogs.Document.CopyMove);// Item SearchEve.vc.createFormPanel('DocumentSearch',				Eve.Dialogs.Document.Search);// Item DetailsExt.override( Eve.vc.DocumentItemDetails, {	loadEvent		: function(){ return 'modern.document.{root}.details'; }	,submitEvent	: function(){ return 'modern.document.{root}.processDetails'; }});// Item VersionsExt.override( Eve.vc.DocumentItemVersions, {	loadEvent		: function(){ return 'modern.document.{root}.details'; }	,submitEvent	: function(){ return 'modern.document.{root}.processDetails'; }});// Item PermissionsExt.override( Eve.vc.DocumentItemPermissions, {	loadEvent		: function(){ return 'modern.document.group.permissionDetails'; }	,submitEvent	: function(){ return 'modern.document.group.processDetails'; }});// CommentsExt.override( Eve.vc.Comments, {	loadEvent		: function(){ return 'modern.comment.{root}.view'; }	,submitEvent	: function(){ return 'modern.comment.{root}.createModify'; }});// InterlinkingExt.override( Eve.vc.Interlinking, {	loadEvent		: function(){ return 'modern.interlink.{root}.view'; }	,submitEvent	: function(){ return ''; }});// Folder DetailsExt.override( Eve.vc.DocumentFolderDetails, {	loadEvent 	: function(){ return 'modern.documentFolder.group.details'; }	,submitEvent 	: function(r, m)	{		if (r == 'group' && m == 'edit')			return 'modern.documentFolder.group.processDetails';		return 'modern.documentFolder.{root}.createModify';	}});// Folder PermissionsExt.override( Eve.vc.DocumentFolderPermissions, {	loadEvent		: function(){ return 'modern.documentFolder.group.permissionDetails'; }	,submitEvent	: function(){ return /*'modern.documentFolder.group.processPermissionDetails'*/'modern.documentFolder.group.processDetails'; }});// File UploadExt.override( Eve.vc.DocumentFileUpload, {	loadEvent 		: function(){ return ''; }	,submitEvent 	: function(){ return 'modern.document.{root}.attachFile'; }});//Ext.override( Eve.vc.FlashDocumentFileUpload, {//	loadEvent 		: function(){ return ''; }//	,submitEvent 	: function(){ return 'modern.document.{root}.attachFile'; }//});// AuditExt.override( Eve.vc.DocumentAudit, {	loadEvent 		: function(){ return 'modern.document.group.audit'; }	,submitEvent 	: function(){ return 'modern.document.group.submitAudit'; }});// CopyMoveExt.override( Eve.vc.DocumentCopyMove, {	loadEvent 		: function(){ return 'modern.document.{root}.copyMoveFile'; }	,submitEvent 	: function(){ return 'modern.document.{root}.executeCopyMoveFile'; }});// SearchExt.override( Eve.vc.DocumentSearch, {/*	loadEvent 		: function(){ return 'modern.document.{root}.modifyFilter'; }	,submitEvent 	: function(){ return 'modern.document.{root}.modifyFilter'; }*/	 loadEvent		: function() { return 'modern.document.personal.textSearchFilter'; }	,submitEvent	: function() { return 'modern.document.personal.textSearchFilter'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentTreePanel.js *//*--------------------------------------------------*//* * HyperOffice library based on Ext Js 2.2 * May 2008 *  * khashayar@hyperoffice.com * * http://hyperoffice.com */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Eve.Document.Tree*/Eve.Document.Tree = function() {};Eve.Document.Tree = Ext.extend(Eve.Tree, {		isValidDropZone: function(e) {		var isMultiSelected = (!e.dropNode) ? true : false;		// TODO: Change it.		isMultiSelected = false;				if (!e.dropNode) {			// Dragged From Grid.			var items = e.data.items;			var id =[];			for (var i=0; i< items.length; i++) {				id.push(items[i].info.id);			}			id = id.join(',');			e.data.items[0].info.ids = id;						var src		= e.data.items[0].info;			src.type	= e.data.items[0].type;			var p = this.getNodeInfo(null);			src.parentId = p.id;			src.root	= p.root;			src.path 	=  p.path;			src.groupId	= (src.root == this.getPersonalId()) ? null : p.groupId;			src.dragSrc	= 'grid';		}		else {			// Dragged From Tree.			var src		= this.getNodeInfo(e.dropNode);			src.path    = this.getNodeInfo(e.dropNode.parentNode).path;			src.per		= e.dropNode.attributes.per;			src.dragSrc	= 'tree';		}		src.title	= e.data.items[0].title;				// Target Element info.		var dest 	= this.getNodeInfo(e.target);		dest.rawId	= e.target.id;		var msg = Eve.Resource.getDDMsg;//		console.log("src : ", src);//		console.log("dest : ", dest);				// D&D Between Groups.		if (dest.root == 'group' && src.groupId != dest.groupId)			var ddbtwGroups = true;				// Dropped on parent folder		if (src.parentId === dest.id && !ddbtwGroups)			return msg.ddTitle, msg.parentFolder;		// If Dragged from grid		if (items) {			for(var i=0; i< items.length; i++){	    		// Dropped on itself.				if(items[i].info.id === dest.id)					return msg.ddTitle, msg.itself;				//Drag diffrent types				if(items[i].type !== src.type)				    return msg.ddTitle, msg.diffrentType;			}		} else {			if (src.id === dest.id)				return msg.ddTitle, msg.itself;		}		// Drag & Drop between 'Personal' & 'Groups'.//		if (src.root !== dest.root)//			return msg.ddTitle, msg.personalGroups;		// Dropped on its Children.		if (this.isParentOf(src, dest))			return msg.ddTitle, msg.itsChildren;		// If it's ok		return {src: src, dest: dest, isMultiSelected : isMultiSelected};	}	}); // End of Ext.extend/**	END:	Eve.Document.Tree* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentFactory.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Document.Factory = function() {}Ext.extend( Eve.lib.Document.Factory, Eve.lib.Factory, {  	section: 'document'	,prefix	: 'D'		,createBefore: function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D        superbridge.addBridge(Eve.DragDrop);		        Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});    }    ,createWest: function(superbridge)	{		Eve.vc.createComponent('DocumentTreePanel'	, Eve.Document.Tree);        var view	= new Eve.vc.DocumentTreePanel();        var conn	= Eve.widgets.TreeStore;        var bridge	= new Eve.Document.TreeBridge();		        superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);        bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Documents'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]		}		        return { view: view, config: config };    }    ,createCenter: function(superbridge)	{   		var view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Document.GridBridge();				var view2 	= new Eve.vc.EditorGridPanel();		var conn2	= new Eve.widgets.GridStore();		var bridge2 = new Eve.widgets.Document.RecycleBinGridBridge();				conn2.setSection('document_recycle');				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,manager	: this.manager		});						this.topBar	= new Ext.Toolbar(bridge.getToolbar());						superbridge.addBridge(bridge2);		this.RecycleBar	= new Ext.Toolbar(bridge2.getToolbar());		bridge2.init({			superbridge	: superbridge			,view		: view2			,conn		: conn2			,topBar		: this.RecycleBar			,section	: this.section		});								var config = {			layout		: 'border'			,border		: false			,items		: [{				region		: 'center'				,layout		: "card"				,id			: "doc-card"				,activeItem	: 0				,tbar		: this.topBar				,items		: [	view.get(), view2.get() ]			}]		}						return { view: view, config: config };        	}	    ,createMenus: function(superbridge)	{        this.amenu = new Eve.widgets.DocumentAddMenu();        this.emenu = new Eve.widgets.DocumentEditMenu();        this.tmenu = new Eve.widgets.DocumentTreeMenu();        this.rmenu = new Eve.widgets.DocumentRecycleMenu();		        superbridge.addBridge([this.amenu, this.emenu, this.tmenu, this.rmenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}		        this.amenu.init(data);        this.emenu.init(data);        this.tmenu.init(data);        this.rmenu.init(data);    }    ,createDialogs: function(superbridge)	{        var itemDlg		= new Eve.lib.Document.ItemDialogBridge();        var folderDlg	= new Eve.lib.Document.FolderDialogBridge();        if (!Eve.isFlashInstalled())        	var fileUpDlg	= new Eve.lib.Document.FileUploadDialogBridge();        else        	var fileUpDlg	= new Eve.lib.Document.FlashFileUploadDialogBridge();        		var auditDlg	= new Eve.lib.Document.AuditDialogBridge();		var cmDlg		= new Eve.lib.Document.CopyMoveDialogBridge();		var srchDlg		= new Eve.lib.Document.SearchDialogBridge();		        superbridge.addBridge([itemDlg, folderDlg, fileUpDlg, auditDlg, cmDlg, srchDlg]);		        itemDlg.addPanel(new Eve.vc.DocumentItemDetails());		itemDlg.addPanel(new Eve.vc.DocumentItemVersions());        itemDlg.addPanel(new Eve.vc.DocumentItemPermissions());        itemDlg.addPanel(new Eve.vc.Comments());        itemDlg.addPanel(new Eve.vc.Interlinking());		        folderDlg.addPanel(new Eve.vc.DocumentFolderDetails());        folderDlg.addPanel(new Eve.vc.DocumentFolderPermissions());		        if (!Eve.isFlashInstalled())        	fileUpDlg.addPanel(new Eve.vc.DocumentFileUpload());        else        	fileUpDlg.addPanel(new Eve.vc.DocumentFlashFileUpload());        		auditDlg.addPanel(new Eve.vc.DocumentAudit());				cmDlg.addPanel(new Eve.vc.DocumentCopyMove());				srchDlg.addPanel(new Eve.vc.DocumentSearch());				        itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});		        folderDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'folder'		});		        fileUpDlg.init({			superbridge	: superbridge,			section		: this.section		});		        auditDlg.init({			superbridge	: superbridge			,section	: this.section		});				// Start: Copy/Move		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.Document.CopyMoveTreeBridge();				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix		});		        cmDlg.init({			superbridge	: superbridge			,view		: view.get()			,section	: this.section		});		// End: Copy/Move						srchDlg.init({			superbridge	: superbridge			,section	: this.section		});    }	,createRest: function(superbridge)	{		var filter 	= new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm		= new Eve.Permission();		var prmRB	= new Eve.Permission();				superbridge.addBridge([prm, prmRB]);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prmRB.init({			superbridge	: superbridge			,section	: 'doc_recycle'		})						prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);  		prm.regToolbarButton(this.topBar);				prmRB.regGridMenu(this.rmenu);		prmRB.regToolbarButton(this.RecycleBar);    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Document.GridBridge = Ext.extend(Eve.widgets.DefaultGridBridge, {    gridSection: 'document'    ,getToolbar: function()	{        return this.toolbar    }		,getTitle   : function(rec) {return rec.data.name}	    ,initLocalVars: function(){        this.fields = [			 { name: 'groupId'			, type: 'string' }			,{ name: 'type'				, type: 'string' }			,{ name: 'name'				, type: 'string' }			,{ name: 'size'				, type: 'string' }			,{ name: 'versioningCount'	, type: 'string' }			,{ name: 'versioning_value'	, type: 'string' }			,{ name: 'revisionNumber'	, type: 'string' }			,{ name: 'Lock_value'		, type: 'string' }			,{ name: 'subscriptionType'	, type: 'string' }			,{ name: 'lastModified'		, type: 'string' }			,{ name: 'image'			, type: 'string' }			,{ name: 'deletePermission'	, type: 'boolean'}			,{ name: 'editPermission'	, type: 'boolean'}			,{ name: 'linkedItems'		, type: 'string' }			,{ name: 'fileFolder'		, type: 'string' }			,{ name: '_index'			, type: 'int' , mapping: 'index'}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}        ];        this.reader = new Ext.data.XmlReader({            id			: 'id',            record		: 'row',            totalRecords: 'total'        }, Ext.data.Record.create(this.fields));				        this.columns = new Ext.grid.ColumnModel([{			header			: '&nbsp;'			,dataIndex		: 'type'			,width			: 30			,sortable		: false			,fixed			: true			,menuDisabled	: true			,renderer		: function(value, meta, rec) {				var path = "";								if (value == "Folder")					path = "<img src='" + Eve.Resource.getIcon('folder-document','document') + "' />";				else {					var img = rec.get('image');					path	= "<center><img src='" + img + "' height=16/></center>";				}				return path;			}		},{			header  		: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex  	: 'linkedItems'			,width      	: 30			,manueDisabled  : true			,sortable       : false			,fixed          : true			,renderer       : function(value, metadata, rec){				var icon = (value != '0' && value != '' && value !== undefined) ? '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />' : '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		}, {			header 		: 'Name'			,dataIndex 	: 'name'			,width 		: 200			,sortable	: true			,main		: true			,editor 	: new Ext.grid.GridEditor(new Ext.form.TextField({				allowBlank : false			}))		}, {			header		: 'Size (byte)'			,dataIndex	: 'size'			,width		: 80			,sortable	: true			,renderer	: function(val, md, rec) {				if (rec.data.type.toLowerCase() == 'folder')					return '';								return val;			}		}, {			header		: 'Versioning'			,dataIndex	: 'versioningCount'			,width		: 130			,sortable	: false		}, {			header		: 'Type'			,dataIndex	: 'fileFolder'			,width		: 50			,sortable	: false			,renderer	: function(value, meta, rec) {				return (value == "Folder") ? "Folder" : "File";			}		}, {			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		}, {			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		}, {			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);						var that = this;		this.quickSearch = new Ext.form.TriggerField({			width 			: 'auto'			,triggerClass	: 'x-form-search-trigger'			,id				: 'document_quick_search'			,listeners 		: {				specialKey : function(el, e)				{					if (e.getKey() == e.ENTER)					{					//	var sb = Ext.getCmp('doc-search-type');						var data = {							info 		: {								id			: this.id								,root		: this.root								,parentId	: this.parentId								,path		: this.path                ,groupId: this.groupId							}							,text		: el.getValue()							,type		: 'File Name Only'//sb.getValue()						}												this.fire('document_search_dlg', data);					}				}				,resize: function(cmp){					Ext.get(cmp.wrap.dom).setWidth(130);				}				,scope : this			}			,onTriggerClick : function(e)			{				//var sb = Ext.getCmp('doc-search-type');				var data = {					info 		: {						id			: that.id						,root		: that.root						,parentId	: that.parentId						,path		: that.path          	,groupId: that.groupId					}					,text		: this.getValue()					,type		: 'File Name Only'//sb.getValue()				}								that.fire('document_search_dlg', data);			}		});		        this.toolbar = {            items: [{				text		: 'New Folder'				,cls		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('folder-new','document')				,disabled	: true				,handler: function(e) {					var info = {						id			: 0						,root		: this.root						,groupId	: this.groupId						,parentId	: this.id						,path		: this.path					}										this.fire('document_create_folder_dlg', {info: info});				}				,scope		: this			}, {				text		: 'Upload File'				,cls		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('item-upload','document')				,handler	: function(e) {					var info = {						parentId	: this.id						,groupId	: this.groupId						,root		: this.root						,path		: this.path					}										this.fire('document_upload_file_dlg', {info: info});				}				,scope		: this			}, '-', {				text		: 'Delete'				,cls		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('delete', 'general')				,disabled	: true				,handler	: this.deleteHdl				,scope		: this			}, {				text		: 'Audit'				,cls		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('audit','document')				,handler	: function() {					var info	= {						groupId		: this.groupId						,root		: this.root						,path		: this.path					}											this.fire("document_audit_dlg", {info: info} );				}				,scope		: this			}, {				text 		: "Details"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('details','document')				,handler	: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var type = rec.data.type;												var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path								,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)	// Used in Interlinking Dialog.							}							,title	: this.getRowTitle(rec)						}												this.fire("document_" + type + "_detail_dlg", data);					} else {						Ext.tools.msg('Select a Record', 'To Edit a Contact, You need to select a record in grid below.');					}          							}				,scope		: this			}, '-', {				text		: 'Up'				,id			: this.section + 'btnToolbarUp'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('arrow-up', 'general')				,handler	: function() {					this.fire(this.section + "_activate_parent_node");				}				,scope		: this			}, '-' , {				text 		: "Print"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('print', 'general')				,handler	: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path						,start		: this.view.get().store.lastOptions.params.start					}										this.fire("document_print_folder", {info: info});				}				,scope		: this							}, '->', 'Search: ', ' ', ' ',			this.quickSearch		]};    }	    ,init: function(obj)	{        Eve.widgets.Document.GridBridge.superclass.init.call(this, obj);        this.initLocalVars();				this.conn.init( this.reader );		var store = this.conn.getStore();				this.view.init({			id 				: 'document_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Documents'			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,keys			: this.getKeyMap()		});    	this.registerView();    },    	registerView : function(){		Eve.widgets.Document.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();						//		// Handle Row Double Click		//		grid.on('rowdblclick', function(g, idx) {			var rec	 = grid.getStore().getAt(idx);			var type = rec.get('type');						var data = {					title	: this.getRowTitle(rec)					,info	: {						id			: rec.id.split('_')[1]						,parentId 	: this.parentId						,groupId 	: this.groupId						,root		: this.root						,path		: this.path					}				};							if (type == 'item') {				this.fire('document_download_file', data);			} else {				this.fire("document_activate_child_node", data );			}		}, this);						// Click on Icon		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var rec	= grid.getStore().getAt(rowIdx);			var cm 	= grid.colModel;			if ( cm.getDataIndex(colIdx) != 'type' ) {				return;			}			var type	= rec.get('type');			if (type == 'item') {				var data = {					title	: rec.get('title')					,info	: {						id			: rec.id.split('_')[1]						,parentId 	: this.parentId						,groupId 	: this.groupId						,root		: this.root						,path		: this.path					}				}				this.fire('document_download_file', data);			}		}, this);				// Handle Grid After Cell Edit.		grid.on('validateedit', function(e) {			if(  e.value.match(/[*,\\'`!@$%^&~|"=+#/\?]/))				return false;		});			}	 	,execute : function(callee, type, object)	{		switch(type) {			case 'document_set_active_node':				if (parseInt(object.info.id) <= -100 ) {					return				}				else {					var card = Ext.getCmp('doc-card');										if (card.getLayout().setActiveItem !== undefined)						card.getLayout().setActiveItem(0);					card.getTopToolbar().show();				}			break;		}		Eve.widgets.Document.GridBridge.superclass.execute.apply(this,arguments);	}		,printFolder : function(callee, type, data)	{		var cm	= this.view.get().getColumnModel();		var th 	= "";		var tb 	= "";		for (var i=0; i<cm.config.length; i++) {			if (cm.config[i]['hidden']) {				continue;			}			var header 		= cm.config[i].header.trim();			var dataIndex	= cm.config[i].dataIndex;			th += ["<td style='color:#CE0000; font-weight:bold; padding:3px; border-bottom:1px solid #646464'>",				   header,				   "</td>"].join('');			tb += ["<td style='border-color:white; border-style:solid; border-width:0 0 1px 1px; padding-left:4px; padding-top:3px;'>{",				   dataIndex,				   "}&nbsp;</td>"].join('');		}		var reader	= this.conn.getStore().reader;		var result	= reader.read(data);				// Replace type of items with image		var records = result.records;		for (var i=0,len = result.records.length; i<len; i++) {						if (records[i].data.type.toLowerCase() == 'folder')				records[i].data.type = ["<img src='", Eve.Resource.getIcon('folder-document','document'), "' width=16>"].join('');			else				records[i].data.type = ["<img src='",records[i].data.image ,"' width=16>"].join('');			if (records[i].data.fileFolder.toLowerCase() == 'item')				records[i].data.fileFolder = 'file';			if( parseInt(records[i].data.linkedItems) > 0 ){				records[i].data.linkedItems =["<img src='", Eve.Resource.getIcon('paper-clip', 'interlink'), "' width=16>"].join('');			}			else{				records[i].data.linkedItems = "";			}		}		// Create Template and feed with data.		var tpl = new Ext.XTemplate(				'<div>',					//'<div style="float:right;"><input type="button" value="Print" onclick="window.print()" /></div>',					'<table width="100%" border="0" style="border:1px solid #646464; font: 11px Tahoma" cellpadding="3" cellspacing="0">',					'<tr style="background:transparent url(' + Eve.Resource.getIcon('print-table-head-bg', 'general') + ')">',						th,					'</tr>',					'<tpl for=".">',						'<tpl for="data">',						 '<tr style="background-color:#F4F4F4; border:0px solid white">',							tb,						'</tr>',						'</tpl>',					'</tpl>',					'</table>',				'</div>'		);		var content = tpl.apply(result.records);		// Create the new page		var page = window.open("/hyperoffice2nd/views/Styles/ModernStyle/print/Print.html", this.gridSection + "_print", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=1000, height=500");		setTimeout( function() {			page = (Ext.isChrome &&  page.innerHeight == 0) ? false : page;			if (page) {				page.document.body.innerHTML = content;				page.print();			}			else {				Ext.Msg.alert('Popup Blocker', 'Your browser is currently preventing popups, please change the setting and try again.');			}		}, 100);	}});/*----------------------------------------------------------------						RecycleBin grid						------------------------------------------------------------------*/Eve.widgets.Document.RecycleBinGridBridge = Ext.extend(Eve.widgets.DefaultGridBridge, {    gridSection: 'doc_recycle'	,getTitle: function(rec){return rec.data.title}//Override deleteHdl	,deleteHdl: function(btnClicked){		var id, title, type;		var isMultiSelected = false;		var selections = this.view.get().getSelectionModel().selections;		var sameType    = true;		if(selections.length > 1){			var titles	=[];			var ids		=[];			isMultiSelected = true;			type = selections.first().get('type');						selections.each(function(rec){				if(rec.get('type') != type){					sameType = false;					return;				}				title = this.getTitle(rec);				titles.push( title );				ids.push(rec.id.split("_")[1]);			}, this);			if(!sameType){				Ext.tools.msg('', 'All selected rows must have the same type');				return;			}			title	= titles.join(",");			id      = ids.join(",");		}		else if(selections.length > 0){			var rec = (this.getRecord)? this.getRecord()				:this.view.get().getSelectionModel().getSelected();			id = rec.id.split("_")[1];			title = this.getTitle(rec);			type = rec.data.type;		}		if (rec || selections.length > 1) {			var data = {				info :{					id: id					,parentId : this.id					,groupId : this.groupId					,root: this.root					,path: this.path					,type: type					}				,title : title				,isMultiSelected : isMultiSelected				,event: btnClicked			}			this.fire("document_"+ btnClicked, data );		}		else {			Ext.tools.msg('Select a Record', 'You need to select a record in grid below.');		}	}	,getToolbar: function()	{		var toolbar = {            items: [{				text	: 'Empty Recycle Bin'				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('empty-recycle-bin','document')				,handler: function(e) {					var info = {						id			: 0						,root		: this.root						,groupId	: this.groupId						,parentId	: this.id						,path		: this.path					}					this.fire('document_purge_all', {info: info});				}				,scope: this			}, {				text	: 'Restore'				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('restore','document')				,handler: this.deleteHdl.createDelegate(this, ['restore'])/*function(e) {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec)					{						var info = {     						id			: rec.id.split("_")[1]							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path							,type       : rec.get('type').toLowerCase()						}						this.fire('document_restore', {info: info, event: 'restore'});					}					else{	                    Ext.tools.msg('Select a Record', 'To Restore a Document, You need to select a record in grid below.');					}				}*/				,scope	: this			}, '-',{				text	: 'Purge'				,cls	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('delete', 'general')				,handler: this.deleteHdl.createDelegate(this, ['purge'])/*function()				{   					var rec = this.view.get().getSelectionModel().getSelected();					if (rec)					{						var info = {							id			: rec.id.split("_")[1]							,parentId	: this.id							,groupId	: this.groupId							,root		: this.root							,path		: this.path							,type       : rec.get('type')							,title      : rec.get('title')						}						this.fire("document_purge", {info: info, title: rec.data.title, event:'purge'} );					}					else {						Ext.tools.msg('Select a Record', 'To Purge a Document, You need to select a record in grid below.');					}				}*/				,scope	: this			}		]};				return toolbar;    }    ,initLocalVars: function(){        this.fields = [           { name: 'groupId'			, type: 'string' }          ,{ name: 'type'				, type: 'string' }          ,{ name: 'title'				, type: 'string' }          ,{ name: 'showPath'			, type: 'string' }          ,{ name: 'imagePath'			, type: 'string' }          ,{ name: 'path'				, type: 'string' }          ,{ name: 'deletedDate'		, type: 'string' }          ,{ name: 'modifiedDate'		, type: 'string' }          ,{ name: 'deletedBy'			, type: 'string' }		  ,{ name: 'deletePermission'	, type: 'boolean' , mapping: 'recycleBinDeletePermission'}		  ,{ name: 'editPermission'		, type: 'boolean' , mapping: 'recycleBinRestorePermission'}		          ];        this.reader = new Ext.data.XmlReader({            id			: 'id',            record		: 'row',            totalRecords: 'total'        }, Ext.data.Record.create(this.fields));        this.columns = new Ext.grid.ColumnModel([{			header			: '&nbsp;'			,dataIndex		: 'type'			,width			: 25			,sortable		: false			,fixed			: true			,menuDisabled	: true			,renderer		: function(value, meta, rec) {				var path = "";				if (value == "Folder")					path = "<img src='" + Eve.Resource.getIcon('folder-document','document') + "' />";				else {					var img = rec.get('imagePath');					path	= "<center><img src='" + img + "' /></center>";				}				return path;			}		}, {			header 		: 'Name'			,dataIndex 	: 'title'			,width 		: 200			,sortable	: false			,editor 	: new Ext.grid.GridEditor(new Ext.form.TextField({				allowBlank : false			}))		}, {			header		: 'Type'			,dataIndex	: 'type'			,width		: 80			,sortable	: false			,renderer	: function(value, meta, rec) {				return (value == "Folder") ? "Folder" : "File";			}		}, {			header		: 'Path'			,dataIndex	: 'showPath'			,width		: 120			,sortable	: false		},{			header		: 'Deleted On'			,dataIndex	: 'deletedDate'			,width		: 130			,sortable	: false		}, {			header		: 'Deleted By'			,dataIndex	: 'deletedBy'			,width		: 180			,sortable	: false			,renderer	: function(value, meta, rec) {				return value			}		}]);    }    ,init: function(obj)	{        Eve.widgets.Document.RecycleBinGridBridge.superclass.init.call(this, obj);        this.initLocalVars();		this.conn.init( this.reader );		var store = this.conn.getStore();				this.view.init({			id 				: this.gridSection + '_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({ store: store })			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : false			,tbar           : obj.topBar			,ddGroup		: Eve.Resource.getGridGroup()			,viewConfig 	: {				rowSelectorDepth	: 20			}		});    	this.registerView();    },	registerView : function(){		Eve.widgets.Document.RecycleBinGridBridge.superclass.registerView.call(this);		var grid = this.view.get();	}		,execute : function(callee, type, object){		switch(type){			case 'document_set_active_node':							if (parseInt(object.info.id) <= -100) {					var card = Ext.getCmp('doc-card');					card.getLayout().setActiveItem(1);					card.getTopToolbar().hide();					// Update the this.[id, groupId, parentId, root, path]					Ext.apply(this, object.info);					// Update grid according to new id and parentId					this.fetchData(object);				}				else{				    return				}								break;		}				Eve.widgets.Document.RecycleBinGridBridge.superclass.execute.apply(this,arguments);	}	});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentMenu.js *//*--------------------------------------------------*//** * Hyperoffice Contect section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// -----------------------------------------------------------------------// Document Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.DocumentBaseEditMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data)	{		Eve.widgets.DocumentBaseEditMenu.superclass.init.call(this, data);	}	,registerView : function()	{		this.item_menu.on('itemclick', function(bi)		{			var data = {				title			: this.title				,isMultiSelected: this.isMultiSelected				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}			switch(bi.id) {				case 'details':					this.fire('document_item_detail_dlg', data);					break;								case 'download':					this.fire('document_download_file', data);					break;								case 'delete':					this.fire('document_delete_item_dlg', data);					break;								case 'rename':					this.fire('document_rename_item_inline_editor', data);					break;								case 'copy':					this.fire('document_copy_item_dlg', data);					break;								case 'move':					this.fire('document_move_item_dlg', data);					break;									case 'unlock':					data.lock = this.lock;					this.fire('document_toggle_lock', data);					break;									case 'versioning':					data.versioning = this.versioning;					this.fire('document_toggle_versioning', data);					break;									case 'subscription':					data.subscription = this.subscription;					this.fire('document_toggle_subscription', data);					break;				case 'linked':					this.fire('document_interlinking_dlg', data);					break;				case 'comments':					Eve._cm.main.revision = this.record.get('revisionNumber');					this.fire('document_comment_dlg', data);					break;			}		}, this);						this.folder_menu.on('itemclick', function(bi)		{			var data = {				title			: this.title				,isMultiSelected: this.isMultiSelected				,info	: {					id			: this.id					,typeId		: this.typeId					,parentId	: this.parentId					,groupId	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}						switch(bi.id) {				case 'details':					this.fire('document_folder_detail_dlg', data);					break;								case 'delete':					this.fire('document_delete_folder_dlg', data);					break;									case 'rename':					this.fire('document_rename_folder_inline_editor', data);					break;									case 'folder_subscription':					data.subscription = this.subscription;					this.fire('document_toggle_subscription', data);					break;			}		}, this);	}		,setModeTo : function(root, type)	{		var count	= (type == 'item') ? 5 : 3;		var flag	= (root == 'personal' || this.isMultiSelected) ? true : false;		for (var i in this.menu.items.items) {			if (i < count)				continue;							var item = this.menu.items.items[i];						if (item.setDisabled)				item.setDisabled(flag);		}				// If menu called on Groups, change the text.		if (!flag && !this.isMultiSelected) {			this.lock			= this.record.get('Lock_value');			this.versioning		= this.record.get('versioning_value');			this.subscription	= this.record.get('subscriptionType');						var unlockItem		= Ext.getCmp('unlock');			var versioningItem	= Ext.getCmp('versioning');						// Lock			if (this.lock == 'true') {				unlockItem.setText('Unlock');				//unlockItem.setIcon(Eve.Resource.getIcon('item-unlock','document'));			}			else {				unlockItem.setText('Lock');				//unlockItem.setIcon(Eve.Resource.getIcon('item-lock','document'));			}						// Versioning			if (this.versioning == 'true') {				versioningItem.setText('Turn Versioning Off');				//versioningItem.setIcon(Eve.Resource.getIcon('item-version-off','document'));			}			else {				versioningItem.setText('Turn Versioning On');				//versioningItem.setIcon(Eve.Resource.getIcon('item-version-on','document'));			}						if (type == 'item') {				if (this.subscription == 'true') {					Ext.getCmp('subscription').setText('Unsubscribe to Changes');					//versioningItem.setIcon(Eve.Resource.getIcon('item-subscribe-changes','document'));				}				else {					Ext.getCmp('subscription').setText('Subscribe to Changes');					//versioningItem.setIcon(Eve.Resource.getIcon('item-unsubscribe-changes','document'));				}			}			else{				if (this.subscription == 'true') {					Ext.getCmp('folder_subscription').setText('Unsubscribe to Folder');					//versioningItem.setIcon(Eve.Resource.getIcon('item-subscribe-changes','document'));				}				else {					Ext.getCmp('folder_subscription').setText('Subscribe to Folder');					//versioningItem.setIcon(Eve.Resource.getIcon('item-unsubscribe-changes','document'));				}			}		}	}	,execute : function(callee, type, obj)	{		switch (type) {			case ('document_editmenu'):				Ext.apply(this, obj.info);				this.type 				= obj.type.toLowerCase();				this.title				= obj.title;				this.record				= obj.rec				this.isMultiSelected	= obj.isMultiSelected;								this.menu = (this.type == 'folder') ? this.folder_menu : this.item_menu;				this.setModeTo(this.root, this.type);				this.menu.showAt(obj.pos);								break;		}	}});Eve.widgets.DocumentEditMenu = Ext.extend( Eve.widgets.DocumentBaseEditMenu, {	init : function(data)	{		Eve.widgets.DocumentEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({			items : [{				text	: 'Download File'				,id		: 'download'				,icon	: Eve.Resource.getIcon('item-download','document')			}, {				text	: 'Delete File'				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}, {				text	: 'Rename File'				,id		: 'rename'				//,icon	: Eve.Resource.getIcon('rename', 'general')			}, {				text	: 'Copy'				,id		: 'copy'				,icon	: Eve.Resource.getIcon('item-copy','document')			}, {				text	: 'Move'				,id		: 'move'				,icon	: Eve.Resource.getIcon('item-move','document')			}, '-',	{				text	: 'Details'				,id		: 'details'				,icon	: Eve.Resource.getIcon('details','document')			}, '-', {				text	: 'Unlock'				,id		: 'unlock'				,icon	: Eve.Resource.getIcon('item-unlock','document')			}, {				text	: 'Turn Versioning On'				,id		: 'versioning'				,icon	: Eve.Resource.getIcon('item-version-on','document')			}, {				text	: 'Subscribe to Changes'				,id		: 'subscription'				,icon	: Eve.Resource.getIcon('item-subscribe-changes','document')			}, '-', {				text	: "Comments"				,id		: "comments"			}, {				text	: "Linked Items"				,id		: "linked"			}]		});				this.folder_menu = new Ext.menu.Menu({			items : [{				text		: 'Delete Folder'				,id			: 'delete'				,icon		: Eve.Resource.getIcon('delete', 'general')			}, '-',	{				text		: 'Details'				,id			: 'details'				,icon		: Eve.Resource.getIcon('details','document')			}, {				text		: 'Subscribe To Folder'				,id			: 'folder_subscription'				,icon		: Eve.Resource.getIcon('folder-subscribe-changes','document')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Document Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.DocumentBaseAddMenu = Ext.extend( Eve.widgets.Menu, {	menu: {}	,init : function(data)	{		Eve.widgets.DocumentBaseAddMenu.superclass.init.call(this, data);	}	,registerView : function(brdg) {		this.menu.on('itemclick', function(bi) {			var data = {				title	: this.title				,info	: {					id 			: this.id					,groupId 	: this.groupId					,root 		: this.root					,parentId	: this.parentId					,title		: this.title					,path		: this.path				}			}							switch(bi.id){               	case 'upload':   					this.fire('document_upload_file_dlg', data);					break;									case 'folder':					this.fire(this.section + '_create_folder_dlg', { info: {id: 0, groupId : this.groupId,							  							parentId: this.parentId, root: this.root, path: this.path} });					break;			}		}, this);	}	,execute : function( callee, type, obj ) {		switch( type ) {			case (this.section + '_addmenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.path		= obj.info.path;				this.menu.showAt( obj.pos );				break;		}	}});Eve.widgets.DocumentAddMenu = Ext.extend( Eve.widgets.DocumentBaseAddMenu, {	init : function(data)	{		Eve.widgets.DocumentAddMenu.superclass.init.call(this, data);		this.menu = new Ext.menu.Menu({			items : [{				text	: "New Folder"				,id		: 'folder'				,icon	: Eve.Resource.getIcon('folder-new','document')			}, {				text	: "Upload File" 				,id		: 'upload'				,icon	: Eve.Resource.getIcon('item-upload','document')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Document Tree Add Context Menu// -----------------------------------------------------------------------Eve.widgets.DocumentBaseTreeMenu = Ext.extend( Eve.widgets.Menu, {	foldermenu	: {}	,groupmenu  : {}	,recyclemenu: {}		,init : function(data) {		Eve.widgets.DocumentBaseTreeMenu.superclass.init.call( this, data);	}	,registerView : function()	{		this.foldermenu.on('itemclick', function(bi)		{			var data = {				title	: this.title                ,info	: {                	id			: this.id					,groupId 	: this.groupId					,parentId	: this.parentId					,root		: this.root					,path		: this.path				}			};			switch (bi.id) {				case 'add':					data.info.parentId	= data.info.id;					data.info.id		= 0;										this.fire(this.section + '_create_folder_dlg', data);					break;									case 'delete':					this.fire(this.section + '_delete_folder_dlg', data);					break;									case 'details':					this.fire('document_folder_detail_dlg', data);					break;									case 'folder_subscription':					data.subscription = this.subscription;					this.fire('document_toggle_subscription', data);					break;			}		}, this);		this.groupmenu.on('itemclick', function(bi)		{			var data = {				info: {					id: 0					,groupId : this.groupId					,parentId: 0					,root: this.root					,path: this.path					}			};			switch (bi.id) {				case 'add':					this.fire(this.section + '_create_folder_dlg'  ,  data);					break;			}		}, this);		this.recyclemenu.on('itemclick', function(bi)		{			var data = {				info: {					id: 0					,groupId : this.groupId					,parentId: 0					,root: this.root					,path: this.path					}			};			switch (bi.id)			{				case 'empty':					this.fire('document_purge_all'  , data);					break;			}		}, this);	}		,setModeTo : function(root)	{		var flag	= (root == 'personal') ? true : false;		var count	= 3;				for (var i in this.foldermenu.items.items) {			if (i < count)				continue;							var item = this.foldermenu.items.items[i];						if (item.setDisabled)				item.setDisabled(flag);		}	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_treemenu'):				Ext.apply(this, obj.info);				this.title	= obj.title;				this.path	= obj.info.path;								if (this.title == 'RecycleBin') {					var amenu = this.recyclemenu;				} else {					var amenu = (obj.type == 'folder') ? this.foldermenu : this.groupmenu;				}								this.setModeTo(this.root);				amenu.showAt( obj.pos );				break;		}	}});Eve.widgets.DocumentTreeMenu = Ext.extend( Eve.widgets.DocumentBaseTreeMenu, {	init : function(data) {		Eve.widgets.DocumentTreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({			items : [{				text	: "Add Folder"				,id		: 'add'				,icon	: Eve.Resource.getIcon('folder-new','document')			}, {				text	: "Delete Folder"				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}, '-',	{				text		: 'Details'				,id			: 'details'				,icon		: Eve.Resource.getIcon('details','document')			}]		});		this.groupmenu = new Ext.menu.Menu({			items : [{				text	: "Add"				,id		: 'add'				,icon	: Eve.Resource.getIcon('folder-new','document')			}]		});				this.recyclemenu = new Ext.menu.Menu({			items : [{				text	: "Empty Recycle Bin"				,id		: 'empty'				,icon	: Eve.Resource.getIcon('empty','document')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------//              Menu used in Recycle bin grid// -----------------------------------------------------------------------Eve.widgets.BaseRecycleMenu = Ext.extend( Eve.widgets.Menu, {  menu: {},	init : function(data)	{		Eve.widgets.BaseRecycleMenu.superclass.init.call(this, data );	},	registerView : function(brdg) {		this.menu.on('itemclick', function(bi) {			var data = {				title			: this.title				,isMultiSelected : this.isMultiSelected				,info	: {					id 			: this.id					,groupId 	: this.groupId					,root 		: this.root					,parentId	: this.parentId					,title		: this.title					,path		: this.path					,type       : this.type				}			}			switch(bi.id){               	case 'doc_purge':               	    data.event = 'purge'        			this.fire("document_purge", data );					break;				case 'doc_restore':				    data.event = 'restore';					this.fire('document_restore', data);					break;			}		}, this);	}	,execute : function( callee, type, obj ) {		switch( type ) {			case ('doc_recycle_editmenu'):			    				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.path		= obj.info.path;				this.title      = obj.title;				this.type       = obj.type.toLowerCase()				this.isMultiSelected = obj.isMultiSelected;								this.menu.showAt(obj.pos);				break;		}	}});Eve.widgets.DocumentRecycleMenu = Ext.extend(Eve.widgets.BaseRecycleMenu, {	init: function(data)	{		Eve.widgets.DocumentRecycleMenu.superclass.init.call(this, data);				this.menu = new Ext.menu.Menu({			items : [{				text	: "Purge"				,id		: 'doc_purge'				,icon	: Eve.Resource.getIcon('delete', 'general')			}, {				text	: "Restore"				,id		: 'doc_restore'				,icon	: Eve.Resource.getIcon('restore','document')				}]		});		this.registerView();	}})/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\document/DocumentDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Document section based on ExtJS Library 2.2 February 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/	 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// Details, Versions, Permissions, Comments, Interlinking  * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.ItemDialogBridge = Ext.extend(Eve.lib.TabDialogController, {    mode	: 'create'	    ,init: function(data)	{        Eve.lib.Document.ItemDialogBridge.superclass.init.call(this, data);		var tab		= {            items: ['Details', 'Versions', 'Permissions', 'Comments', 'Linked Items']			,related: [ [0, 1, 2] ]			,main	: [0, 1]		}				var dialog	= {			width 	: 600			,height : 500			,y		: 50			,title	: 'Document'		}				this.createDialog({tab: tab, dialog: dialog})		this.registerView();    }		,registerView : function()	{		var me = this;				Ext.getCmp(this.section + '_revision').on('render' , function(cmp){			cmp.view.el.on('click', function(e, item) {				var vsx		= Ext.get(item).up(cmp.view.itemSelector);				if (! vsx)					return;				var rec		= cmp.view.getRecord( vsx.dom );				var target	= Ext.get(item).dom.className.split(' ')[0];				var data	= {					info : {						id			: this.id						,groupId	: this.groupId						,parentId	: this.parentId					}					,revisionNum: rec.get('revisionNumber')					,event		: 'revert'					,title		: this.title				}				if (target == 'revert' && rec.get('command') == "revert") {					this.fire(this.section + '_item_revert', data);					this.clearLoaded(0);				}				else if (target == 'revision') {					data.info.root = this.root;					this.fire(this.section + '_download_file', data);				}			}, this)		},this);						Ext.getCmp(this.section + 'CollapseAll').on('click', function(btn){			var data = {				info : {					groupId 	: this.groupId					,title  	: this.title					,id     	: this.id					,parentId	: this.parentId				}				,event  : 'collapseAllVersions'			}			Ext.Msg.confirm( 'CollapseAll Confirmation','All the old versions of the file will be deleted, only the most recent version will remain.This is an unrecoverable action because deleted versions are not put in the recycle bin ',			function(btn)			{				if (btn == 'yes') {					this.fire(this.section + '_item_revert', data);				}			}, this );		},this);	}		,onDialogHide : function()	{		// Reset the tab index on window hide.		this.dialog.items.items[0].setActiveTab(0);				// Remove Permissions Grid Data.		var store = Ext.getCmp(this.section + 'GridPermission').getStore();		store.removeAll();				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset the dataview' store		this.getDataView().store.removeAll();				// Reset all Flags.		this.clearLoaded();				// Reset Versioning Value Radio		Ext.getCmp(this.section + 'VVOn').setValue(false);		Ext.getCmp(this.section + 'VVOff').setValue(false);				// Reset Image		Ext.fly(this.section + '_docItemImage').dom.innerHTML = '';	}		,setRevision : function(r)	{		var dq 		= Ext.DomQuery;		var root	= dq.selectNode('revision', r.responseXML);if (root === undefined) return;		var rows	= dq.select('row', root);if (rows === undefined) return;		var node	= dq.selectValue('revisionNumber', rows[0]);		Eve._cm.main.revision = node;	}		,augment : function(callee)	{		var obj = callee.params;		var idx = this.getIndex(this.getTabPanel().activeTab);				if (this.mode == 'edit') {			obj.id = this.id;		}				if (this.root == 'group') {			obj.groupId = this.groupId;		}				obj.parentId = this.parentId;				switch(idx)	{			// Permissions			case 2:				var users	= [];				var store	= Ext.getCmp(this.section + 'GridPermission').getStore();				store.each( function(rec)				{					obj["groupUserID_" + rec.id]			= rec.id;					obj["read_option_" + rec.id]			= rec.get('read');					obj["write_option_" + rec.id]			= rec.get('write');					obj["delete_option_" + rec.id]			= rec.get('delete');					obj["inherited_permissions_" + rec.id]	= rec.get('inherited');										if (rec.get('isAdministrator') == 'false' && rec.get('isOwner') == 'false')						users.push(rec.id);									}, this);								obj.all_group_users = users.join(',');				break;						// Comments			case (this.idxComments):				obj.objTypeId		= this.typeId;				obj.objId			= this.id;				obj.revisionNumber	= Eve._cm.main.revision;				delete obj.id;				break;						// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}				return callee;	}		,controller : function(obj)	{		this.id 		= obj.info.id;		this.typeId		= obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;		if (! this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;		}				this.panels[0].reset();				if (! this.isIL()) {			this.panels[this.idxComments].reset();		}				// Check Elements.		this.showHideCmp();		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch (type) {			case (this.section + '_item_detail_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);								if (!this.getLoaded(0)) 					this.loadForm(0);								break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_comment_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxComments);				// ...Clear its load status ;)				this.clearLoaded(0);				break;			case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_interlinking_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxInterlink);				// ...Clear its load status ;)				this.clearLoaded(0);				break;						case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}	}		,loadSuccess : function(data)	{		var idx	= this.getIndex(this.getTabPanel().activeTab);		var dq	= Ext.DomQuery;		var xml	= data.responseXML;				switch(idx)	{			// Details			case 0:			// Versions			case 1:			// Permissions			case 2:				this.setRevision(data);				var per = dq.select('permission', xml);				( per === undefined ) ? this.setDisabled(2, true) : this.setDisabled(2, false);				var store	= Ext.getCmp(this.section + 'GridPermission').getStore();				var node	= dq.select('permissions', xml)[0];								if (node !== undefined) {					var res	= store.reader.readRecords(node);					 this.getTabPanel().getItem(2).enable();				} else {                    this.getTabPanel().getItem(2).disable();				}                    				store.loadRecords(res, {add: false}, true);				this.setRevision(data);								// Load image				var image = dq.selectValue('image', xml, 'no-pic.png');				Ext.fly(this.section + '_docItemImage').dom.innerHTML = '<img src="' + image + '" width="32" height="32" />';								break;							// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(data);				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			/*			 * Commented by Khashayar			 * We don't need them cause we close dialog after submit.			 * 			// Update dialog image			var img = dq.selectValue('image', xml);			Ext.fly(this.section + '_docItemImage').first().set({src: img});						// Update LastModified			var lastMod = dq.selectValue('lastModified', xml, '');			Ext.getCmp(this.section + 'detailLastModified').setValue(lastMod);						// Update LockedBy			var lockedBy = dq.selectValue('lockedBy', xml, '');			Ext.getCmp(this.section + 'detailLockedBy').setText(lockedBy);						// Update Audit			var dvAudit = Ext.getCmp(this.section + 'ItemAuditDV');			var root	= dq.select(dvAudit.getName(), xml);			var reader	= new Ext.data.XmlReader({				record	: 'auditRow'				,id		: 'id'			}, ['id', 'auditUserCompleteName', 'action', 'changeDate', 'sourceLocation']);						var result	= reader.readRecords(root).records;			dvAudit.store.removeAll();			dvAudit.store.add(result);			delete reader;			*/									var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex) {				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}										var type = (obj.id == 0 || obj.id === undefined) ? "document_success_create_item" : "document_success_modify_item";					this.fire(type, {info: info, params: obj});							} // End of Switch		} // End of If	}});// * * * * * * * * * * * * * * * * * * * * // File Upload * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.FileUploadDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Document.FileUploadDialogBridge.superclass.init.call(this,data);				var tab		= {			items	: ['Upload']		}				var dialog	= {			width 	: 550			,height : 250			,title	: 'Upload File'		}				this.createDialog({tab: tab ,dialog: dialog})				this.registerView();	}		,registerView : function()	{		var me	= this;		var cmp	= Ext.getCmp('documentUploadFilePanel');				cmp.on('beforefilestart', function(scope) {			// Reset groupId in case of set before			delete scope.baseParams.groupId;			console.log('me:::', me.root, me.section);			scope.baseParams.event	= Eve.Resource.cmdAttachFile(me.section, me.root);			scope.baseParams.path	= me.path;						if (me.groupId) {				scope.baseParams.groupId = me.groupId;			}		});				cmp.on('filefinished', function(options, resp) {			me.hasUpload = true;			me.uploadData = {options: options, resp: resp};						//if (me.hideIt) {				me.dialog.hide();			//	me.hideIt = false;			//}			// If we got here, it means a new interlink item created,			// so it needs to refresh interlink tab, and the srouce grid too (for paperclip icon)			if (me.il) {				var i = Eve.Resource.getSecInfoByTypeId(me.typeId);				i.type = i.type || 'item';				var data = {					origin	: i.type					,info	: {response: resp}				}				me.fire(i.section + '_reload_interlink_grid', data, true);				delete me.il;			}		});	}		,afterAddButtons: function(btns)	{		var btnCancel = btns[2];				var b = [];				if (Eve.Preference.get('showDocumentAdvertisement') == '1' && Eve.Preference.get('resellerId') == '0' && Eve.Preference.get('whiteLabel') == '0')			b.push({id: 'showDocumentAdvertisementButton', text: 'Easier uploads with HyperDrive', cls: 'document-advertisement', handler: function() { 				Ext.Ajax.request({url: Eve.url, params: {event: 'modern.document.personal.hideDocumentAdvertisement'}});				var ssl = (Eve.isSSL == "0") ?'http://' : 'https://';				url = ssl + Eve.loginUrl +'/downloads/setupscreens/hyperdrive/hyperdrive.cfm'								window.open(url);				Ext.getCmp('showDocumentAdvertisementButton').hide();				Eve.Preference.set('showDocumentAdvertisement', '0');			}});						var cmp = Ext.getCmp('documentUploadFilePanel')		cmp.uploadBtn = new Ext.Button({			 xtype:'button'			,iconCls:cmp.uploadIconCls			,text:cmp.uploadText			,scope:cmp			,handler:cmp.onUpload			,disabled:true		});		b.push(cmp.uploadBtn);		b.push(btnCancel);		         		         		return b;	}	,onDialogHide : function()	{		// Remove prevoiusly uploaded files on dialog hide.		var cmp = Ext.getCmp('documentUploadFilePanel');		cmp.store.removeAll();				// If user uploaded something...		if (this.hasUpload) {			this.submitSuccess(this.uploadData.options, this.uploadData.resp);			delete this.hasUpload;		}	}	,onDialogShow : function()	{		var uploadPanel = Ext.getCmp('documentUploadFilePanel');				uploadPanel.addBtn.enable();		uploadPanel.uploadBtn.enable();	}		,augment : function(callee)	{		var obj = callee.params;		obj.path = this.path;		if (this.root == 'group')			obj.groupId = this.groupId;				return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;		this.typeId		= obj.info.typeId;		this.linkBack	= obj.info.linkBack;				// We don't want to prompt user for this dialog on hide.		this.noPromptNeeded = true;				// We can also write this as a function for all of the panels		this.panels[0].reset();		this.dialog.show();		var baseParams = {event: 'modern.document.personal.attachFile'};		if (this.il)			baseParams.forwardUrl = 'modern.interlink.' + this.root + '.prepareToCreate&objId=' + obj.info.objId + '&objTypeId=' + obj.info.typeId + '&doGetGrid=true&toGroupId=' + obj.info.groupId + '&linkBack=' + obj.info.linkBack + '&toObjTypeId=' + (this.root == 'personal' ? '5' : '15');		Ext.getCmp('documentUploadFilePanel').uploader.baseParams = baseParams;						// Remove prevoiusly uploaded files on dialog hide.		var cmp = Ext.getCmp('documentUploadFilePanel');		cmp.store.removeAll();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('document_upload_file_dlg'):			case ('document_create_item_dlg'):				this.controller(data);				break;			case ('document_il_create_item_dlg'):				this.il = true;				this.controller(data);				break;		}	}		,submitSuccess : function(options, resp)	{		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			// Ext.getCmp('doc-upload-field').setValue('');			// change the mode in case of it was 'create'.			this.mode	= 'edit';			//			try {//				this.id	= dq.selectValue('id', xml).split("_")[1];//			}//			catch (e) {//				Ext.Msg.alert("Upload Failed", "Oops! There's an error while uploading file.");//				console.log(xml);//			}						/*			var info = {				id 			: this.id				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: this.parentId				,groupId	: this.groupId			}						//var type = (obj.id == 0 || obj.id === undefined) ? "document_success_create_item" : "document_success_modify_item";						// We need to reload grid if root is group						if (this.root == 'personal') {				var type = "document_success_create_item";				this.fire(type, { info: info, params: obj });			} else {				var grid = Ext.getCmp('document_grid');				grid.getStore().reload();			}			*/						var grid = Ext.getCmp('document_grid');			grid.getStore().reload();		}		else {			Ext.Msg.alert('Upload Error', resp.responseText);		}	}});//* * * * * * * * * * * * * * * * * * * * //File Upload * * * * * * * * * * * * * * //* * * * * * * * * * * * * * * * * * * *Eve.lib.Document.FlashFileUploadDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	 mode	: 'create'	,panels	: []		,init : function(data)	{		Eve.lib.Document.FlashFileUploadDialogBridge.superclass.init.call(this,data);				var tab		= {			items	: ['Upload']		}				var dialog	= {			width 	: 550			,height : 250			,title	: 'Upload File'		}				this.createDialog({tab: tab ,dialog: dialog})			}	,onDialogHide : function()	{		Eve.Dialogs.Document.flashStore.removeAll();		var grid = Ext.getCmp('document_grid');		grid.getStore().reload();		if (this.il)		{			sectionInfo = Eve.Resource.getSecInfoByTypeId(Eve.lib.Document.objTypeId);			Eve.Resource.superbridge.broadcast(this, sectionInfo.section + '_reload_interlink_grid')		}	}	,afterAddButtons: function(btns)	{		var btnCancel = btns[2];		btnCancel.text = 'Close';				var b = [];		if (Eve.Preference.get('showDocumentAdvertisement') == '1')			b.push({id: 'showDocumentAdvertisementButton', text: 'Easier uploads with HyperDrive', cls: 'document-advertisement flash', handler: function() { 				Ext.Ajax.request({url: Eve.url, params: {event: 'modern.document.personal.hideDocumentAdvertisement'}});				window.open('http://portal.hyperoffice.com/downloads/DownloadHyperDrive.cfm');				Ext.getCmp('showDocumentAdvertisementButton').hide();				Eve.Preference.set('showDocumentAdvertisement', '0');			}});				b.push(btnCancel);		return b;	}	,augment : function(callee)	{		var obj = callee.params;		obj.path = this.path;		if (this.root == 'group')			obj.groupId = this.groupId;				return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;		this.dialog.show();				if (this.root == "personal")			var groupId = 0;		else			var groupId = this.groupId;				Eve.lib.Document.path = this.path;		Eve.lib.Document.groupId = groupId; 		Eve.lib.Document.linkBack	= obj.info.linkBack || false;		Eve.lib.Document.objId	= obj.info.objId || 0;		Eve.lib.Document.objTypeId = obj.info.typeId;	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('document_upload_file_dlg'):			case ('document_create_item_dlg'):				this.il = false;				this.controller(data);				break;			case ('document_il_create_item_dlg'):				this.il = true;				this.controller(data);				break;		}	}		,submitSuccess : function(options, resp)	{	}});/** Added for Flash multiupload **/Eve.lib.Document.getGroupId = function(){	return Eve.lib.Document.groupId;};Eve.lib.Document.getPath = function(){	return Eve.lib.Document.path;};Eve.lib.Document.getObjId = function(){	return Eve.lib.Document.objId;};Eve.lib.Document.getLinkBack = function(){	return Eve.lib.Document.linkBack;};Eve.lib.Document.getObjTypeId = function(){	return Eve.lib.Document.objTypeId;};// * * * * * * * * * * * * * * * * * * * * // Folder Dialog * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.FolderDialogBridge = Ext.extend(Eve.lib.TabDialogController, {    mode	: 'create'    ,panels	: []    ,init	: function(data)	{        Eve.lib.Document.FolderDialogBridge.superclass.init.call(this, data);				var tab		= {            items		: ['Details', 'Permissions']			,related	: [[0, 1]]			,main 		: [0]		}				var dialog	= {			width		: 600			,height		: 350			,resizable	: false			,title		: 'Folder'		}				this.createDialog({tab: tab ,dialog: dialog});	}		,onDialogHide : function()	{		// Reset the tab index on window hide.		this.dialog.items.items[0].setActiveTab(0);				// Reset all Flags.		this.clearLoaded();				// Reset Image		Ext.fly('docPersonalFolderImage').dom.innerHTML = "";		Ext.fly('docGroupFolderImage').dom.innerHTML = "";				// Reset Checkboxes		Ext.getCmp('docFolderPermissionCheckBoxes').reset();	}		,augment : function(callee)	{		var obj = callee.params;				if (this.root == 'group') {			obj.groupId = this.groupId;		}					if (this.mode == 'edit') {			obj.id = this.id;		}				obj.parentId = this.parentId;				return callee;	}		,showHideCmp : function()	{		var personalFolder	= Ext.getCmp('docPersonalFolder');		var groupFolder		= Ext.getCmp('docGroupFolder');		var cboNotify		= Ext.getCmp('docGroupNotification');				if (this.root == 'personal') {			personalFolder.show();			groupFolder.hide();			cboNotify.hide();						// Disable Permission Tab			//this.setDisabled(1, true);		 	this.getTabPanel().hideTabStripItem(1);		} else {            this.getTabPanel().unhideTabStripItem(1);						if (this.mode == 'create') {				personalFolder.show();				groupFolder.hide();				cboNotify.show();			} else {				personalFolder.hide();				groupFolder.show();				cboNotify.hide();				if (!this.getLoaded(0) && this.dialog.isVisible()) {					this.loadForm(0);				}			}							// Enable Permission Tab			if (this.mode == 'edit') {				this.setDisabled(1, false);			} else {				this.setDisabled(1, true);			}		}	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;				// We can also write this as a function for all of the panels		this.panels[0].reset();		this.dialog.show();		this.showHideCmp();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('document_edit_folder_dlg'):				this.mode = 'edit';				this.controller(data);				if (!this.getLoaded(0))				this.loadForm(0);				break;						case ('document_create_folder_dlg'):				this.mode = 'create';				this.controller(data);								break;						case ('document_folder_detail_dlg'):				this.mode = 'edit';				this.controller(data);				//debugger;				if (!this.getLoaded(0))				this.loadForm(0);				break;						}	}	,loadSuccess : function(data)	{		// Set Image		var id		= (this.root == 'personal') ? 'Personal' : 'Group';		var image	= Ext.DomQuery.selectValue('image', data.responseXML) || 'no-pic.png';		Ext.fly('doc' + id + 'FolderImage').dom.innerHTML = '<img src="' + image + '" width="32" height="32" />';	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: this.parentId				,groupId	: this.groupId			}						var type = (obj.id == 0 || obj.id === undefined) ? "document_success_create_folder" : "document_success_modify_folder";			this.fire(type, {info: info, params: obj});		}	}});// * * * * * * * * * * * * * * * * * * * * // Audit * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.AuditDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Document.AuditDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Audit']		}				var dialog	= {			width 		: 670			,height 	: 300			,title		: 'Audit Log'			,noPrompt	: true		}				this.createDialog({tab: tab ,dialog: dialog})	}		,onDialogHide : function()	{		Ext.getCmp('docAuditDV').store.removeAll();	}	,afterAddButtons: function(btns)	{		btns[0].text = 'Submit';		btns[0].hidden = false;		btns.splice(1,1)		return btns;	}		,augment : function(callee)	{		var obj = callee.params;				obj.groupId = this.groupId;				return callee;	}		,controller	: function(obj)	{		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.parentId	= obj.info.parentId;		this.path		= obj.info.path;				// We can also write this as a function for all of the panels		this.panels[0].reset();		this.loadForm(0);		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase())		{			case ('document_audit_dlg'):				this.controller(data);				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0')		{			var store	= Ext.getCmp('docAuditDV').store;			var result	= store.reader.read({responseXML: xml});			store.loadRecords(result, {add: false, params: obj}, true);		}	}});// * * * * * * * * * * * * * * * * * * * * // Copy/Move * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.CopyMoveDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Document.CopyMoveDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Copy/Move']		}				var dialog	= {			width 	: 500			,height : 300			,title	: 'Copy/Move'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,afterAddButtons : function(btns)	{			btns.splice(0, 1);		btns[0].text = "Move";		btns[0].id	 = "docCopyMoveButton";		return btns;	}		,onDialogHide : function()	{  //Commented by ghazal		/*		var tree = this.view		var pNode = tree.getNodeById('DP_0');		pNode.collapse();		pNode.loaded = false;		tree.selModel.select(pNode);		var gNode = tree.getNodeById('DP_-2');		gNode.collapse();		gNode.loaded = false;	*/	}		,augment : function(callee)	{		var obj = callee.params;				var node = this.view.getSelectionModel().getSelectedNode();		obj.parentId= this.parentId;		var nodeInfo = this.view.getNodeInfo(node);		obj.folders = nodeInfo.folderId;					if (nodeInfo.groupId != null || nodeInfo.groupId != "0" || nodeInfo.groupId !== undefined)			obj.groups = nodeInfo.groupId;		//handle save attachment to document from mail		if (this.mode == 'upload') {			var p = this.popMail;			if(p == true || p == "true" || p == "1")				obj.popId = 0;			else				obj.mailId = this.mailId;						obj.oldtitle = this.mailAttachment;			obj.title = Ext.getCmp(this.section + 'attach_name').getValue();		} else {			obj.title	= this.title;			obj.id		= this.id;			if (typeof (this.rec.get('location')) !== 'undefined')			    obj.showPath = this.rec.get('location');			if (this.root == 'group')				obj.groupId = this.groupId;			if (this.mode == 'move')				obj.move = true;		}		return callee;	}		,showHideCmp : function()	{		if (this.mode == "upload") {//It means call from mail		 	Ext.getCmp(this.section + 'attach_field').show();		 	Ext.getCmp(this.section + 'attach_name').setValue( this.mailAttachment );		} else {		    Ext.getCmp(this.section + 'attach_field').hide();		}	}	,controller	: function(obj)	{		Ext.apply(this, obj.info);		this.title = obj.title;		delete this.groups;		Ext.getCmp('docCopyMoveButton').setText( this.mode.charAt(0).toUpperCase() + this.mode.substr(1) )		// We can also write this as a function for all of the panels		this.panels[0].reset();		//this.loadForm(0);		this.showHideCmp();		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('document_copy_item_dlg'):				this.mode = 'copy';				this.controller(data);				break;						case ('document_move_item_dlg'):				this.mode = 'move';				this.controller(data);				break;							case ('document_upload_item_dlg'):				this.mode = 'upload';				this.controller(data);				break;					/*	case ('document_reload_copymove_dlg'):				this.groups = data.record.get('value');				this.loadForm(0);				break;							case ('doc_set_active_node'):			    this.folders = data.info.folderId;				this.groups = data.info.groupId;			    break;*/		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			// If the mode is Move, remove the item from grid			if (this.mode == 'move') {				var info = {					id			: this.id					,root		: this.root					,parentId	: this.parentId					,groupId	: this.groupId					,path		: this.path				}				//this.fire('document_delete_item_dlg', {info: info, byPass: true});				var grid	= Ext.getCmp('document_grid');				var pre		= (this.groupId) ? 'DGI_' : 'DPI_';				var rec		= grid.store.getById( pre+this.id );								if ( rec !== undefined ) {					grid.store.remove(rec);				}			}			this.fire('document_success_move_copy');			var op = (this.mode == 'move') ? 'Moved' : 'Copied';			Ext.tools.msg('', op + ' successfully');		}	}});// * * * * * * * * * * * * * * * * * * * * // Search  * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Document.SearchDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Document.SearchDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Search']		}				var dialog	= {			width 		: 700			,height 	: 400			,y			: 30			,title		: 'Search'			,noPrompt	: true		}		this.createDialog({tab: tab ,dialog: dialog})	}	,onDialogHide : function()	{		Ext.getCmp('docSearchDV').store.removeAll();		this.isClosed = true;		}	,onDialogShow : function()	{		Ext.getCmp('docSortBy').setValue('score');		Ext.getCmp('docSortDir').setValue('asc');		Ext.getCmp('docSearchIn').setValue(-3);	}	,augment : function(callee)	{		var obj = callee.params;				obj.groupId = this.searchIn || this.groupId;		if (obj.groupId == -3 || obj.groupId === undefined)			obj.groupId = this.groupId || 0;					if (obj.groupId === undefined || obj.groupId == null) obj.groupId = 0;				obj.searchText 		= this.searchText;		obj.DOCNAME			= this.searchTitle;		obj.DISPLAYPATH		= this.searchLocation;		obj.CREATEDBY		= this.searchCreatedBy;		obj.DocType			= this.searchDocType;		obj.LastModifiedBy	= this.searchLastModifiedBy;		obj.AUTHOR			= this.searchAuthor;		obj.isadvanced		= 1;		//obj.searchFieldText = this.searchFieldText;		obj.sortBy			= this.searchSortBy;		obj.sortDir			= this.searchSortDir;		obj.groupId			= this.searchGroupId;				return callee;	}		,controller	: function(obj)	{		this.isClosed   = false;		if (obj.info.groupId !== undefined)			this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root		|| this.root;		this.parentId	= obj.info.parentId || this.parentId;		this.path		= obj.info.path		|| this.path;		this.searchText				= obj.text;		this.searchFieldText		= obj.type;		this.searchTitle			= obj.info.title;		this.searchCreatedBy		= obj.info.createdBy;		this.searchAuthor			= obj.info.author;		this.searchIn				= obj.info.searchIn;		this.searchLocation			= obj.info.location;		this.searchLastModifiedBy	= obj.info.lastModifiedBy;		this.searchDocType			= obj.info.docType;		this.searchSortBy 			= obj.info.sortBy;		this.searchSortDir      = obj.info.sortDir;		this.searchGroupId      = obj.info.groupId;		var rec = Ext.getCmp('docSearchIn').store.getAt(0);		if (this.groupId == 0 || this.groupId === undefined)			rec.set('text', '[Personal]');		else			rec.set('text', '[Current group]');		if (this.searchGroupId == -3 || this.searchGroupId === undefined){			this.searchGroupId = this.groupId || 0;		}		// We can also write this as a function for all of the panels		//this.panels[0].reset();		//this.loadForm(0);		var dv = Ext.getCmp('docSearchDV');		// set BaseParams		Ext.apply(dv.store.baseParams, {				searchText		: this.searchText,				DOCNAME				: this.searchTitle,				DISPLAYPATH		: this.searchLocation,				CREATEDBY			: this.searchCreatedBy,				DocType				: this.searchDocType,				LastModifiedBy: this.searchLastModifiedBy,				AUTHOR				: this.searchAuthor,				isadvanced		: 1,				sortBy				: (this.searchSortBy) ? this.searchSortBy : 'score',				sortDir				: (this.searchSortDir) ? this.searchSortDir : 'asc',				groupId				: this.searchGroupId		})				dv.store.load({callback:this.loadSuccess, scope: this});				// If its send by button on self form, skip this		if (obj.info.root)			this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase())		{						case ('document_search_dlg'):								this.controller(data);								// Set the Form Elements value based on passed data.			//	Ext.getCmp('docSearchTypeCombo').setValue( data.type );				Ext.getCmp('docSearchTextbox').setValue( data.text );								break;			default:			      if (	this.section == 'document' &&			            this.isClosed !== undefined &&		 				this.isClosed == false &&						 type.indexOf('_success_') !== -1){		 					this.loadForm(0);					}		 						    break;		}	}	,loadSuccess : function (resp)	{		var dq	 = Ext.DomQuery;		var store = Ext.getCmp('docSearchDV').store;		var xml  = store.reader.xmlData;//resp.responseXML;		var activated = dq.selectValue("activated", xml);		if (activated == 0)		{			Ext.Msg.show({				   title:'Activate search'				   ,msg: 'The search feature has not yet been enabled for documents in this section. If you like to enable this feature please click on the activate button below.'				   ,buttons: {ok: 'Activate', cancel: 'Cancel'}				   ,fn: function(buttonId) {					   if (buttonId == 'ok')						   {						   Ext.Ajax.request({							   url: Eve.url,							   params: {event: 'modern.document.' + this.root + '.textSearchActivate', groupId: this.groupId || 0}							   ,success: function () {							   		Ext.Msg.alert('Search activated', 'The system has begun indexing all of the documents that are currently in this section. This process is required for the search feature to work. Depending on the number and size of documents to be indexed this process may take some time to complete. If your initial search does not yield satisfactory results, give the system a little time to complete the indexing process and try your search again.');						   		}						   	   ,failure: function () { 								   Ext.Msg.alert("Activation failed", "Activation failed, please try again.");								   							   }							});					   }				   }				   ,scope	: this				   ,icon: Ext.MessageBox.QUESTION				});					}	}	,submitSuccess : function(resp, action)	{				var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;				var code = dq.selectValue("code", xml);				if (code == '0')		{			var store	= Ext.getCmp('docSearchDV').store;			var result	= store.reader.read({responseXML: xml});			store.loadRecords(result, {add: false, params: obj}, true);		}	}	,afterAddButtons: function(btns, scope){		var btn= [];		return btn;	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\contact/ContactDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Contacts section based on ExtJS Library 2.2 December 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/var dlgCon = Eve.Dialogs.Contact;// * * * * * * * * * * * * * * * * * * * * // Item General	 * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.changeStat = function(id, text, mapId, fid) {	var el  = Ext.getCmp(id);	var fel = Ext.getCmp(fid);	el._id  = mapId;	el.setText(text);	fel.setValue(Ext.getCmp(mapId).getValue());}dlgCon.ItemGeneralButtons = function(id, fid, c){	return [{		text		: 'Home Phone'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Home Phone', c.section + 'HomePhone', fid);		}	}, {		text		: 'Home Phone (Alternate)'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Home Phone (Alt)', c.section + 'HomePhone2', fid);		}	}, {		text		: 'Home Fax'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Home Fax', c.section + 'FaxNumber', fid);		}	}, {		text		: 'Work Phone'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Work Phone', c.section + 'WorkPhone', fid);		}	}, {		text		: 'Work Phone (Alternate)'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Work Phone (Alt)', c.section + 'WorkPhone2', fid);		}	}, {		text		: 'Work Fax'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Work Fax', c.section + 'WorkFax', fid);		}	}, {		text		: 'Pager'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Pager', c.section + 'Pager', fid);		}	}, {		text		: 'Mobile'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Mobile', c.section + 'MobilePhone', fid);		}	}, {		text		: 'Mobile (Alternate)'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Mobile (Alt)', c.section + 'MobilePhone2', fid);		}	}, {		text		: 'Assistant Phone'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Assistant Phone', c.section + 'AssistantPhone', fid);		}	}, {		text		: 'Manager Phone'		,handler	: function() {			Eve.Dialogs.Contact.changeStat(id, 'Manager Phone', c.section + 'ManagerPhone', fid);		}	}]};dlgCon.storeTitle = new Ext.data.SimpleStore({	fields	: ['value', 'text']	,data	: [ ['Mr.', 'Mr.'], ['Mrs.', 'Mrs.'], ['Ms.', 'Ms.'], ['Miss.', 'Miss.'], ['Dr.', 'Dr.'], ['Prof.', 'Prof.'] ]});//------- userGroupsdlgCon.storeUserGroups = new Ext.data.SimpleStore({	fields	: ['value', 'text']	,data	: [ ['0', 'Personal'], ['2', 'hyperoffice2nd'], ['4', 'hyperBase'] ]});dlgCon.ItemGeneral = function(c){	return new Eve.FormPanel({        labelWidth	: 100		,labelAlign	: 'left'		,fileUpload	: true        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,width		: 700		,height		: 550        ,items 		: [{			layout			:'form'			,id             : c.section + 'groupsPanel'   			//,labelPad		: -40   			,style          : 'margin-top:-20px; margin-bottom:-3px;'			,items          :[{					xtype			: 'combo'					,id				: c.section + 'userGroups'					,hiddenName		: 'userGroups'					,mode			: 'local'					,fieldLabel 	: 'Address Book'					,valueField		: 'value'					,displayField	: 'text'				//	,labelStyle 	: 'width: 55px'					,labelSeparator : ''					,lazyInit		: false					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '66.5%'			},{				html: '<hr/>'			}]			},{			layout		: 'column'			,defaults	: {				layout		: 'form'				,labelAlign	: 'top'			}			// Start: Hidden Inputs			,items		: [{				xtype		: 'hidden'				,name		: 'Address'				,id			: c.section + 'HomeStreet'			}, {				xtype		: 'hidden'				,name		: 'City'				,id			: c.section + 'HomeCity'			}, {				xtype		: 'hidden'				,name		: 'State'				,id			: c.section + 'HomeState'			}, {				xtype		: 'hidden'				,name		: 'Zip'				,id			: c.section + 'HomeZip'			}, {				xtype		: 'hidden'				,name		: 'Country'				,id			: c.section + 'HomeCountry'			}, {				xtype		: 'hidden'				,name		: 'WorkAddress'				,id			: c.section + 'WorkStreet'			}, {				xtype		: 'hidden'				,name		: 'WorkCity'				,id			: c.section + 'WorkCity'			}, {				xtype		: 'hidden'				,name		: 'WorkState'				,id			: c.section + 'WorkState'			}, {				xtype		: 'hidden'				,name		: 'WorkZip'				,id			: c.section + 'WorkZip'			}, {				xtype		: 'hidden'				,name		: 'WorkCountry'				,id			: c.section + 'WorkCountry'			}, {				xtype		: 'hidden'				,name		: 'EmailAddress'				,id			: c.section + 'EmailAddress'			}, {				xtype		: 'hidden'				,name		: 'EmailAddress2'				,id			: c.section + 'EmailAddress2'			}, {				xtype		: 'hidden'				,name		: 'EmailAddress3'				,id			: c.section + 'EmailAddress3'			}, {				xtype		: 'hidden'				,name		: 'HomePhone'				,id			: c.section + 'HomePhone'			}, {				xtype		: 'hidden'				,name		: 'HomePhone2'				,id			: c.section + 'HomePhone2'			}, {				xtype		: 'hidden'				,name		: 'FaxNumber'				,id			: c.section + 'FaxNumber'			}, {				xtype		: 'hidden'				,name		: 'WorkPhone'				,id			: c.section + 'WorkPhone'			}, {				xtype		: 'hidden'				,name		: 'WorkPhone2'				,id			: c.section + 'WorkPhone2'			}, {				xtype		: 'hidden'				,name		: 'WorkFax'				,id			: c.section + 'WorkFax'			}, {				xtype		: 'hidden'				,name		: 'Pager'				,id			: c.section + 'Pager'			}, {				xtype		: 'hidden'				,name		: 'MobilePhone'				,id			: c.section + 'MobilePhone'			}, {				xtype		: 'hidden'				,name		: 'MobilePhone2'				,id			: c.section + 'MobilePhone2'			}, {				xtype		: 'hidden'				,name		: 'AssistantPhone'				,id			: c.section + 'AssistantPhone'			}, {				xtype		: 'hidden'				,name		: 'ManagerPhone'				,id			: c.section + 'ManagerPhone'			},{			// End: Hidden Inputs				columnWidth	: 0.1				,items		: [{					xtype			: 'combo'					,xxtype			: 'combo'					,fieldLabel		: 'Title'					,hiddenName		: 'Title'					,store			: dlgCon.storeTitle					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,loadPrevent	: true					,anchor 		: '90%'				}]			}, {				columnWidth	: 0.3				,items		: [{					xtype		: 'textfield'					,id			: c.section + 'DetailsFirstName'					,fieldLabel	: 'First Name'					,name		: 'FirstName'					,maxLength	: 75					,setFocus	: true					,anchor		: '90%'					,listeners	: {						change: function(el, newValue, oldValue) {							var lastName = Ext.getCmp(c.section + 'DetailsLastName');							var fullName = Ext.getCmp(c.section + 'DetailsFullName');														fullName.setValue(lastName.getValue() + ', ' + el.getValue());						}					}				}]			}, {				columnWidth	: 0.3				,items		: [{					xtype		: 'textfield'					,fieldLabel	: 'Middle Name'					,name		: 'middleName'					,maxLength	: 75					,anchor		: '90%'				}]			}, {				columnWidth	: 0.3				,items		: [{					xtype		: 'textfield'					,id			: c.section + 'DetailsLastName'					,fieldLabel	: 'Last Name'					,name		: 'LastName'					,maxLength	: 75					,anchor		: '90%'					,listeners	: {						change: function(el, newValue, oldValue) {							var firstName = Ext.getCmp(c.section + 'DetailsFirstName');							var fullName  = Ext.getCmp(c.section + 'DetailsFullName');														fullName.setValue(el.getValue() + ', ' + firstName.getValue());						}					}				}]			}]		}, {			html	: '<hr />'			,style	: 'padding: 5px 0px 15px 0px'		}, {			layout		: 'column'			,defaults	: {layout: 'form'}			,items		: [{				columnWidth	: 0.85				,items		: [{					xtype		: 'textfield'					,id			: c.section + 'DetailsFullName'					,fieldLabel	: 'Full Name'					,name		: 'FullName'					,maxLength	: 350					,anchor		: '96%'				}, {					xtype		: 'textfield'					,fieldLabel	: 'Organization'					,name		: 'Organization'					,maxLength	: 350					,anchor		: '96%'				}, {					xtype		: 'textfield'					,fieldLabel	: 'Job Title'					,name		: 'JobTitle'					,maxLength	: 350					,anchor		: '96%'				}, {					layout	: 'column'					,items	: [{						layout		: 'form'						,columnWidth: 0.196						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'EmailButton'							,_id		: c.section + 'EmailAddress'							,text		: 'Primary Email'							,menu		: [{								text		: 'Primary Email'								,handler	: function() {									Eve.Dialogs.Contact.changeStat(c.section + 'EmailButton', 'Primary Email', c.section + 'EmailAddress', c.section + 'EmailField');								}							}, {								text		: 'Email Address (A)'								,handler	: function() {									Eve.Dialogs.Contact.changeStat(c.section + 'EmailButton', 'Email Address (A)', c.section + 'EmailAddress2', c.section + 'EmailField');								}							}, {								text		: 'Email Address (B)'								,handler	: function() {									Eve.Dialogs.Contact.changeStat(c.section + 'EmailButton', 'Email Address (B)', c.section + 'EmailAddress3', c.section + 'EmailField');								}							}]							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.765						,items		: [{							xtype			: 'textfield'							,id				: c.section + 'EmailField'							,hideLabel		: true							,enableKeyEvents: true							,maxLength		: 255							,anchor			: '100%'							,listeners		: {								change	: function() {									var val = this.getValue();									var btn = Ext.getCmp(c.section + 'EmailButton');									var hdn = Ext.getCmp(btn._id);									hdn.setValue(val);								}							}						}]					}]				}]			}, {				columnWidth	: 0.15				,items		: [{					html		: '<img id="' + c.section +'imgContactAvatar" src="' + Eve.Resource.getIcon('item-icon','contact') + '" width="73" height="77" style="padding-bottom: 2px;" />'				}, {					xtype	: 'button'					,id		: c.section + 'btnContactUpload'					,text	: 'Edit Image'				}]			}]		}, {			html	: '<hr />'			,style	: 'padding: 5px 0px 15px 0px'		}, {			layout		: 'column'			,defaults	: {layout: 'form'}			,items		: [{				columnWidth	: 0.5				,items		: [{					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: 0.3						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'PhoneButton1'							,_id		: c.section + 'WorkPhone'							,text		: 'Work Phone'							,menu		: Eve.Dialogs.Contact.ItemGeneralButtons.call(this, c.section + 'PhoneButton1', c.section + 'PhoneField1', c)							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.7						,items		: [{							xtype			: 'textfield'							,id				: c.section + 'PhoneField1'							,hideLabel		: true							,enableKeyEvents: true							,maxLength		: 50							,anchor			: '90%'							,listeners		: {								change	: function() {									var val = this.getValue();									var btn = Ext.getCmp(c.section + 'PhoneButton1');									var hdn = Ext.getCmp(btn._id);									hdn.setValue(val);								}							}						}]					}]				}, {					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: 0.3						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'PhoneButton2'							,_id		: c.section + 'HomePhone'							,text		: 'Home Phone'							,menu		: Eve.Dialogs.Contact.ItemGeneralButtons.call(this, c.section + 'PhoneButton2', c.section + 'PhoneField2', c)							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.7						,items		: [{							xtype			: 'textfield'							,id				: c.section + 'PhoneField2'							,hideLabel		: true							,enableKeyEvents: true							,maxLength		: 50							,anchor			: '90%'							,listeners		: {								change	: function() {									var val = this.getValue();									var btn = Ext.getCmp(c.section + 'PhoneButton2');									var hdn = Ext.getCmp(btn._id);									hdn.setValue(val);								}							}						}]					}]				}, {					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: 0.3						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'PhoneButton3'							,_id		: c.section + 'MobilePhone'							,text		: 'Mobile'							,menu		: Eve.Dialogs.Contact.ItemGeneralButtons.call(this, c.section + 'PhoneButton3', c.section + 'PhoneField3', c)							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.7						,items		: [{							xtype			: 'textfield'							,id				: c.section + 'PhoneField3'							,hideLabel		: true							,enableKeyEvents: true							,maxLength		: 50							,anchor			: '90%'							,listeners		: {								change	: function() {									var val = this.getValue();									var btn = Ext.getCmp(c.section + 'PhoneButton3');									var hdn = Ext.getCmp(btn._id);									hdn.setValue(val);								}							}						}]					}]				}, {					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: 0.3						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'PhoneButton4'							,_id		: c.section + 'WorkFax'							,text		: 'Work Fax'							,menu		: Eve.Dialogs.Contact.ItemGeneralButtons.call(this, c.section + 'PhoneButton4', c.section + 'PhoneField4', c)							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.7						,items		: [{							xtype			: 'textfield'							,id				: c.section + 'PhoneField4'							,hideLabel		: true							,enableKeyEvents: true							,maxLength		: 50							,anchor			: '90%'							,listeners		: {								change	: function() {									var val = this.getValue();									var btn = Ext.getCmp(c.section + 'PhoneButton4');									var hdn = Ext.getCmp(btn._id);									hdn.setValue(val);								}							}						}]					}]				}]			}, {				columnWidth	: 0.4				,items		: [{					xtype		: 'textarea'					,id			: c.section + 'txtContactAllWorkAddress'					,fieldLabel	: 'Work Address'					,name		: 'addressWork'					,cls		: 'ev-pointer'					,maxLength	: 605					,height		: 48					,readOnly	: true					,anchor		: '95%'					,listeners	: {						focus		: function() {							Ext.getCmp(c.section + 'btnContactEditWorkAddress').fireEvent('click');						}					}				}, {					xtype		: 'textarea'					,id			: c.section + 'txtContactAllHomeAddress'					,fieldLabel	: 'Home Address'					,name		: 'addressHome'					,cls		: 'ev-pointer'					,maxLength	: 605					,height		: 48					,readOnly	: true					,anchor		: '95%'					,listeners	: {						focus		: function() {							Ext.getCmp(c.section + 'btnContactEditHomeAddress').fireEvent('click');						}					}				}]			}, {				columnWidth	: 0.1				,items		: [{					xtype		: 'button'					,id			: c.section + 'btnContactEditWorkAddress'					,text		: 'Edit'					,style		: 'margin-bottom:33px;'				}, {					xtype		: 'button'					,id			: c.section + 'btnContactEditHomeAddress'					,text		: 'Edit'				}]			}]		}, {			html	: '<hr />'			,style	: 'padding: 5px 0px 15px 0px'		}, {			xtype		: 'htmleditor'			,fieldLabel	: 'Notes'			,name		: 'notes'			,width		: 'auto'			,height		: 100			,anchor		: '97%'		}, {			xtype		: 'checkbox'			,name		: 'evaluateAsHTML'			,checked	: true			,hidden		: true			,hideLabel	: true		}]    })};// * * * * * * * * * * * * * * * * * * * * // Item Details	 * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.ItemDetails = function(c){	return new Eve.FormPanel({        labelWidth	: 110        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,width		: 700        ,items 		: [{			layout		: 'column'			,defaults	: {				layout		: 'form'			}			,items		: [{				columnWidth	: 0.5				,items		: [{					xtype		: 'datefield'					,fieldLabel	: 'Birthdate'					,name		: 'Birthdate'					,anchor		: '95%'					,format 	: Eve.Preference.get('dateFormat')				}, {					layout	: 'column'					,items	: [{						layout		: 'form'						,columnWidth: 0.35						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'detail_email_labels'							,text		: 'Online Nickname'							,menu		: [{								text		: 'Online Nickname'								,handler	: function() {									Ext.getCmp(c.section + 'detail_email_labels').setText('Online Nickname');									Ext.getCmp(c.section + 'detial_email_fields').getLayout().setActiveItem(0);								}							}, {								text		: 'AIM Nickname'								,handler	: function() {									Ext.getCmp(c.section + 'detail_email_labels').setText('AIM Nickname');									Ext.getCmp(c.section + 'detial_email_fields').getLayout().setActiveItem(1);								}							}, {								text		: 'Skype ID'								,handler	: function() {									Ext.getCmp(c.section + 'detail_email_labels').setText('Skype ID');									Ext.getCmp(c.section + 'detial_email_fields').getLayout().setActiveItem(2);								}							}, {								text		: 'ICQ UIN'								,handler	: function() {									Ext.getCmp(c.section + 'detail_email_labels').setText('ICQ UIN');									Ext.getCmp(c.section + 'detial_email_fields').getLayout().setActiveItem(3);								}							}]							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.65						,style		: 'margin: 0px 14px 0px 5px;'						,items		: [{							layout		: 'card'							,id			: c.section + 'detial_email_fields'							,activeItem	: 0							,items		: [{								xtype		: 'textfield'								,name		: 'OnlineNickname'								,maxLength	: 50								,hideLabel	: true								,anchor		: '95%'							}, {								xtype		: 'textfield'								,name		: 'AIMNickname'								,maxLength	: 20								,hideLabel	: true								,anchor		: '95%'							}, {								xtype		: 'textfield'								,name		: 'IRCNickname'								,maxLength	: 20								,hideLabel	: true								,anchor		: '95%'							}, {								xtype		: 'textfield'								,name		: 'ICQUIN'								,maxLength	: 20								,hideLabel	: true								,anchor		: '95%'							}]						}]					}]				}]			}, {				columnWidth	: 0.5				,items		: [{					layout	: 'column'					,items	: [{						layout		: 'form'						,columnWidth: 0.4						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'detail_name_labels'							,text		: 'Assistant Name'							,menu		: [{								text		: 'Assistant Name'								,handler	: function() {									Ext.getCmp(c.section + 'detail_name_labels').setText('Assistant Name');									Ext.getCmp(c.section + 'detail_name_fields').getLayout().setActiveItem(0);								}							}, {								text		: 'Manager Name'								,handler	: function() {									Ext.getCmp(c.section + 'detail_name_labels').setText('Manager Name');									Ext.getCmp(c.section + 'detail_name_fields').getLayout().setActiveItem(1);								}							}]							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.6						,style		: 'margin: 0px 10px 5px 10px;'						,items		: [{							layout		: 'card'							,id			: c.section + 'detail_name_fields'							,activeItem	: 0							,items		: [{								xtype		: 'textfield'								,name		: 'Assistant'								,maxLength	: 50								,hideLabel	: true								,anchor		: '95%'							}, {								xtype		: 'textfield'								,name		: 'Manager'								,maxLength	: 50								,hideLabel	: true								,anchor		: '95%'							}]						}]					}]				}]			}, {				columnWidth	: 0.5				,items		: [{					layout	: 'column'					,items	: [{						layout		: 'form'						,columnWidth: 0.4						,items		: [{							xtype		: 'splitbutton'							,id			: c.section + 'detail_webpage_labels'							,text		: 'Company Webpage'							,menu		: [{								text		: 'Company Webpage'								,handler	: function() {									Ext.getCmp(c.section + 'detail_webpage_labels').setText('Company Webpage');									Ext.getCmp(c.section + 'detail_webpage_fields').getLayout().setActiveItem(0);								}							}, {								text		: 'Personal Webpage'								,handler	: function() {									Ext.getCmp(c.section + 'detail_webpage_labels').setText('Personal Webpage');									Ext.getCmp(c.section + 'detail_webpage_fields').getLayout().setActiveItem(1);								}							}]							,handler	: function() {this.showMenu()}						}]					}, {						layout		: 'form'						,columnWidth: 0.6						,style		: 'margin: 0px 10px 0px 10px;'						,items		: [{							layout		: 'card'							,id			: c.section + 'detail_webpage_fields'							,activeItem	: 0							,items		: [{								xtype		: 'textfield'								,name		: 'CompanyWebpage'								,maxLength	: 255								,hideLabel	: true								,anchor		: '95%'							}, {								xtype		: 'textfield'								,name		: 'Webpage'								,maxLength	: 255								,hideLabel	: true								,anchor		: '95%'							}]						}]					}]				}]			}]		}, {			html	: '<hr />'			,style	: 'padding: 5px 0px 15px 0px'		}, {			xtype	: 'fieldset'			,id		: c.section + 'detail_customfields'			,title	: 'Custom Fields'			//,autoHeight: true			,height	: 350			,autoScroll: true			,layout	: 'column'			,items: [{				columnWidth	: .5				,layout		: 'form'			}, {				columnWidth	: .5				,layout		:'form'			}]			,addToColumn: function(id, items) {				this.items.get(id).add(items);				this.items.get(id).doLayout();			}		}]    })}// * * * * * * * * * * * * * * * * * * * * // Item Categories * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.ItemCategories = function(c){	return new Eve.FormPanel({        labelWidth	: 50        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,width		: 700		,height		: 400        ,items 		: [{			html			: 'You can associate a contact with as many categories as you want. If you do not have the category created yet you can add a contact to a category later by simply dragging the contact from the contact list onto a category name in the left-hand tree.'		}, {			xtype			: 'itemselector'			,hideLabel		: true			,msWidth		: 290			,msHeight		: 400			,width			: 600			,name			: 'associations_box'			,id				: 'contact_categories_associations_box'   			,valueField		: 'id'   	   		,displayField	: 'title'			,fromLegend		: 'Unassociated Categories'			,toLegend		: 'Associated Categories'			,dataFields		: ['title', 'id']			,fromData		: []			,toData			: []			,style			: 'margin-top: 20px;'			,drawUpIcon		: false			,drawBotIcon	: false			,drawTopIcon	: false			,drawDownIcon	: false			,drawAllLeftIcon: false			,drawAllRightIcon: false		}]    })}// * * * * * * * * * * * * * * * * * * * * // Folder Details  * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.FolderDetails = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 20px'		,width		: 700		,height		: 300		,items 		: [{			xtype		: 'textfield'			,fieldLabel	: 'Name'			,name		: 'title'			,allowBlank	: false			,setFocus	: true			,maxLength	: 350			,anchor		: '95%'		}, {			xtype		: 'textarea'			,fieldLabel	: 'Description'			,name		: 'description'			,maxLength	: 350			,anchor		: '95%'		}]	})};// * * * * * * * * * * * * * * * * * * * *// Folder Contacts * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCon.FolderContacts = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 10px'		,items 		: [{			xtype			: 'itemselector'			,hideLabel		: true			,msWidth		: 260			,msHeight		: 180			,width			: 550			,name			: 'associations_box'   			,valueField		: 'id'   	   		,displayField	: 'title'			,fromLegend		: 'Unassociated Contacts'			,toLegend		: 'Associated Contacts'			,dataFields		: ['title', 'id']			,fromData		: []			,toData			: []			,drawUpIcon		: false			,drawBotIcon	: false			,drawTopIcon	: false			,drawDownIcon	: false			,drawAllLeftIcon: false			,drawAllRightIcon: false		}]	})};// * * * * * * * * * * * * * * * * * * * * // Column Chooser  * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.storeSort = new Ext.data.SimpleStore({	fields : ['text'],	data : [ ['None'], ['Ascending'], ['Descending'] ]});dlgCon.sm = new Ext.grid.CheckboxSelectionModel({	listeners: {		beforerowselect : function(sm) {			if (sm.getSelections().length > 9) {				Ext.tools.msg("Not Supported", "Selecting more than 10 columns is not currently supported.");				return false;			}		}		,rowselect : function(sm, rowIdx, rec) {			// If its the firt time (store on load)			if (rec.preventToggle) {				delete rec.preventToggle;				return;			}						rec.set('displayField', !rec.get('displayField'));		}	}});dlgCon.cboSort = new Ext.form.ComboBox({	store 			: dlgCon.storeSort	,mode         	: 'local'	,valueField		: 'text'	,displayField 	: 'text'	,typeAhead 		: true	,editable		: false	,selectOnFocus 	: true	,triggerAction 	: 'all'});	dlgCon.ColumnChooser = function(){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 20px'		,width		: 420		,height		: 350		,items 		: [			new Ext.grid.EditorGridPanel({				id			: 'grid_col_chooser'				,width		: 400				,height		: 250				,autoScroll	: true				,anchor		: '100%'				,sm			: dlgCon.sm				,columns	: [ 					new Ext.grid.CheckboxSelectionModel({						dataIndex	: 'displayField'						,checkOnly	: true						,header		: ''				}), {					header			: "Column Name"					,width			: 160					,dataIndex		: 'title'					,fixed			: true					,menuDisabled	: true				}, {					header			: "Sorting"					,width			: 150					,dataIndex		: 'sortType'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(dlgCon.cboSort)				}]				,store		: new Ext.data.Store({					reader		: new Ext.data.XmlReader({						record 		: 'row'						,success	: '@success'						,id			: 'id'						,totalRecords: 'total'					}, [						 {name: 'displayField', type: 'boolean'}						,{name: 'title', 		type: 'string'}						,{name: 'sortType',		type: 'string'}					])					,listeners	: {						load : function(ds) {							ds.each( function(row, idx) {								if (row.get('displayField') == true) {									row.preventToggle = true;									Ext.getCmp('grid_col_chooser').getSelectionModel().selectRow(idx, true);								}							}, this);						}					}				})			})		]	})};// * * * * * * * * * * * * * * * * * * * * // Custom Fields * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCon.storeDataType = new Ext.data.SimpleStore({	fields : ['text', 'value'],	data : [		 ['Small Text', 'smallText']		,['Medium Text', 'mediumText']		,['Large Text', 'largeText']		,['Unlimited Text', 'text']		,['Date', 'date']		,['Yes/No', 'boolean']		,['Integer', 'integer']		,['Decimal', 'decimal']		,['Percent', 'percent']		,['Currency', 'currency']	]});dlgCon.cboDataType = new Ext.form.ComboBox({	store 			: dlgCon.storeDataType	,mode         	:'local'	,valueField		: 'value'	,displayField 	: 'text'	,typeAhead 		: true	,editable		: false	,selectOnFocus 	: true	,triggerAction 	: 'all'	,listeners		: {		change	: function(cbo, newValue, oldValue) {			var ds 	= Ext.getCmp('grid_custom_fields').getStore();			var rec	= ds.getAt(dlgCon._cfRowIdx);			if ((oldValue == 'date' || oldValue == 'boolean') && !(newValue == 'date' || newValue == 'boolean'))				rec.set('');			else if (!(oldValue == 'date' || oldValue == 'boolean') && (newValue == 'date' || newValue == 'boolean'))				rec.set('{N/A}');		}		,scope : this	}});dlgCon.storeCtrlType = new Ext.data.SimpleStore({	fields : ['text', 'value'],	data : [ ['Text Box', 'textBox']			,['Drop Down', 'dropdown']			,['Radio Buttons', 'radio']	]});dlgCon.cboCtrlType = new Ext.form.ComboBox({	store 			: dlgCon.storeCtrlType	,mode         	: 'local'	,valueField		: 'value'	,displayField 	: 'text'	,typeAhead 		: true	,editable		: false	,selectOnFocus 	: true	,triggerAction 	: 'all'	,listeners		: {		change	: function(cbo, newValue, oldValue) {			var ds 	= Ext.getCmp('grid_custom_fields').getStore();			var rec	= ds.getAt(dlgCon._cfRowIdx);						if (oldValue == 'textBox')				rec.set('');			else if (newValue == 'textBox')				rec.set('{N/A}');		}		,scope : this	}});dlgCon.CustomFields = function(c){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,bodyStyle	: 'padding: 20px'		,width		: 650		,height		: 350		,items 		: [			new Ext.grid.EditorGridPanel({				id			: 'grid_custom_fields'				,width		: 550				,height		: 250				,autoScroll	: true				,anchor		: '100%'				,columns	: [{					header			: "Name"					,width			: 200					,dataIndex		: 'name'					,fixed			: true					,menuDisabled	: true					,editor 		: new Ext.form.TextField({allowBlank : false})				}, {					header			: "Data Type"					,width			: 100					,dataIndex		: 'classType'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(dlgCon.cboDataType)					,renderer		: Eve.comboRenderer(dlgCon.cboDataType)				}, {					header			: "Control Type"					,width			: 100					,dataIndex		: 'type'					,fixed			: true					,menuDisabled	: true					,editor			: new Ext.grid.GridEditor(dlgCon.cboCtrlType)					,renderer		: Eve.comboRenderer(dlgCon.cboCtrlType)				}, {					header			: "Options"					,width			: 140					,dataIndex		: 'option'					,fixed			: true					,menuDisabled	: true					,renderer		: function(val, att, rec) {						if (rec.get('type') == 'textBox' || rec.get('classType') == 'date' || rec.get('classType') == 'boolean')							return '{N/A}';													return val;					}				}, {					header			: "&nbsp;"					,width			: 25					,fixed			: true					,menuDisabled	: true					,renderer		: function() { 							return "<img src='" + Eve.Resource.getIcon('delete', 'general') + "' onmouseover='this.style.cursor=&quot;pointer&quot; ' />"					}				}]				,store		: new Ext.data.Store({					reader		: new Ext.data.XmlReader({						record 		: 'customField'						,success	: '@success'						,id			: 'id'						,totalRecords: 'total'					}, [						 {name: 'name', 		type: 'string'}						,{name: 'type', 		type: 'string'}						,{name: 'classType',	type: 'string'}						,{name: 'option',		type: 'string'}						,{name: 'visible',		type: 'boolean'}					])				})				,tbar		: new Ext.Toolbar({					items		: [{						text		: 'New'						,cls		: "x-btn-text-icon"						,icon		: Eve.Resource.getIcon('new', 'general')						,handler	: function() {							var grid	= Ext.getCmp('grid_custom_fields');							var ds		= grid.getStore();							var row 	= Ext.data.Record.create(['name', 'type', 'classType', 'option', 'visible'])														var record = new row({								name		: ''								,type		: 'textBox'								,classType	: 'smallText'								,option		: ''								,visible	: ''							})														record.id = 'new_' + ds.getCount();							ds.add(record);							grid.startEditing(ds.getCount() - 1, 0, true);						}						,scope: this					}]				})				,listeners	: {					cellclick	: function(grid, rIdx, cIdx, e) {						var ds		= grid.getStore();						var rec 	= ds.getAt(rIdx);																		switch (cIdx) {							// Delete							case 4:								ds.remove(rec);								break;														// Control Type							case 3:								if (rec.get('type') == 'textBox' || rec.get('classType') == 'date' || rec.get('classType') == 'boolean')									return;																dlgCon._cfRow = rec;								dlgCon.CFOptions.show();								Ext.getCmp('txtCFOptions').setValue(rec.get('option').replace(/,/g, '\n'));								break;						}					}					,rowclick	: function(grid, rIdx, e) {						dlgCon._cfRowIdx = rIdx;					}					,beforeedit	: function(e) {						var cIdx 	= e.column;						var rec		= e.record;						var cType	= rec.get('classType');												if (cIdx == 2 && (cType == 'boolean' || cType == 'date'))							return false;					}					,afteredit : function(e) {						switch (e.value) {							case 'date':								e.record.set('type', 'dropdown');								break;														case 'boolean':								e.record.set('type', 'radio');								break;						}					}				}			})		]	})};// * * * * * * * * * * * * * * * * * * * *// Custom Fields Options * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCon.CFOptions = new Ext.Window({	title		: 'Options'	,layout		: 'fit'	,width		: 200	,height		: 150	,resizable	: false	,closeAction: 'hide'	,items		: [{		xtype		: 'textarea'		,id			: 'txtCFOptions'	}]	,buttons	: [{		text		: 'Done'		,handler	: function() {			var tx = Ext.getCmp('txtCFOptions');						var rawValue = tx.getValue().replace(/\n/g,'_');			var temp = rawValue.split("_");			var validationError = true;			var msg = "Validation Error";			switch( dlgCon._cfRow.get('classType').toLowerCase() ){				case 'integer':				    for(var i = 0; i<temp.length; i++){					    if(temp[i].match(/^(\+|-)?\d+$/) == null){					        validationError = false;					        msg = "Please enter a valid integer number."					        continue;					    }				    }				    break;				case 'decimal':    				for(var i = 0; i<temp.length; i++){					    if(temp[i].match(/^(-|\+)?\d+(\.\d+)?$/) == null){					        validationError = false;					        msg = "Please enter a valid decimal number."					        continue;					    }				    }					break;				case 'percent':    				for(var i = 0; i<temp.length; i++){					    if(temp[i].match(/^\d+(%)?$/) == null){					        validationError = false;					        msg = "Please enter a valid percent number."					        continue;					    }				    }					break;				case 'currency':    				for(var i = 0; i<temp.length; i++){					    if(temp[i].match(/^($)?\d+(\.(\d{1,2}))?$/) == null){					        validationError = false;					        msg = "Please enter a valid $ amount. For example $100.00 ."					        continue;					    }				    }					break;			}			if(!validationError){				Ext.tools.msg(msg, '');				return;			}						dlgCon._cfRow.set('option', tx.getValue().replace(/\n/g, ','));			dlgCon.CFOptions.hide();		}	}]});// * * * * * * * * * * * * * * * * * * * * // Copy/Move * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCon.CopyMove = function(data){	return new Eve.FormPanel({		labelWidth	: 70		,frame		: false		,autoScroll : true		,bodyStyle	: 'padding: 10px'		,style		: 'background-color: white; border: 1px solid #D0D0D0;'		,width		: 500		,height		: 300		,items 		: [data.view]	})};/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       ContactDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */// Items GeneralEve.vc.createFormPanel( 'ContactItemGeneral'	, Eve.Dialogs.Contact.ItemGeneral );// Items DetailsEve.vc.createFormPanel( 'ContactItemDetails'	, Eve.Dialogs.Contact.ItemDetails );// Items DetailsEve.vc.createFormPanel( 'ContactItemCategories'	, Eve.Dialogs.Contact.ItemCategories );// CommentsEve.vc.createFormPanel( 'ContactComments'		, Eve.Dialogs.Comment.Main );// InterlinkingEve.vc.createFormPanel( 'ContactInterlinking'	, Eve.Dialogs.Interlink.Main );// FoldersEve.vc.createFormPanel( 'ContactFolderDetails'	, Eve.Dialogs.Contact.FolderDetails );// Folders ContactEve.vc.createFormPanel( 'ContactFolderContacts'	, Eve.Dialogs.Contact.FolderContacts );// Column ChooserEve.vc.createFormPanel( 'ContactColumnChooser'	, Eve.Dialogs.Contact.ColumnChooser );// Custom FieldsEve.vc.createFormPanel( 'ContactCustomFields'	, Eve.Dialogs.Contact.CustomFields );// CopyMoveEve.vc.createFormPanel('ContactCopyMove'		, Eve.Dialogs.Contact.CopyMove);// Items GeneralExt.override( Eve.vc.ContactItemGeneral,{	 loadEvent		: function() {return 'modern.contact.{root}.editDetails';}	,submitEvent	: function() {return 'modern.contact.{root}.createModify';}});Ext.override( Eve.vc.ContactItemDetails,{	 loadEvent		: function() {return 'modern.contact.{root}.editDetails';}	,submitEvent	: function() {return 'modern.contact.{root}.createModify';}});Ext.override( Eve.vc.ContactItemCategories,{	 loadEvent		: function() {return 'modern.contact.{root}.editDetails';}	,submitEvent	: function() {return 'modern.contact.{root}.createModify';}});Ext.override( Eve.vc.ContactComments,{	 loadEvent		: function() {return 'modern.comment.{root}.view';}	,submitEvent	: function() {return 'modern.comment.{root}.createModify';}});Ext.override( Eve.vc.ContactInterlinking,{	 loadEvent		: function() {return 'modern.interlink.{root}.view';}	,submitEvent	: function() {return '';}});Ext.override( Eve.vc.ContactFolderDetails,{ 	  loadEvent 	: function() {return 'modern.contactFolder.{root}.edit';} 	 ,submitEvent 	: function() {return 'modern.contactFolder.{root}.createModify';}});Ext.override( Eve.vc.ContactFolderContacts,{	  loadEvent 	: function() {return 'modern.contactFolder.{root}.edit';}	 ,submitEvent 	: function() {return 'modern.contactFolder.{root}.createModify';}});// Column ChooserExt.override( Eve.vc.ContactColumnChooser,{ 	  loadEvent 	: function() {return 'modern.contactFolder.{root}.columnChooser';}	 ,submitEvent 	: function() {return 'modern.contactFolder.{root}.createModify';}});// Custom FieldsExt.override( Eve.vc.ContactCustomFields,{ 	  loadEvent 	: function() {return 'modern.contact.{root}.customFieldEditAll';} 	 ,submitEvent 	: function() {return 'modern.contact.{root}.customFieldCreateModifyAll';}});// CopyMoveExt.override( Eve.vc.ContactCopyMove, {	loadEvent 		: Ext.emptyFn	,submitEvent 	: function(){return 'modern.contact.group.executeCopyMove';}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\contact/ContactFactory.js *//*--------------------------------------------------*//** * Hyperoffice Contacts section based on ExtJS Library 2.2 December 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Contact.Factory = function() {}Ext.extend( Eve.lib.Contact.Factory, Eve.lib.Factory, {		section: 'contact'	,prefix	: 'C'		,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);				Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}		,createWest  : function(superbridge)	{		var view 	= new Eve.vc.TreePanel();		var conn 	= Eve.widgets.TreeStore;		var bridge	= new Eve.widgets.DefaultTreeBridge();				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge		: superbridge			,view			: view			,conn			: conn			,section		: this.section			,prefix			: this.prefix			,manager		: this.manager		});		// Categories		var selView = new Eve.vc.Selector();		var selBrdg	= new Eve.widgets.SelectorBridge();				superbridge.addBridge(selBrdg);		this.manager.registerComponents(selBrdg);		selBrdg.init({			superbridge		: superbridge			,view			: selView			,section		: this.section			,manager		: this.manager			,hideBodyScroll	: true		});				// Layout config.		var config = {			region		: 'west'			,layout		: 'border'			,title		: 'Contacts'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]			,items		: [{				region		: 'center'				,autoScroll	: true				,layout		: 'fit'				,border		: false				,items		: [view.get()]			}, {				region		: 'south'				//,layout		: 'fit'				,autoScroll	: true				,border		: false				,collapsible: true				,split		: true				,title		: 'Categories'				,height		: 200				,cls		: 'contact-category-selector'				,items		: [selView.get()]				,tools		: [{					id			: 'plus'					,qtip		: 'New Category'					,handler	: function() {						var btn = Ext.getCmp('contact-tb-new-category');						btn.fireEvent('click');					}				}]				,plugins: new Ext.ux.collapsedPanelTitlePlugin()			}]					}				return { view: view, config: config };	 }	 	,createCenter: function(superbridge)	{		this.view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Contact.GridBridge();		var cIcon	= new Eve.widgets.Contact.IconLayout();				conn.setSection('Contacts');				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: this.view			,conn		: conn			,section	: this.section			,manager	: this.manager		});				superbridge.addBridge(cIcon);		cIcon.init({			superbridge	: superbridge			,store		: conn.getStore()			,conn		: conn			,section	: this.section		});				var icon = cIcon.createLayout();				this.topBar = new Ext.Toolbar(bridge.getToolbar());						var config = {			layout		: "card"			,id			: "contactCardLayout"			,activeItem	: 0			,tbar		: this.topBar			,items		: [	this.view.get(), icon ]		}				return { view: this.view, config: config };	}	 	,createMenus : function(superbridge) 	{		this.amenu = new Eve.widgets.ContactAddMenu();		this.emenu = new Eve.widgets.ContactEditMenu();		this.tmenu = new Eve.widgets.ContactTreeMenu();		this.cmenu = new Eve.widgets.ContactColumnContext();				superbridge.addBridge([this.amenu, this.emenu, this.tmenu, this.cmenu]);						var data = {			superbridge	: superbridge			,section	: this.section		}				this.emenu.init(data);		this.amenu.init(data);		this.tmenu.init(data);		this.cmenu.init(data);	}	 	,createDialogs : function(superbridge)	{		var itemDlg 	= new Eve.lib.Contact.ItemDialogBridge();		var folderDlg 	= new Eve.lib.Contact.FolderDialogBridge();		var colChDlg 	= new Eve.lib.Contact.ColumnChooserDialogBridge();		var custDlg 	= new Eve.lib.Contact.CustomFieldsDialogBridge();		var cmDlg		= new Eve.lib.Contact.CopyMoveDialogBridge();		superbridge.addBridge([itemDlg, folderDlg, colChDlg, custDlg, cmDlg]);		itemDlg.addPanel(new Eve.vc.ContactItemGeneral());		itemDlg.addPanel(new Eve.vc.ContactItemDetails());		itemDlg.addPanel(new Eve.vc.ContactItemCategories());		itemDlg.addPanel(new Eve.vc.ContactComments());		itemDlg.addPanel(new Eve.vc.ContactInterlinking());		folderDlg.addPanel(new Eve.vc.ContactFolderDetails());		folderDlg.addPanel(new Eve.vc.ContactFolderContacts());		colChDlg.addPanel(new Eve.vc.ContactColumnChooser());		custDlg.addPanel(new Eve.vc.ContactCustomFields());				cmDlg.addPanel(new Eve.vc.ContactCopyMove());		itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				folderDlg.init({			superbridge	: superbridge,			section		: this.section			,origin		: 'folder'		});				colChDlg.init({			superbridge	: superbridge,			section		: this.section		});				custDlg.init({			superbridge	: superbridge,			section		: this.section		});								// Import Dialog		var importDlg = new Eve.widgets.ImportDlgBridge();		superbridge.addBridge(importDlg);		importDlg.init({			superbridge	: superbridge			,section	: this.section		});					// Export Dialog		var expDlg = new Eve.widgets.ContactExportDlgBridge();		superbridge.addBridge(expDlg);		expDlg.init({			superbridge	: superbridge			,section	: this.section		});						// Filter Dialog		var filterDlg = new Eve.widgets.FilterDlgBridge();		superbridge.addBridge(filterDlg);		filterDlg.init({			superbridge	: superbridge			,section	: this.section		});						// Start: Copy/Move		var view	= new Eve.vc.TreePanel();		var conn	= Eve.widgets.TreeStore;		var bridge	= new Eve.Contact.CopyMoveTreeBridge()				superbridge.addBridge(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix		});        cmDlg.init({			superbridge	: superbridge			,view		: view.get()			,section	: this.section		});		// End: Copy/Move								// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgContactItem 	= new Eve.lib.Contact.ItemDialogBridge();				superbridge.addBridge(dlgContactItem);				dlgContactItem.addPanel(new Eve.vc.ContactItemGeneral());		dlgContactItem.addPanel(new Eve.vc.ContactItemDetails());		dlgContactItem.addPanel(new Eve.vc.ContactItemCategories());				dlgContactItem.init({			superbridge	: superbridge			,section	: this.section + '_il'			,origin		: 'item'		});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -	}	,createRest : function(superbridge)	{		var filter = new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\contact/ContactGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Contacts section based on ExtJS Library 2.2 December 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Contact.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge,{	gridSection : 'contact'		,getToolbar : function() 	{		return this.toolbar	}		,initLocalVars : function()	{		// Fields for Grid's Reader.1		this.fields = [			 { name: 'type'				,type: 'string' }			,{ name: 'linkedItems'		,type: 'string' }			,{ name: 'created'			,type: 'string' }			,{ name: 'lastModified'		,type: 'string' }			,{ name: 'imageUrl'			,type: 'string'}			,{ name: 'editPermission'	,type: 'boolean'}			,{ name: 'deletePermission'	,type: 'boolean'}			,{ name: 'openPermission'	,type: 'boolean'}			// Fix Fields			,{ name: 'Title'			,type: 'string'}			,{ name: 'Organization'		,type: 'string'}			,{ name: 'WorkAddress'		,type: 'string'}			,{ name: 'WorkPhone'		,type: 'string'}			,{ name: 'HomePhone'		,type: 'string'}			,{ name: 'HomeFax'			,type: 'string'}			,{ name: 'MobilePhone'		,type: 'string'}			,{ name: 'EmailAddress'		,type: 'string'}			,{ name: '_index'			,type: 'int' , mapping: 'index'}						//  These are always "coming" from backend			//	and are needed for the Custom View			,{ name: 'FirstName'		,type: 'string'}			,{ name: 'LastName'			,type: 'string'}			,{ name: 'FullName'			,type: 'string'}			,{ name: 'id'				,type: 'string'}			,{ name: 'Member'			,type: 'string'}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}		];				// This is grid's reader. You'll see grid itself few more lines down.		this.reader = new Ext.data.XmlReader({			id				: 'id'			,record			: 'row'			,totalRecords	: 'total'		}, Ext.data.Record.create( this.fields ) );						// Adds a Plus/Minus icon in the left of each ro to expands grid's row. (Ext's user extention)		this.rowExpander = new Ext.grid.RowExpander({			dataIndex		: ""			,fieldName		: "type"			,enableCaching	: false 			,tpl			: new Ext.XTemplate(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td><b>{FullName}</b></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="53px" height="56px" src="{[this.imagePath(values.imageUrl)]}" />',						'</div>',						'<div>',							'<table width="100%">',							 '<tr>',								'<td>',									'Organization: {Organization}<br />',									'Title: {Title}<br />',									'Work Address: {WorkAddress}<br />',								'</td>',								'<td>',									'Work Phone: {WorkPhone}<br />',									'Home Phone: {HomePhone}<br />',									'Mobile Phone: {MobilePhone}<br />',									'Fax: {HomeFax}<br />',									'eMail: {[this.showImage(values.EmailAddress)]}<br />',								'</td>',							 '</tr>',							'</table>',						'</div>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 '</tr>',				 '</table>', {					showImage : function(email) {						if (email) {									var mailEnabled = Eve.Preference.getBoolean('mail');							var value		= '<img src="' + Eve.Resource.getIcon('arrow', 'mail') + '" /> ' + email;														if (mailEnabled) {								var b = "Eve.Resource.superbridge.broadcast(this, \'proxy_dialog\', { " +											"type	: \'mail\'" +											",func	: function() {" +												"Eve.Resource.superbridge.broadcast(this, \'mail_create_item_dlg\',{to:rec.get(\'EmailAddress\')})" +											"}" +										"})";																return '<div onmouseover="this.style.cursor=\'pointer\'" onclick="' + b + '" <img src="' + Eve.Resource.getIcon('arrow', 'mail') + '" /> ' + email + '</div>';							}							else {								return '<a href="mailto:"' + email + '>' + value + '</a>';							}						}						else {							return '<img src="' + Ext.BLANK_IMAGE_URL + '" />' + email;						}					}										,imagePath: function(img) {						img	= img || '';						img	= img.trim();						return ((img == '') ? Eve.Resource.getIcon('item-icon','contact') : img);					}				 }			)		});						// Grid's Column Model		this.columns = new Ext.grid.ColumnModel([this.rowExpander, {			header			: "<img src='" + Eve.Resource.getIcon('item-contact','contact') + "' />"			,dataIndex		: 'type'			,width			: 30			,menuDisabled	: true			,sortable		: false			,renderer		: function(value, attr, rec) {				return "<img src='" + Eve.Resource.getIcon('item-contact','contact') + "' />";			}		}, {			header  		: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex  	: 'linkedItems'			,width      	: 30			,menuDisabled	: true			,sortable		: false			,fixed			: true			,renderer		: function(value, metadata, rec) {				var icon = (value != '0') ? '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />': '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		},{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);								// - - - - - - - - - -		// Start: QuickSearch		var hdlSearch = function(el, e) {			if (e && e.getKey && e.getKey() != e.ENTER)				return;						var doSearch = function() {				var sb 	 = Ext.getCmp('btnContactSearch');				var el 	 = Ext.getCmp('contact_quick_search');								// Get Value				var val	 = el.getValue().trim();				val		 = val.replace('@', '');				val		 = val.replace('&', '');								var data = {					info 		: {						id			: this.id						,root		: this.root						,parentId	: this.parentId						,path		: this.path						,groupId    : this.groupId					}					,text		: val					,type		: sb._name					,quickSearch: true				}								this.fire('contact_modify_filter', data);				/* Majid: Wait : next lines was commented */				Eve.mask.show(Ext.getCmp('contact_grid').getEl());			}									if (this.filterIsOn) {				Ext.Msg.show({				   title	: 'Are you sure you want to clear your filter?'				   ,msg		: 'You have attempted an action that will clear your current filter. Please click OK to proceed or Cancel to return to the previous screen and preserve the filter'				   ,buttons	: Ext.Msg.OKCANCEL				   ,icon	: Ext.MessageBox.QUESTION				   ,fn		: function(btn) {						if (btn == 'ok') {							doSearch.call(this);							// Reset the filter on Front-End							this.onFilterChange({criteria: ''});						}				   }				   ,scope	: this				})			} else {				doSearch.call(this);			}					}				this.quickSearch = new Ext.form.TriggerField({			width 			: 'auto'			,triggerClass	: 'x-form-search-trigger'			,id				: 'contact_quick_search'			,onTriggerClick : hdlSearch.createDelegate(this)			,listeners: {				resize: function(cmp){					Ext.get(cmp.wrap.dom).setWidth(130);			}			}		});				this.quickSearch.on('specialKey', hdlSearch, this);		// End: QuickSearch		// - - - - - - - - - -				//New contact handler		var newContactHdl = function(){			var info = {				id			: 0				,root		: this.root				,groupId	: this.groupId				,parentId	: this.id				,path		: this.path			}			this.fire('contact_create_item_dlg', {info: info});		}				// Grid's Toolbar.		this.toolbar = {			items: [new Ext.Toolbar.SplitButton({				text 		: 'New'				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('new', 'general')				,disabled	: true				,handler	: newContactHdl.createDelegate(this)				,type 		: 'split'				//,tooltip	: Eve.Resource.getToolTip.btnNew				,menu : [{					text 		: 'Category'					,id			: 'contact-tb-new-category'					,cls 		: "x-btn-text-icon"					,icon		: Eve.Resource.getIcon('folder-new','contact')					,handler	: function() {						var info = {							id			: 0							,root		: this.root							,groupId	: this.groupId							,parentId	: this.id							,path		: this.path						}												this.fire('contact_create_folder_dlg', {info: info});					}					,scope		: this				}, {					text 		: 'Contact'					,cls 		: "x-btn-text-icon"					,icon		: Eve.Resource.getIcon('item-new','contact')					,handler	: newContactHdl					,scope		: this				}]			}), {				text 		: "Edit"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('edit', 'general')				//,tooltip	: Eve.Resource.getToolTip.btnEdit				,handler	: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						type = rec.data.type;												var data = {								info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path								,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)	// Used in Interlinking Dialog.							}							,title		: this.getRowTitle(rec)						}												this.fire("contact_edit_" + type + "_dlg", data);					}					else {						Ext.tools.msg('Select a Record', 'To Edit a Contact, You need to select a record in grid below.');					}				}				,scope	: this			}, {				text 		: "Delete"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('delete', 'general')				,handler	: this.deleteHdl				//,tooltip	: Eve.Resource.getToolTip.btnDelete				/*				,handler	: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						var type = rec.data.type;												var data = {								info	: {								id			: rec.id.split("_")[1]								,parentId	: this.id								,groupId	: this.groupId								,root		: this.root								,path		: this.path								,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)	// Used in Interlinking Dialog.							}							,title		: this.getRowTitle(rec)						}													this.fire("contact_delete_" + type + "_dlg", data);					}					else {						Ext.tools.msg('Select a Record', 'To Delete a Contact, You need to select a record in grid below.');					}				}				*/				,scope	: this					}, {				text 		: "Purge All"				//,cls 		: "x-btn-text-icon"				//,icon		: Eve.Resource.getIcon('delete', 'general')				,handler	: function() {						var selectedNode = (this.root == 'personal') ? 'personal' : 'current selected group';						Ext.MessageBox.show({							msg:	'You are about to delete all of the contacts in '+selectedNode+'\n\									once this action is taken, this data is unrecoverable.\n\									Are you sure you want to continue? '							,fn: function(btnID) {								if(btnID == 'ok'){									this.fire(this.section + '_delete_all_items', {info:{groupId: this.groupId, parentId: 0, root: this.root, path:this.path}})								}							}							,title: 'Delete Confirmation'							,buttons: Ext.MessageBox.OKCANCEL							,scope: this							});				}				,scope	: this			}, '-', {				xtype		: "splitbutton"				,id			: "btnContactFind"				,text 		: "Find"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('find', 'general')				,handler   	: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path					};										this.fire("contact_filter_dlg", {info: info});				}				,scope      : this				,menu		: [{					text		: 'Clear'					,cls 		: "x-btn-text-icon"					,icon		: Eve.Resource.getIcon('filter-clear', 'general')					,disabled	: true					,handler	: function() {						var data = {							criteria: ''							,mode	: {								base	: 'filter'								,branch	: ''							}							,info	: { root: this.root }						}												this.filter(this, this.gridSection + '_filter', data);						//this.fire(this.gridSection + '_filter', data);					}					,scope		: this				}]							}, '-', {				text 		: "Print"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('print', 'general')				,handler	: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path						,start		: this.view.get().store.lastOptions.params.start					}										this.fire("contact_print_folder", {info: info});				}				,scope		: this							}, '-', {				text 		: "Tools"				,cls 		: "x-btn-text-icon"				,icon		: Eve.Resource.getIcon('tools','contact')				,type		: 'split'				,menu		: [{					text		: 'Import'					,cls 		: "x-btn-text-icon"					,icon		: Eve.Resource.getIcon('import','contact')					,group		: 'tl' 					,handler	: function(e) {						this.fire('contact_open_import_dlg',{ root: this.root, groupId: this.groupId, grid: this.view.get()});					}					,scope		: this				}, {					text		:'Export'					,cls 		: "x-btn-text-icon"					,icon		: Eve.Resource.getIcon('export','contact')					,group		: 'tl'					,handler	: function (e) {						this.fire(this.section + '_do_export', {id: this.id, root: this.root, groupId: this.groupId});					}					,scope		: this				}]			}, {				text	:'Custom Fields'				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('custom-fields','contact')				,handler: function (e) {					var info = {						id			: this.id						,root		: this.root						,groupId	: this.groupId						,parentId	: this.parentId						,path		: this.path					}										this.fire('contact_custom_fields_dlg', {info: info});				}				,scope	:this			}, '-', {				xtype	: "splitbutton"				,text	: "List View"				,id		: "contact_list_icon_view"				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('view-list','contact')				,handler: function() { this.showMenu() }				,menu	: new Ext.menu.Menu({					items: [{						text	: "List View"						,icon	: Eve.Resource.getIcon('view-list','contact')						,cls 	: "x-btn-text-icon"						,group	: "lcv"						,handler: function(e) {							info = {								parentId: this.id								,groupId: this.groupId								,root	: this.root								,id		: 0							}														Ext.getCmp("contact_list_icon_view").setIcon(Eve.Resource.getIcon('view-list','contact'));							this.fire("contact_change_layout", {idx: 0, text: 'List View', info: info}, true);						}						,scope	: this					}, {						text	: "Card View"						,cls 	: 'x-btn-text-icon'						,icon	: Eve.Resource.getIcon('view-card','contact')						,group	: "lcv"						,handler: function(e) {							info = {								parentId: this.id								,groupId: this.groupId								,root	: this.root								,id		: 0							}														Ext.getCmp("contact_list_icon_view").setIcon(Eve.Resource.getIcon('view-card','contact'));							this.fire("contact_change_layout", {idx: 1, text: 'Card View', info: info}, true);						}						,scope	: this					}]				})			}, '->', {				xtype	: 'splitbutton'				,id		: 'btnContactSearch'				,text	: 'Search'				,handler: function() { this.showMenu() }				,menu	: new Ext.menu.Menu()			}, ' ',				this.quickSearch		]}	}		,init : function(obj)	{		Eve.widgets.Contact.GridBridge.superclass.init.call(this, obj);				this.initLocalVars();		this.conn.init(this.reader);				var store = this.conn.getStore();		var view  = new Eve.GridView({			 rowSelectorDepth	: 20			,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			,getRowCustomClass: function(record, index){				if (record.data.Member == "1")					return 'x-grid-row-gray';				else					return '';			}			,hMenuItems: [{				text	: 'Modify Columns'				,id		: 'contactModifyColumns1'				,handler: function() {					var val	 = Ext.getCmp('contactCatSelector').getValue();					var data = {						info	: {							id		: val.split('_')[1]							,root	: this.root							,groupId: this.groupId						}					}										this.fire('contact_modify_columns_dlg', data);				}				,scope	: this			}]		});				this.view.init({			id 				: 'contact_grid'			,view			: view			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Contacts'			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,enableDragDrop : true			,enableColumnHide: false			,ddGroup		: Eve.Resource.getGridGroup()			,keys			: this.getKeyMap()		});				this.registerView();	}		,onBeforeSearch : function()	{		if (this.filterIsOn) {			Ext.Msg.show({			   title	: 'Are you sure you want to clear your filter?'			   ,msg		: 'You have attempted an action that will clear your current filter. Please click OK to proceed or Cancel to return to the previous screen and preserve the filter'			   ,buttons	: Ext.Msg.OKCANCEL			   ,icon	: Ext.MessageBox.QUESTION			   ,fn		: function(btn) {					return (btn == 'ok') ? true : false;			   }			})		} else {			return true;		}	}		,hdlRowContextMenu : function(grid, rowIndex, e)	{		if (this.id == -2)		{			e.stopEvent();			return false;		}		Eve.widgets.Contact.GridBridge.superclass.hdlRowContextMenu.apply(this, arguments);	}	,registerView : function(){		Eve.widgets.Contact.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();		this.depth = 0;//TODO--PreRender		grid.on('render', function(grid){			if(Eve.Preference.get('mycontacts')== '1'){				var store = grid.store;								store.loadData(Eve.Preference.get('contactpersonalgrid'));				store.params = {					event : Eve.Resource.cmdChangePage('contact', 'personal')					,groupId: 0				};				this.setSharedSection({sharedSection : false});			}		}, this);				grid.getStore().on('load', function(ds) {			if ( this.depth == 0 && ++this.depth )				this.updateColumnModel( ds, { params: ds.param } );						if (this.id == -2)				Ext.getCmp('contactModifyColumns1').setDisabled(true);			else				Ext.getCmp('contactModifyColumns1').setDisabled(false);						setTimeout( (function(){this.depth = 0;}).createDelegate( this ), 500 );		}, this );						// - - - - - - - - - - - - - - - - - -		// Custom Handlers can go here.		// - - - - - - - - - - - - - - - - - - 		grid.on('headercontextmenu', function(grid, colIndex, e) {			var val = Ext.getCmp('contactCatSelector').getValue();			this.fire('contact_column_menu', {				info	: {					id		: val.split('_')[1]					,root	: this.root					,groupId: this.groupId				}				,pos	: e.getXY()			});		}, this);				grid.on('rowdblclick', function(el, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx);			if (this.id == -2 || rec.data.Member == "1")				return false;			if(rec) {				type = rec.data.type;								var info = {					id			: rec.id.split("_")[1]					,parentId	: this.id					,groupId	: this.groupId					,root		: this.root					,path		: this.path					,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)	// Used in Interlinking Dialog.				}								if ( type == "folder" )					this.fire("contact_activate_child_node", {info: info } );				else					this.fire("contact_edit_" + type + "_dlg", {info: info } );			}		}, this);		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm			= grid.colModel;			var rec			= grid.getStore().getAt(rowIdx);			var mailEnabled = Eve.Preference.getBoolean('mail');						// To popup compose mail			if (cm.getDataIndex(colIdx) == 'EmailAddress') {				if (mailEnabled) {					this.fire('proxy_dialog', { 						type	: 'mail'						,func	: function() {							Eve.Resource.superbridge.broadcast(this,'mail_create_item_dlg',{to:rec.get('EmailAddress')})						}					});					return;				}			}						if (cm.getDataIndex(colIdx) == 'type' && this.id != -2) {				var data = {					info	: {						id			: rec.id						,parentId 	: this.parentId						,groupId 	: this.groupId						,root		: this.root						,path		: this.path						,rec        : rec					}				}				this.fire('contact_load_icon_popup', data);			}		}, this);	}		// Hook before Grid store load for new filter	// Return false makes the process stop	,onFilterChange : function(data)	{		var btnFind = Ext.getCmp('btnContactFind');		var btnClear  = btnFind.menu.items.items[0];				if (data.criteria.trim() != '') {			btnClear.enable();			btnFind.setText('Find +');			this.filterIsOn = true;		}		else {			btnClear.disable();			btnFind.setText('Find');			this.filterIsOn = false;		}				return true;	}		,execute: function( callee, type, object )	{		switch( type ) {			case ('contact_success_modify_folder'):			case ('contact_success_move_item'):			case ('contact_reload_active_node'):				this.fetchData();				break;							default:				Eve.widgets.Contact.GridBridge.superclass.execute.apply( this, arguments );		}			}		// This method will be called after store has been loaded.	// and sets the column model from back-end's data.	,updateColumnModel : function(store, options)	{		// Prevent it from running in future store's load.		store.done = true;				var grid	= this.view.get();		var cm		= grid.getColumnModel();		var xml		= store.reader.xmlData;		var dq		= Ext.DomQuery;				var root	= dq.selectNode('fields', xml);		var temp	= root.getElementsByTagName('field');		var data	= [];		var fields = grid.store.fields;		var fieldName;		cm.config = cm.config.splice( 0, 3 );				// Apply the RowExpander & Type columns first.		Ext.apply(data, cm.config);				for (var i = 0; i < temp.length; ++i) {			var cfg = {				dataIndex	: dq.selectValue('name', temp[i])				,header		: dq.selectValue('title', temp[i])				,sortable	: true				,width		: 150				// @@XERXES@@				// ,editor 	: new Ext.form.TextField({ allowBlank : false })			}						if (cfg.dataIndex.toLowerCase() == 'emailaddress') {				cfg.renderer = function(val) {					var mailEnabled = Eve.Preference.getBoolean('mail');					var imgTag		= '<img src="' + Eve.Resource.getIcon('arrow', 'mail') + '" /> ' +val;										if (val && val.trim() != '') {						if (mailEnabled) {							return imgTag;						}						else {							return '<a href="mailto:' + val + '">' + imgTag + '</a>'						}					}											return '';				}			}						data.push(cfg);			fieldName = dq.selectValue('name', temp[i]);			if(fields.get( fieldName) != -1){				fields.add(fieldName, {name: fieldName, sortDir:Ext.DomQuery.selectValue( 'orderDir', xml, 'ASC' )})				this.fields.push({name: fieldName})			}		}				// Update the ColumnModel.		cm.setConfig(data);				// Update the Reader.		store.reader.recordType = Ext.data.Record.create(this.fields);				//Commented by Ghazal//		/*		 store.fields.items 		= this.fields;				for (var i = 0; i < this.fields.length; ++i)			store.fields.keys.push(this.fields[i].name);		*/		// Read the records with new setting,		// and add them to store manually.				var result	= store.reader.read({responseXML: xml});		grid.getBottomToolbar().unbind( store );		if(options.params === undefined){			options.params ={};			options.params.root = store.lastOptions.params.event.split('.')[2];			options.params.groupId = store.lastOptions.params.groupId;		}		store.loadRecords(result, {add: false, params: options.params}, true);		grid.getBottomToolbar().bind( store );				// Update the Search Menu Items.		var sRoot	= dq.selectNode('searchFields', xml);		var sTemp	= sRoot.getElementsByTagName('searchField');				var mSearch  = Ext.getCmp('btnContactSearch').menu;		var mHandler = function() {			var cmp = Ext.getCmp('btnContactSearch');			cmp.setText(this.text);			cmp._name = this.name;		}				mSearch.removeAll();		for (var i = 0; i < sTemp.length; ++i) {			mSearch.add(				new Ext.menu.CheckItem({					text	: dq.selectValue('title', sTemp[i])					,name	: dq.selectValue('name', sTemp[i])					,group	: 'si'					,checked: (i == 0)					,handler: mHandler				})			);		}				// Select the first Item		if (!Ext.getCmp('btnContactSearch')._name)			mSearch.items.itemAt(0).fireEvent('click')				// Add a Separator before adding Custom Fields		mSearch.add('-');						// Add Custom Fields		var cRoot	= dq.selectNode('customFields', xml);		var cTemp	= sRoot.getElementsByTagName('customField');		var tmpMenu = [];				for (var i = 0; i < cTemp.length; ++i) {			tmpMenu.push(				new Ext.menu.CheckItem({					text	: dq.selectValue('title', cTemp[i])					,name	: dq.selectValue('name', cTemp[i])					,group	: 'si'					,handler: mHandler				})			);		}				mSearch.add({			text	: 'Custom Fields'			,menu	: {	items	: tmpMenu }		});				this.syncColumnModel(0);	}});// * * * * * * * * * * * * * * * * * * * * * * * *// Contact Icon View Layout// * * * * * * * * * * * * * * * * * * * * * * * *Eve.widgets.Contact.IconLayout = Ext.extend( Eve.lib.Bridge, {	init : function(data) {		Eve.widgets.Contact.IconLayout.superclass.init.call(this, data);				this.store 	= this.conn.getStore();		this.tpl	= new Ext.XTemplate(			'<tpl for=".">',			'<div class="eve-popout" style="padding: 10px;">',				'<table width="100%">',				 '<tr>',					'<td valign="center">',						'<h3>{FullName}</h3>',					'</td>',				 '</tr>',				 '<tr>',					'<td valign="top" height=20px>',						'<hr size=1 width=100%>',					'</td>',				 '</tr>',				 '<tr>',					'<td valign="top">',						'<table cellPadding=0 cellSpacing=0 border=0 width=100%>',						 '<tr>',							'<td width=22%>Name</td>',							'<td width=22%>{FullName}</td>',							'<td width=12%></td>',							'<td width=22%>Title</td>',							'<td width=22%>{Title}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>E-Mail</td>',							'<td width=22%>{EmailAddress}</td>',							'<td width=12%></td>',							'<td width=22%>First Name</td>',							'<td width=22%>{FirstName}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>E-Mail (Alternate A)</td>',							'<td width=22%>{EmailAddress2}</td>',							'<td width=12%></td>',							'<td width=22%>Middle Name</td>',							'<td width=22%>{middleName}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>E-Mail (Alternate B)</td>',							'<td width=22%>{EmailAddress3}</td>',							'<td width=12%></td>',							'<td width=22%>Last Name</td>',							'<td width=22%>{LastName}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Home Phone</td>',							'<td width=22%>{HomePhone}</td>',							'<td width=12%></td>',							'<td width=22%>Online Nickname</td>',							'<td width=22%>{OnlineNickname}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Home Phone (Alternate)</td>',							'<td width=22%>{HomePhone2}</td>',							'<td width=12%></td>',							'<td width=22%>IRC Nickname</td>',							'<td width=22%>{IRCNickname}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Home Fax</td>',							'<td width=22%>{FaxNumber}</td>',							'<td width=12%></td>',							'<td width=22%>AIM Nickname</td>',							'<td width=22%>{AIMNickname}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Work Phone</td>',							'<td width=22%>{WorkPhone}</td>',							'<td width=12%></td>',							'<td width=22%>ICQ UIN</td>',							'<td width=22%>{ICQUIN}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Work Phone (Alternate)</td>',							'<td width=22%>{WorkPhone2}</td>',							'<td width=12%></td>',							'<td width=22%>Assistant</td>',							'<td width=22%>{Assistant}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Work Fax</td>',							'<td width=22%>{WorkFax}</td>',							'<td width=12%></td>',							'<td width=22%>Manager</td>',							'<td width=22%>{Manager}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Pager</td>',							'<td width=22%>{Pager}</td>',							'<td width=12%></td>',							'<td width=22%>Birth Date</td>',							'<td width=22%>{Birthdate}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Mobile</td>',							'<td width=22%>{MobilePhone}</td>',							'<td width=12%></td>',							'<td width=22%>Personal Webpage</td>',							'<td width=22%>{Webpage}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Mobile (Alternate)</td>',							'<td width=22%>{MobilePhone2}</td>',							'<td width=12%></td>',							'<td width=22%>Company Webpage</td>',							'<td width=22%>{CompanyWebpage}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Assistant Phone</td>',							'<td width=22%>{AssistantPhone}</td>',							'<td width=12%></td>',							'<td width=22%>Company</td>',							'<td width=22%>{Organization}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Manager Phone</td>',							'<td width=22%>{ManagerPhone}</td>',							'<td width=12%></td>',							'<td width=22%>Job Title</td>',							'<td width=22%>{JobTitle}</td>',						 '</tr>',						 '<tr>',							'<td width=22%>Hyperoffice Login</td>',							'<td width=22%>{HyperofficeLogin}</td>',							'<td width=12%></td>',							'<td width=22%></td>',							'<td width=22%></td>',						 '</tr>',						 '<tr>',							'<td width=22%>Home Address</td>',							'<td width=22%>{Address}</td>',							'<td width=12%></td>',							'<td width=22%>Work Address</td>',							'<td width=22%>{WorkAddress}</td>',						 '</tr>',						'</table>',					'</td>',				  '</tr>',				'</table>',			'</div>',			'</tpl>'		)	}		,getButtons : function()	{		var doToggle = function(btn, pressed) {			var el = Ext.getCmp('contact_customview').getEl();						/* Majid: Wait : next lines was commented */			Eve.mask.show(el);						var ct		= btn.container;			var info	= {				root		: this.root				,parentId	: this.parentId				,path		: this.path				,groupId	: this.groupId			}						if (ct.filterName === undefined && pressed) {				// Add New Filter				this.fire('contact_modify_filter', {info: info, letter: btn.text});				ct.filterName = btn.text;			}			else {				if (ct.filterName == btn.text && !pressed) {					// Remove All Filters					this.fire('contact_modify_filter', {info: info, letter: 'All'});					Ext.getCmp('btnSortAll').toggle(true);					delete ct.filterName;				}				else if(pressed) {					// Change Filter					this.fire('contact_modify_filter', {info: info, letter: btn.text});					ct.filterName = btn.text;				}							}		}				// '123' Button		var buttons = [{			xtype			: 'button'			,text			: '123'			,enableToggle	: true			,toggleGroup	: 'sb'			// Just prevent for error in Ext			,getSize		: function() { return {width: 10} }			,listeners		: {				toggle	: doToggle				,scope	: this			}		}];				// 'A' to 'Z' Buttons		for (var i = 65; i < 91; i++)		{			buttons.push({				xtype			: 'button'				,text			: String.fromCharCode(i)				,enableToggle	: true				,toggleGroup	: 'sb'				// Just prevent for error in Ext				,getSize		: function() { return {width: 10} }				,listeners		: {					toggle	: doToggle					,scope	: this				}			})		}				// 'All' Button		buttons.push({			xtype			: 'button'			,text			: 'All'			,id				: 'btnSortAll'			,enableToggle	: true			,pressed		: true			,toggleGroup	: 'sb'			// Just prevent for error in Ext			,getSize		: function() { return {width: 10} }		});				return buttons;	}		,getTemplate : function()	{		var that = this;		return new Ext.XTemplate(		//'<div class="eve-container" style="margin:20px; width:400px;" onmouseover="this.style.cursor=\'pointer\'">',			'<table width="45%" class="ev-contact-dv-selector eve-container" style="font: 11px Tahoma; border: 1px solid #D0D0D0; margin:5px 20px;">',			 '<tr>',				'<td colspan="4" class="x-panel-header">{[this.getTitle(values)]}<td>',			 '</tr>',			 '<tr>',				'<td width="60px"><img src="{[this.imagePath(values.imageUrl)]}" height="56" width="53" /></td>',				'<td width="80px">',					'<div>Organization:</div>',					'<div>Title:</div>',					'<div>Work Address:</div>',					'<div>Work Phone:</div>',					'<div>E-Mail Address:</div>',				'<td>',				'<td>',					'<div>{Organization}&nbsp;</div>',					'<div>{Title}&nbsp;</div>',					'<div>{WorkAddress}&nbsp;</div>',					'<div>{WorkPhone}&nbsp;</div>',					'<div><span onclick="{[this.mailHandler(values)]}">{EmailAddress}</span></div>',				'<td>',			 '</tr>',			'</table>',		//'</div>',		{				imagePath: function(img) {					  img = img || '';						img = img.trim();						return (img=='') ? Eve.Resource.getIcon('item-icon','contact') : img;				}				,mailHandler: function(values) {					var func = 'function(){ Eve.Resource.superbridge.broadcast(this,\'mail_create_item_dlg\',{to:\''+values.EmailAddress+'\'}) }';					var temp = 'Eve.Resource.superbridge.broadcast( window, \'proxy_dialog\', { type:\'mail\', func:' + func + ' } )';					return temp;				}				,getTitle: function(values) {					if (values.FullName && values.FullName.trim() != '')						return values.FullName;					else						return values.Organization;				}			}		)	}		,createLayout : function()	{		return {			layout		: 'border'			,border		: false			,items		: [{				region		: 'north'				,layout		: 'column'				,border		: false				,height		: 22				,margins	: '5'				,bodyStyle	: 'background: none transparent'				,items		: this.getButtons()			}, {				region		: 'center'				,layout		: 'fit'				,border		: false				,items		: {					xtype		: 'customview'					,store 		: this.store					,bbar		: new Ext.PagingToolbar({ store: this.store, pageSize: Eve.Preference.getInteger("itemsperpage") })					,template	: this.getTemplate()					,dvConfig	: { 						id				: "contact_customview"						,itemSelector	: 'table.ev-contact-dv-selector'						,singleSelect	: true						,selectedClass  : 'contact-customview-selected-class'						,listeners		: {							click			: function(dv, index, el, e) {								var sm = Ext.getCmp('contact_grid').getSelectionModel();								sm.selectRow(index);							}							,dblclick		: function(dv, index, el, e) {								var rec		= dv.getRecord(el);								var info	= {										id			: rec.id.split('_')[1]										,root		: this.root										,parentId	: this.parentId										,path		: this.path									};																	if ( this.groupId )									info.groupId = this.groupId;																	var data	= {									idx		: index									,target	: el									,rec	: rec									,info	: info								}																this.fire("contact_edit_item_dlg"/*contact_load_icon_popup"*/, data);							}							,contextmenu	: function(dv, index, el, e) {								var grid = Ext.getCmp('contact_grid');								// Tricky one								grid.fireEvent('rowcontextmenu', grid, index, e)							}							,scope			: this						}					}				}			}]		}	}		,showIconLayout : function(d) {		if (d.idx == 1) {			// Remove all selections in grid			Ext.getCmp('contact_grid').getSelectionModel().clearSelections();			Ext.getCmp('contact_customview').clearSelections();		}				this.layout	= Ext.getCmp("contactCardLayout");		this.layout.getLayout().setActiveItem(d.idx);		Ext.getCmp("contact_list_icon_view").setText(d.text);	}		,showPopup : function(d)	{		var tpl	= new Ext.XTemplate(			'<tpl for=".">',			'<div class="eve-popout" style="padding: 10px;">',				'<table width="100%">',				 '<tr>',					'<td valign="center"><h3>{FullName}</h3></td>',				 '</tr>',				 '<tr>',					'<td valign="top" height=20px><hr size=1 width=100%></td>',				 '</tr>',				 '<tr>',					'<td valign="top">',						'<div>',							'{[this.makeHtml( "Name", "FullName", values )]}',							'{[this.makeHtml( "Title", "Title", values )]}',							'{[this.makeHtml( "E-Mail", "EmailAddress", values )]}',							'{[this.makeHtml( "First Name", "FirstName", values )]}',							'{[this.makeHtml( "E-Mail (Alternate A)", "EmailAddress2", values )]}',							'{[this.makeHtml( "Middle Name", "middleName", values )]}',							'{[this.makeHtml( "E-Mail (Alternate B)", "EmailAddress3", values )]}',							'{[this.makeHtml( "Last Name", "LastName", values )]}',							'{[this.makeHtml( "Home Phone", "HomePhone", values )]}',							'{[this.makeHtml( "Online Nickname", "OnlineNickname", values )]}',							'{[this.makeHtml( "Home Phone (Alternate)", "HomePhone2", values )]}',							'{[this.makeHtml( "IRC Nickname", "IRCNickname", values )]}',							'{[this.makeHtml( "Home Fax", "FaxNumber", values )]}',							'{[this.makeHtml( "AIM Nickname", "AIMNickname", values )]}',							'{[this.makeHtml( "Work Phone", "WorkPhone", values )]}',							'{[this.makeHtml( "ICQ UIN", "ICQUIN", values )]}',							'{[this.makeHtml( "Work Phone (Alternate)", "WorkPhone2", values )]}',							'{[this.makeHtml( "Assistant", "Assistant", values )]}',							'{[this.makeHtml( "Work Fax", "WorkFax", values )]}',							'{[this.makeHtml( "Manager", "Manager", values )]}',							'{[this.makeHtml( "Pager", "Pager", values )]}',							'{[this.makeHtml( "Birth Date", "Birthdate", values )]}',							'{[this.makeHtml( "Mobile", "MobilePhone", values )]}',							'{[this.makeHtml( "Personal Webpage", "Webpage", values )]}',							'{[this.makeHtml( "Mobile (Alternate)", "MobilePhone2", values )]}',							'{[this.makeHtml( "Company Webpage", "CompanyWebpage", values )]}',							'{[this.makeHtml( "Assistant Phone", "AssistantPhone", values )]}',							'{[this.makeHtml( "Company", "Organization", values )]}',							'{[this.makeHtml( "Manager Phone", "ManagerPhone", values )]}',							'{[this.makeHtml( "Job Title", "JobTitle", values )]}',							'{[this.makeHtml( "Hyperoffice Login", "HyperofficeLogin", values )]}',							'{[this.makeHtml( "Home Address", "Address", values )]}',							'{[this.makeHtml( "Work Address", "WorkAddress", values )]}',						'</div>',					'</td>',				  '</tr>',				'</table>',			'</div>',			'</tpl>', {				makeHtml : function(title, name, data) {					var value = data[name];					if (value) {						// Format HomeAddress						if (name == 'Address') {							var hCity	 = (data.City) ? data.City + ', ' : '';							var hState	 = data.State	|| '';							var hZip	 = data.Zip		|| '';							var hCountry = data.Country	|| '';							value = value + '<br/>' + hCity + hZip + ' ' + hState + '<br />' + hCountry;						}						// Format WorkAddress						if (name == 'WorkAddress') {							var wCity	 = (data.WorkCity) ? data.WorkCity + ', ' : '';							var wState	 = data.WorkState	|| '';							var wZip	 = data.WorkZip		|| '';							var wCountry = data.WorkCountry	|| '';							value = value + '<br/>' + wCity + wZip + ' ' + wState + '<br />' + wCountry;						}						var html = '<div style="float:left; width:50%">' +									'<div style="width:45%; display:inline-block; vertical-align:top;">' + title + '</div>' +									'<div style="width:50%; display:inline-block;">' + value + '</div>' +								   '</div>'						return html;					}					return '';				}			}		)		var rd	= new Ext.data.XmlReader({			record 		: 'data'			,success	: '@success'			,id			: 'id'		}, [			 {name: 'FirstName', 		type: 'string'}			,{name: 'middleName', 		type: 'string'}			,{name: 'LastName', 		type: 'string'}			,{name: 'FullName',			type: 'string'}			,{name: 'Organization',		type: 'string'}			,{name: 'JobTitle',			type: 'string'}			,{name: 'EmailAddress',		type: 'string'}			,{name: 'EmailAddress2',	type: 'string'}			,{name: 'EmailAddress3',	type: 'string'}			,{name: 'WorkPhone', 		type: 'string'}			,{name: 'WorkPhone2', 		type: 'string'}			,{name: 'WorkFax',			type: 'string'}			,{name: 'HomePhone',		type: 'string'}			,{name: 'HomePhone2',		type: 'string'}			,{name: 'FaxNumber',		type: 'string'}			,{name: 'MobilePhone', 		type: 'string'}			,{name: 'MobilePhone2', 	type: 'string'}			,{name: 'Address',			type: 'string'}			,{name: 'City',				type: 'string'}			,{name: 'State',			type: 'string'}			,{name: 'Zip',				type: 'string'}			,{name: 'WorkAddress',		type: 'string'}			,{name: 'WorkCity',			type: 'string'}			,{name: 'WorkState',		type: 'string'}			,{name: 'WorkZip',			type: 'string'}			,{name: 'OnlineNickname',	type: 'string'}			,{name: 'AIMNickname',		type: 'string'}			,{name: 'IRCNickname',		type: 'string'}			,{name: 'ICQUIN',			type: 'string'}			,{name: 'Title',			type: 'string'}			,{name: 'Birthdate',		type: 'string'}			,{name: 'Assistant',		type: 'string'}			,{name: 'Manager',			type: 'string'}			,{name: 'Webpage',			type: 'string'}			,{name: 'CompanyWebpage',	type: 'string'}			,{name: 'ManagerPhone',		type: 'string'}			,{name: 'AssistantPhone',	type: 'string'}			,{name: 'HyperofficeLogin',	type: 'string'}			,{name: 'Pager',		type: 'string'}		])				var info	= rd.read(d.response, {add: false}, true).records[0].data;		delete rd;				// Hanlder for Print & Popout tools.		var toolHandler = function(e, el, panel) {			var content = panel.items.itemAt(0).body.dom.innerHTML;			var page	= window.open("about:blank", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=800, height=500");						setTimeout( function() {				var body = "<div style='font-size: 10px; background-color: #FFFFCC; width:100%; height:100%;'>" + content;				page.focus();								if (el.dom.qtip.toLowerCase() == 'print') {					body += "<div style='position:absolute; right:10px; top:10px;'><input type='submit' value='Print' onclick='window.print();' /></div>";				}								body += "</div>";								page.document.body.innerHTML	= body;				page.document.body.style.margin = "0px";			}, 100);		}				var el = new Ext.Window({			layout		: 'fit'			,frame		: true			,modal		: true			,floating	: true			//,autoHeight	: true			,width		: 600			,style		: "position:absolute;"			,tools		: [{				id			: 'print'				,qtip		: "Print"				,handler	: toolHandler			}, {				id			: 'restore'				,qtip		: "Popout"				,handler	: toolHandler			}]			,items		: [{				html		: tpl.apply(info)			}]		})				el.show(d.target);				// Check permission.		var pr = d.rec || d.info.rec;		this.fire('contact_set_active_row', {rec: pr})	}		,execute : function(callee, type, data) {		switch(type) {			case ('contact_set_active_node'):				Ext.apply(this, data.info);				break;						case ('contact_change_layout'):				this.showIconLayout(data);				break;							case ('contact_show_icon_popup'):				this.showPopup(data);				break;							case ('show_section'):				if (this.section == Eve.SectionManager.getSectionId( data.sectionName )) {					this.id 	 = data.info.id || 0;					this.groupId = data.info.groupId || 0;					this.root	 = (data.info.groupId == '0') ? 'personal' : 'group';					this.path	 = data.info.path || '\\';					this.parentId= 0;				}				break;		}	}})/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\contact/ContactMenu.js *//*--------------------------------------------------*//** * Hyperoffice Contact section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */ // -----------------------------------------------------------------------// Contact Base Edit Menu// -----------------------------------------------------------------------Eve.widgets.ContactBaseEditMenu = Ext.extend( Eve.widgets.Menu, {	folder_menu : {}	,item_menu 	: {}	,type		: {}	,init : function(data) {		Eve.widgets.BaseEditMenu.superclass.init.call(this, data);	}	,registerView : function( brdg )	{		this.item_menu.on('itemclick', function(bi)		{			var data = {				title	: this.title				,isMultiSelected : this.isMultiSelected				,info	: {					id			: this.id					,rawId		: this.rawId					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: this.root					,path		: this.path					,rec        : this.record				}			}			switch(bi.id)			{				case 'edit':					this.fire(this.section + '_edit_item_dlg'  , data);					break;								case 'delete':					this.fire(this.section + '_delete_item_dlg'  , data );					break;								case 'menuContactCopy':					this.fire(this.section + '_copy_item_dlg'  , data );					break;								case 'menuContactOpen':					this.fire('contact_load_icon_popup', data);					break;				case 'linked':					this.fire('contact_interlinking_dlg', data);					break;				case 'comments':					this.fire('contact_comment_dlg', data);					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_editmenu'):				Ext.apply(this, obj.info);				this.title	= obj.title;				this.record	= obj.rec				this.isMultiSelected = obj.isMultiSelected;				var pos		 = obj.pos;				var menuCopy = Ext.getCmp('menuContactCopy');								//Commented by Ghazal, Mr.Ghasemi told me				/*if (this.root == 'personal') {					menuCopy.enable();				} else {					menuCopy.disable();				}*/				this.item_menu.showAt(pos);				break;		}	}});// -----------------------------------------------------------------------// Contact Grid Edit Context Menu// -----------------------------------------------------------------------Eve.widgets.ContactEditMenu = Ext.extend( Eve.widgets.ContactBaseEditMenu, {	init : function(data)	{		Eve.widgets.ContactEditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}, {				text	: 'Copy'				,id		: 'menuContactCopy'				,icon	: Eve.Resource.getIcon('item-copy','contact')			}, {				text	: "Open Contact"				,id		: "menuContactOpen"				,icon	: Eve.Resource.getIcon('item-open','contact')			}, '-', {				text	: "Comments"				,id		: "comments"			}, {				text	: "Linked Items"				,id		: "linked"			}]		});		this.folder_menu = new Ext.menu.Menu({			items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.registerView();	}});// -----------------------------------------------------------------------// Contact Grid Add Context Menu// -----------------------------------------------------------------------Eve.widgets.ContactAddMenu = Ext.extend( Eve.widgets.BaseAddMenu, {	init : function(data)	{		Eve.widgets.ContactAddMenu.superclass.init.call(this, data);				this.menu = new Ext.menu.Menu({			items : [{				text	: "New Category"				,id		: 'folder'				,icon	: Eve.Resource.getIcon('folder-new','contact')			}, {				text	: "New Contact"				,id 	: 'item'				,icon	: Eve.Resource.getIcon('item-new','contact')			}]		});				this.registerView();	}});// -----------------------------------------------------------------------// Contact Tree Add Context Menu// -----------------------------------------------------------------------Eve.widgets.ContactTreeMenu = Ext.extend( Eve.widgets.BaseTreeMenu, {	init : function(data)	{		Eve.widgets.ContactTreeMenu.superclass.init.call(this, data);		this.foldermenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','contact')				}, {					text	: "Edit"					,id		: 'edit'					,icon	: Eve.Resource.getIcon('edit', 'general')				}, {					text	: "Delete"					,id		: 'delete'					,icon	: Eve.Resource.getIcon('delete', 'general')			}]		});		this.groupmenu = new Ext.menu.Menu({			items : [{					text	: "Add"					,id		: 'add'					,icon	: Eve.Resource.getIcon('folder-new','contact')			}]		});				this.registerView();	}	,registerView : function(){		this.groupmenu.on('itemclick', function( bi ) {			switch( bi.id ){				case 'add':					this.fire(this.section + '_create_folder_dlg'  , { info: {id: 0, groupId : this.groupId, parentId: 0, root: this.root, path: this.path} });					break;			}		}, this );	}});// -----------------------------------------------------------------------// Contact Modify Column Context Menu// -----------------------------------------------------------------------Eve.widgets.ContactColumnContext = Ext.extend( Eve.widgets.Menu, {	init : function(data)	{		Eve.widgets.ContactColumnContext.superclass.init.call(this, data);				this.menu = new Ext.menu.Menu({			items : [{				text		: 'Modify Columns'				,id			: 'contactModifyColumns2'				,icon		: Eve.Resource.getIcon('modify-columns','contact')			}]		});				this.registerView();	}	,registerView : function()	{		this.menu.on('itemclick', function(bi) {			switch(bi.id) {				case 'contactModifyColumns2':					this.fire(this.section + '_modify_columns_dlg', {info: {id: this.id, root: this.root, groupId: this.groupId}});					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_column_menu'):				this.id			= obj.info.id;				this.root		= obj.info.root;				this.groupId	= obj.info.groupId;				this.menu.showAt(obj.pos);				break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\contact/ContactDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Contact section based on ExtJS Library 2.2 December 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// * * * * * * * * * * * * * * * * * * * * // 	Item , Comments, Interlinking// * * * * * * * * * * * * * * * * * * * * Eve.lib.Contact.ItemDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Contact.ItemDialogBridge.superclass.init.call(this, data);				var items	= (this.isIL()) ? ["General", "Details", "Categories"] : ["General", "Details", "Categories", "Comments", "Linked Items"];		var tab		= {			items	: items			,related: [ [0, 1, 2] ]			,main	: [0, 1]		}				var dialog	= {			width 	: 700			,height : 600			,y		: 10			,title	: 'Contacts'		}		//this.createDialog({tab: tab ,dialog: dialog, preRender: !this.isIL()})		this.createDialog({tab: tab ,dialog: dialog, preRender: false})				// Register handlers		this.registerViews();	}		,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset all Flags.		this.clearLoaded();				// Reset Image		Ext.get(this.section + 'imgContactAvatar').set({ src: Eve.Resource.getIcon('item-icon','contact') })				var parent	= Ext.getCmp(this.section + 'detail_customfields');		parent.items.each( function(r) {			r.items.each( function(q) {				r.remove( q );			})			r.getLayoutTarget().dom.innerHTML = '';		});				parent.doLayout();	}		,registerViews : function()	{		// Handler for Edit Work Address & Edit Home Address		Ext.getCmp(this.section + 'btnContactEditHomeAddress').on('click', this.showHomeWorkAddress.createDelegate(this, ['Home']), this)		Ext.getCmp(this.section + 'btnContactEditWorkAddress').on('click', this.showHomeWorkAddress.createDelegate(this, ['Work']), this)				Ext.getCmp(this.section + 'userGroups').on('select', function(el, newVal, oldVal){            this.loadForm(0);		},this);		// Handler for Image Upload Button		Ext.getCmp(this.section + 'btnContactUpload').on('click', function(btnUpload) {			if (this.mode == 'create') {				Ext.tools.msg('Prohibited action', 'You need to save your contact first.');				return;			}						var that = this;						var fp = new Eve.UploadFormPanel({				fileUpload	: true				,frame		: true				,autoHeight	: true				,bodyStyle	: 'padding: 10px 10px 0 10px;'				,labelWidth	: 50				,defaults	: {					anchor		: '95%'				//	,allowBlank	: false					,msgTarget	: 'side'				}				,items		: [{					xtype		: 'fileuploadfield'					,emptyText	: 'Select an image'					,fieldLabel	: 'Photo'					,name		: 'uploaded_data'					,buttonCfg	: {						text		: ''						,iconCls	: 'eve-upload-icon'					}				}]				,buttons	: [{					text		: 'Save'     				,handler	: function(){						if (fp.getForm().isValid()) {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Uploading photo...'								,params	: {									event	: 'modern.contact.' + that.root + '.uploadImage'									,id		: that.id									,groupId: that.groupId									,m_shariat_m: true								}								,success: function(fp, o) {									var val = Ext.DomQuery.selectValue('imageUrl', o.response.responseXML)									if (val !== undefined) {										if (!val || val.trim() == '' ) {											Ext.Msg.alert("Error", "There's an error while uploading image!");											val = Eve.Resource.getIcon('item-icon','contact');										}																				Ext.get(that.section + 'imgContactAvatar').set({ src: val });										that.winImage.hide();									}									else{	 									var text = o.response.responseText;										Ext.Msg.alert('Error', text);									}								}								/*,failure: function(form, action) {									var text = action.response.responseText;									Ext.Msg.alert('Error', text);								}*/							});						}					}				}, {					text	: 'Reset'					,handler: function() {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Removing photo...'								,params	: {									event	: 'modern.contact.' + that.root + '.resetImage'									,id		: that.id									,groupId: that.groupId								}								,success: function() {									fp.getForm().reset();									Ext.get(that.section + 'imgContactAvatar').set({src: Eve.Resource.getIcon('item-icon','contact') });									that.winImage.hide();								}							});					}				}]			});						that.winImage = new Ext.Window({				layout		: 'form'				,width		: 400				,title		: 'Image Upload'				,resizable	: false				,modal		: true				,items		: [fp]			});						that.winImage.show(btnUpload);					}, this);	}		// Shows the Edit Address Popup	,showHomeWorkAddress : function(aType)	{		// Form Fields		var hdnStreet	= Ext.getCmp(this.section + aType + 'Street');		var hdnCity		= Ext.getCmp(this.section + aType + 'City');		var hdnState	= Ext.getCmp(this.section + aType + 'State');		var hdnZip		= Ext.getCmp(this.section + aType + 'Zip');		var hdnCountry	= Ext.getCmp(this.section + aType + 'Country');				var that = this;				// Start: Creating and showing the Address Popup		var hdlSubmit = function() {			if ( Ext.getCmp(that.section + 'ContactAddressForm').getForm().isValid() ) {				hdnStreet.setValue(txtStreet.getValue());				hdnCity.setValue(txtCity.getValue());				hdnState.setValue(txtState.getValue());				hdnZip.setValue(txtZip.getValue());				hdnCountry.setValue(txtCountry.getValue());								Ext.getCmp(that.section + 'txtContactAll' + aType + 'Address').setValue(					txtStreet.getValue()  + '\n' + [txtCity.getValue(), txtState.getValue(), txtZip.getValue(), txtCountry.getValue()].join(' ')				);								win.destroy();			}		}				var win	 = new Ext.Window({			width		: 500			,height		: 260			,layout		: 'fit'			,title		: aType + ' Address'			,modal		: true			,resizable	: false			,items		: [{				xtype		: 'form'				,id			: this.section + 'ContactAddressForm'				,frame		: true				,bodyStyle	: 'padding: 10px'				,items		: [{					xtype		: 'textarea'					,id			: this.section + 'txtContactStreet'					,fieldLabel	: 'Street'					,value		: hdnStreet.getValue()					,maxLength	: 350					,anchor		: '100%'				}, {					xtype		: 'textfield'					,id			: this.section + 'txtContactCity'					,fieldLabel	: 'City'					,value		: hdnCity.getValue()					,maxLength	: 75					,anchor		: '100%'				}, {					xtype		: 'textfield'					,id			: this.section + 'txtContactState'					,fieldLabel	: 'State/Province'					,value		: hdnState.getValue()					,maxLength	: 75					,anchor		: '100%'				}, {					xtype		: 'textfield'					,id			: this.section + 'txtContactZip'					,fieldLabel	: 'Zip/Postal Code'					,value		: hdnZip.getValue()					,maxLength	: 30					,anchor		: '100%'				}, {					xtype		: 'textfield'					,id			: this.section + 'txtContactCountry'					,fieldLabel	: 'Country/Region'					,value		: hdnCountry.getValue()					,maxLength	: 75					,anchor		: '100%'				}]				,buttons: [{					text	: 'Done'					,handler: hdlSubmit					,scope	: this.showHomeWorkAddress				}]			}]		})				win.show();		// End: Creating and showing the Address Popup								// Popup Fields		var txtStreet	= Ext.getCmp(this.section + 'txtContactStreet');		var txtCity		= Ext.getCmp(this.section + 'txtContactCity');		var txtState	= Ext.getCmp(this.section + 'txtContactState');		var txtZip		= Ext.getCmp(this.section + 'txtContactZip');		var txtCountry	= Ext.getCmp(this.section + 'txtContactCountry');	}		,augment : function(callee, tabIndex, state )	{		var obj = callee.params;				// check dialog pop from mail or not		if(this.isFromMail){			this.groupId 	= Ext.getCmp(this.section + 'userGroups').getValue() || 0;			this.root 		= (parseInt(this.groupId) > 0) ? 'group': 'personal';			obj.email 		= this.email;			obj.FirstName 	= this.fName;			obj.LastName 	= this.lName;			//obj.MiddleName 	= this.mName;			obj.FullName    = this.fullName;						if(state == 'load'){				obj.event = 'modern.contact.'+ this.root +'.editByEmail';				obj.MiddleName 	= this.mName;			}			else{			    obj.event = this.panels[tabIndex].submitEvent().replace('{root}', this.root);			}		}		//setting hidden fields		if(state == 'submit'){			var fields = ['EmailField', 'PhoneField1', 'PhoneField2', 'PhoneField3', 'PhoneField4'];			var btns = ['EmailButton', 'PhoneButton1', 'PhoneButton2', 'PhoneButton3', 'PhoneButton4'];			for(var i=0; i<5; i++){				var val = Ext.getCmp( this.section + fields[i]).getValue();				var btn = Ext.getCmp( this.section + btns[i]);				var hdn = Ext.getCmp(btn._id);				hdn.setValue(val);			}		}						//if (this.mode != 'create')			obj.id = this.id;		if (this.root == 'group')			obj.groupId = this.groupId;				obj.parentId = this.parentId;		obj.path	 = this.path;						var idx = this.getIndex(this.getTabPanel().activeTab);		switch(idx) {			// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}				return callee;	}		,showHideCmp : function()	{		if (this.isFromMail) {		 	Ext.getCmp(this.section + 'groupsPanel').show();		} else {		    Ext.getCmp(this.section + 'groupsPanel').hide();		}	}		,controller : function(obj)	{		this.id 		= obj.info.id || 0;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack;				this.isFromMail = obj.isFromMail || false;		if(this.isFromMail){			this.groupId 	= Ext.getCmp(this.section + 'userGroups').getValue()|| 0;			this.root 		= (parseInt(this.groupId) > 0) ? 'group': 'personal';			this.email 		= obj.mail;			this.fName 		= obj.fName;			this.mName		= obj.mName;			this.lName 		= obj.lName;			this.fullName 	= obj.fullName;		}				this.title		= obj.title;		if (!this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;		}		try{		this.panels[0].reset();		this.panels[1].reset();		}catch(e){}		if (! this.isIL()) {			this.panels[this.idxComments].reset();		}				// Check Elements.		this.showHideCmp();		this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type)		{			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				if (!this.getLoaded(0))					this.loadForm(0);								break;							case (this.section + '_create_item_dlg'):				this.mode = 'create';				this.controller(data);				this.loadForm(0);				break;			case (this.section + '_create_from_mail_dlg'):				this.mode = 'create';				this.controller(data);			    //Ext.getCmp(this.section + 'EmailField').setValue(data.mail);			    //Ext.getCmp(this.section + 'EmailAddress').setValue(data.mail);			   	//Ext.getCmp('contactDetailsFirstName').setValue(data.fName);			    //Ext.getCmp('contactDetailsLastName').setValue(data.lName);			    //Ext.getCmp('contactDetailsFullName').setValue(data.fullName);				this.loadForm(0);			    			    break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_comment_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxComments);				// ...Clear its load status ;)				this.clearLoaded(0);				break;			case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_interlinking_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxInterlink);				// ...Clear its load status ;)				this.clearLoaded(0);				break;						case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}	}		,createCustomFields : function(xml)	{		var counter	= 0;		var parent	= Ext.getCmp(this.section + 'detail_customfields');		var store	= new Ext.data.Store({			reader		: new Ext.data.XmlReader({				record 		: 'customField'				,success	: '@success'				,id			: 'id'			}, [				 {name: 'name', 		type: 'string'}				,{name: 'label', 		type: 'string'}				,{name: 'type', 		type: 'string'}				,{name: 'classType',	type: 'string'}				,{name: 'value',		type: 'string'}				,{name: 'option',		type: 'string'}				,{name: 'optionValue',	type: 'string'}				,{name: 'selected',		type: 'string'}			])		});				store.loadRecords(store.reader.read(xml), {add: false}, true);						store.each( function(rec) {			var el			= {};			var classType	= rec.get('classType');			var label		= rec.get('label');						if (label.length > 13)				label = label.substr(0, 13) + '...';						switch(rec.get('type'))	{				// TextBox				case "textBox":					var xt = (classType == 'date') ? 'datefield' : 'textfield';										if (classType == 'date'){						el = {							xtype		: xt							,fieldLabel	: label							,name		: rec.get('name')							,value		: rec.get('value')							,anchor		: '95%'							,format 	: Eve.Preference.get('dateFormat')						}					}					else{						el = {							xtype		: xt							,fieldLabel	: label							,name		: rec.get('name')							,value		: rec.get('value')							,anchor		: '95%'						}					}										// Check class type to set validator					switch (classType) {						case 'smallText':							el.maxLength = 50;							break;													case 'mediumText':							el.maxLength = 100;							break;													case 'largeText':							el.maxLength = 350;							break;												case 'integer':							el.xtype = 'numberfield';							break;													case 'decimal':							el.xtype = 'numberfield';							el.decimalPrecision = 8;							break;													case 'percent':							el.xtype = 'numberfield';							el.validator = function(val) { return ((val <= 100) && (val >= 0)); }							break;													case 'currency':							el.xtype = 'numberfield';							el.decimalPrecision = 4;							break;												case 'date':							el.value = rec.get('value').split(' ')[0]							break;					}										break;									// ComboBox				case "dropdown":					var options = rec.get('option').split(',');					var opt2 = [];										for (var i =0; i < options.length; i++) {						opt2[i]		= new Array(1);						opt2[i][0]	= options[i];					}										el = {						xtype			: 'combo'						,fieldLabel		: label						,name			: rec.get('name')						,mode         	: 'local'						,displayField 	: 'text'						,typeAhead 		: true						,editable		: false						,selectOnFocus 	: true						,forceSelection	: true						,triggerAction 	: 'all'						,anchor			: '95%'						,store			: new Ext.data.SimpleStore({							fields	: ['text']							,data	: opt2						})						,value			: rec.get('selected')					}					break;									// RadioButton				case "radio":					var options	= rec.get('option').split(',');										// If it's Yes/No field, its label differs from its value					if (rec.get('optionValue')) {						var values	= rec.get('optionValue').split(',');					}										var items	= [];					el = {						xtype			: 'radiogroup'						,fieldLabel		: label						,name			: rec.get('name')						,columns		: [90, 90]					}										for (var i = 0; i < options.length; ++i) {						var label = (values !== undefined) ? values[i].trim() : options[i].trim();												items.push({							boxLabel	: label							,name		: rec.get('name')							,inputValue	: options[i].trim()							,checked	: rec.get('selected') == options[i]						})					}										el.items = items;					break;			}						el.cls = "contact-custom-fields";			parent.addToColumn(counter % 2, el);			counter++;		}, this);				// Gee, Attaboy...		delete store;	}		,loadSuccess : function(res)	{		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// General			case 0:						// Details			case 1:				// Important! Reset field labels before setting values				Ext.getCmp(this.section + 'EmailButton').setText('Primary Email');				Ext.getCmp(this.section + 'PhoneButton1').setText('Work Phone');				Ext.getCmp(this.section + 'PhoneButton2').setText('Home Phone');				Ext.getCmp(this.section + 'PhoneButton3').setText('Mobile Phone');				Ext.getCmp(this.section + 'PhoneButton4').setText('Work Fax');				// Set default value for each field				Ext.getCmp(this.section + 'EmailField').setValue(Ext.getCmp(this.section + 'EmailAddress').getValue());				Ext.getCmp(this.section + 'PhoneField1').setValue(Ext.getCmp(this.section + 'WorkPhone').getValue());				Ext.getCmp(this.section + 'PhoneField2').setValue(Ext.getCmp(this.section + 'HomePhone').getValue());				Ext.getCmp(this.section + 'PhoneField3').setValue(Ext.getCmp(this.section + 'MobilePhone').getValue());				Ext.getCmp(this.section + 'PhoneField4').setValue(Ext.getCmp(this.section + 'WorkFax').getValue());								// Set Image Source for Photo								var img = Ext.DomQuery.selectValue('imageUrl', res.responseXML, Eve.Resource.getIcon('item-icon','contact'));				if (!img || img.trim() == '') {					img = Eve.Resource.getIcon('item-icon','contact');				}								Ext.get(this.section + 'imgContactAvatar').set({src: img});								// Add Custom Fields				this.createCustomFields(res);								//when adding contact from mail section				if(this.isFromMail){					var id = Ext.DomQuery.selectValue('id', res.responseXML, "0");					if(id.indexOf("_")!= -1)						id = id.split("_")[1];					this.id = id;				    				}				break;							// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}	}		,afterSubmitParams : function(idx)	{			// Because we create Custom Fields dynamically,		// They wouldn't show up when submiting in other relared tabs.		if (idx == 0 || idx == 2) {			return this.panels[1].getParams(idx);		}	}	 	,submitForm : function(id, close, changeTo)	{		var that = this;				if ( !this.panels[id].get().getForm().isValid() )			return false;				if (id == 0 || id == 1 || id == 2) {			Ext.select('.contact-custom-fields').each(function(f) {				f = Ext.getCmp(f.dom.id);				if (f && f.validate && !f.validate()) {					that.ret = true;					return false;				}			});		}				if (this.ret) {			Ext.Msg.alert('', 'Validation error in custom fields');			delete this.ret;			return false;		}				var params = this.getSubmitParams(id, false, close, changeTo);				if (params != false) {			setTimeout (function(){that.panels[id].submit(params);}, 500);		}		/* Majid: Wait		if (close) {			(function() {				that.noPromptNeeded = true;				that.dialog.hide();				that.onDialogHide();				that.disableDeleteButtons();			}).defer(1000);		}		*/				// Update Tab's Title		if (id == this.idxComments) {			this.updateCountOfTitle('+');		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex)			{				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: obj.parentId						,groupId	: obj.groupId					}										var type = (obj.id == 0 || obj.id === undefined) ? "contact_success_create_item" : "contact_success_modify_item";					this.fire(type, { info: info, params: obj });			} // End of Switch		} // End of If	}});// * * * * * * * * * * * * * * * * * * * * //	Category Dialog// * * * * * * * * * * * * * * * * * * * * Eve.lib.Contact.FolderDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Contact.FolderDialogBridge.superclass.init.call(this, data);				var tab		= {			// @@XERXES@@			items	: ['Details'/*, 'Contacts'*/]			,related: [ [0, 1] ]		}				var dialog	= {			width 	: 600			,height : 300			,title	: 'Category'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,controller	: function(obj) {		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.title		= obj.title;		// We can also write this as a function for all of the panels		this.panels[0].reset();;		this.dialog.show();			}		,augment: function(callee, idx, type)	{				var obj = callee.params;		if (this.mode != 'create') {			obj.id = this.id;		}				if (this.root == 'group') {			obj.groupId = this.groupId;		}				obj.parentId = this.parentId;		obj.path	 = this.path;		obj.partial	 = 1;				return callee;	}		,execute : function(callee, type, data)	{		switch( type.toLowerCase() )		{			case (this.section + '_edit_folder_dlg'):				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;							case (this.section + '_create_folder_dlg'):				this.mode = 'create';				this.controller(data);				break;		}	}		,submitSuccess : function( resp, action ){ 		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0')		{			var info = {				id 			: dq.selectValue('id', xml).split('_')[1]				,rawId		: dq.selectValue('id', xml)				,xml		: xml				,root		: this.root				,path		: this.path				,parentId	: obj.parentId				,groupId	: obj.groupId			}						var type = (obj.id == 0 || obj.id === undefined) ? "contact_success_create_folder" : "contact_success_modify_folder";			// 'byPass' forces the tree to do not mention it.			this.fire(type, { info: info, params: obj, byPass: true });		}	}});// * * * * * * * * * * * * * * * * * * * * // 	Column Chooser// * * * * * * * * * * * * * * * * * * * * Eve.lib.Contact.ColumnChooserDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Contact.ColumnChooserDialogBridge.superclass.init.call(this, data);		this.store = Ext.getCmp('grid_col_chooser').getStore();				var tab		= {			items	: ["ColumnChooser"]		}				var dialog	= {			width 	: 420			,height : 350			,title	: 'Column Chooser'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,onDialogHide : function()	{		this.store.removeAll();	}		,augment : function(callee)	{		var obj = callee.params;				obj.id			= this.id;		obj.partial		= 1;		var counter		= 1;				if (this.root == 'group')		    obj.groupId = this.groupId;				this.store.each( function(rec) {			if (rec.get('displayField') == true) {				var col_txt		= ["display_column_", counter].join('');				var sort_txt	= ["sort_column_", counter].join('');				obj[col_txt]	= rec.id;								switch (rec.data.sortType) {					case "None":						obj[sort_txt] = "0";						break;											case "Ascending":						obj[sort_txt] = "+" + rec.id;						break;											case "Descending":						obj[sort_txt] = "-" + rec.id;						break;				}								counter++;			}		}, this);				return callee;	}		,execute : function(callee, type, data)	{		switch(type) {			case (this.section + '_modify_columns_dlg'):				this.id = data.info.id;				this.root = data.info.root;				this.groupId = data.info.groupId;				this.loadForm(0);				this.dialog.show();				break;		}	}		,submitSuccess: function(){		this.fire( this.section + '_reload_active_node' );	}		,loadSuccess : function(data)	{		var res = this.store.reader.read(data);		this.store.loadRecords(res, {add: false}, true);	}});// * * * * * * * * * * * * * * * * * * * * // 	Custom Fields// * * * * * * * * * * * * * * * * * * * * Eve.lib.Contact.CustomFieldsDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Contact.CustomFieldsDialogBridge.superclass.init.call(this, data);		this.store = Ext.getCmp('grid_custom_fields').getStore();				var tab		= {			items	: ["Custom Fields"]		}				var dialog	= {			width 	: 650			,height : 350			,title	: 'Custom Fields'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,onDialogHide : function()	{		this.store.removeAll();	}		,augment : function(callee)	{		var obj = callee.params;				if (this.root == 'group')			obj.groupId = this.groupId;						var counter = 1;		obj.lastCustomField = 0;		this.store.each( function(rec) {			obj["id_" + counter]			= (rec.id.split('_')[0] == 'new') ? '0' : rec.id;			obj["name_" + counter]			= rec.get('name');			obj["option_" + counter]		= rec.get('option');			obj["dataType_" + counter]		= rec.get('classType');			obj["controlType_" + counter]	= rec.get('type');						// TODO: it may need changes			obj["shown_" + counter]	= true;						obj.lastCustomField				= this.store.getCount();			counter++;		}, this);				return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				this.panels[0].reset();		this.dialog.show();			}		,execute : function(callee, type, data)	{		switch(type)		{			case (this.section + '_custom_fields_dlg'):				this.controller(data);				this.loadForm(0);				break;		}	}		,loadSuccess : function(data)	{		var res = this.store.reader.read(data);		this.store.loadRecords(res, {add: false}, true);	}});// * * * * * * * * * * * * * * * * * * * * // Copy/Move * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * *Eve.lib.Contact.CopyMoveDialogBridge = Ext.extend(Eve.lib.TabDialogController, {	mode	: 'create'    ,panels	: []		,init : function(data)	{		Eve.lib.Contact.CopyMoveDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Copy/Move']		}				var dialog	= {			width 	: 500			,height : 300			,title	: 'Copy/Move'		}				this.createDialog({tab: tab ,dialog: dialog})	}		,afterAddButtons : function(btns)	{			btns.splice(0, 1);		btns[0].text = "Move";		btns[0].id	 = "contactCopyMoveButton";		return btns;	}		,augment : function(callee)	{		var obj = callee.params;				var node = this.view.getSelectionModel().getSelectedNode();		obj.parentId= this.parentId;		var nodeInfo = this.view.getNodeInfo(node);		if (nodeInfo.groupId != null || nodeInfo.groupId != "0" || nodeInfo.groupId !== undefined)			obj.groups = nodeInfo.groupId;				obj.id = this.id;				if (this.root == 'group')			obj.groupId = this.groupId;				if (this.mode == 'move')			obj.move = true;		return callee;	}		,controller	: function(obj)	{		Ext.apply(this, obj.info);		this.title = obj.title		delete this.groups;		Ext.getCmp('contactCopyMoveButton').setText( this.mode.charAt(0).toUpperCase() + this.mode.substr(1) )		// We can also write this as a function for all of the panels		this.panels[0].reset();				this.dialog.show();	}		,execute : function(callee, type, data)	{		switch(type.toLowerCase()) {			case ('contact_copy_item_dlg'):				this.mode = 'copy';				this.controller(data);				break;						case ('contact_move_item_dlg'):				this.mode = 'move';				this.controller(data);				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode(action.params);				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			// If the mode is Move, remove the item from grid			if (this.mode == 'move') {				var info = {					id			: this.id					,root		: this.root					,parentId	: this.parentId					,groupId	: this.groupId					,path		: this.path				}				//this.fire('contact_delete_item_dlg', {info: info, byPass: true});				var grid = Ext.getCmp('contact_grid');				var pre = (this.groupId) ? 'CGI_' : 'CPI_';				var rec = grid.store.getById( pre+this.id );				if( rec !== undefined )					grid.store.remove(rec);			}			this.fire('contact_success_move_copy');		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarDialogs.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com*/var dlgCal = Eve.Dialogs.Calendar;// * * * * * * * * * * * * * * * * * * * *// Event Details * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCal.ReminderPopup = function(c){	var btnReminderId	= c.section + 'btnCalendarReminderRelative';	var btnReminder		= Ext.getCmp(btnReminderId);	var hdlReminder		= function() {		// Set Values		var reminderWhen = Ext.getCmp(c.section + 'reminderWhen').getValue();		var reminderSubject = Ext.getCmp(c.section + 'reminderSubject');				if (reminderWhen != '-1' && reminderSubject.getValue() == "") {			reminderSubject.markInvalid("This field is required");			return;		} else {			reminderSubject.clearInvalid();		}				Ext.getCmp(c.section + 'ReminderRelativeMinutes').setValue( Ext.getCmp(c.section + 'reminderWhen').getValue() );		Ext.getCmp(c.section + 'hdnReminderSubject').setValue( Ext.getCmp(c.section + 'reminderSubject').getValue() );		Ext.getCmp(c.section + 'hdnReminderPopup').setValue( Ext.getCmp(c.section + 'reminderPopup').getValue() );		Ext.getCmp(c.section + 'hdnReminderSMS').setValue( Ext.getCmp(c.section + 'reminderSMS').getValue() );		Ext.getCmp(c.section + 'hdnReminderShowOnDesktop').setValue( Ext.getCmp(c.section + 'reminderShowOnDesktop').getValue() );		Ext.getCmp(c.section + 'hdnReminderUseEmail').setValue( Ext.getCmp(c.section + 'UseEmail').getValue() );		Ext.getCmp(c.section + 'hdnReminderSendTo').setValue( Ext.getCmp(c.section + 'reminderSendTo').getValue() );		dlgCal._reminderWin.hide()	}	if (! dlgCal._reminderWin) {		dlgCal._reminderWin = new Ext.Window({			modal			: true			,header			: false			,draggable		: false			,closable		: false			,resizable		: false			,shadow			: false			,border			: false			,closeAction	: 'hide'			,width			: 300			,x				: btnReminder.getEl().getLeft()			,y				: btnReminder.getEl().getTop() + btnReminder.getEl().getHeight()			,items			: [{				layout			: 'form'				,border			: false				,labelWidth		: 50				,bodyStyle		: 'padding: 5px'				,items			: [{					xtype			: 'combo'					,xxtype			: 'combo'					,id				: c.section + 'reminderWhen'					,mode			: 'local'					,valueField		: 'value'					,displayField	: 'text'					,hideLabel		: true					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,anchor 		: '100%'					,store			: new Ext.data.SimpleStore({						fields	: ['text', 'value']						,data	: [							 ['None', '-1']							,['At Event Time', '0']							,['5 Minutes Before', '5']							,['15 Minutes Before', '15']							,['30 Minutes Before', '30']							,['1 Hour Before', '60']							,['2 Hour Before', '120']							,['3 Hour Before', '180']							,['4 Hour Before', '240']							,['5 Hour Before', '300']							,['6 Hour Before', '360']							,['7 Hour Before', '420']							,['8 Hour Before', '480']							,['9 Hour Before', '540']							,['10 Hour Before', '600']							,['11 Hour Before', '660']							,['12 Hour Before', '720']							,['1 Day Before', '1440']							,['2 Days Before', '2880']							,['1 Week Before', '10080']						]					})					,value			: '15'				}, {					xtype			: 'textfield'					,fieldLabel		: 'Subject'					,id				: c.section + 'reminderSubject'					,anchor 		: '100%'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderPopup'					,hideLabel		: true					,boxLabel		: 'Popup'					,anchor			: '100%'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderShowOnDesktop'					,hideLabel		: true					,checked		: true					,boxLabel		: 'Show on Desktop'					,anchor			: '100%'				}, {					xtype			: 'checkbox'					,id				: c.section + 'reminderSMS'					,hideLabel		: true					,boxLabel		: 'Send Text'					,anchor			: '100%'					,listeners	: {						check		: function(box, checked) {							if (checked) {								var sms = Eve.Preference.get('sms');								if (!sms || sms.trim() == '') {									// Uncheck									this.setValue(false);									Ext.Msg.show({										title	: 'SMS'										,msg	: 'Please add your phone number under "Settings > General Preferences" before activating this feature.'										,buttons: Ext.Msg.OK										,icon	: Ext.MessageBox.INFO									})								}							}						}					}				}, {					layout			: 'column'					,border			: false					,defaults		: {						layout			: 'form'						,border			: false					}					,items			: [{						columnWidth		: .3						,items			: [{							xtype			: "checkbox"							,id				: c.section + 'UseEmail'							,hideLabel		: true							,boxLabel   	: 'Email'							,anchor			: '100%'							,listeners		: {								check: function(t, checked) {									var cmp = Ext.getCmp(c.section + 'reminderSendTo');																		if (checked) {										cmp.setValue( Eve.Preference.get('emailAddress') );										cmp.enable();									}									else {										cmp.setValue("");										cmp.disable();									}								}							}						}]					}, {						columnWidth		: .7						,border			: false						,items			: [{							 xtype			: 'combo'							,id				: c.section + 'reminderSendTo'							,mode			: 'local'							,valueField		: 'value'							,displayField	: 'value'							,record			: 'item'							,disabled		: true							,lazyInit		: false							,hideLabel		: true							,typeAhead		: true							,editable		: true							,selectOnFocus 	: true							,forceSelection : false							,validator		: Ext.form.VTypes.email							,triggerAction 	: 'all'							,anchor			: '100%'							,store          : new Ext.data.SimpleStore({								 data	: [[Eve.Preference.get('emailAddress'), Eve.Preference.get('emailAddress')]]								,fields	: [ 'text', 'value' ]								,reader	: new Ext.data.XmlReader({									id		: 'id'									,record	: 'row'								}, [ 'text', 'value' ])							})						}]					}]				}]			}]			,buttons		: [{				text			: 'Done'				,handler		: hdlReminder			},{				text			: 'Cancel'				,handler		: function(){dlgCal._reminderWin.hide();}			}]		})	}	// Set Values	var relMin = Ext.getCmp(c.section + 'ReminderRelativeMinutes');		if (relMin.getValue() == "-1" || relMin.getValue() == "") {		Ext.getCmp(c.section + 'reminderWhen').setValue('15')	} else {		Ext.getCmp(c.section + 'reminderWhen').setValue( relMin.getValue() );	}	Ext.getCmp(c.section + 'reminderPopup').setValue( Ext.getCmp(c.section + 'hdnReminderPopup').getValue() );	Ext.getCmp(c.section + 'reminderSMS').setValue( Ext.getCmp(c.section + 'hdnReminderSMS').getValue() );	Ext.getCmp(c.section + 'UseEmail').setValue( Ext.getCmp(c.section + 'hdnReminderUseEmail').getValue() );	Ext.getCmp(c.section + 'reminderSendTo').setValue( Ext.getCmp(c.section + 'hdnReminderSendTo').getValue() );	// Set Subject	var rSubject = Ext.getCmp(c.section + 'reminderSubject');		// Reminder Subject	var hSubject = Ext.getCmp(c.section + 'hdnReminderSubject');	// Hidden Subject	var cSubject = Ext.getCmp(c.section + 'txtDetailSubject');		// Calendar Subject	if (hSubject.getValue() == "") {		rSubject.setValue( cSubject.getValue() );	} else {		rSubject.setValue( hSubject.getValue() );	}	// Set Checkbox	var hShowOnDesktop = Ext.getCmp(c.section + 'hdnReminderShowOnDesktop');	var rShowOnDesktop = Ext.getCmp(c.section + 'reminderShowOnDesktop');		if (hShowOnDesktop.getValue() == "") {		rShowOnDesktop.setValue( true );	} else {		rShowOnDesktop.setValue( hShowOnDesktop.getValue() );	}		// Show Popup	dlgCal._reminderWin.show(btnReminderId);};dlgCal.AllDay = function(el, checked, c){	// CheckBoxes	var detailAllDay  = Ext.getCmp(c.section + 'chkCalendarDetailAllDay');	var meetingAllDay = Ext.getCmp(c.section + 'chkCalendarMeetingAllDay');		// TimeFields	var detailStartTime		= Ext.getCmp(c.section + 'detailStartTime');	var detailEndTime		= Ext.getCmp(c.section + 'detailEndTime');	var meetingStartTime	= Ext.getCmp(c.section + 'meetingStartTime');	var meetingEndTime		= Ext.getCmp(c.section + 'meetingEndTime');		if (checked) {		detailAllDay.setValue(true);		meetingAllDay.setValue(true);		detailStartTime.setDisabled(true);		detailEndTime.setDisabled(true);		meetingStartTime.setDisabled(true);		meetingEndTime.setDisabled(true);	} else {		detailAllDay.setValue(false);		meetingAllDay.setValue(false);		detailStartTime.setDisabled(false);		detailEndTime.setDisabled(false);		meetingStartTime.setDisabled(false);		meetingEndTime.setDisabled(false);	}}dlgCal.EventDetails = function(c){	var section = c.section;		// Custom Validators	var customVTypes = {};		// ToDo: Majid... it should be moved to the submit, not as a single common validator. 	customVTypes[section + "_DateTimeText"] = 'End DateTime must be later than Start DateTime';	customVTypes[section + "_DateTime"]  = function(val, field) {		var dlg = field.dialog;		var startDate = Ext.getCmp(section + dlg +'StartDate').getValue();		var startTime = Ext.getCmp(section + dlg +'StartTime').getValue();		var endDate = Ext.getCmp(section + dlg +'EndDate').getValue();		var endTime = Ext.getCmp(section + dlg +'EndTime').getValue();		if (startDate == '' || startTime == '' || endDate == '' || endTime == '' )			return true;		var startValue	= startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + startTime;		var time = (Eve.Preference.get('timeFormat').toLowerCase() == 'g:i a')? '12:00 AM': '00:00';		if (Ext.getCmp(c.section + 'chkCalendarDetailAllDay').getValue() == true)			startValue	= startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + time;//'12:00 AM';		startDate = Date.parseDate(startValue,[Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);		if (startDate === undefined || startDate == 'undefined')			return false;		var endValue	= endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + endTime;		if (Ext.getCmp(c.section + 'chkCalendarDetailAllDay').getValue() == true)			endValue	= endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + time;//'12:00 AM';		endDate = Date.parseDate(endValue,[Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);		if (endDate === undefined || endDate == 'undefined')			return false;		if(startDate > endDate){			var endDateField = Ext.getCmp(c.section + 'detailEndDate');			var endTimeField = Ext.getCmp(c.section + 'detailEndTime');			var meetingEndDate = Ext.getCmp(c.section + 'meetingEndDate');			var meetingEndTime = Ext.getCmp(c.section + 'meetingEndTime');			if(field.id == c.section + dlg +'EndTime' || field.id == c.section + dlg +'EndDate'){				endDateField.setRawValue(startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				meetingEndDate.setRawValue(startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				endTimeField.setRawValue(startDate.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));				meetingEndTime.setRawValue(startDate.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));			}			else if(field.id == c.section + dlg  +'StartTime' || field.id == c.section + dlg + 'StartDate'){				endDate = startDate.add(Date.MINUTE, 30);				endDateField.setRawValue(endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				meetingEndDate.setRawValue(endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				endTimeField.setRawValue(endDate.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));				meetingEndTime.setRawValue(endDate.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));			}		}		return true;	}		// Apply custom validators to Ext VTypes	Ext.apply(Ext.form.VTypes, customVTypes);	return new Eve.FormPanel({        labelWidth	: 60		,labelAlign	: 'left'        ,frame		: false        ,bodyStyle	: 'padding: 10px'        ,items 		: [{        	xtype		: 'hidden'			,id			: c.section + 'ReminderRelativeMinutes'        	,name		: 'relativeMinutes'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderPopup'        	,name		: 'reminder_popup_temp'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderSMS'        	,name		: 'reminder_sms_temp'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderSubject'        	,name		: 'reminder_message'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderShowOnDesktop'        	,name		: 'reminderShowOnDesktop_temp'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderUseEmail'        	,name		: 'use_email_temp'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderSendTo'        	,name		: 'reminder_sendTo'        }, {        	xtype		: 'hidden'			,id			: c.section + 'hdnReminderId'        	,name		: 'reminderId'			,value		: 0        }, {        	xtype		: 'hidden'        	,name		: 'recurrenceId'			,id			: c.section + 'recurrenceId'			,value		: 0        }, {        	xtype		: 'hidden'        	,name		: 'evaluateAsHTML'			,value		: true        }, {			layout		: 'column'			,items		: [{				columnWidth: .85				,layout		: 'form'				,items		: [{					xtype		: 'textfield'					,id			: c.section + 'txtDetailSubject'					,fieldLabel	: 'Subject'					,name		: 'subject'					,allowBlank	: false					,setFocus	: true					,anchor		: '95%'				}, {					xtype		: 'textfield'					,id			: c.section + 'detailLocation'					,fieldLabel	: 'Location'					,name		: 'location'					,anchor		: '95%'					,listeners	: {						change : function(cmp, newVal, oldVal) {							Ext.getCmp(c.section + 'meetingLocation').setValue(newVal);						}					}				}]			}, {				columnWidth: .15				,layout		: 'form'				,items		: [{										xtype		: 'splitbutton'					,id			: c.section + 'btnCalendarReminderRelative'					,text		: 'Reminder'					,handler	: dlgCal.ReminderPopup.createDelegate(this, [c])					,arrowHandler:dlgCal.ReminderPopup.createDelegate(this, [c])				}]			}]		}, {			layout		: 'column'			,items		: [{				columnWidth: .26				,layout		: 'form'				,items		: [{					xtype		: 'datefield'					,id			: c.section + 'detailStartDate'					,dialog		: 'detail'					,fieldLabel	: 'Start'					,allowBlank : false					,format		: Eve.Preference.get('dateFormat')//'n/j/y'					,name		: 'startDate'					,vtype		: c.section + '_DateTime'					,validateOnBlur: false					,anchor		: '95%'					,listeners	: {						change		: function(cmp, newValue, oldValue) {							Ext.getCmp(c.section + 'meetingStartDate').setValue(newValue);						}					}				}]			}, {				columnWidth: .15				,layout		: 'form'				,items		: [{					xtype		: 'timefield'					,id			: c.section + 'detailStartTime'					,dialog		: 'detail'					,hideLabel	: true					,allowBlank : false					//,regex		: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/					,name		: 'startTime'					,format		: Eve.Preference.get('timeFormat')					,vtype		: c.section + '_DateTime'					,validateOnBlur: false					,anchor		: '85%'					,listeners	: {						change		: function(cmp, newValue, oldValue) {							Ext.getCmp(c.section + 'meetingStartTime').setValue(newValue);						}					}				}]			}, {				columnWidth: .21				,layout		: 'form'				,labelWidth	: 30				,items		: [{					xtype		: 'datefield'					,id			: c.section + 'detailEndDate'					,dialog		: 'detail'					,fieldLabel	: 'End'					,allowBlank : false					,format		: Eve.Preference.get('dateFormat')//'n/j/y'					,name		: 'endDate'					,vtype		: c.section + '_DateTime'					,validateOnBlur: false					,anchor		: '95%'					,listeners	: {						change		: function(cmp, newValue, oldValue) {							Ext.getCmp(c.section + 'meetingEndDate').setValue(newValue);						}					}				}]			}, {				columnWidth: .15				,layout		: 'form'				,items		: [{					xtype		: 'timefield'					,id			: c.section + 'detailEndTime'					,format		: Eve.Preference.get('timeFormat')					,dialog		: 'detail'					,name		: 'endTime'					,hideLabel	: true					,allowBlank : false					//,regex		: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/					,vtype		: c.section + '_DateTime'					,validateOnBlur: false					,anchor		: '85%'					,listeners	: {						change		: function(cmp, newValue, oldValue) {							Ext.getCmp(c.section + 'meetingEndTime').setValue(newValue);						}					}				}]			}, {				columnWidth: .19				,layout		: 'form'				,items		: [{					xtype		: 'checkbox'					,id			: c.section + 'chkCalendarDetailAllDay'					,boxLabel	: 'All Day'					,name		: 'allDay'					,hideLabel	: true					,anchor		: '100%'					,listeners	: {						check		: dlgCal.AllDay.createDelegate(this, [c], true)					}				}]			}]		}, {			layout		: 'column'			,items		: [{				columnWidth: .3				,items		: [{					xtype		: 'button'					,id			: c.section + 'EditRecurrence'					,text		: 'Edit Recurrence'					,style		: 'margin-left: 65px;'					,anchor		: '100%'				}]			}, {				columnWidth: .5				,style		: 'padding-top: 3px;'				,items		: [new Ext.ux.xLabel({					xtype		: 'xlabel'					,text		: ''					,id         : c.section + 'recurrenceText'					,name		: 'recurrenceText'					,value      : ''					,anchor		: '100%'				})]			}]		}, {			html		: '<hr style="margin:10px 0px; color:#B5B8C8;" />'		}, {			layout		: 'form'			,id			: c.section + 'frmCalendar'			,items		: [{				layout: 'form'				,style: ''				,items:[{				xtype				: 'combo'				,fieldClass			: 'calendar-combo-bg'				,id					: c.section + 'cboCalendarGroups'				,emptyText      	: 'Pick a Calendar...'				,tpl				: Eve.indentComboXTemplate('title')				,fieldLabel			: 'Calendar'				,hiddenName			: 'calendars'				,valueField			: 'id'				,displayField		: 'title'				,defaultSelection	: false				,allowBlank			: false				,typeAhead			: true				,bypassCheck		: true				,anchor 			: '95%'				,mode               : 'local'			}			, {				layout			: 'form'				,id				: c.section + 'frmSharedCalendars'				,items			: [{					xtype			: 'checkboxgroup'					,id				: c.section + 'gcSharedCalendars'					,name			: 'sharedCalendars'					,style			: 'height:80px;border:1px solid #B5B8C8;padding:2px 10px;margin:0px;background-color:#F1F1F1;overflow-y:scroll;'					,anchor			: '95%'					,labelSeparator	: ''					,items			: [{						hidden	: true					}]				}]			}]}, {				xtype		: 'htmleditor'				,fieldLabel	: 'Description'				,name		: 'notes'				,height		: 100				,anchor		: '95%'			}, {				html		: '<hr style="margin:10px 0px; color:#B5B8C8;" />'			}, {				layout		: 'column'				,items		: [{					columnWidth: .45					,layout		: 'form'					,items		: [{						xtype			: 'combo'						,xxtype			: 'combo'						,fieldLabel		: 'Show As'						,hiddenName		: 'showAsBusy'						,mode			: 'local'						,valueField		: 'value'						,displayField	: 'text'						,typeAhead		: true						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor 		: '80%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ ['0', 'Busy'], ['1', 'Free'], ['2', 'Tentative'], ['3', 'Out of office'] ]						})						,value			: '0'					}]				}, {					columnWidth: .45					,layout		: 'form'					,labelWidth	: 80					,items		: [{						xtype			: 'combo'						,xxtype			: 'combo'						,fieldLabel		: 'This event is'						,hiddenName		: 'privatePublic'						,mode			: 'local'						,valueField		: 'value'						,displayField	: 'text'						,typeAhead		: true						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor 		: '80%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ ['1', 'Public'], ['2', 'Private'] ]						})						,value			: '2'					}]				},{						columnWidth	: .1						,layout : 'form'						,items:{								html : '<label></label>'								,cls : 'lamp-tip'								,id : 'eventTypeTip'								,listeners : {									render : function(cmp){										 new Ext.ToolTip({											target: 'eventTypeTip'											,width	: 300											,html	:[	'Private - "This event will not appear on the public calendar" <br/>',														'Public - "This event will appear on the public calendar using the URL located in the group administration section"'].join('')											,trackMouse:true										});									}								}							}							}]			}]		}, {			layout		: 'form'			,id			: c.section + 'frmRecurrence'			,hidden		: true			,items		: [{				xtype		: 'fieldset'				,title		: 'Recurrence pattern'				,autoHeight	: true				,items		: [{					layout		: 'column'					,items		: [{						columnWidth: .220						,layout		: 'form'						,id			: c.section + 'frmPeriodRadios'						,style		: 'border-right: 1px solid #B5B8C8;'						,items		: [{							xtype		: 'radio'							,boxLabel	: 'None'							,name		: 'typeParent'							,inputValue	: '0'							,checked	: true							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Daily'							,name		: 'typeParent'							,inputValue	: '1'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Weekly'							,name		: 'typeParent'							,inputValue	: '2'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Monthly'							,name		: 'typeParent'							,inputValue	: '3'							,hideLabel	: true							,anchor		: '98%'						}, {							xtype		: 'radio'							,boxLabel	: 'Yearly'							,name		: 'typeParent'							,inputValue	: '4'							,hideLabel	: true							,anchor		: '98%'						}]					}, {						columnWidth: .780						,layout		: 'form'						,id			: c.section + 'frmPeriodView'						,style		: 'margin:10px;'						,items		: [{							layout		: 'form'							,hidden		: true							,items		: [{								html		: 'No Recurrence'							}]						}, { // Daily							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'dailyRadio1'										,name		: 'typeChild1'										,boxLabel	: 'Every'										,inputValue	: '1'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'dailyJumpAmount'										,value			: 1											,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var d	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(1);											var ds1	= Ext.getCmp(c.section + 'dailyRadio1');																						if (d.checked && ds1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .5									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'day(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}/*, {								xtype		: 'radio'								,name		: 'typeChild1'								,boxLabel	: 'Every weekday'								,inputValue	: '1'								,hideLabel	: true							}*/]						}, { // Weekly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth: .3									,layout		: 'form'									,labelWidth	: 70									,items		: [{										xtype			: 'numberfield'										,fieldLabel		: 'Recur every'										,name			: 'weeklyJumpAmount'										,value			: 1										,anchor			: '100%'										,labelSeparator	: ''										,validate		: function() {											var w = Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(2);																						if (w.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .5									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'Week(s) on:'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}, {								xtype			: 'checkboxgroup'								,id				: c.section + 'weekDaysMask'								,hiddenName		: 'weekDaysMask'								,name			: 'weekDaysMask'								,columns		: 4								,hideLabel		: true								,columns		: [110, 110, 110, 110]								,items			: [{									boxLabel		: 'Sunday'									,name			: 'weekDaysMask'									,inputValue		: '0'								}, {									boxLabel		: 'Monday'									,name			: 'weekDaysMask'									,inputValue		: '1'								}, {									boxLabel		: 'Tuesday'									,name			: 'weekDaysMask'									,inputValue		: '2'								}, {									boxLabel		: 'Wednesday'									,name			: 'weekDaysMask'									,inputValue		: '3'								}, {									boxLabel		: 'Thursday'									,name			: 'weekDaysMask'									,inputValue		: '4'								}, {									boxLabel		: 'Friday'									,name			: 'weekDaysMask'									,inputValue		: '5'								}, {									boxLabel		: 'Saturday'									,name			: 'weekDaysMask'									,inputValue		: '6'								}]								,validate		: function() {									var w 		= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(2);									var retVal	= false;																		if (w.checked) {										this.items.each( function(el) {											// At least one checkbox should be checked!											if (el.checked) {												retVal = true;												return;											}										})																				if (! retVal) {											this.markInvalid(this.blankText)											return false;										}									}																		// In case of previously marked as invalid.									this.clearInvalid()									return true;								}							}]						}, { // Monthly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'MonthlyRadio1'										,name		: 'typeChild3'										,boxLabel	: 'Day'										,inputValue	: '1'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,id				: c.section + 'DayInMonthnth'										,name			: 'DayInMonthnth'										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio1');																						if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .15									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of every'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'jumpAmountMonthnth'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio1');																						if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .15									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'month(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}, {								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'MonthlyRadio2'										,name		: 'typeChild3'										,inputValue	: '2'										,boxLabel	: 'The'										,hideLabel	: true									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'instanceOfDayInMonthMonthly'										,hiddenName		: 'instanceOfDayInMonthMonthly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'First'], ['2', 'Second'], ['3', 'Third'], ['4', 'Fourth'], ['5', 'Last'] ]										})										,value			: '1'									}]								}, {									columnWidth: .22									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'dayOfWeekMonthly'										,hiddenName		: 'dayOfWeekMonthly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '100%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'Sunday'], ['2', 'Monday'], ['3', 'Tuesday'], ['4', 'Wednesday'], ['5', 'Thursday'], ['6', 'Friday'], ['7', 'Saturday'] ]										})										,value			: '1'									}]								}, {									columnWidth: .15									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of every'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'jumpAmountMonthly'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var m	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(3);											var ms1	= Ext.getCmp(c.section + 'MonthlyRadio2');																						if (m.checked && ms1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'month(s)'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}]							}]						}, { // Yearly							layout		: 'form'							,hidden		: true							,items		: [{								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,id			: c.section + 'YearlyRadio1'										,name		: 'typeChild4'										,inputValue	: '1'										,boxLabel	: 'Every'										,hideLabel	: true										,checked	: true									}]								}, {									columnWidth: .21									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'specificMonthYearnth'										,hiddenName		: 'specificMonthYearnth'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'January'], ['2', 'Febraury'], ['3', 'March'], ['4', 'April'], ['5', 'May'], ['6', 'June'], ['7', 'July'], ['8', 'August'], ['9', 'September'], ['10', 'October'], ['11', 'November'], ['12', 'December'] ]										})										,value			: '1'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype			: 'numberfield'										,name			: 'dayInMonthYearnth'										,value			: 1										,hideLabel		: true										,anchor			: '100%'										,validate		: function() {											var y	= Ext.getCmp(c.section + 'frmPeriodRadios').items.itemAt(4);											var ys1	= Ext.getCmp(c.section + 'YearlyRadio1');																						if (y.checked && ys1.checked) {												if (this.getValue() == '') {													this.markInvalid(this.blankText)													return false;												}											}																						// In case of previously marked as invalid.											this.clearInvalid()											return true;										}									}]								}]							}, {								layout		: 'column'								,items		: [{									columnWidth	: .12									,layout		: 'form'									,items		: [{										xtype		: 'radio'										,name		: 'typeChild4'										,inputValue	: '2'										,boxLabel	: 'The'										,hideLabel	: true									}]								}, {									columnWidth: .2									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'instanceOfDayInMonthYearly'										,hiddenName		: 'instanceOfDayInMonthYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'First'], ['2', 'Second'], ['3', 'Third'], ['4', 'Fourth'], ['5', 'Last'] ]										})										,value			: '1'									}]								}, {									columnWidth: .22									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'dayOfWeekYearly'										,hiddenName		: 'dayOfWeekYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '100%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'Sunday'], ['2', 'Monday'], ['3', 'Tuesday'], ['4', 'Wednesday'], ['5', 'Thursday'], ['6', 'Friday'], ['7', 'Saturday'] ]										})										,value			: '1'									}]								}, {									columnWidth: .1									,layout		: 'form'									,items		: [{										xtype		: 'label'										,text		: 'of'										,cls		: 'x-form-item'										,style		: 'padding-top:4px; padding-left:10px;'									}]								}, {									columnWidth: .21									,layout		: 'form'									,items		: [{										xtype			: 'combo'										,xxtype			: 'combo'										,id				: c.section + 'specificMonthYearly'										,hiddenName		: 'specificMonthYearly'										,mode			: 'local'										,valueField		: 'value'										,displayField	: 'text'										,hideLabel		: true										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,loadPrevent	: true										,triggerAction 	: 'all'										,anchor 		: '90%'										,store			: new Ext.data.SimpleStore({											fields	: ['value', 'text']											,data	: [ ['1', 'January'], ['2', 'Febraury'], ['3', 'March'], ['4', 'April'], ['5', 'May'], ['6', 'June'], ['7', 'July'], ['8', 'August'], ['9', 'September'], ['10', 'October'], ['11', 'November'], ['12', 'December'] ]										})										,value			: '1'									}]								}]							}]						}]					}]				}]			}, {				xtype		: 'fieldset'				,title		: 'Ends on'				,autoHeight	: true				,height		: 200				,items		: [{					xtype		: 'radio'					,name		: 'noenddate'					,inputValue	: '1'					,boxLabel	: 'No end date'					,checked	: true					,hideLabel	: true				}, {					layout		: 'column'					,items		: [{						layout		: 'form'						,columnWidth: .3						,items		: [{							xtype		: 'radio'							,id			: c.section + 'NoEndDate'							,name		: 'noenddate'							,inputValue	: '0'							,boxLabel	: 'End by'							,hideLabel	: true							,anchor		: '90%'						}]					}, {						layout		: 'form'						,columnWidth: .3						,items		: [{							xtype		: 'datefield'							,name		: 'dateEndBy'							,format		: Eve.Preference.get('dateFormat')//'n/j/Y'							,hideLabel	: true							,anchor		: '100%'							,validate		: function() {								var ned = Ext.getCmp(c.section + 'NoEndDate');																if (ned.checked) {									if (this.getValue() == '') {										this.markInvalid(this.blankText)										return false;									}								}																// In case of previously marked as invalid.								this.clearInvalid()								return true;							}						}]					}]				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Meeting * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCal.Meeting = function(c){	return new Eve.FormPanel({        labelWidth	: 60		,labelAlign	: 'left'        ,frame		: false        ,bodyStyle	: 'padding: 10px'        ,items 		: [{			xtype		: 'hidden'			,id			: c.section + 'meetingId'			,name		: 'meetingId'			,value		: 0		}, {			xtype		: 'radiogroup'			,fieldLabel	: 'Meeting'			,name		: 'scheduleMeeting'			,anchor		: '90%'			,items		: [{				boxLabel	: 'On'				,id			: c.section + 'MeetingOn'				,name		: 'scheduleMeeting'				,inputValue	: 'true'				,listeners	: {					check : function(el, checked) {						if (checked) {							Ext.getCmp(c.section + 'MeetingCmp').show();							Ext.getCmp(c.section + 'MeetingCmp').doLayout()							Ext.getCmp(c.section + 'MeetingTextMsg').hide();						}						else {							Ext.getCmp(c.section + 'MeetingTextMsg').show();							Ext.getCmp(c.section + 'MeetingCmp').hide();						}					}				}			}, {				boxLabel	: 'Off'				,id			: c.section + 'MeetingOff'				,name		: 'scheduleMeeting'				,inputValue	: 'false'				,checked	: true				,listeners	: {					check : function(el, checked) {						if (checked) {							Ext.getCmp(c.section + 'MeetingCmp').hide();							Ext.getCmp(c.section + 'MeetingCmp').doLayout()							Ext.getCmp(c.section + 'MeetingTextMsg').show();						}						else {							Ext.getCmp(c.section + 'MeetingTextMsg').hide();							Ext.getCmp(c.section + 'MeetingCmp').show();						}					}				}			}]		}, {			html		: '<hr />'		}, {			layout		: 'form'			,id			: c.section + 'MeetingTextMsg'			,items		: [{				html		: '<div style="text-align:center; margin-top:50px;">This calendar does not have meeting turned on.</div>'			}]		}, {			layout		: 'form'			,id			: c.section + 'MeetingCmp'			,hidden		: true			,items		: [{				layout		: 'column'				,items		: [{					columnWidth: .26					,layout		: 'form'					,items		: [{						xtype		: 'datefield'						,id			: c.section + 'meetingStartDate'						,vtype		: c.section + '_DateTime'						,dialog		: 'meeting'						,fieldLabel	: 'Start'						,format		: Eve.Preference.get('dateFormat')//'n/j/y'						,name		: 'startDate'						,anchor		: '95%'						,listeners	: {							change		: function(cmp, newValue, oldValue) {								Ext.getCmp(c.section + 'detailStartDate').setValue(newValue);							}						}					}]				}, {					columnWidth: .15					,layout		: 'form'					,items		: [{						xtype		: 'timefield'						,id			: c.section + 'meetingStartTime'						,vtype		: c.section + '_DateTime'						,format		: Eve.Preference.get('timeFormat')						,dialog		: 'meeting'						,hideLabel	: true						,allowBlank : false						//,regex: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/						,name		: 'startTime'						,anchor		: '85%'						,listeners	: {							change		: function(cmp, newValue, oldValue) {								Ext.getCmp(c.section + 'detailStartTime').setValue(newValue);							}						}					}]				}, {					columnWidth: .21					,layout		: 'form'					,labelWidth	: 30					,items		: [{						xtype		: 'datefield'						,id			: c.section + 'meetingEndDate'						,vtype		: c.section + '_DateTime'						,dialog		: 'meeting'						,fieldLabel	: 'End'						,format		: Eve.Preference.get('dateFormat')//'n/j/y'						,name		: 'endDate'						,anchor		: '95%'						,listeners	: {							change		: function(cmp, newValue, oldValue) {								Ext.getCmp(c.section + 'detailEndDate').setValue(newValue);							}						}					}]				}, {					columnWidth: .15					,layout		: 'form'					,items		: [{						xtype		: 'timefield'						,id			: c.section + 'meetingEndTime'						,vtype		: c.section + '_DateTime'						,format		: Eve.Preference.get('timeFormat')						,dialog		: 'meeting'						,name		: 'endTime'						,hideLabel	: true						,allowBlank : false						//,regex: /^(10|11|12|[1-9]):([0-5]?[0-9])\s(AM|PM)$/						,anchor		: '85%'						,listeners	: {							change		: function(cmp, newValue, oldValue) {								Ext.getCmp(c.section + 'detailEndTime').setValue(newValue);							}						}					}]				}, {					columnWidth: .19					,layout		: 'form'					,items		: [{						xtype		: 'checkbox'						,id			: c.section + 'chkCalendarMeetingAllDay'						,boxLabel	: 'All Day'						,name		: 'allDay'						,hideLabel	: true						,anchor		: '100%'						,listeners	: {							check		: dlgCal.AllDay.createDelegate(this, [c], true)						}					}]				}]			}, {				xtype		: 'fieldset'				,title		: 'Meeting Invitation'				,autoHeight	: true				,anchor		: '100%'				,items		: [{					layout		: 'form'					,labelWidth	: 90					,items		: [{						xtype			: 'combo'						,xxtype			: 'combo'						,fieldLabel		: 'Schedule as'						,hiddenName		: 'scheduleAs'						,mode			: 'local'						,valueField		: 'value'						,displayField	: 'text'						,typeAhead		: true						,editable		: false						,selectOnFocus 	: true						,loadPrevent	: true						,triggerAction 	: 'all'						,anchor			: '100%'						,store			: new Ext.data.SimpleStore({							fields	: ['value', 'text']							,data	: [ ['0', 'A Meeting'], ['1', 'Audio Meeting'], ['2', 'Web Meeting'] ]						})						,value			: '0'					}, {						xtype		: 'textfield'						,id			: c.section + 'meetingLocation'						,fieldLabel	: 'Location'						,name		: 'meetingLocation'						,anchor		: '100%'						,listeners	: {							change : function(cmp, newVal, oldVal) {								Ext.getCmp(c.section + 'detailLocation').setValue(newVal);							}						}					}, {						xtype		: 'textarea'						,fieldLabel	: 'Additional instructions'						,name		: 'meetingDescription'						,anchor		: '100%'					}, {						xtype			: 'checkboxgroup'						,hiddenName		: 'attendeesCan'						,name			: 'attendeesCan'						,fieldLabel		: 'Attendees can'						,columns		: [120, 135, 130, 140]						//,anchor			: '100%'						,items			: [{							boxLabel		: 'Invite&nbsp;others'							,inputValue		: 'inviteOthers'						}, {							boxLabel		: 'See&nbsp;the&nbsp;guest&nbsp;list'							,inputValue		: 'seeTheGuestList'							,id				: c.section + 'seeTheGuestList'						}, {							boxLabel		: 'Add&nbsp;comments'							,inputValue		: 'addComments'							,id				: c.section + 'addComments'						}, {							boxLabel		: 'Access&nbsp;linked&nbsp;Items'							,inputValue		: 'accessLinkedItems'						}]					}]				}]			}, {				xtype		: 'fieldset'				,title		: 'Attendees'				,autoHeight	: true				,anchor		: '100%'				,items		: [{					layout		: 'column'					,items		: [{						columnWidth	: .5						,layout		: 'form'						,items		: [new Ext.form.ComboBoxMulti({							id				: c.section + 'AttendeesCbo'							,fieldLabel		: 'Attendee'							,name			: 'attendees'							,valueField		: 'email'							,displayField	: 'email'							,mode			: 'local'							,sep			: ','							,lazyInit		: false							,editable		: true							,hideTrigger	: true							,triggerAction	: 'all'							,anchor			: '98%'							,store			: Eve.registery.allContacts							,filterByFn		: function(record, id) {								return record.get(this.displayField).replace(/"/g, "").match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));							}						  })]					}, {						columnWidth	: .08						,items		: [{							xtype		: 'button'							,id			: c.section + 'AddParticipants'							,text		: 'Add'						}]					}, {						columnWidth	: .22						,items		: [{							xtype		: 'splitbutton'							,iconCls	: 'x-form-date-trigger'							,icon		: Eve.Resource.getIcon('new', 'general')							,handler	: function() {this.showMenu()}							,menu		: [{								text		: 'Group Membership Directory'								,handler	: function() {									var groupId	= Ext.getCmp(c.section + 'cboCalendarGroups').getValue();									if (groupId == '') {										return;									}									var info 	= {										root	: 'group'										,groupId: groupId									}									Eve.Resource.superbridge.broadcast(this, 'calendar_participants_dlg', {info: info});								}							}, {								text		: 'Portal Members'								,hidden		: (! Eve.Preference.getBoolean('useDefaultGroup'))								,handler	: function() {									var info 	= {										root	: 'group'										,groupId: Eve.Preference.getInteger('defaultGroupId')									}									Eve.Resource.superbridge.broadcast(this, 'calendar_participants_dlg', {info: info});								}							}, {								text		: 'Contacts'								,handler	: function() {									Eve.Resource.superbridge.broadcast(this, 'calendar_contact_participants_dlg');								}							}]						}]					}, {						columnWidth	: .2						,items		: [{							xtype		: 'button'							,id			: c.section + 'btnAttendeeSchedule'							,text		: 'Attendee Schedules'						}]					}]				}, {					xtype			: 'panel'					,border			: true					,autoScroll		: true					,style			: 'margin-top: 5px; background-color:#FFF;'					,items			: [{						html : 	'<div style="border:1px solid; width:624px;" class="ev-dataview-header" >'									+ '<div style="width:350px;float:left">Attendee</div>'									+ '<div style="width:200px;float:left">Status</div>'									+ '<div style="width:25px;float:left">&nbsp;</div>'									+ '<div style="clear:both"></div>'								+ '</div>'					}, {						xtype			: 'xdataview'						,id				: c.section + 'dvCalendarMeetingAttendees'						,name			: 'meetingAttendees'						,field			: ['attendee', 'statusId']						,hideLabel		: true						,itemSelector	: 'div.search-item'						,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'						,height			: 70						,rowName        : 'attendeeRow'						,store			: new Ext.data.Store({							reader	: new Ext.data.XmlReader({								record		: 'attendeeRow'								,id			: 'attendeeId'							}, ['id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType'])						})						,tpl			: new Ext.XTemplate(							'<div>',							'<tpl for=".">',							'<div style="width:98%; margin: 10px 5px;" class="search-item">',								'<div style="width:350px;float:left">{[this.doReplace(values.attendee)]}</div>',								'<div style="width:224px;float:left">{status}</div>',								'<div style="width:20px;float:left">', 									'<img class="calendar-meeting_attendee_del" src="' + Eve.Resource.getIcon('delete', 'general') + '" onmouseover="this.style.cursor=\'pointer\'"  />',								'</div>',							'</div>',							'</tpl>',							'</div>', {								doReplace : function(val) {									return val.replace("<", "&lt;");								}							}						)					}]				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Sharing  * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCal.Sharing = function(){	return new Eve.FormPanel({        labelWidth	: 70		,labelAlign	: 'left'        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,items 		: [{			xtype		: 'textfield'			,fieldLabel	: 'Share Name'			,name		: 'shareName'			,allowBlank	: false			,setFocus	: true			,anchor		: '100%'		}, {			html		: '<hr style="margin:10px 0px; color:#B5B8C8;" />'		}, {			xtype		: 'label'			,text		: 'Please choose the user you would like to share your calendar with. The calendar can be shared with any user in your portal'			,anchor		: '100%'		}, {			layout		: 'column'			,style		: 'padding-top: 10px;'			,items		: [{				columnWidth	: .62				,layout		: 'form'				,items		: [new Ext.form.ComboBoxMulti({					id				: 'cboCalendarSharingAttendee'					,name			: 'usersCobrand'					,valueField		: 'email'					,displayField	: 'email'					,mode			: 'local'					,sep			: ','					,hideLabel		: true					,lazyInit		: false					,editable		: true					,value			: ""					,hideTrigger	: true					,triggerAction	: 'all'					,anchor			: '97%'					,store			: Eve.registery.allContacts					,filterByFn		: function(record, id) {						if (record.get('type') != 'member') {							return;						}												return record.get(this.displayField).match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));					}				  })]			}, {				columnWidth	: .3				,layout		: 'form'				,items		: [{					xtype			: 'combo'					,xxtype			: 'combo'					,id				: 'cboCalendarSharingStatus'					,hiddenName		: 'status'					,valueField		: 'value'					,displayField	: 'text'					,mode			: 'local'					,value			: '1'					,hideLabel		: true					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,loadPrevent	: true					,triggerAction 	: 'all'					,anchor 		: '95%'					,store			: new Ext.data.SimpleStore({						fields	: ['value', 'text']						,data	: [ ['1', 'Make Changes'], ['2', 'View Only'], ['3', 'Show Free/Busy Only'] ]					})				}]			}, {				columnWidth	: .08				,layout		: 'form'				,items		: [{					xtype		: 'button'					,id			: 'btnCalendarSharingAdd'					,text		: 'Add'				}]			}]		}, {			xtype			: 'panel'			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF;border:1px solid; border-top:none;'			,items			: [{				html : 	'<div style=" width:526px" class="task-gray-header">'							+ '<div style="width:300px;float:left">Attendee</div>'							+ '<div style="width:200px;float:left">Status</div>'							+ '<div style="width:20px;float:left">&nbsp;</div>'							+ '<div style="clear:both"></div>'						+ '</div>'			}, {				xtype			: 'xdataview'				,name			: 'calendarAttendees'				,id				: 'dvCalendarAttendees'				,field			: ['id', 'statusId']				,hideLabel		: true				,itemSelector	: 'div.search-item'				,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,height			: 100				,store			: new Ext.data.Store({					reader	: new Ext.data.XmlReader({						record		: 'row'						,id			: 'id'					}, ['id', 'attendee', 'statusId', 'status'])				})				,tpl			: new Ext.XTemplate(					'<div>',					'<tpl for=".">',					'<div style="width:98%; margin: 10px 5px;">',						'<div style="width:300px;float:left">{attendee}</div>',						'<div style="width:180px;float:left">{status}</div>',						'<div style="width:20px;float:left"><img src="' + Eve.Resource.getIcon('delete','general')+ '" onmouseover="this.style.cursor=&quot;pointer&quot;" onclick="Eve.Resource.superbridge.broadcast(this, \'calendar_settings_attendee_delete\', { info: {id: {id}, index: {#}} })" /></div>',					'</div>',					'</tpl>',					'</div>'				)			}]		}, /*{			html		: '<hr style="margin:10px 0px; color:#B5B8C8;" />'		},*/ {			xtype		: 'checkbox'			,boxLabel	: 'Publish this calendar publicly'			,name		: 'isPublish'			,hidden		: true			,hideLabel	: true		}]	})};// * * * * * * * * * * * * * * * * * * * * // Notifications * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * dlgCal.Notifications = function(){	return new Eve.FormPanel({        labelWidth	: 70		,labelAlign	: 'left'        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,items 		: [{			xtype		: 'label'			,text		: 'Choose how you would like to be notified when any of the following actions occur within this calendar. Please note that these settings do not apply to meeting invitations which have their own pre-defined behavior.'			,anchor		: '100%'		}, {			html		: '<hr style="margin:20px 0px; color:#B5B8C8;" />'		}, {			layout		: 'column'			,items		: [{				columnWidth	: .6				,layout		: 'form'				,items		: [{					html		: '&nbsp;'				}, {					html		: 'An event is added to this calendar'					,style		: 'padding:4px;'					,cls		: 'x-form-item'				}, {					html		: 'An event is modified on this calendar'					,style		: 'padding:4px;'					,cls		: 'x-form-item'				}, {					html		: 'An event is deleted from this calendar'					,style		: 'padding:4px;'					,cls		: 'x-form-item'				}, {					html		: 'Send a daily log of all changes to this calendar'					,style		: 'padding-top:4px;'					,cls		: 'x-form-item'				}, {					html		: '<b>Note:</b> all daily logs will be compiled & sent as a single email detailing all calendars.'				}]			}, {				columnWidth	: .2				,layout		: 'form'				,items		: [{					xtype		: 'label'					,text		: 'E-Mail'					,anchor		: '100%'				}, {					xtype		: 'checkbox'					,name		: 'isAddEmail'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isModifiedEmail'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isDeletedEmail'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isAllEmail'					,hideLabel	: true				}]			}, {				columnWidth	: .2				,layout		: 'form'				,items		: [{					xtype		: 'label'					,text		: 'SMS'					,anchor		: '100%'				}, {					xtype		: 'checkbox'					,name		: 'isAddSMS'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isModifiedSMS'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isDeletedSMS'					,hideLabel	: true				}, {					xtype		: 'checkbox'					,name		: 'isAllSMS'					,hideLabel	: true				}]			}]		}]	})};// * * * * * * * * * * * * * * * * * * * * // Participants (Group Membership, Portal)// * * * * * * * * * * * * * * * * * * * * dlgCal.Participants = function(){	return new Eve.FormPanel({        labelWidth	: 70		,labelAlign	: 'left'        ,frame		: false        ,bodyStyle	: 'padding: 20px'        ,items 		: [{			xtype			: 'panel'			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF;'			,items			: [{				html : 	'<table width="100%" class="x-form-item ev-dataview-header"><tr>'							+ '<td style="width:20px;"><input type="checkbox" id="checkAllParticipants" /></td>'							+ '<td style="width:200px;">Name</td>'						+ '</tr></table>'			}, {				xtype			: 'xdataview'				,name			: 'contacts'				,id				: 'dvCalendarParticipants'				,hideLabel		: true				,itemSelector	: 'div.search-item'				,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,height			: 150				,store			: new Ext.data.Store({					reader	: new Ext.data.XmlReader({						record		: 'row'						,id			: 'id'					}, ['id', 'contact', 'contactEmail'])				})				,tpl			: new Ext.XTemplate(					'<table id="calParticipantTable" width="100%" class="x-form-item">',					'<tpl for=".">',					 '<tr>',						'<td width="20px">&nbsp;<input type="checkbox" id="{id}" class="cal-participant-checkbox" /></td>',						'<td width="290px">{[this.convert(values.contact)]}</td>',					 '</tr>',					'</tpl>',					'</table>',	{						convert : function(c) {return c.replace('<', '&lt;')}					}				)			}]		}]	})};// * * * * * * * * * * * * * * * * * * * *// Participants (Contacts) * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCal.ContactParticipants = function(){	return new Eve.FormPanel({        labelWidth	: 70		,labelAlign	: 'top'        ,frame		: false        ,bodyStyle	: 'padding: 10px'        ,items 		: [{			layout		: 'column'			,items		: [{				columnWidth	: .35				,layout		: 'form'				,items		: [{					xtype			: 'combo'					,id				: 'cboCalContactPersonalContact'					,hiddenName		: 'groupId'					//,tpl			: Eve.indentComboXTemplate('title')					,fieldLabel		: 'Groups/Personal'					,mode           : 'local'					,valueField		: 'value'					,displayField	: 'text'					,allowBlank		: false					,editable		: false					,anchor			: '95%'				}]			}, {				columnWidth	: .35				,layout		: 'form'				,items		: [{					xtype			: 'combo'					,id				: 'cboCalContactCategories'					,hiddenName		: 'folderId'					//,tpl			: Eve.indentComboXTemplate('title')					,fieldLabel		: 'Categories'					,mode           : 'local'					,valueField		: 'id'					,displayField	: 'title'					,allowBlank		: false					,editable		: false					,anchor			: '95%'				}]			}, {				columnWidth	: .16				,layout		: 'form'				,items		: [{					xtype		: 'textfield'					,name		: 'searchText'					,fieldLabel	: 'Filter by'					,anchor		: '95%'				}]			}, {				columnWidth	: .14				,layout		: 'form'				,items		: [{					xtype		: 'button'					,id			: 'btnContactParticipantsApplyFilter'					,text		: 'Apply Filter'					,style		: 'padding-top:18px;'				}]			}]		}, {			xtype			: 'panel'			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF;'			,items			: [{				html : 	'<table width="100%" class="x-form-item ev-dataview-header"><tr>'							+ '<td style="width:20px;"><input type="checkbox" id="checkAllContactParticipants" /></td>'							+ '<td style="width:205px;">Last Name, First Name</td>'							+ '<td style="width:300px;">Email</td>'						+ '</tr></table>'			}, {				xtype			: 'xdataview'				,name			: 'contacts'				,id				: 'dvCalendarContactParticipants'				,keyMapField	: 'contact'				,hideLabel		: true				,singleSelect	: true				,itemSelector	: 'div.ev-dataview-row-container'				,selectedClass	: 'ev-item-selected'				,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No Comment.</i></div>'				,height			: 125				,store			: new Ext.data.Store({					reader	: new Ext.data.XmlReader({						record		: 'row'						,id			: 'id'					}, ['id', 'contact', 'contactEmail'])				})				,tpl			: new Ext.XTemplate(					'<tpl for=".">',					'<div class="ev-dataview-row-container ev-pointer">',					'<table width="100%" id="calContactParticipantTable" cellspacing="0">',					 '<tr>',						'<td width="25px">&nbsp;',							'<input type="checkbox" id="{id}" class="cal-contact-participant-checkbox" />',						'</td>',						'<td width="200px" class="ev-pointer">{contact}</td>',						'<td width="300px" class="ev-pointer">{[this.convert(values.contactEmail)]}</td>',					 '</tr>',					'</table>',					'</div>',					'</tpl>', {						convert : function(c) {return c.replace('<', '&lt;')}					}				)			}]		}]	})};// * * * * * * * * * * * * * * * * * * * *// Schedules * * * * * * * * * * * * * * *// * * * * * * * * * * * * * * * * * * * *dlgCal.Schedules = function(){	// Custom Validators	var customVTypes = {};	customVTypes["calSchedule_DateTimeText"] = 'End DateTime must be later than Start DateTime';	customVTypes["calSchedule_DateTime"]  = function(val, field) {		var startDate	= Ext.getCmp('calSchedulesStartDate');		var startTime	= Ext.getCmp('calSchedulesStartTime');		var endDate		= Ext.getCmp('calSchedulesEndDate');		var endTime		= Ext.getCmp('calSchedulesEndTime');		var chkAllDay	= Ext.getCmp('calSchedulesAllDay');		var startDateVal	= startDate.getValue();		var startTimeVal	= startTime.getValue();		var endDateVal		= endDate.getValue();		var endTimeVal		= endTime.getValue();		if (startDateVal == '' || startTimeVal == '' || endDateVal == '' || endTimeVal == '' ) {			return true;		}		var startValue	= startDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + startTimeVal;		var time = (Eve.Preference.get('timeFormat').toLowerCase() == 'g:i a')? '12:00 AM': '00:00';		if (chkAllDay.getValue() == true) {			startValue	= startDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + time;//'12:00 AM';		}		startDateVal = Date.parseDate(startValue, [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);		if (startDateVal === undefined) {			return false;		}		var endValue	= endDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + endTimeVal;		if (chkAllDay.getValue() == true) {			endValue	= endDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) + ' ' + time;//'12:00 AM';		}		endDateVal = Date.parseDate(endValue, [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*"n/j/y g:i A"*/);		if (endDate === undefined) {			return false;		}		if (startDateVal > endDateVal) {			if(field.id == 'calSchedulesEndDate' || field.id == 'calSchedulesEndTime') {				endDate.setRawValue(startDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				endTime.setRawValue(startDateVal.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));			}			else if(field.id == 'calSchedulesStartDate' || field.id == 'calSchedulesStartTime') {				endDateVal = startDateVal.add(Date.MINUTE, 30);				endDate.setRawValue(endDateVal.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));				endTime.setRawValue(endDateVal.format(Eve.Preference.get('timeFormat')/*'g:i A'*/));			}		}		return true;	}	// Apply custom validators to Ext VTypes	Ext.apply(Ext.form.VTypes, customVTypes);	return new Eve.FormPanel({		labelWidth	: 40		,bodyStyle	: 'padding: 10px;'		,items		: [{			layout		: 'column'			,items		: [{				columnWidth	: 0.25				,layout		: 'form'				,items		: [{					xtype		: 'datefield'					,id			: 'calSchedulesStartDate'					,fieldLabel	: 'Start'					,format		: Eve.Preference.get('dateFormat')//'n/j/y'					,vtype		: 'calSchedule_DateTime'					,anchor		: '95%'				}]			}, {				columnWidth	: 0.17				,layout		: 'form'				,items		: [{					xtype		: 'timefield'					,format		: Eve.Preference.get('timeFormat')					,id			: 'calSchedulesStartTime'					,vtype		: 'calSchedule_DateTime'					,hideLabel	: true					,anchor		: '90%'				}]			}, {				columnWidth	: 0.25				,layout		: 'form'				,items		: [{					xtype		: 'datefield'					,id			: 'calSchedulesEndDate'					,fieldLabel	: 'End'					,format		: Eve.Preference.get('dateFormat')//'n/j/y'					,vtype		: 'calSchedule_DateTime'					,anchor		: '95%'				}]			}, {				columnWidth	: 0.17				,layout		: 'form'				,items		: [{					xtype		: 'timefield'					,format		: Eve.Preference.get('timeFormat')					,id			: 'calSchedulesEndTime'					,vtype		: 'calSchedule_DateTime'					,hideLabel	: true					,anchor		: '90%'				}]			}, {				columnWidth	: 0.16				,layout		: 'form'				,items		: [{					xtype		: 'checkbox'					,id			: 'calSchedulesAllDay'					,boxLabel	: 'All Day'					,hideLabel	: true					,anchor		: '100%'				}]			}]		}, {			html	: '<hr style="margin:2px 0;" />'		}, {			layout	: 'column'			,items	: [{				columnWidth	: .4				,items		: [{					layout		: 'column'					,style		: 'padding-top:5px;'					,items		: [{						columnWidth	: .5						,layout		: 'form'						,items		: [new Ext.form.ComboBoxMulti({							id				: 'calSchedulesAttendeesCbo'							,fieldLabel		: 'Attendee'							,valueField		: 'email'							,displayField	: 'email'							,mode			: 'local'							,sep			: ','							,lazyInit		: false							,editable		: true							,hideTrigger	: true							,hideLabel		: true							,emptyText		: 'Search'							,triggerAction	: 'all'							,anchor			: '95%'							,store			: Eve.registery.allContacts							,filterByFn		: function(record, id) {								if (record.get('type') != 'member') {									return;								}																return record.get(this.displayField).match(/[^@]*/)[0].match(new RegExp( Ext.escapeRe(this.getActiveEntry()), "i" ));							}						  })]					}, {						columnWidth	: .15						,items		: [{							xtype		: 'button'							,id			: 'btnCalScheduleAdd'							,text		: 'Add'						}]					}, {						columnWidth	: .35						,items		: [{							xtype		: 'splitbutton'							,text		: 'Add From'							,iconCls	: 'x-form-date-trigger'							,icon		: Eve.Resource.getIcon('tree-group-node', 'general')							,handler	: function() {this.showMenu()}							,menu		: [{								text		: 'Group Membership Directory'								,handler	: function() {									var groupId	= Ext.getCmp('calendarcboCalendarGroups').getValue();									if (groupId == '') {										return;									}									var data 	= {										schedule: true										,info	: {											root	: 'group'											,groupId: groupId										}									}									Eve.Resource.superbridge.broadcast(this, 'calendar_participants_dlg', data);								}							}, {								text		: 'Portal Members'								,hidden		: (! Eve.Preference.getBoolean('useDefaultGroup'))								,handler	: function() {									var data = {										schedule: true										,info	: {											root	: 'group'											,groupId: Eve.Preference.getInteger('defaultGroupId')										}									}									Eve.Resource.superbridge.broadcast(this, 'calendar_participants_dlg', data);								}							}, {								text		: 'Contacts'								,handler	: function() {									Eve.Resource.superbridge.broadcast(this, 'calendar_contact_participants_dlg', {schedule: true});								}							}]							,anchor		: '95%'						}]					}]				}, {					html : 	'<div id="calSchedulesUsersDvHeader">User</div>'				}]			}, {				columnWidth	: .6				,items		: [{					layout		: 'column'					,style		: 'padding-top: 5px;'					,items		: [{						columnWidth	: .3						,items		: [{							html		: '&nbsp;'						}]					}, {						columnWidth	: .4						,layout		: 'form'						,items		: [{							xtype		: 'datefield'							,id			: 'calSchedulesDateSelector'							,hideLabel	: true							,format		: Eve.Preference.get('dateFormat')//'n/j/y'							,style		: 'margin-bottom: 5px;'							,anchor		: '100%'						}]					}, {						columnWidth	: .3						,items		: [{							html		: '&nbsp;'						}]					}]				}, {					html		: '<div id="calSchedulesLeftHeaderContainer">' +								  '<table class="calScheduleTableHeader" cellspacing="0">' +									'<tr>' +										'<td>12am</td><td>1am</td><td>2am</td>'	+										'<td>3am</td><td>4am</td><td>5am</td>'	+										'<td>6am</td><td>7am</td><td>8am</td>'	+										'<td>9am</td><td>10am</td><td>11am</td>'+										'<td>12pm</td><td>1pm</td><td>2pm</td>'	+										'<td>3pm</td><td>4pm</td><td>5pm</td>'	+										'<td>6pm</td><td>7pm</td><td>8pm</td>'	+										'<td>9pm</td><td>10pm</td><td>11pm</td>'+										'<td>&nbsp;</td>' +									'</tr>' +								   '</table>' +								   '</div>'				}]			}]		}, {			layout	: 'column'			,height	: 176			,items	: [{				columnWidth	: .4				,items		: [{					xtype			: 'panel'					,width			: 290					,height			: 157					,style			: {						'background-color'	: 'white'						,'border'			: '1px solid #CCC'					}					,items			: [{						xtype		: 'dataview'						,id			: 'calSchedulesUsersDV'						,name		: 'data'						,field		: ['attendee', 'statusId']						,height		: 155						,rowName	: 'attendeeRow'						,itemSelector: 'div.search-item'						,store			: new Ext.data.Store({							reader	: new Ext.data.XmlReader({								record		: 'attendeeRow'							}, ['id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType'])						})						,tpl			: new Ext.XTemplate(							'<table class="calSchedulesTableLeft" cellspacing="0">',							'<tpl for=".">',							 '<tr class="{[this.getClassName(xindex)]}">',								'<td width="265px">{attendee}</td>',								'<td onmouseover="this.style.cursor=\'pointer\'" onclick="Eve.Resource.superbridge.broadcast(this, \'calendar_schedules_delete\', {index: {#}, info: {} })">',									'<img src="' + Eve.Resource.getIcon('delete', 'general') + '" height="12" />',								'</td>',							 '</tr>',							'</tpl>',							'</table>', {								getClassName : function(idx) {									if (idx % 2 == 0) {										return 'calScheduleEvenRow'									}									return 'calScheduleOddRow';								}							}						)					}]				}]			}, {				columnWidth	: .6				,items		: [{					xtype			: 'panel'					,width			: 430					,height			: 175					,style			: {						'background-color'	: 'white'						,'border'			: '1px solid #CCC'					}					,items			: [{						xtype		: 'dataview'						,id			: 'calSchedulesRightDV'						,name		: 'data'						,height		: 155						,itemSelector: 'div.search-item'						,store			: new Ext.data.Store({							reader	: new Ext.data.XmlReader({								record		: 'attendeeRow'							}, ['id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType'])						})						,tpl			: new Ext.XTemplate(							'<table id="calSchedulesRightTable" cellspacing="0">',							'<tpl for=".">',							 '<tr class="{[this.getClassName(xindex)]}">',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',								'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>',							 '</tr>',							'</tpl>',							'</table>', {								getClassName : function(idx) {									if (idx % 2 == 0) {										return 'calScheduleEvenRow'									}									return 'calScheduleOddRow';								}							}						)						,listeners	: {							render		: function() {							}						}					}]				}]			}]		}, {			html	: '<img src="' + Eve.Resource.getIcon('schedules-bbar', 'calendar') + '" />'			,style	: 'margin-top:10px;'		}]	});}/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       CalendarDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */// Event DetailsEve.vc.createFormPanel( 'CalendarEventDetails'	, Eve.Dialogs.Calendar.EventDetails );// RecurrenceEve.vc.createFormPanel( 'CalendarRecurrence'	, Eve.Dialogs.Reminder.Recurrence );// ReminderEve.vc.createFormPanel( 'CalendarReminder'		, Eve.Dialogs.Reminder.ReminderFormPanel );// MeetingEve.vc.createFormPanel( 'CalendarMeeting'		, Eve.Dialogs.Calendar.Meeting );// CommentsEve.vc.createFormPanel( 'CalendarComments'		, Eve.Dialogs.Comment.Main );// InterlinkingEve.vc.createFormPanel( 'CalendarInterlinking'	, Eve.Dialogs.Interlink.Main );// ParticipantsEve.vc.createFormPanel( 'CalendarParticipants'		, Eve.Dialogs.Calendar.Participants );// Contact ParticipantsEve.vc.createFormPanel( 'CalendarContactParticipants', Eve.Dialogs.Calendar.ContactParticipants );// SharingEve.vc.createFormPanel( 'CalendarSharing'		, Eve.Dialogs.Calendar.Sharing );// NotificationsEve.vc.createFormPanel( 'CalendarNotifications'	, Eve.Dialogs.Calendar.Notifications );// SchedulesEve.vc.createFormPanel( 'CalendarSchedules'		, Eve.Dialogs.Calendar.Schedules );// Event DetailsExt.override( Eve.vc.CalendarEventDetails,{	 loadEvent		: function() {return 'modern.calendar.{root}.edit';}	,submitEvent	: function() {return 'modern.calendar.{root}.createModify';}});// RecurrenceExt.override( Eve.vc.CalendarRecurrence,{	 loadEvent		: function() {return 'modern.calendar.{root}.editDetails';}	,submitEvent	: function() {return 'modern.calendar.{root}.createModify';}});// ReminderExt.override( Eve.vc.CalendarReminder,{	 loadEvent		: function() {return 'modern.calendar.{root}.editDetails';}	,submitEvent	: function() {return 'modern.calendar.{root}.createModify';}});// MeetingExt.override( Eve.vc.CalendarMeeting,{	 loadEvent		: function() {return 'modern.calendar.{root}.edit';}	,submitEvent	: function() {return 'modern.calendar.{root}.createModify';}});// CommentExt.override( Eve.vc.CalendarComments,{	 loadEvent		: function() {return 'modern.comment.{root}.view';}	,submitEvent	: function() {return 'modern.comment.{root}.createModify';}});// InterlinkingExt.override( Eve.vc.CalendarInterlinking,{	 loadEvent		: function() {return 'modern.interlink.{root}.view';}	,submitEvent	: function() {return '';}});// ParticipantsExt.override( Eve.vc.CalendarParticipants,{	 loadEvent		: function() {return 'modern.contact.{root}.getAllContacts';}	,submitEvent	: function() {return '';}});// Contact ParticipantsExt.override( Eve.vc.CalendarContactParticipants,{	 loadEvent		: function() {return 'modern.contact.{root}.getAllContacts';}	,submitEvent	: function() {return 'modern.contact.{root}.getAllContacts';}});// SharingExt.override( Eve.vc.CalendarSharing,{	 loadEvent		: function() {return 'modern.calendar.personal.myShareEdit';}	,submitEvent	: function() {return 'modern.calendar.personal.myShareCreateModify';}});// NotificationsExt.override( Eve.vc.CalendarNotifications,{	 loadEvent		: function() {return 'modern.calendar.{root}.editSetting';}	,submitEvent	: function(root) {		if (root == 'personal')			return 'modern.calendar.personal.myShareCreateModify';		else			return 'modern.calendar.group.settingCreateModify';	}});// SchedulesExt.override( Eve.vc.CalendarSchedules,{	 loadEvent		: function() {return 'modern.calendar.group.checkSchedules';}	,submitEvent	: function() {return 'modern.calendar.group.checkSchedules';}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarTreeBridge.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.Calendar.TreeBridge = function() {	Eve.Calendar.TreeBridge.superclass.constructor.apply(this, arguments);};Eve.Calendar.TreeBridge = Ext.extend( Eve.widgets.TreeBridge, {	fetchData : function()	{		var temp = {};		var root = (this.root=='group') ? 'group' : 'personal';				temp.event =  Eve.Resource.cmdGetSubTree(this.section, root);				temp.id   = this.id;		temp.path = this.path;				if (this.root == 'group')			temp.groupId = this.groupId;				return temp;	}		,forceLoad : function(data)	{		// forceLoad affects 'SelectionOnChange'		this.loadForce = true;				var tree	 = this.view.get();		var personal = tree.getNodeById( tree.getPersonalId() );		var groupId	 = data.info.groupId;				if (groupId == '0') {			if (personal)				personal.select();		} else {			var root = tree.getNodeById( tree.getRootId() );			tree.expandNode(root, data.info.groupPath, data.info.path);		}		this.setSharedSection(data);		this.manager.loadFinished(this);	}	,setSharedSection : function(data)	{		var tree	 = this.view.get();		var personal = tree.getNodeById( tree.getPersonalId() );				if (personal) {			if (data.sharedSection) {				personal.getUI().hide();				personal.getUI().toggleCheck(false, true);			} else {				personal.getUI().show();			}		}	}		,registerView : function()	{		Eve.Calendar.TreeBridge.superclass.registerView.apply(this, arguments);				// Get Tree component		var tree = this.view.get();		var sel	 = tree.selModel;						// Remove SelectionChange Handler for Calendar Tree		sel.un('selectionchange', sel._onSelChange, this);				// Remove ContextMenu Handler for Calendar Tree		tree.un('contextmenu', tree._onContextMenu, this);		tree.on('contextmenu', function(node, e) {			var temp = tree.getNodeInfo(node);						this.id			= temp.id;			this.groupId 	= temp.groupId;			this.parentId 	= temp.parentId;			this.root		= temp.root;			this.path		= temp.path;						var obj = tree.getMode(node.id);			if (node.id == tree.getRootId())				return;							// In case of node is 'Personal' the way we send data is diffrent from other cases.			if (obj.root == 'personal' && obj.id == 0) {				var data = {					type	: 'group'					,pos	: e.getXY()					,node	: node					,info	: {						id			: 0						,parentId	: 0						,root		: 'personal'						,path		: '\\'					}				}								this.fire(this.section + '_treemenu',  data);				return;			}						var data = {				type	: (node.id.indexOf('G_')==-1) ? 'folder' : 'group'				,pos	: e.getXY()				,node	: node				,title	: node.text				,info	: {					id			: this.id					,parentId	: this.parentId					,groupId	: this.groupId					,root		: this.root					,path		: this.path				}			}						this.fire(this.section + '_treemenu', data);		}, this);						// Remove BeforeStartEdit Handler for Calendar Tree		this.treeEd.un('beforestartedit', this.treeEd._onBeforeStartEdit, this)		this.treeEd.on('beforestartedit', function() {			return false;		}, this)						// Handle Checkbox		tree.on('checkchange', function(node, checked) {			var data 	 	 = tree.getMode(node.id);			var personalNode = tree.getNodeById(tree.getPersonalId());			var groupsNode	 = tree.getNodeById(tree.getGroupsId());			var sharedNode	 = tree.getNodeById(tree.getSharedId());						data.checked	 = checked;			data.showOnly	 = node.showOnly;			// Important			delete node.showOnly;						// If user trying to uncheck all nodes...			if (!checked) {				var checkedNodes = tree.getCheckedNodes();				var ns			 = [];								for (var i in checkedNodes) {					try {						if (! node.contains(checkedNodes[i])) {							ns.push(checkedNodes[i]);						}					} catch (e) {}				}								if (ns.length < 1) {					Ext.tools.msg('Operation denied', 'At least one node should be selected in tree');					// re-check the node					node.getUI().toggleCheck(true, true);					return;				}			}						// If user doesn't have permission...			if (checked && !node.attributes.per.Select) {				// re-uncheck the node				node.getUI().toggleCheck(false, true);				return;			}						data.info	 = {				id			: node.id				,groupId	: this.groupId				,root		: this.root				,path		: this.path				,parentId	: this.parentId			}						this.fire(this.section + '_set_active_node', data);						// If a Child node of Personal checked, uncheck the Personal node itself...			if (checked && data.root == 'personal' 				&& node != personalNode				&& node !== groupsNode				&& node !== sharedNode				&& node.parentNode !== sharedNode)			{					personalNode.getUI().toggleCheck(false, true);			}						// ... and vice versa			if (checked && node == personalNode) {				personalNode.eachChild(function(n) {					n.getUI().toggleCheck(false, true);					// Lock to prevent sending request to back-end on unchecking process.				})							}						// Apply action to its children			if (node.hasChildNodes() && node != personalNode) {				/*				while (node.hasChildNodes()) {					node.removeChild(node.item(0));				}				*/				node.reload();							}					}, this);	}		,execute : function(callee, type, object)	{		var tree = this.view.get();				switch(type) {			// Update Color			case ('calendar_success_update_color'):				var id		= tree.createId(object.info.root, object.info.id, object.info.groupId);				var node 	= tree.getNodeById(id);				node.getUI().updateColor(object.color);				break;							// Check only a Node			case ('calendar_check_only'):				// Check the passed node				if (object.node) {					var node = object.node;				} else {					var id	 = tree.createId(object.info.root, object.info.id, object.info.groupId);					var node = tree.getNodeById(id);				}								// If node doesn't have select permission, return				if (!node.attributes.per.Select)					return;												// Get all checked nodes				var nodes = tree.getCheckedNodes();								// Uncheck them				for (var i = 0; i < nodes.length; ++i) {					nodes[i].getUI().toggleCheck(false, true);				}								node.showOnly = true;				node.getUI().toggleCheck(true, false);				tree.getSelectionModel().select(node);								break;						// Create Folder			case (this.section + '_success_create_folder'):				// We can add shared calendar only under the Personal node				parent = tree.getNodeById(tree.getPersonalId());								if (parent) {					// Make sure the parent is not a leaf anymore					parent.leaf = false;										// Make the node here;					var attr = {						text	: object.params.shareName						,id		: object.info.rawId || object.info.id						,leaf	: true						,cls	: 'calendar-tree-folder-node'						,checked: false						,color	: object.info.color					};										// Permissions					attr.per	= {						Select	: object.info.selectPrm || true						,New	: object.info.newPrm	|| true						,Edit	: object.info.editPrm	|| true						,Delete	: object.info.deletePrm || true					}										parent.appendChild(new Ext.tree.TreeNode(attr));				}												if (object.info.root == 'personal') {					// Update the Preference					var nodes = Eve.Preference.get('tree')[this.section].nodes;										for (var i = 0; i < nodes.length; ++i) {						var node = nodes[i];												if (node.get('id') == parent.id) {							node.set('leaf', false);														// We found it, so let's skip the loop							return;						}					}				}								break;							// Check Parent on tree when a sub item created			case ('calendar_success_create_item'):				var id	 = object.params.calendars;				var pre	 = (id == '0') ? 'EP_' : 'EG_';				var node = tree.getNodeById(pre + id);								// If Parent node exists and is not checked yet				if (node) {					if (!node.getUI().isChecked()) {						node.getUI().toggleCheck(true, false);					}				}				else {					// If parent node doesn't exist in tree					this.fire('calendar_set_active_node', object);				}								break;							default:				Eve.Calendar.TreeBridge.superclass.execute.apply(this, arguments);		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarTreePanel.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Eve.Calendar.Tree*/Eve.Calendar.Tree = function(config) {	config.loader = new Eve.Calendar.TreeLoader(config.loader);		// Invoke the parent constructor.	Eve.Calendar.Tree.superclass.constructor.call(this, config);};Ext.extend(Eve.Calendar.Tree, Eve.Tree, {		getSharedId : function() {		return [this.getSP(), "P_-3"].join('');	}		// Get info about currently selected node.	,getNodeInfo: function (node) {		if (node === undefined || !node) {			node = this.getSelectionModel().getSelectedNode();			if (!node) return false;		}				var	gId 	= this.getGroupId(node);						// Group ID		var fId 	= this.getFolderId(node);						// Folder ID		var pId		= node.parentNode ? node.parentNode.id : '';	// Parent ID		var nId 	= node.id;		var nPath 	= this.getNodePath(node);		switch (nId) {			case this.getRootId():				nId 		= '-1';				break;						case this.getGroupsId():				nId 		= '-2';				break;						case this.getSharedId():				nId = '-3';				break;						default:				var obj = this.getMode(nId);				if (obj !== undefined)					nId = obj.id;		}		switch(pId) {			case this.getRootId():				pId = '-1';				break;						case this.getGroupsId():				pId = '-2';				break;						case this.getSharedId():				pId = '-3';				break;						default:				var obj = this.getMode(pId);				if (obj !== undefined)					pId = obj.id;		}				return {			id			: nId			,headerPath : nPath.header			,groupId	: gId			,folderId	: fId			,parentId	: pId			,path		: nPath.path			,root		: (gId && gId != this.getGroupsId() && gId != this.getPersonalId() && gId != this.getRootId())							? 'group' : 'personal'		}	}		// Written by Omid	,getCheckedNodes : function(a, startNode)	{		startNode = startNode || this.root;		var r = [];		var f = function() {			if (this.getUI().isChecked()) {				r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));			}		}				startNode.cascade(f);		return r;	}	}); // End of Ext.extend/**	END:	Eve.Calendar.Tree* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Tree NodeUI*/Ext.override(Ext.tree.TreeNodeUI, {	renderElements : function(n, a, targetNode, bulkRender){        // add some indent caching, this helps performance when rendering a large tree        this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';        var cb = typeof a.checked == 'boolean';		var textStyle = (n.attributes['completed']== true || n.attributes['completed']== "1") ?			'color:#808080;text;font-style:italic;' : 'color:#000; font-style:none;'// majid: use the old version for now.        var href = a.href ? a.href : Ext.isGecko ? "" : "#";        var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',            '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",            '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',            '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',            cb ? ('<input style="vertical-align:middle;" class="x-tree-node-cb"  type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',            (a.color ? "<span style='vertical-align:middle;margin-left:2px;background-color:#" + a.color + "'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" : ""),            '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on" style="'+textStyle+'">',n.text,"</span></a>",			 //(a.color ? "<span style='background-color:#" + a.color + "'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" : ""),			 "</div>",            '<ul class="x-tree-node-ct" style="display:none;"></ul>',            "</li>"].join('');        var nel;        if(bulkRender !== true && n.nextSibling && (nel = n.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[3];			// fix for IE6			this.checkbox.defaultChecked = this.checkbox.checked;			            index++;            if(a.color)                index++        }        this.anchor = cs[index];        this.textNode = cs[index].firstChild;		this.color	= cs[4]    }		,toggleCheck : function(value, silent) {        var cb = this.checkbox;        if(cb){            cb.checked = (value === undefined ? !cb.checked : value);            this.onCheckChange(silent);        }    }		// private    ,onCheckChange : function(silent) {        var checked = this.checkbox.checked;		// fix for IE6		this.checkbox.defaultChecked = checked;        this.node.attributes.checked = checked;				if (silent === true)			return;					this.fireEvent('checkchange', this.node, checked);    }		,updateColor : function(color) {		Ext.fly(this.color).setStyle('background-color', ['#', color].join(''));	}});/**	END:	Tree NodeUI* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **	START:	Tree Loader*/// Change the Tree Loader behaviour to read the Xml instead of Json.Eve.Calendar.TreeLoader = Ext.extend(Ext.tree.TreeLoader, {	reader : new Ext.data.XmlReader({			record : 'node'		}, [				 {name: 'text'				, type: 'string' }				,{name: 'id'				, type: 'string' }				,{name: 'leaf'				, type: 'boolean'}				,{name: 'cls'				, type: 'string' }				,{name: 'selectPermission'	, type: 'boolean'}				,{name: 'newPermission'		, type: 'boolean'}				,{name: 'editPermission'	, type: 'boolean'}				,{name: 'deletePermission'	, type: 'boolean'}        		,{name: 'system'			, type: 'string' }				// Calendar Section				,{name: 'checked'			, type: 'auto',	defaultValue: undefined}				,{name: 'color'				, type: 'auto',	defaultValue: undefined}			]	),		createNode : function(record) {		var attr = {};		attr.text	= record.get('text');		attr.id		= record.get('id');		attr.leaf	= record.get('leaf');		attr.cls	= 'calendar-tree-' + record.get('cls');				var permission = {			Select	: record.get('selectPermission')			,New	: record.get('newPermission')			,Edit	: record.get('editPermission')			,Delete	: record.get('deletePermission')		}				attr.per	= permission;		attr.loader = this;        	attr.system 	= record.get('system');		attr.title		= record.get('title');    	attr.unread 	= record.get('unread');    	attr.path 		= record.get('path');				if (record.get('checked') !== undefined) {			attr.checked = (record.get('checked') == 'true') || (record.get('checked') == '1');		}				// Set the Color if its defined or not equals to me --> :D (Xerxes)		var color = record.get('color');		if (color !== undefined || color.toLowerCase() != 'xerxes') {			attr.color = color;		}		var temp = (attr.id.indexOf("P_0") != -1 ||					attr.id.indexOf("P_-2") != -1) ? false : true;				// Prevent Special Nodes from Dragging.		attr.draggable	= temp;		// Prevent Special Nodes to be Target Node.		attr.isTarget	= (attr.id.indexOf("P_-2") != -1) ? false : true;		if (typeof attr.uiProvider == 'string'){			attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);		}				return(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr));	}});/**	END:	Tree Loader* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarFactory.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Calendar.Factory = function() {}Ext.extend( Eve.lib.Calendar.Factory, Eve.lib.Factory,{	section: 'calendar'	,prefix	: 'E'			,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);				// D&D		superbridge.addBridge(Eve.DragDrop);		Eve.DragDrop.init({			superbridge	: superbridge			,section	: this.section		});	}		,createWest  : function(superbridge)	{		Eve.vc.createComponent('CalendarTreePanel'	, Eve.Calendar.Tree);				var view 	= new Eve.vc.CalendarTreePanel();		var conn 	= Eve.widgets.TreeStore;		var bridge	= new Eve.Calendar.TreeBridge();				superbridge.addBridge(bridge);		this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,section	: this.section			,prefix		: this.prefix			,manager	: this.manager		});				var config = {			title		: 'Calendar'			,width		: 200			,collapsible: true			,collapseMode: 'mini'			,split		: true			,hideCollapseTool: true			,tools		: [{				id			: 'refresh'				,qtip		: 'Refresh'				,handler	: function() {					view.get().root.reload();				}			}]		}				Eve.Calendar._treePanel = view.get();				return { view: view, config: config };	}	 	,createCenter: function(superbridge)	{		var view 	= new Eve.vc.EditorGridPanel();		var conn	= new Eve.widgets.GridStore();		var bridge 	= new Eve.widgets.Calendar.GridBridge();		var dailyView = new Eve.widgets.Calendar.DailyView();				conn.setSection('Calendar');				superbridge.addBridge( bridge );		superbridge.addBridge( dailyView );				this.manager.registerComponents(dailyView);		dailyView.init({			superbridge	: superbridge			,section	: this.section			,manager	: this.manager		});				this.manager.registerComponents(bridge);		bridge.init({			superbridge	: superbridge			,view		: view			,conn		: conn			,dwm		: dailyView			,section	: this.section			,manager	: this.manager		});				this.topBar = new Ext.Toolbar(bridge.getToolbar());				var config = {			layout		: "card"			,id			: "calendarCardLayout"			,activeItem	: 1			,tbar		: this.topBar			,items		: [	view.get(), dailyView.get() ]			/*			,listeners  : {				render: function() {					setTimeout(function() {						Ext.getCmp('calendarCardLayout').getLayout().setActiveItem(1);					}, 500)				}			}			*/		}				return { view: view, config: config };	 }	 	 ,createMenus : function(superbridge) 	 {		 this.amenu 	= new Eve.widgets.CalendarAddMenu();		 this.emenu 	= new Eve.widgets.CalendarEditMenu();		 this.tmenu 	= new Eve.widgets.CalendarTreeMenu();		 this.taskMenu 	= new Eve.widgets.CalendarTaskAddMenu();		 		 superbridge.addBridge( [this.amenu, this.emenu, this.tmenu, this.taskMenu] );						var data = {			superbridge	: superbridge			,section	: this.section		}		 		 this.amenu.init(data);		 this.emenu.init(data);		 this.tmenu.init(data);		 this.taskMenu.init(data)	 }	 	 ,createDialogs : function(superbridge)	 {		var itemDlg		= new Eve.lib.Calendar.EventDetails();		var settingDlg	= new Eve.lib.Calendar.Settings();		var partiDlg	= new Eve.lib.Calendar.Participants();		var cntPartiDlg	= new Eve.lib.Calendar.ContactParticipants();		var scheduleDlg	= new Eve.lib.Calendar.Schedules();				superbridge.addBridge(itemDlg);		superbridge.addBridge(settingDlg);		superbridge.addBridge(partiDlg);		superbridge.addBridge(cntPartiDlg);		superbridge.addBridge(scheduleDlg);				itemDlg.addPanel(new Eve.vc.CalendarEventDetails());		itemDlg.addPanel(new Eve.vc.CalendarMeeting());		itemDlg.addPanel(new Eve.vc.CalendarComments());		itemDlg.addPanel(new Eve.vc.CalendarInterlinking());				settingDlg.addPanel(new Eve.vc.CalendarSharing());		settingDlg.addPanel(new Eve.vc.CalendarNotifications());		partiDlg.addPanel(new Eve.vc.CalendarParticipants());		cntPartiDlg.addPanel(new Eve.vc.CalendarContactParticipants());		scheduleDlg.addPanel(new Eve.vc.CalendarSchedules());				itemDlg.init({			superbridge	: superbridge			,section	: this.section			,origin: 'item'		});				settingDlg.init({			superbridge	: superbridge			,section	: this.section		});				partiDlg.init({			superbridge	: superbridge			,section	: this.section		});		cntPartiDlg.init({			superbridge	: superbridge			,section	: this.section		});		scheduleDlg.init({			superbridge	: superbridge			,section	: this.section		});								// - - - - - - - - - - - - - - - - - - - - - - - - - - -		// Start: Get new instance of dialog for interlinking				var dlgCalendarItem 	= new Eve.lib.Calendar.EventDetails();				superbridge.addBridge(dlgCalendarItem);				dlgCalendarItem.addPanel(new Eve.vc.CalendarEventDetails());		dlgCalendarItem.addPanel(new Eve.vc.CalendarMeeting());				dlgCalendarItem.init({superbridge: superbridge, section: this.section + '_il', origin: 'item'});				// End: Get new instance of dialog for interlinking		// - - - - - - - - - - - - - - - - - - - - - - - - - - -	 }	 	 ,createRest : function(superbridge)	 {		var filter 	= new Eve.Filter();		superbridge.addBridge(filter);				filter.init({			superbridge	: superbridge			,section	: this.section		})						// * * * * * * * * * *		// Premissions		// * * * * * * * * * *				var prm	= new Eve.Permission();		superbridge.addBridge(prm);				prm.init({			superbridge	: superbridge			,section	: this.section		})				//prm.regTreeMenu(this.tmenu);		prm.regGridMenu(this.amenu);		prm.regGridMenu(this.emenu);		prm.regToolbarButton(this.topBar);			 }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarGridImp.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.widgets.Calendar.GridBridge = Ext.extend( Eve.widgets.DefaultGridBridge,{	gridSection : 'calendar'		,getToolbar : function() 	{		return this.toolbar	}		// Set Instance Daily, Weekly, Monthly View	,setDWM : function(dwm)	{		this.dwm = dwm;	}		// Get Instance Daily, Wfeekly, Monthly View	,getDWM : function()	{		return this.dwm;	}		,init : function(obj)	{		Eve.widgets.Calendar.GridBridge.superclass.init.call(this, obj);		this.initLocalVars();				this.conn.init(this.reader);		var store = this.conn.getStore();				this.view.init({			id 				: 'calendar_grid'			,ds 			: store			,cm 			: this.columns			,sm 			: new Ext.grid.RowSelectionModel({moveEditorOnEnter :false,  singleSelect: true})			// Pagination Toolbar			,bbar			: new Ext.PagingToolbar({				store			: store				,displayInfo	: true				,btnRefreshText	: 'Refresh'				,refreshText	: 'Refresh Calendar'			})			,plugins		: this.rowExpander			,loadMask 		: true			,stripeRows 	: true			,border 		: false			,viewConfig 	: {				rowSelectorDepth	: 20				,emptyText			: '<div style="width:400px; margin:50px auto; ">There are no items to be displayed, Create one by clicking on New.</div>'			}			,keys			: this.getKeyMap()		});				this.setDWM(obj.dwm);		this.registerView();	}		,initLocalVars : function()	{		// Fields for Grid's Reader.		this.fields = [			 { name: 'type'						,type: 'string'}			,{ name: 'subject'					,type: 'string'}			,{ name: 'notes'					,type: 'string'}			,{ name: 'startDate'				,type: 'string'}			,{ name: 'endDate'					,type: 'string'}			,{ name: 'location'					,type: 'string'}			,{ name: 'allDay'					,type: 'string'}			,{ name: 'hasReminder'				,type: 'string'}			,{ name: 'calendarName'				,type: 'string'}			,{ name: 'appliedToAllRecurrences'	,type: 'string'}			,{ name: 'reminderId'				,type: 'string'}			,{ name: 'recurrence'				,type: 'string'}			,{ name: 'color'					,type: 'string'}			,{ name: '_index'					,type: 'int' , mapping: 'index'}						// Important			,{ name: 'groupId'					,type: 'string'}			,{ name: 'root'						,type: 'string'}			,{ name: 'path'						,type: 'string'}			,{ name: 'parentId'					,type: 'string'}						,{ name: 'linkedItems'				,type: 'string' }			,{ name: 'created'					,type: 'string' }			,{ name: 'lastModified'				,type: 'string' }			,{ name: 'editPermission'			,type: 'boolean'}			,{ name: 'deletePermission'			,type: 'boolean'}			,{ name: 'createdBy'		,type: 'string'}			,{ name: 'createdDate'		,type: 'string'}			,{ name: 'lastModifiedBy'	,type: 'string'}			,{ name: 'lastModifiedDate' ,type: 'string'}		];				// This is grid's reader. You'll see grid itself few more lines down.		this.reader = new Ext.data.XmlReader({			id				: 'id'			,record			: 'row'			,totalRecords	: 'total'		}, Ext.data.Record.create( this.fields ) );						// Adds a Plus/Minus icon in the left of each ro to expands grid's row. (Ext's user extention)		this.rowExpander = new Ext.grid.RowExpander({			dataIndex		: ""			,fieldName		: "type"			,enableCaching	: false 			,tpl			: new Ext.XTemplate(				'<table width="100%" style="padding: 5px;overflow: hidden;">',				 '<tr>',					'<td><b>{subject}</b></td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<div style="float:left; position:relative; padding-right:15px;">',							'<img width="32px" height="32px" src=',								Eve.Resource.getIcon('item-event','calendar'),							' />',						'</div>',						'<div>',							'<table width="100%">',							 '<tr>',								'<td>',									'{notes}<br />',								'</td>',								'<td>',								'</td>',							 '</tr>',							'</table>',						'</div>',					'</td>',				 '</tr>',				 '<tr>',					'<td><hr /></td>',				 '</tr>',				 '<tr>',					'<td>',						'<p>{created}',						'<br />{lastModified}</p>',					'</td>',				 '</tr>',				 '</table>'			)		});						// Grid's Column Model		this.columns = new Ext.grid.ColumnModel([this.rowExpander, {			header 			: "<img src='" + Eve.Resource.getIcon('item-event','calendar') + "' />"			,dataIndex 		: 'type'			,width 			: 30			,sortable		: false			,fixed			: true			,menuDisabled	: true			,renderer		: function(value, attr, rec) {				return "<img src='" + Eve.Resource.getIcon('item-event','calendar') + "' />";			}		}, {			header			: '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />'			,dataIndex		: 'linkedItems'			,width			: 30			,sortable		: false			,fixed			: true			,menuDisabled	: true			,renderer		: function(value, metadata, rec) {				if (value == '') { return '' }								var icon = (value != '0') ? '<img src="' + Eve.Resource.getIcon('paper-clip', 'interlink') + '" />': '';				return "<span onmouseover='this.style.cursor=\"pointer\"'>" + icon + "</span>";			}		}, {			header			: '&nbsp;'			,dataIndex		: 'color'			,width			: 25			,sortable		: false			,fixed			: true			,menuDisabled	: true			,renderer		: function(value, metadata, rec) {				return "<div style='background-color: #" + value + "'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>"			}		}, {			header			: 'Subject'			,dataIndex		: 'subject'			,width			: 250			,sortable   	: true		}, {			header			: 'Location'			,dataIndex		: 'location'			,width			: 150			,sortable   	: true		}, {			header			: 'Start'			,dataIndex		: 'startDate'			,width			: 80			,sortable   	: true		}, {			header			: 'End'			,dataIndex		: 'endDate'			,width			: 80			,sortable   	: true		}, {			header			: 'Calendars'			,dataIndex		: 'calendarName'			,width			: 100		}, {			header			: '<img src="' + Eve.Resource.getIcon('recurrence','calendar')	+ '" />'			,dataIndex		: 'recurrence'			,width			: 25			,menuDisabled	: true			,renderer		: function(val) {				if (val != '0') {					return '<img src="' + Eve.Resource.getIcon('recurrence','calendar')	+ '" />';				}									return '';			}		},{			header		: 'Created By'			,dataIndex	: 'createdBy'			,width		: 120			,sortable	: true		}, {			header		: 'Creation Date'			,dataIndex	: 'createdDate'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified By'			,dataIndex	: 'lastModifiedBy'			,width		: 120			,sortable	: true		},{			header		: 'Last Modified Date'			,dataIndex	: 'lastModifiedDate'			,width		: 120			,sortable	: true		}]);				// New Item handler		var newEventHdl = function() {			// Find current mode			var mode;						if (Ext.getCmp('calendar-topbar-daily').pressed)				mode = 'dailyCal';			else if (Ext.getCmp('calendar-topbar-weekly').pressed)				mode = 'weeklyCal';			else if (Ext.getCmp('calendar-topbar-monthly').pressed)				mode = 'monthlyCal';			else				mode = null;							var dwm		= this.getDWM();						if (mode) {				var rDate	= dwm[mode].getDate();				//var date	= rDate.format('n/j/y');				var date	= rDate.format(Eve.Preference.get('dateFormat'));			}					var data = {				info		: {					id			: 0					// It's ok to hardcode it in Calendar... Don't Ask me why, probably i can't remember					,root		: 'personal'					,groupId	: 0					,parentId	: 0					,path		: '\\'				}				,selectedDate	: date				,rawSelectedDate: rDate				,calType: mode || 'listCal'			}						this.fire('calendar_create_item_dlg', data);		}				// Grid's Toolbar.		this.toolbar = {			items: [new Ext.Toolbar.SplitButton({				text 	: 'New'				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('new', 'general')				,handler: newEventHdl.createDelegate(this)				,menu : [{					text 	: 'Event'					,id		: 'calendar-tb-new-category'					,cls 	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('item-new','calendar')					,handler: newEventHdl					,scope	: this				}, {					text 	: 'Shared Calendar'					,cls 	: "x-btn-text-icon"					,icon	: Eve.Resource.getIcon('folder-new','calendar')					,handler: function() {    						var info = {							id			: 0							// It's ok to hardcode it in Calendar... Don't Ask me why, probably i can't remember							,root		: 'personal'							,groupId	: 0							,parentId	: 0							,path		: '\\'						}												this.fire('calendar_add_setting_dlg', {info: info});					}					,scope	: this				}]			}), {				text 	: "Edit"				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('edit', 'general')				//,tooltip: Eve.Resource.getToolTip.btnEdit				,handler: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						// Calendar just has items						type = 'item';												var data = {							info	: {								id			: rec.id.split("_")[1]								,parentId	: this.getId()								,groupId	: this.getGroupId()								,root		: this.getRoot()								,path		: this.getPath()								,typeId		: Eve.Resource.getTypeId(this.getRoot(), type, this.section)	// Used in Interlinking Dialog.							}							,title	: this.getRowTitle(rec)						}												this.fire("calendar_edit_" + type + "_dlg", data);					} else {						Ext.tools.msg('Select a Record', 'To Edit a Contact, You need to select a record in grid below.');					}				}				,scope	: this			}, {				text 	: "Delete"				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('delete', 'general')				//,tooltip: Eve.Resource.getToolTip.btnDelete				,handler: function() {					var rec = this.view.get().getSelectionModel().getSelected();					if (rec) {						type = 'item';												var info = {							id			: rec.id.split("_")[1]							,parentId	: this.getId()							,groupId	: this.getGroupId()							,root		: this.getRoot()							,path		: this.getPath()						}												this.fire("calendar_delete_" + type + "_dlg", {info: info, title: rec.data.subject} );					} else {						Ext.tools.msg('Select a Record', 'To Delete a Calendar, You need to select a record in grid below.');					}				}				,scope	: this					}, '-', {				text 	: "Print"				,id		: "btnCalendarButton"				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('print', 'general')				,handler: function() {					var info = {						id			: this.id		// Id of current tree node.						,groupId	: this.groupId						,root		: this.root						,path		: this.path						//,start		: this.view.get().store.lastOptions.params.start					}					if (this.activeView == 'list') {						info.start =  this.view.get().store.lastOptions.params.start;						this.fire("calendar_print_folder", {info: info});					} else {						//this.printPopup();						this.fire("calendar_print_views", {});					}				}				,scope		: this							}, '-', {				text 	: "Refresh"				,id		: "btnCalendarRefresh"				,tooltip: 'Refresh Calendar'				,cls 	: "x-btn-text-icon"				,icon	: Eve.Resource.getIcon('refresh', 'calendar')				,handler: function() {					this.fire('calendar_dwm_refresh');				}				,scope		: this			}, {				xtype			: 'splitbutton'				,id				: 'calFilterFrom'				,text			: 'Start: '				,hidden			: true				,menu			: new Ext.menu.DateTimeMenu({					id			: 'calFilterFromPicker'					,dateFormat	: Eve.Preference.get('dateFormat')//'n/j/y'					,timeFormat	: Eve.Preference.get('timeFormat')//'G:i A'					,format		: [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')//'n/j/y G:i A'					,listeners	: {						select		: function(cmp, date) {							var toPicker = Ext.getCmp('calFilterToPicker').picker;							var data = {								 startDate	: date.format(cmp.dateFormat)								,startTime	: date.format(cmp.timeFormat)								,endDate	: toPicker.getValue().format(cmp.dateFormat)								,endTime	: toPicker.getValue().format(cmp.timeFormat)							}							this.fire('calendar_set_filter_list', data);						}						,scope		: this					}				})				,handler		: function() { this.showMenu() }			}, {				xtype			: 'splitbutton'				,id				: 'calFilterTo'				,text			: 'End: '				,hidden			: true				,menu			: new Ext.menu.DateTimeMenu({					id			: 'calFilterToPicker'					,dateFormat	: Eve.Preference.get('dateFormat')//'n/j/y'					,timeFormat	: Eve.Preference.get('timeFormat')//'G:i A'					,format		: [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')//'n/j/y G:i A'					,listeners	: {						select		: function(cmp, date) {							var fromPicker = Ext.getCmp('calFilterFromPicker').picker;							var data = {								 startDate	: fromPicker.getValue().format(cmp.dateFormat)								,startTime	: fromPicker.getValue().format(cmp.timeFormat)								,endDate	: date.format(cmp.dateFormat)								,endTime	: date.format(cmp.timeFormat)							}							this.fire('calendar_set_filter_list', data);						}						,scope		: this					}				})				,handler		: function() { this.showMenu() }			}, '->', {				text			: 'Daily'				,id				: "calendar-topbar-daily"				,cls 			: "x-btn-text-icon"				,icon			: Eve.Resource.getIcon('view-daily','calendar')				,enableToggle	: true				,toggleGroup	: 'dwml'				,handler		: this.changeView				,scope			: this				,txt			: 'day'				,taskHeight		: '86'			}, {				text			: 'Weekly'				,id				: "calendar-topbar-weekly"				,cls 			: "x-btn-text-icon"				,icon			: Eve.Resource.getIcon('view-weekly','calendar')				,enableToggle	: true				,toggleGroup	: 'dwml'				,handler		: this.changeView				,scope			: this				,txt			: 'week'				,taskHeight		: '86'			}, {				text			: 'Monthly'				,id				: "calendar-topbar-monthly"				,cls 			: "x-btn-text-icon"				,icon			: Eve.Resource.getIcon('view-monthly','calendar')				,enableToggle	: true				,toggleGroup	: 'dwml'				,pressed		: true				,handler		: this.changeView				,scope			: this				,txt			: 'month'				,taskHeight		: '24'			}, {				text			: 'List'				,cls 			: "x-btn-text-icon"				,id				: "calendar-topbar-list"				,icon			: Eve.Resource.getIcon('view-list','calendar')				,enableToggle	: true				,toggleGroup	: 'dwml'				,handler		: this.changeView				,scope			: this				,txt			: 'list'			}		]}	}	,setPrintIcons: function(records){		var v;		for (var i = 0, len = records.length; i < len; i++) {			v = records[i].data.recurrence;			if( v == 0 ){				records[i].data.recurrence = "";			}			else{				records[i].data.recurrence =["<img src='", Eve.Resource.getIcon('recurrence', 'calendar'), "' width=16>"].join('');			}		}	}	// Overrride	,getGroupId : function()	{		var grid 	= this.view.get();		var rec		= grid.getSelectionModel().getSelected();				if (rec) {			return rec.get('groupId').split('_')[1];		}				return this.groupId || 0;	}		// Overrride	,getRoot : function()	{		var grid 	= this.view.get();		var rec		= grid.getSelectionModel().getSelected();				return (rec) ? rec.get('root') : 'personal';	}		// Overrride	,getPath : function()	{		var grid 	= this.view.get();		var rec		= grid.getSelectionModel().getSelected();		var path	= this.path;				if (rec && rec.get('path') != '')			path = rec.get('path');					return path;	}	// It called by buttons on toolbar to switch bet	,changeView : function(btn)	{		var layout	 = Ext.getCmp("calendarCardLayout").getLayout();				var viewMode = '';		var cardIdx	 = 1;				if (btn.txt == 'list') {			this.refetchData();			cardIdx = 0;			this.syncColumnModel(0);						// Show From/To			Ext.getCmp('calFilterFrom').show();			Ext.getCmp('calFilterTo').show();			Ext.getCmp('btnCalendarRefresh').hide();					} else {			// Hide From/To			Ext.getCmp('calFilterFrom').hide();			Ext.getCmp('calFilterTo').hide();			Ext.getCmp('btnCalendarRefresh').show();						switch (btn.txt) {				case 'day':					this.fire( 'calendar_switch_view', { viewMode: 'daily' } );					viewMode = 'Daily';					break;									case 'week':					this.fire( 'calendar_switch_view', { viewMode: 'weekly' } );					viewMode = 'Weekly';					break;									case 'month':					this.fire( 'calendar_switch_view', { viewMode: 'monthly' } );					viewMode = 'Monthly';					break;			}					}				Eve.calendar.Bubble.closeBubble();		Eve.calendar.MonthlyBubble.hide();				// Change the layout		if(cardIdx == 0) {			layout.setActiveItem(cardIdx);		}				// 		this.activeView = btn.txt;	}		// Fetch data when view is changed	,refetchData : function()	{		var command = Eve.Resource.cmdSelectMode('List', 'personal');				command.start = 0;		command.limit = 20;				// Append this object to store for PagingToolbar		this.conn.getStore().params = {			event	: Eve.Resource.cmdChangePage(this.section, 'personal')		}				// Execute the command		this.conn.request(command);		}		// Override for custom operations needed in this section	,fetchData : function(data)	{		var command = { 			event 	: Eve.Resource.cmdSelectFolder(this.section, 'personal')			,checked: data.checked			,start	: 0			,limit	: 20		};				if (data.showOnly) {			command.showOnlyThisCalendar = true;		}				var root = data.root || data.info.root;		var pId	 = (data.id !== undefined) ? data.id : data.info.id;		var gId	 = data.groupId || data.id || data.info.groupId;						// There's some exception		try {			var id = data.info.id.split('_')[1];			switch (id) {				case '-2':					root = 'personal';					pId	 = '-2';					break;								case '-3':					root = 'personal';					pId = '-3';					break;								}		}		catch(e) {};				switch (root) {			case "personal":				command.personalId = pId;				break;						case "group":				command.groupId	= gId;				break;							case "shared":				command.personalId = data.id;		}				// Append this object to store for PagingToolbar use.		this.conn.getStore().params = {			event	: Eve.Resource.cmdChangePage(this.section, 'personal'),			groupId	: gId		}				// Execute the command		this.conn.request(command);	}	,forceLoad : function(data)	{			if ( this.checkValidSection() ) {			var command = {				event 	: Eve.Resource.cmdSelectFolder(data.section, 'personal')				,id		: data.info.id || 0				,groupId: data.info.groupId				,path	: data.info.path || '\\'				,start	: 0				,limit	: Eve.Preference.get('itemsperpage')			}			// Append this object to store for PagingToolbar			this.conn.getStore().params = {				event	: Eve.Resource.cmdChangePage(data.section, 'personal')				,groupId: data.info.groupId			};						this.setSharedSection(data);						// Execute the command			this.conn.request(command);		} else {			// Important			this.manager.loadFinished(this);		}	}		,registerView : function()	{		Eve.widgets.Calendar.GridBridge.superclass.registerView.call(this);				var grid = this.view.get();				// - - - - - - - - - - - - - - - - - -		// Custom Handlers can go here.		// - - - - - - - - - - - - - - - - - - 				grid.un('rowcontextmenu', this.hdlRowContextMenu, this );		grid.on('rowcontextmenu', function(grid, rowIndex, e) {			e.stopEvent();			// First Select the row			grid.getSelectionModel().selectRow(rowIndex);						var rec		= this.view.get().getStore().getAt(rowIndex);			var type	= this.getRowType(rowIndex);			var data	= { 				pos		: e.getXY()				,type	: type				,title	: this.getRowTitle(rowIndex)				,rec	: rec				,info	: { 					id			: this.getRowId(rowIndex)					,typeId		: Eve.Resource.getTypeId(this.getRoot(), type, this.section)					,parentId	: this.getId()					,groupId	: this.getGroupId()					,root		: this.getRoot()					,path		: this.getPath()					,rawId		: rec.id				}			}						this.fire('calendar_before_editmenu', data);		}, this);				// - - - - - - - - - - - - - - - - - -		// Handle Calendar Grid Double Click		// - - - - - - - - - - - - - - - - - -		grid.on('rowdblclick', function(grid, rowIdx, e) {			var rec	 = grid.getStore().getAt(rowIdx);						if (rec) {				type = rec.data.type;				var info = {				   id			: rec.id.split("_")[1]				  ,parentId 	: this.id				  ,groupId		: this.getGroupId()				  ,root			: this.getRoot()				  ,path			: this.getPath()				  ,typeId		: Eve.Resource.getTypeId(this.getRoot(), type, this.section)				  ,singleEvent	: false				}								this.fire(this.gridSection + "_edit_item_dlg", {info: info, title: this.getRowTitle(rec)} );							}		}, this);						//--------------------------------------		//  Handle Calendar Grid Icon Click		//--------------------------------------		grid.on('cellclick', function(grid, rowIdx, colIdx) {			var cm 	= grid.colModel;			if (colIdx != 1)				return;						var rec	 = grid.getStore().getAt(rowIdx);						if (rec) {				type = rec.data.type;				var info = {				   id			: rec.id.split("_")[1]				  ,parentId 	: this.id				  ,groupId		: this.getGroupId()				  ,root			: this.getRoot()				  ,path			: this.getPath()				  ,typeId		: Eve.Resource.getTypeId(this.root, type, this.section)				  ,singleEvent	: false				}				this.fire(this.gridSection + "_edit_item_dlg", {info: info, title: this.getRowTitle(rec)} );			}		}, this);						//--------------------------------------		//  Handle Calendar Column Move & Resize		//--------------------------------------		grid.un('columnmove', this.hdlColResizeMove, this);		grid.un('columnresize', this.hdlColResizeMove, this);				var hdlColResizeMove = function() {			var columns = this.view.get().getColumnModel().config;			var data	= [];						for (var i = 0; i < columns.length; ++i) {				var col = columns[i];								if (col.dataIndex != '') {					data.push(col.dataIndex + ':' + col.width);				}			}						var tree	= Eve.Preference.get('tree');			var nodes	= tree[this.section].nodes;						for (var i = 0; i < nodes.length; ++i) {				var node = nodes[i];								if (0 == nodes[i].id.split('_')[1]) {								node.set('columns', data.join(','));					node.set('columnsChanged', true);					break;				}			}		}				grid.on('columnmove', hdlColResizeMove, this, {buffer: true});		grid.on('columnresize', hdlColResizeMove, this);	}		,checkValidSection: function()	{		if (Ext.getCmp('calendar-topbar-list') !== undefined) {			return Ext.getCmp('calendar-topbar-list').pressed;		}					return true;	}		,execute : function(callee, type, object)	{		if ( !this.checkValidSection() ) {			return true;		}				var grid	= this.view.get();		var store	= grid.getStore();				switch(type) {			// Update Color			case ('calendar_success_update_color'):				this.refetchData();				break;							case ('calendar_set_active_node'):				// Update the this.[id, groupId, parentId, root, path]				Ext.apply(this, object.info);								this.syncColumnModel(0);								// Update grid according to new id and parentId				this.fetchData(object);				break;							case ('calendar_success_modify_filter'):				var dq		= Ext.DomQuery;				var xml		= object.responseXML;				var filter	= dq.selectNode('filter', xml);				var startDate	= dq.selectValue('startDate', filter, '');				var startTime	= dq.selectValue('startTime', filter, '');				var endDate		= dq.selectValue('endDate', filter, '');				var endTime		= dq.selectValue('endTime', filter, '');				Ext.getCmp('calFilterFrom').setText('Start: ' + startDate + ' ' + startTime);				Ext.getCmp('calFilterTo').setText('End: ' + endDate + ' ' + endTime);				var start	= Date.parseDate(startDate + ' ' + startTime, [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y G:i A'*/);				var end		= Date.parseDate(endDate + ' ' + endTime, [Eve.Preference.get('dateFormat') , ' ' ,Eve.Preference.get('timeFormat')].join('')/*'n/j/y G:i A'*/);				Ext.getCmp('calFilterFromPicker').picker.setValue( start );				Ext.getCmp('calFilterToPicker').picker.setValue( end );								var records = store.reader.read(object);				store.loadRecords(records, {add: false}, true);								break;						default:				Eve.widgets.Calendar.GridBridge.superclass.execute.apply(this, arguments);		}	}});// * * * * * * * * * * * * * * * * * * * * * * * *// Calendar Daily View// * * * * * * * * * * * * * * * * * * * * * * * *Eve.widgets.Calendar.DailyView = Ext.extend( Eve.lib.Bridge, { 	init: function(data)	{		Eve.widgets.Calendar.DailyView.superclass.init.call(this, data);				this._timeOffset = 0; //this._timeOffset || ( ( new Date() ).getTimezoneOffset() / 60 );				this.tt =  new Eve.calendar.TopToolbar();		this.tt.on('back', this.gotoPreviousDate, this );		this.tt.on('forward', this.gotoNextDate, this );		Eve.calendar.Broadcaster = this;		this.dailyCal	 = new Eve.calendar.Daily({			handleNodeDblClick	: this.popNodeDialog.createDelegate( this, [], true )			,handleDblClick		: this.multiDayDblClick.createDelegate( this )			,nodeMenu			: this.popMenu.createDelegate( this )			,titleClick			: this.multidayTitleClick.createDelegate( this )			,viewConfig			: { ddGroup: 'DailyDDGroup' }		});				this.weeklyCal	 = new Eve.calendar.Weekly({			numberOfDays		: 7			,handleNodeDblClick	: this.popNodeDialog.createDelegate( this, [], true )			,handleDblClick		: this.multiDayDblClick.createDelegate( this )			,titleClick			: this.multidayTitleClick.createDelegate( this )			,nodeMenu			: this.popMenu.createDelegate( this )			,viewConfig			: { ddGroup: 'WeeklyDDGroup' }		});				this.monthlyCal  = new Eve.calendar.MonthlyCalendar({ 			handleNodeDblClick	: this.popNodeDialog.createDelegate( this, [], true )			,handleDblClick		: this.multiDayDblClick.createDelegate( this )			,nodeMenu			: this.popMenu.createDelegate( this )			,titleClick			: this.multidayTitleClick.createDelegate( this )			,viewConfig			: { ddGroup: 'MonthlyDDGroup' }		});				this.dailyView   = this.dailyCal.getView();		this.weeklyView  = this.weeklyCal.getView();		this.monthlyView = this.monthlyCal.getView();//for PreLoad Calendar		var loadMonthlyView = function(){			this.fillMonthly( {				response: Eve.Preference.get('calendarmonthly')				,forcedRecreateRows	: false				,updateTasks		: true				,firstTime			: true			});			this.monthlyView.un('resize', loadMonthlyView, this);		}		this.monthlyView.on('resize', loadMonthlyView, this);//		//Added by Ghazal		var d = new Date()		this.monthlyCal.setDate( d.getFirstDateOfMonth());		this.monthlyView.recreateRows();				this.dailyHeader   = this.dailyCal.getHeader();		this.weeklyHeader  = this.weeklyCal.getHeader();		this.monthlyHeader = this.monthlyCal.getHeader();						//this.dailyView.on('render'	, this.loadDaily, this );		this.dailyCal.on ( 'move'	, this.moveItem, this );		this.weeklyCal.on( 'move'	, this.moveItem, this );		this.monthlyCal.on( 'move'  , this.moveItem, this );		this.monthlyCal.on( 'dayclick', this.changeToDailyFromMonthly, this );				// Task View		this.taskView = new Eve.calendar.TaskView();		this.taskView.onChange = this.onChangeTask.createDelegate( this );				// First View Configuration		this.activeContext = 'monthly';		this.activeItem	   = 2;		//this.weeklyView.on('render'	, this.loadWeekly, this );				this.dailyCal.on('nodedblclick', this.popNodeDialog, this );		//this.dailyCal.on('click', this.showBubble, this );		this.dailyCal.on('click', this.dailyDayClick, this );				this.weeklyCal.on('nodedblclick', this.popNodeDialog, this );		//this.weeklyCal.on('click', this.showBubble, this );		this.weeklyCal.on('click', this.dailyDayClick, this );				this.monthlyCal.on('nodedblclick', this.popNodeDialog, this );	}	,forceLoad : function(data)	{		//if ( this.checkValidSection() ) {			if (data.sharedSection) {							var data = {					checked	: false					,info 	: {						id		: 0						,root	: 'personal'					}				}								this.fire(this.section + '_set_active_node', data, true);							} else {				//this.refreshContent({updateTasks: true, firstTime: true});			}//		} else {//			// Important//			this.manager.loadFinished(this);//		}	}		,setSharedSection : function(data)	{		if (data.sharedSection) {					var data = {				checked	: false				,info 	: {					id		: 0					,root	: 'personal'				}			}						this.fire(this.section + '_set_active_node', data, true);					}	}		,getViewMode : function()	{		var retVal;				if (Ext.getCmp('calendar-topbar-monthly').pressed) {			retVal = 'month';		} else if (Ext.getCmp('calendar-topbar-weekly').pressed) {			retVal = 'week';		} else if (Ext.getCmp('calendar-topbar-daily').pressed) {			retVal = 'day';		} else if (Ext.getCmp('calendar-topbar-list').pressed) {			retVal = 'list';		}				return retVal;	}		,dailyDayClick: function(e, target, cal)	{		if ( Ext.get(e.target).up('.x-calendar-item') !== null )			return false;		var view = cal.getView();		var c = e.getXY()[1] - cal.getView().getBackgroundLayer().getTop();		var hm	 = view.getPositionTranslator().decipher(c, cal);		var d = view.getCalendar().getDate();		var dt = new Date( d.getFullYear(), d.getMonth(), d.getDate(), hm.h, view.getPositionTranslator().gapTime(hm.m), 0 );				var x	 = this.multidayCreateEventAdapter.createDelegate( this );		Eve.calendar.MonthlyBubble.show(dt, x, e);	}		,multiDayDblClick: function(e, target, cal)	{		if ( Ext.get(e.target).up('.x-calendar-item') !== null )			return false;		var view = cal.getView();		var c	= e.getXY()[0] - cal.getView().getBackgroundLayer().getLeft();		var x = c/cal.getView().getBackgroundLayer().getWidth();		var d	= view.getPositionTranslator().decipher(x, cal);		var dt	= new Date( d.getFullYear(), d.getMonth(), d.getDate(), 9, 0, 0 );				var x	 = this.multidayCreateEventAdapter.createDelegate( this );		Eve.calendar.MonthlyBubble.show(dt, x, e);	}		,multidayTitleClick: function(date, e)	{			var dt = new Date( date );		dt.setHours(9);		Eve.calendar.MonthlyBubble.show( dt, this.multidayCreateEventAdapter.createDelegate( this ), e );	}		,multidayCreateEventAdapter: function( ret )	{		this.createEvent({			startDate	: ret.startDate			,startTime	: ret.startTime			,endDate	: ret.endDate			,endTime	: ret.endTime		}, ret.subject, ret.calendar);	}		,changeToDailyFromMonthly: function( dv, index, node, e )	{		if ( arguments.length == 1 )			index = dv;					Ext.getCmp('calendar-topbar-daily').toggle( true );		/*var d = new Date( this.monthlyCal.getStartDate().getTime() + index * 86400000 );*/		//majid		var d = new Date(this.monthlyCal.getStartDate());		d.setDate( d.getDate() + index );		//majid		this.switchToDaily();				this.gotoDate( d, this.contextCallback(), this );	}		,changeToDailyFromWeekly: function( index )	{		Ext.getCmp('calendar-topbar-daily').toggle( true );		/*var d = new Date( this.weeklyCal.getDate().getTime() + index * 86400000 );*/		//majid		var d = new Date(this.weeklyCal.getDate());		d.setDate( d.getDate() + index );		//majid		this.switchToDaily();				this.gotoDate( d, this.contextCallback(), this );	}		,changeToDaily: function( date )	{		this.switchToDaily();		Ext.getCmp('calendar-topbar-daily').toggle( true );		this.gotoDate( date, this.contextCallback(), this );	}		,showBubble: function(e, ele, cal)	{		if ( Ext.get(e.target).up('.x-calendar-item') !== null )			return false;					var c = e.getXY()[1] - cal.getView().getBackgroundLayer().getTop();		var v = cal.getView();		var d = v.getPositionTranslator().decipher( c );				c = v.getCalendar().getDate();		/*		Majid Commented		Eve.calendar.Bubble.showBubble(e.getXY(), this.createEvent, this, {			date	: new Date( c.getFullYear(), c.getMonth(), c.getDate(), d.h, d.m, 0 )		});		*/	}		,createEvent: function( extra, subject, calendar )	{		calendar = parseInt( calendar, 10 );		Ext.Ajax.request({			url		: Eve.url			,params	: {				event		: 'modern.calendar.' + ((!calendar) ? 'personal' : 'group') + '.createModify'				,startDate	: extra.startDate.format('n/j/y')				,endDate	: extra.endDate.format('n/j/y')				,startTime	: extra.startTime				,endTime	: extra.endTime				,subject	: subject				,id		 	: 0				// Extra Arguments that I have no idea about				,noEndDate	: 1				,dayinmonth	: 0				,type		: 0				// Till here				,groupId	: calendar || 0				,calendars	: 0				,path		: '/'			},			success	: function(response){				var dq	= Ext.DomQuery;				var xml = dq.select('calData', response.responseXML);				this.refreshContent({response: xml, forcedRecreateRows:false, updateTasks:false } )								var xi = response.responseXML;				var id = dq.selectValue('id', xi);				var info = {					id 			: id.split("_")[1]					,rawId		: id					,xml		: xi					,root		: dq.selectValue('root', xi)					,path		: dq.selectValue('path', xi)					,groupId	: dq.selectValue('groupId', xi)				}				// Is there any conflicts?				var conflicts = dq.selectNode('conflicts', response.responseXML);				if (conflicts) {					var ds = new Ext.data.Store({						mode	: 'local'						,reader	: new Ext.data.XmlReader({							record			: 'conflict'						}, [ 'conflictMode', 'conflictId', 'conflictSubject', 'conflictLocation', 'conflictStartDate', 'conflictEndDate'] )					});					var wp = new Ext.Window({						modal		: true						,title		: 'Events Conflict'						,layout		: 'fit'						,width		: 450						,height		: 320						,items		: [{							xtype		: 'panel'							,autoScroll	: true							,border		: false							,frame		: false							,items		: [{								xtype			: 'dataview'								,autoHeight		: true								,singleSelect	: true								,itemSelector	: 'div.x-group-select'								,overClass		: 'x-group-over'								//,selectedClass	: 'x-group-selected'								,tpl			: new Ext.XTemplate(									'<div style="padding:5px; color:red; text-align:center; background-color:#EEE;">',										'<p>Warning!</p>',										//'<span>The event conflicts with the following event(s) below. You may click on one of the conflicting events to reschedule it.</span>',									'</div>',									'<tpl for=".">',										'<div class="x-group-select">',											//'<div style="padding:5px; border:1px solid #999; background-color:#DDD; float:right">Reschedule</div>',											'<table>',											 '<tr>',												'<td>Subject&nbsp;&nbsp;&nbsp;</td>',												'<td><b>{conflictSubject}</b></td>',												'<td></td>',											 '</tr>',											 '<tr>',												'<td>Start</td>',												'<td>{conflictStartDate}</td>',												'<td></td>',											 '</tr>',											 '<tr>',												'<td>End</td>',												'<td>{conflictEndDate}</td>',											 '</tr>',											'</table>',										'</div>',									'</tpl>'								)								,store			: ds								/*								,listeners		: {									click	: function(cmp, idx, node, e) {										var record	= cmp.getRecord(node);										var data	= {											info		: {												id			: record.get('conflictId')												,root		: 'personal'											}										}										this.fire('calendar_edit_item_dlg', data, true);										wp.hide();									}									,scope	: this								}								*/							}]						}]						,buttons	: [{							text		: 'Ignore All'							,id			: 'calendarConflictCloseBtn'							,handler	: function() {								this.ownerCt.hide();							}						}, {							text		: 'Reschedule new event'							,handler	: function() {								this.fire('calendar_edit_item_dlg', { info: info }, true);								wp.hide();							}							,scope		: this						}]					})					ds.removeAll();					ds.add( ds.reader.readRecords(conflicts).records );					wp.show();				}			}			,scope	: this		});	}		,popMenu: function( dv, index, node, e )	{		if(!Eve.calendar.iCalendarMenu){			Eve.calendar.iCalendarMenu = new Ext.menu.Menu({				items: [{					text: 'Edit'					,icon	: Eve.Resource.getIcon('edit', 'general')					,handler: function(){ Eve.calendar.iCalendarMenu.popNodeDialog(); }				}, {					text: 'Delete'					,icon	: Eve.Resource.getIcon('delete', 'general')					,handler: function(){ Eve.calendar.iCalendarMenu.popDeleteDialog(); }				}]			} );		}		node = dv.getRecord(node).get('cnt');		Eve.calendar.iCalendarMenu.popNodeDialog = this.popNodeDialog.createDelegate( this, [ dv, node, index ] );		Eve.calendar.iCalendarMenu.popDeleteDialog = this.popDeleteDialog.createDelegate( this, [ dv, node, index ] );				var func = ( node.wrapped.extra.editPer == "1" ) ? 'enable' : 'disable';		Eve.calendar.iCalendarMenu.items.items[0][func]();				var func = ( node.wrapped.extra.deletePer == "1" ) ? 'enable' : 'disable';		Eve.calendar.iCalendarMenu.items.items[1][func]();				Eve.calendar.iCalendarMenu.showAt( e.getXY() );		e.stopEvent();	}		,popDeleteDialog: function( dv, node, index )	{			var type = 'item';		var recId = parseInt( node.wrapped.extra.recurrenceId, 10 );		var id = node.wrapped.extra.id;		var root = ( node.wrapped.extra.groupId == "0" ) ? 'personal' : 'group';				if ( !recId ){						var info = {				id			: node.wrapped.extra.id				,groupId	: node.wrapped.extra.groupId				,root		: root				,path		: node.wrapped.extra.path				,typeId		: Eve.Resource.getTypeId(root, type, this.section)	// Used in Interlinking Dialog.			}			this.fire("calendar_delete_" + type + "_dlg", {info: info, title: node.wrapped.extra.subject } );		}else{			Ext.Msg.confirm( "Confirmation", "Would you like to delete the whole series?", function( id ){				//var pId  = ((id != 'yes') ? node.wrapped.extra.id : node.wrapped.extra.parentRecordId );				var pId  = node.wrapped.extra.id;				var info = {					id			: pId					,groupId	: node.wrapped.extra.groupId					,root		: root					,path		: node.wrapped.extra.path					,typeId		: Eve.Resource.getTypeId(root, type, this.section)	// Used in Interlinking Dialog.				}												info.singleEvent = ( id == 'no' );									this.fire("calendar_delete_" + type + "_dlg", {info: info, title: node.wrapped.extra.subject } );			}, this );		}	}		,popNodeDialog: function( dv, node, index )	{		var type = 'item';		var recId = parseInt( node.wrapped.extra.recurrenceId, 10 );		var id = node.wrapped.extra.id;		var root = ( node.wrapped.extra.groupId == "0" ) ? 'personal' : 'group';				if ( !recId ){						var info = {				id		: node.wrapped.extra.id				,groupId	: node.wrapped.extra.groupId				,root		: root				,path		: node.wrapped.extra.path				,typeId		: Eve.Resource.getTypeId(root, type, this.section)	// Used in Interlinking Dialog.			}			this.fire("calendar_edit_" + type + "_dlg", {info: info, title: node.wrapped.extra.subject } );				}else{			Ext.Msg.confirm( "Confirmation", "Would you like to edit the whole series?", function( id ){				//var pId  = ((id != 'yes') ? node.wrapped.extra.id : node.wrapped.extra.parentRecordId );				var pId  = node.wrapped.extra.id;				var info = {					id			: pId					,groupId	: node.wrapped.extra.groupId					,root		: root					,path		: node.wrapped.extra.path					,typeId		: Eve.Resource.getTypeId(root, type, this.section)	// Used in Interlinking Dialog.				}								info.singleEvent = ( id == 'no' );									this.fire("calendar_edit_" + type + "_dlg", {info: info, title: node.wrapped.extra.subject } );					}, this );		}	}		,get: function()	{			var view = {			layout	: 'card'			,border	: false			,id		: 'calendar-dwm-view'			,items	: [				(new Eve.calendar.DailyDecorator()).decorate( this.dailyView )				,(new Eve.calendar.WeeklyDecorator()).decorate( this.weeklyView  )				,this.monthlyView			]			,activeItem: this.activeItem		};						view.region = 'center';		this.sliderPanel = new Eve.SliderPanel({			xtype	: 'sliderpanel'			,region	: 'south'			,hidden	: false			,height	: 24			,autoEl	: {				tag		: 'div'				,style	: 'height: 22px; width: 100%; background-color: white;'			}			,border	: false			,bodyItem: this.taskView		});		this.sliderPanel.on('contextmenu', function(cmp, e) {			e.stopEvent();			if (this.activeContext == 'weekly') {				var x = e.getXY()[0] - this.weeklyCal.multiday.getView().getBackgroundLayer().getLeft();				var numOfCal =Math.floor( x / this.taskView.weeklyTask.view.items[0].getSize().width );				numOfCal = (numOfCal > this.weeklyCal.numberOfDays)? this.weeklyCal.numberOfDays : numOfCal;				var selectedDate = this.taskView.weeklyTask.views[numOfCal].activeDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/);			} else {				var selectedDate = this.getActiveCalendarDate().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/);			}						Eve.Resource.superbridge.broadcast(this, 'calendar_task_addmenu', {selectedDate: selectedDate, pos: e.getXY()});		}, this);					  		var tView = {			 layout: 'border'			,region: 'center'			,items: [ 				view, this.sliderPanel			]		};				var tHeader = {			 region		: 'south'			,xtype		: 'container'			,id			: 'calendar-dwm-view-header'			,layout		: 'card'			,titlebar	: false			,height		: 10			,border		: false			,autoEl		: { tag: 'div'}			,items		: [ this.dailyHeader, this.weeklyHeader, this.monthlyHeader ]			,activeItem	: this.activeItem		};		var layout = {			layout	: 'border'			,cls  	: 'calendar-dwm-bg'			,items	: [{				region	: 'north'				,layout	: 'border'				,border	: false				,height	: 50				,items	: [{					region	: 'center'					,layout	: 'column'					,border	: false					,items	: [ this.tt.getEl( { width: 400, height: 46 } ), {						columnWidth	: 1						,xtype		: 'container'						,autoEl		: {							tag			: 'div'							,style		: 'height: 3px;'						}					}, {						xtype		: 'container'						,width		: 135						,autoEl		: {							tag			: 'div'							,style		: 'height: 40px; padding: 10px;'						}						,listeners	: {							render		: function( cmp ) {								var df = new Ext.form.DateField({									id			: 'calendarDateField'									,format		: Eve.Preference.get('dateFormat')//'n/j/y'									,width		: 80									,listeners	: {										select		: this.gotoDateAdapter										,specialKey	: function(el, e) {																						if (e && e.getKey && e.getKey() != e.ENTER)												return;																							this.gotoDateAdapter(el, el.getValue())										}										,scope		: this									}								});																		df.render( cmp.el.dom );								this.initEvents();							}							,scope: this						}					}]				}, tHeader]			},tView]			,listeners	: {				render		: function( comp ){					comp.ownerCt.on('resize', function(){						setTimeout( function(){						comp.doLayout()					}, 500 );					}, this );				}				,scope		: this			}		}				return layout;	}		,onRefreshTask: function(item, e)	{		var params = this.taskView.lastParams;		var date1 = ( params && params.startDate ) ? params.startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) : '';		var date2 = ( params && params.endDate ) ? params.endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) : '';		var temp = [' [ ',date1];		if(this.activeContext != 'daily' ) 			temp.push(' - ', date2); 		temp.push(' ]');		if ( Eve.calendar.Registery.Tasks.WhichDate == 'dueDate' ){			Eve.calendar.Registery.Tasks.WhichDate = 'startDate';			this.sliderPanel.setTopHeaderText('Start Date' , temp.join(''));		}		else{			Eve.calendar.Registery.Tasks.WhichDate = 'dueDate';			this.sliderPanel.setTopHeaderText('Due Date' , temp.join(''));					}		item.setChecked(true, false);		this.monthlyCal.removeTasks();		this.refresh();	}		,onChangeTask: function( notMonitor )	{		var params = this.taskView.lastParams;		var date1 = ( params && params.startDate ) ? params.startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) : '';		var date2 = ( params && params.endDate ) ? params.endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/) : '';		var temp = [' [ ',date1];		if(this.activeContext != 'daily' )			temp.push(' - ', date2);   		temp.push(' ]');		if ( Eve.calendar.Registery.Tasks.WhichDate == 'startDate' ){			this.sliderPanel.setTopHeaderText('Start Date ', temp.join(''));		}else{			this.sliderPanel.setTopHeaderText('Due Date', temp.join(''));		}	}		,initEvents: function()	{		var oneTime = false;		this.sliderPanel.on('afterrender', function(){			if (oneTime) {				return false;			}						oneTime = true;			// Set some wierdo Events...			//this.sliderPanel.getTopHeader().on('dblclick', this.onRefreshTask, this );			this.sliderPanel.menu.menu.on('itemclick', this.onRefreshTask, this);					}, this );	}		,gotoDateAdapter: function( field, newValue )	{		if ( field.isValid() )			this.gotoDate( newValue, this.contextCallback(), this );	}		,refresh: function()	{		this.taskView.refresh();	}		,getActiveCalendar: function()	{		switch( this.activeContext ){			case 'daily':				return this.dailyCal;			case 'weekly':				return this.weeklyCal;			case 'monthly':				return this.monthlyCal;		}	}		,getActiveCalendarDate: function()	{		switch( this.activeContext ){			case 'daily':				return this.dailyCal.getDate();			case 'weekly':				return this.weeklyCal.getDate();			case 'monthly':				return this.monthlyCal.getDate();		}	}		//majid	,contextDate: function( next )	{		switch( this.activeContext ){			case 'daily':				return 1;			case 'weekly':				return 7;			case 'monthly':				if ( next !== true )					return ( 21 );				return ( 42 ); // Just to make sure we will pass one month		}	}		,contextCallback: function()	{		switch( this.activeContext ){			case 'daily':				return this.fillDaily;			case 'weekly':				return this.fillWeekly;			case 'monthly':				return this.fillMonthly;		}	}		,gotoPreviousDate: function()	{		//@@Benchmark		//console.log("@@Benchmark -- Time(gotoPreviousDate 1): ",(new Date()).getRTime() % 100000);		var date = this.getActiveCalendarDate();		/*var newDate = new Date( date.getTime() - this.contextDate( false ) );*/		//majid		var newDate = new Date(date) ;		newDate.setDate( newDate.getDate()  - this.contextDate( false ) );		//majid		this.gotoDate( newDate, this.contextCallback(), this );				//@@Benchmark		//console.log("@@Benchmark -- Time(gotoPreviousDate 2): ",(new Date()).getRTime() % 100000);	}		,gotoNextDate: function()	{		var date = this.getActiveCalendarDate();		/*var newDate = new Date( date.getTime() + this.contextDate( true ) );*/		//majid		var newDate = new Date(date);		newDate.setDate( newDate.getDate() + this.contextDate( true ))		//majid		this.gotoDate( newDate, this.contextCallback(), this );	}	,gotoDate: function( date, callback, scope )	{		/* Majid: Wait : next line was commented */		Eve.mask.show( Ext.fly('calendarCardLayout') );		Ext.getCmp('calendarDateField').setValue( date );		var params = Eve.Resource.gotoDate( date.format('n/j/y') );		params.whichDate = Eve.calendar.Registery.Tasks.WhichDate;		Ext.Ajax.request( { 			url			: Eve.url		 	,params		: params		 	,success	: function(response, opt){				if(callback)			 		callback.apply(this, [{response: response.responseXML, forcedRecreateRows: true, updateTasks: true }]);			 }		 	,scope:  scope || this		 } );	}		,refreshContent: function( data )	{			switch( this.activeContext ) {			case 'daily':				this.loadDaily(data);				break;			case 'weekly':				this.loadWeekly(data);				break;			case 'monthly':				this.loadMonthly(data);				break;		}	}		,setHeaderSize: function( size )	{		var cmp = Ext.getCmp('calendar-dwm-view-header');		var oc  = cmp.ownerCt;				cmp.setSize( undefined, size );		oc.setSize( undefined, size + 40 );		oc.doLayout();		oc.ownerCt.doLayout();	}		,switchToDaily: function()	{		Ext.getCmp("calendarCardLayout").getLayout().setActiveItem(1);		Eve.calendar.Bubble.closeBubble();		Eve.calendar.MonthlyBubble.hide();		Ext.getCmp('calendar-dwm-view').layout.setActiveItem( 0 );		Ext.getCmp('calendar-dwm-view-header').layout.setActiveItem( 0 );				if ( this.getActiveCalendar().releaseDD ){			this.getActiveCalendar().releaseDD();		}				this.setHeaderSize( 100 );		this.selectMode( 'daily', this.fillDaily, this, false, true );		this.activeContext = 'daily';		        if ( !this.dailyFirstTime ){            Ext.getCmp('calendar-dwm-view').layout.activeItem.getEl().scrollTo( 'top', 8 * 40, true );            this.dailyFirstTime = 1;        }				if ( this.getActiveCalendar().initDD ){			this.getActiveCalendar().initDD();		}	}		,switchToWeekly: function()	{    	Ext.getCmp("calendarCardLayout").getLayout().setActiveItem(1);		Eve.calendar.Bubble.closeBubble();		Eve.calendar.MonthlyBubble.hide();		Ext.getCmp('calendar-dwm-view').layout.setActiveItem( 1 );		Ext.getCmp('calendar-dwm-view-header').layout.setActiveItem( 1 );				if ( this.getActiveCalendar().releaseDD ){			this.getActiveCalendar().releaseDD();		}				this.setHeaderSize( 100 );		this.selectMode( 'weekly', this.fillWeekly, this, false, true);		this.activeContext = 'weekly';		        if ( !this.weeklyFirstTime ){            Ext.getCmp('calendar-dwm-view').layout.activeItem.getEl().scrollTo( 'top', 8 * 40, true );            this.weeklyFirstTime = 1;        }		if ( this.getActiveCalendar().initDD ){			this.getActiveCalendar().initDD();		}	}		,switchToMonthly: function()	{        Ext.getCmp("calendarCardLayout").getLayout().setActiveItem(1);		Eve.calendar.Bubble.closeBubble();		Eve.calendar.MonthlyBubble.hide();		Ext.getCmp('calendar-dwm-view').layout.setActiveItem( 2 );		Ext.getCmp('calendar-dwm-view-header').layout.setActiveItem( 2 );				if ( this.getActiveCalendar().releaseDD ){			this.getActiveCalendar().releaseDD();		}				this.setHeaderSize( 10 );		this.selectMode( 'monthly', this.fillMonthly, this, true, true );		this.activeContext = 'monthly';				if ( this.getActiveCalendar().initDD ){			this.getActiveCalendar().initDD();		}	}		,selectMode: function( mode, callback, scope, forcedRecreateRows, updateTasks, firstTime )	{		/*		 * Commented by Khashayar		if ( mode == 'monthly') {			this.sliderPanel.hide();		} else {			this.sliderPanel.show();		}		*/		var params = Eve.Resource.cmdSelectMode( mode );		params.whichDate = Eve.calendar.Registery.Tasks.WhichDate;				Ext.Ajax.request( {			url			: Eve.url			,params		: params			,success	: function(response, options){				if (callback) {	 				callback.apply(this, [{						response			: response.responseXML						,forcedRecreateRows	: forcedRecreateRows						,updateTasks		: updateTasks						,firstTime			: firstTime					}])	 			}				var temp;			   if(mode == 'monthly'){				   temp = Ext.getCmp('calendar-topbar-monthly').taskHeight;				   this.sliderPanel.setHeight (temp);				   this.sliderPanel.setCorrectToggleTitle( ( temp < 25 ) ? 24 : 86 );			   }			   else if(mode == 'weekly'){				   temp = Ext.getCmp('calendar-topbar-weekly').taskHeight;				   this.sliderPanel.setHeight (temp);				   this.sliderPanel.setCorrectToggleTitle( ( temp < 25 ) ? 24 : 86 );			   }			   else if(mode == 'daily'){				   temp = Ext.getCmp('calendar-topbar-daily').taskHeight;				   this.sliderPanel.setHeight (temp);				   this.sliderPanel.setCorrectToggleTitle( ( temp < 25 ) ? 24 : 86 );			   }			   			   this.sliderPanel.ownerCt.doLayout();			}			,scope: scope || this			} );	}		,moveItem: function( it, date, oldCal, fromMultiday, allDay )	{			var sdate = (fromMultiday)? it.wrapped.extra.start_real : it.wrapped.startDate;		var edate = (fromMultiday)? it.wrapped.extra.end_real : it.wrapped.endDate;		if ( typeof allDay == "undefined" ){			allDay = it.wrapped.extra.allDay;		}		/* What the hell is this? 			if ( allDay )			edate = sdate;		*/		console.log( 'Cache is cleared! - 2' );		if ( allDay ){		    console.log( 'Event is an all day Event!' );		}		it.getEnd();				Ext.Ajax.request( { url: Eve.url, params: { event: 'modern.calendar.' + (( it.wrapped.extra.groupId == 0 ) ? 'personal' : 'group' )+ '.createModifyDate'													,startDate: sdate.format("n/j/y")													,endDate  : edate.format("n/j/y")													,startTime: (allDay) ? '12:00 AM' : sdate.format("g:i A")													,endTime	 : (allDay) ? '12:00 AM' : edate.format("g:i A")													,id		 : it.wrapped.extra.id													,groupId	 : it.wrapped.extra.groupId													,path	 : it.wrapped.extra.path													,allDay	 : allDay ? '1' : '0' 												  }						  }						);	}		,extractDate: function( date )	{		var o = Date.parseDate(date,Eve.Preference.get('dateFormat')/*"n/j/y"*/);		return { y: o.getFullYear(), m: o.getMonth(), d: o.getDate() };	}		,extractTime: function( time )	{		var o = Date.parseDate(time,Eve.Preference.get('timeFormat')/*"g:i A"*/);		return { h: o.getHours(), m: o.getMinutes() };	}		,setDate: function( date, endDate )	{		Ext.getCmp('calendarDateField').setValue( date );		var tt2d = '';		switch( this.activeContext ){			case 'weekly':				if ( endDate )					tt2d = [date.format( 'F j' ), ' - ', endDate.format( 'F j, Y' )].join('');				break;			case 'monthly':				tt2d = date.format( 'F Y' );				break;			case 'daily':				tt2d = date.format( 'l, F j Y' );				break;					}				this.tt.setText( tt2d );	}		,extractData: function( node )	{		var dq = Ext.DomQuery;		return { 			subject			: dq.selectValue( 'subject', node )		  , location		: dq.selectValue( 'location', node )		  , path			: dq.selectValue( 'path', node )		  , id 				: dq.selectValue( 'id', node ).split('_')[1]		  , groupId			: dq.selectValue( 'groupId', node ).split('_')[1]		  , color			: dq.selectValue( 'color', node ).split( ',' )[0]		  , notes			: dq.selectValue( 'notes', node )		  , calendars		: dq.selectValue( 'calendarName', node )		  , createdBy		: dq.selectValue( 'created', node )		  , modifiedBy		: dq.selectValue( 'lastModified', node )		  , editPer			: dq.selectValue( 'editPermission', node )		  , deletePer		: dq.selectValue( 'deletePermission', node )		  , recurrenceId	: dq.selectValue( 'recurrenceId'	, node )		  , parentRecordId	: dq.selectValue( 'parentRecordId'	, node )		  , root			: dq.selectValue( 'mode'	, node )		  , allDay		: ( ( dq.selectValue( 'isAllDay', node ) == '0' ) ? false : true )		 }	}		,fillDaily: function(data)	{		// Let the manager know about our status		this.manager.loadFinished(this);				//remove any elements that are currently visible		this.dailyCal.removeAll();				var xml = data.response;//.responseXML;		var dq  = Ext.DomQuery;				var startDate 	= this.extractDate( dq.selectValue( 'startDate', xml ) );		var endDate 	= this.extractDate( dq.selectValue( 'endDate', xml ) );		startDate		= new Date( startDate.y, startDate.m, startDate.d );		endDate			= new Date( endDate.y, endDate.m, endDate.d );				this.setDate( startDate);		this.dailyCal.setDate( startDate );		/*this.taskView.changeActiveContext( 'daily', startDate, new Date( startDate.getTime() + 86400000 ), Eve.calendar.Registery.Calendar.CheckedNodes );*/		//majid		var eDate = new Date(startDate);		eDate.setDate( eDate.getDate() + 1 );		/*if(data.updateTasks)			this.taskView.changeActiveContext( 'daily', startDate, eDate, Eve.calendar.Registery.Calendar.CheckedNodes );		*/		//For Task Pane toolbar		if(data. updateTasks){			this.taskView.setParameters( {				lastParams:{					startDate: startDate					,endDate: eDate					,ids: Eve.calendar.Registery.Calendar.CheckedNodes				}				,activeContext: 'daily'			});			try{				var st = this.taskView.store;				var records = st.reader.readRecords(Ext.DomQuery.select('tasks', xml)).records				st.add(records);				this.taskView.dailyTask.refresh();			}catch(e){console.log('daily task couldn\'t be refreshed')}					var temp = [' [ ',startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/), ' ]'];			if(Eve.calendar.Registery.Tasks.WhichDate == "startDate")				this.sliderPanel.setTopHeaderText('Start Date ',temp.join(''));			else                this.sliderPanel.setTopHeaderText('Due Date ',  temp.join(''));		}		//majid				var sE = dq.select( 'simpleEvent', xml );				var obj = {};		for ( var i = 0, len = sE.length; i < len; ++i ){			var sdate = this.extractDate( dq.selectValue( 'startDate', sE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', sE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', sE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', sE[i] ) );			var eD = this.extractData( sE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m );			var nonreal_edate 	= new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			nonreal_edate.setMinutes( nonreal_edate.getMinutes() + 30 );			if ( nonreal_edate < eD.end_real )				nonreal_edate = eD.end_real;			var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m ), 								nonreal_edate, eD );			this.dailyCal.addItem( a );		}								var mE = dq.select( 'multiDayEvent', xml );				for ( var i = 0, len = mE.length; i < len; ++i ){ 			var sdate = this.extractDate( dq.selectValue( 'startDate', mE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', mE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', mE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', mE[i] ) );						var eD = this.extractData( mE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m );			var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, 12 + this._timeOffset, 0 ), 								new Date( edate.y, edate.m, edate.d + 1, 0 + this._timeOffset, 0 )							, eD );			this.dailyCal.getMultidayCalendar().addItem( a );		}				this.dailyCal.getMultidayCalendar().resetColProp();		this.dailyCal.getMultidayCalendar().refreshItems();		this.dailyCal.getMultidayCalendar().refreshView();				this.dailyCal.container.refreshItems();		this.dailyCal.getView().refreshView();				/* Majid: Wait : next lines was commented */		Eve.mask.hide();	}		,fillWeekly: function( data )	{		// Let the manager know about our status		this.manager.loadFinished(this);				//remove any elements that are currently visible		this.weeklyCal.removeAll();				var xml = data.response;//.responseXML;		var dq  = Ext.DomQuery;				var startDate 	= this.extractDate( dq.selectValue( 'startDate', xml ) );		var endDate 	= this.extractDate( dq.selectValue( 'endDate', xml ) );		startDate		= new Date( startDate.y, startDate.m, startDate.d );		endDate			= new Date( endDate.y, endDate.m, endDate.d );		this.setDate( startDate, endDate );				this.weeklyCal.setDate( startDate );		//if(data.updateTasks)			//this.taskView.changeActiveContext( 'weekly', startDate, endDate, Eve.calendar.Registery.Calendar.CheckedNodes );				//For Task pane toolbar		if(data. updateTasks){						this.taskView.setParameters({				lastParams:{					startDate: startDate					,endDate: endDate					,ids: Eve.calendar.Registery.Calendar.CheckedNodes				}				,activeContext:  'weekly'			});			try{				var st = this.taskView.store;				var records = st.reader.readRecords(Ext.DomQuery.select('tasks', xml)).records				st.add(records);				this.taskView.dailyTask.refresh();			}catch(e){console.log('weekly task couldn\'t be refreshed')}			var temp = [' [ ',startDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/),'  - ', endDate.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/), ']'];			if(Eve.calendar.Registery.Tasks.WhichDate == "startDate")				this.sliderPanel.setTopHeaderText('Start Date ',temp.join(''));			else                this.sliderPanel.setTopHeaderText('Due Date ',  temp.join(''));		}				var sE = dq.select( 'simpleEvent', xml );				var obj = {};		for ( var i = 0, len = sE.length; i < len; ++i ){			var sdate = this.extractDate( dq.selectValue( 'startDate', sE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', sE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', sE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', sE[i] ) );			var eD = this.extractData( sE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m );			var nonreal_edate 	= new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			nonreal_edate.setMinutes( nonreal_edate.getMinutes() + 30 );			if ( nonreal_edate < eD.end_real )				nonreal_edate = eD.end_real;			var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m ), 								nonreal_edate, eD );			this.weeklyCal.addItem( a );		}				var mE = dq.select( 'multiDayEvent', xml );		for ( var i = 0, len = mE.length; i < len; ++i ){			var sdate = this.extractDate( dq.selectValue( 'startDate', mE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', mE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', mE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', mE[i] ) );						var eD = this.extractData( mE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m )						var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, 12 + this._timeOffset, 0 ), 								new Date( edate.y, edate.m, edate.d + 1, this._timeOffset , 0 )							, eD );			this.weeklyCal.getMultidayCalendar().addItem( a );		}				this.weeklyCal.getMultidayCalendar().resetColProp();		this.weeklyCal.getMultidayCalendar().refreshItems();		this.weeklyCal.getMultidayCalendar().refreshView();		this.weeklyCal.refreshItems();		this.weeklyCal.refreshView();		this.weeklyCal.refreshItems();		this.weeklyCal.refreshView();				/* Majid: Wait : next lines was commented */		Eve.mask.hide();	}		,fillMonthly: function( data )	{		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 1): ",(new Date()).getRTime() % 100000);		// Let the manager know about our status		this.manager.loadFinished(this);				//remove any elements that are currently visible		this.monthlyCal.removeAll();		//this.monthlyCal.begin();		var xml = data.response;		var dq  = Ext.DomQuery;		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 2): ",(new Date()).getRTime() % 100000);		if(data.firstTime){			var filterDoc	= dq.select('filter',xml);			var myShareIds	= dq.selectValue('myShareIds',filterDoc, "");			var groupIds	= dq.selectValue('groupIds',filterDoc, "");			var personalIds = dq.selectValue('personalIds', filterDoc, "");			var ids = [];			if(groupIds.length > 0)				ids.push(groupIds);			if(personalIds.length > 0)				ids.push(personalIds);			if(myShareIds.length > 0 && ids.indexOf("0") == -1)				ids.push("0");			Eve.calendar.Registery.Calendar.CheckedNodes = ids.join(',');		}		var startDate 	= this.extractDate( dq.selectValue( 'startDate', xml ) );		var endDate 	= this.extractDate( dq.selectValue( 'endDate', xml ) );		startDate		= new Date( startDate.y, startDate.m, startDate.d );		endDate			= new Date( endDate.y, endDate.m, endDate.d );		this.monthlyCal.setDate( startDate);				this.setDate( this.monthlyCal.getDate() );		var start = this.monthlyCal.getDate();		/*var end   = new Date( (new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() )).getTime() - 86400000 );*/		//majid		var end   = new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() );		end.setDate( end.getDate() - 1 );		//majid				//this.taskView.changeActiveContext( 'monthly',start , end, Eve.calendar.Registery.Calendar.CheckedNodes, this);		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 3): ",(new Date()).getRTime() % 100000);		var sE = dq.select( 'simpleEvent', xml );		var obj = {};		for ( var i = 0, len = sE.length; i < len; ++i ){			var sdate = this.extractDate( dq.selectValue( 'startDate', sE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', sE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', sE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', sE[i] ) );									var eD = this.extractData( sE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m )									var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, 12 + this._timeOffset, 0 ), 								new Date( edate.y, edate.m, edate.d + 1, 0 + this._timeOffset, 0 )							, eD );			//console.log('i:',i,',a:',a);			this.monthlyCal.addItem( a );		}		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 4): ",(new Date()).getRTime() % 100000);				var mE = dq.select( 'multiDayEvent', xml );				for ( var i = 0, len = mE.length; i < len; ++i ){			var sdate = this.extractDate( dq.selectValue( 'startDate', mE[i] ) );			var stime = this.extractTime( dq.selectValue( 'startTime', mE[i] ) );			var edate = this.extractDate( dq.selectValue( 'endDate', mE[i] ) );			var etime = this.extractTime( dq.selectValue( 'endTime', mE[i] ) );						var eD = this.extractData( mE[i] );			eD.start_real = new Date( sdate.y, sdate.m, sdate.d, stime.h, stime.m );			eD.end_real   = new Date( edate.y, edate.m, edate.d, etime.h, etime.m )						var a = new Eve.calendar.Sample( 								new Date( sdate.y, sdate.m, sdate.d, 12 + this._timeOffset, 0 ), 								new Date( edate.y, edate.m, edate.d + 1, 0 + this._timeOffset , 0 )							, eD );			this.monthlyCal.addItem( a );		}		//this.loadMonthlyTasks();		//this.monthlyCal.getContainer().refreshItems();		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 5): ",(new Date()).getRTime() % 100000);				this.monthlyCal.getView().refreshView(data.forcedRecreateRows);		//this.monthlyCal.commit();		if(data. updateTasks){		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 6): ",(new Date()).getRTime() % 100000);			//this.taskView.changeActiveContext( 'monthly',start , end, Eve.calendar.Registery.Calendar.CheckedNodes, this);		this.taskView.setParameters( {			lastParams:{				startDate: start				,endDate: end				,ids: Eve.calendar.Registery.Calendar.CheckedNodes			}			,activeContext: 'monthly'			,monthlyCal: this		});			var whichDate = (Eve.calendar.Registery.Tasks.WhichDate == "startDate")? "Start Date" : "Due Date";			var temp = [' [ ',start.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/),'  - ', end.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/), ']'];			if(Eve.calendar.Registery.Tasks.WhichDate == "startDate")				this.sliderPanel.setTopHeaderText('Start Date ',temp.join(''));			else                this.sliderPanel.setTopHeaderText('Due Date ',  temp.join(''));			try{				this.fillMonthlyTasks(this.taskView.store.reader.readRecords(Ext.DomQuery.select('tasks', xml)).records);			}catch(e){console.log('monthly task couldn\'t be refreshed')}		}		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 7): ",(new Date()).getRTime() % 100000);		/* Majid: Wait : next lines was commented */		Eve.mask.hide();	}		,loadDailyTask: function( index )	{	if(Ext.getCmp('calendar-topbar-monthly').taskHeight < 25)			return;		try{			var date = new Date(this.monthlyCal.getStartDate());			date.setDate( date.getDate() + index );			var dv = this.taskView.dailyTask.dv;			var index = dv.store.find(Eve.calendar.Registery.Tasks.WhichDate,date.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));			var node = dv.getNode(index);			var el = Ext.getDom(node);			var top = Ext.fly(el).getOffsetsTo(dv.getEl());			dv.getEl().scrollTo('top', top[1], {duration:.5})		}catch(e){}	}		,loadMonthlyTasks: function()	{		var start = this.monthlyCal.getDate();		/*var end   = new Date( (new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() )).getTime() - 86400000 );*/		//majid		var end   = new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() );		end.setDate( end.getDate() - 1 );		//majid				Ext.Ajax.request( { url: Eve.url						 ,params: {							 startDate: start.format( 'm/d/y' )							 ,endDate: end.format('m/d/y')							 ,whichDate: 'startDate'							 ,event:'modern.task.personal.getAllByDate'							 ,ids: Eve.calendar.Registery.Calendar.CheckedNodes						 }						 ,success: this.fillMonthlyTasks						 ,scope: this					} );	}		,fillMonthlyTasks: function( r )	{		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 9): ",(new Date()).getRTime() % 100000);		//this.monthlyCal.removeTasks();		//debugger;		var start = this.monthlyCal.getDate();		/*var end   = new Date( (new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() )).getTime() - 86400000 );*/		//majid		var end   = new Date( start.getFullYear(), start.getMonth() + 1, start.getDate() );		end.setDate( end.getDate() - 1 );		//majid				var length = end.getDaysInMonth();//parseInt( end.format('n/j/y').split("/")[1]) + 1;		var len = r.length;		if(len > 0){			//var st = r[0].store;			//debugger;			var st = this.taskView.store;			st.add(r);			for(var i=1 ; i <= length; i++){					var days = st.query(Eve.calendar.Registery.Tasks.WhichDate, start.format(Eve.Preference.get('dateFormat')/*'n/j/y'*/));					this.monthlyCal.addTask( days.getCount(),start );					for(var j=0; j<days.length; j++)					    st.remove(days.items[j]);					start = start.add(Date.DAY, +1)			}			st.add(r);		}		else{			for(var i=1 ; i<= length; i++){					//this.monthlyCal.addTask( 0,start );					start = start.add(Date.DAY, +1);			}		}		this.monthlyCal.renderTasks();		//@@Benchmark		//console.log("@@Benchmark -- Time(fillMonthly 10): ",(new Date()).getRTime() % 100000);	}	,loadDaily: function(data)	{		/* Majid: Wait : next lines was commented */		Eve.mask.show( Ext.fly('calendarCardLayout') );				if (data == null) {			this.selectMode( 'daily', this.fillDaily, this, data.forcedRecreateRows, data.updateTasks );		} else {			this.fillDaily({response: data.response, forcedRecreateRows: data.forcedRecreateRows, updateTasks: data.updateTasks})		}	}		,loadWeekly: function( data )	{		/* Majid: Wait : next lines was commented */		Eve.mask.show( Ext.fly('calendarCardLayout') );				if (data.response == null) {			this.selectMode( 'weekly', this.fillWeekly, this, data.forcedRecreateRows, data.updateTasks );		} else {			this.fillWeekly({response: data.response, forcedRecreateRows: data.forcedRecreateRows, updateTasks: data.updateTasks})		}	}	,loadMonthly: function( data )	{		/* Majid: Wait : next lines was commented */		Eve.mask.show( Ext.fly('calendarCardLayout') );				if (data.response == null || data.response === undefined) {			this.selectMode( 'monthly', this.fillMonthly, this, data.forcedRecreateRows, data.updateTasks, data.firstTime );		} else {			this.fillMonthly({				response			: data.response				,forcedRecreateRows	: data.forcedRecreateRows				,updateTasks		: data.updateTasks			});		}	}		,checkValidSection: function()	{		if( typeof ( Ext.getCmp('calendar-topbar-list') ) !== "undefined" )			return !Ext.getCmp('calendar-topbar-list').pressed;	}		,dummySelectFolder: function( data )	{		var command = { 			event 	: Eve.Resource.cmdSelectFolder(this.section, 'personal')			,checked: data.checked			,start	: 0			,limit	: 20			,whichDate: Eve.calendar.Registery.Tasks.WhichDate		};				var root = data.root || data.info.root;		var pId	 = (data.id !== undefined) ? data.id : data.info.id;		var gId	 = data.groupId || data.id || data.info.groupId;						// There's some exception		try {			var id = data.info.id.split('_')[1];			switch (id) {				case '-2':					root = 'personal';					pId	 = '-2';					break;								case '-3':					root = 'personal';					pId = '-3';					break;								}		}		catch(e) {};				switch (root) {			case "personal":				command.personalId = pId;				break;						case "group":				command.groupId	= gId;				break;							case "shared":				command.personalId = data.id;		}				if (data.showOnly) {			command.showOnlyThisCalendar = true;		}				Ext.Ajax.request({			url			: Eve.url			,params		: command			,callback	: data.callback			,scope		: this		});	}		,printPopup : function(callee, type, data){		var url	= [Eve.url, "?event=calendar.selectOverlayWithDate&overlayMode=overlay&groupids="+Eve.calendar.Registery.Calendar.CheckedNodes+"&viewMode="+this.activeContext+"&printerFriendly=1&date="+this.getActiveCalendarDate().format('m/d/y'), "&CFID=", Eve.CFId, "&CFTOKEN=", Eve.CFToken].join('');		var win = window.open(url, 'calendarPrint','width=800,height=600,scrollbars=yes,resizable=yes,titlebar=no,menubar=no,toolbar=no');	}	,execute: function(callee, type, data)	{		switch( type ){			case 'calendar_print_views':				this.printPopup();				break;			case 'task_success_create_item':				if ( !this.checkValidSection() )					return false;				if(this.taskView.activeContext == 'monthly')				    this.monthlyCal.removeTasks();				this.taskView.refresh();				break;				   			case 'task_success_update_item':				if ( !this.checkValidSection() )					return false;				if(this.taskView.activeContext == 'monthly')				    this.monthlyCal.removeTasks();				this.taskView.refresh();				break							case 'calendar_success_create_item':				if ( !this.checkValidSection() )					return false;				var xml = Ext.DomQuery.select('calData', data.info.xml);				if(xml.length == 0)					return;				this.refreshContent({response:xml, forcedRecrateRows:false, updateTasks: false});				break;							case 'calendar_success_delete_item':				if ( !this.checkValidSection() )					return false;				var xml = Ext.DomQuery.select('calData', data.info.xml);				if(xml.length == 0)					return;				this.refreshContent({response:xml, forcedRecrateRows:false, updateTasks: false});				break;							case 'calendar_success_modify_item':				if ( !this.checkValidSection() )					return false;				var xml = Ext.DomQuery.select('calData', data.info.xml);				this.refreshContent({response:xml, forcedRecrateRows:false, updateTasks: false});				break;							case 'task_success_delete_item':				if ( !this.checkValidSection() )					return false;				if(this.taskView.activeContext == 'monthly')				    this.monthlyCal.removeTasks();				this.taskView.refresh();				break;							case 'task_success_modify_item':				if ( !this.checkValidSection() )					return false;				if(this.taskView.activeContext == 'monthly')				    this.monthlyCal.removeTasks();								this.taskView.refresh();				break;							case 'calendar_scroll_tasks':				if ( !this.checkValidSection() )					return false;				this.loadDailyTask( data.index );				break;							case 'calendar_success_update_color':				if ( !this.checkValidSection() )					return false;				this.refreshContent({response:data.info.xml, forcedRecreateRows:false, updateTasks:false});				break;							case 'change_calendar_section':				if ( data.from == 'weekly' ){					if ( data.section == 'daily' ){						this.changeToDailyFromWeekly( data.index );					}										break;				}								if ( data.from == 'monthly' ){					if ( data.section == 'daily' ){						this.changeToDailyFromMonthly( data.index );					}										break;				}								if ( data.section == "daily" ){					this.changeToDaily( data.date );				}								break;							case 'calendar_switch_view':				switch( data.viewMode ){					case 'monthly':						this.switchToMonthly();						break;					case 'weekly':						this.switchToWeekly();						break;					case 'daily':						this.switchToDaily();						break;					default:						this.activeContext = data.viewMode;				}				break;						case 'calendar_set_active_node':				if ( !this.checkValidSection() )					return false;								data.callback = function(options, success, response) {					var dq = Ext.DomQuery;					var filterDoc	= dq.select('filter',response.responseXML);					var myShareIds	= dq.selectValue('myShareIds',filterDoc, "");					var groupIds	= dq.selectValue('groupIds',filterDoc, "");					var personalIds = dq.selectValue('personalIds', filterDoc, "");					var ids = [];										if(groupIds.length > 0)						ids.push(groupIds);					if(personalIds.length > 0)						ids.push(personalIds);					if(myShareIds.length > 0 && ids.indexOf("0") == -1)						ids.push("0");					Eve.calendar.Registery.Calendar.CheckedNodes = ids.join(',');					if ( !this.checkValidSection() ) {						return false;					}					var response = (success) ? response.responseXML : null;					this.refreshContent({response: response, forcedRecreateRows: false, updateTasks: true});				}								if (data.firstTime) {					this.loadMonthly({updateTasks: true, firstTime: true});				} else {					this.dummySelectFolder( data );				}								break;			case 'calendar_dwm_refresh':				var ctx = this.activeContext;				var CTX = ctx.substr(0, 1).toUpperCase() + ctx.substr(1, ctx.length);				this.selectMode(ctx, this['fill' + CTX], this, true, true );								break;		}	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarMenu.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// -----------------------------------------------------------------------// Add Context Menu on Grid// -----------------------------------------------------------------------Eve.widgets.CalendarAddMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data)	{		Eve.widgets.CalendarAddMenu.superclass.init.call( this, data);		this.menu = new Ext.menu.Menu({			items : [{				text	: "New Event"				,id		: 'event'				,icon	: Eve.Resource.getIcon('item-new','calendar')			}, {				text: "New Shared Calendar"				,id : 'shared'				,icon	: Eve.Resource.getIcon('folder-new','calendar')			}]		});		this.registerView();	}	,registerView : function()	{		this.menu.on('itemclick', function(bi)		{			var data = {				 info	: {					id			: this.id					,parentId 	: this.parentId					,groupId 	: this.groupId					,root		: 'personal'					,path		: '\\'				}			}			switch(bi.id)			{				case 'event':					this.fire('calendar_create_item_dlg', data);					break;									case 'shared':					this.fire('calendar_add_setting_dlg', data);					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type)		{			case ('calendar_addmenu'):				this.id 		= obj.info.id;				this.groupId 	= obj.info.groupId;				this.root 		= obj.info.root;				this.parentId	= obj.info.parentId;				this.path		= obj.info.path;				this.menu.showAt(obj.pos);				break;		}	}});// -----------------------------------------------------------------------// Edit Context Menu on Grid// -----------------------------------------------------------------------Eve.widgets.CalendarEditMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data){		Eve.widgets.EditMenu.superclass.init.call(this, data);		this.item_menu = new Ext.menu.Menu({		items : [{				text	: "Edit"				,id		: "edit"				,icon	: Eve.Resource.getIcon('edit', 'general')			}, {				text	: "Delete"				,id		: "delete"				,icon	: Eve.Resource.getIcon('delete', 'general')			}, '-', {				text	: "Comments"				,id		: "comments"			}, {				text	: "Linked Items"				,id		: "linked"			}]		});		this.registerView();	}	,registerView : function()	{		this.item_menu.on('itemclick', function(bi) {					var data = {				title	: this.title				,info	: {					id			: this.id					,typeId		: this.typeId					,reminderId	: this.reminderId					,parentId	: this.parentId					,groupId	: this.groupId					,root		: this.root					,path		: this.path					,singleEvent: false				}			}						switch(bi.id) {				case 'edit':					this.fire('calendar_edit_item_dlg' ,data);					break;									case 'delete':					delete data.info.singleEvent;					this.fire('calendar_delete_item_dlg' ,data);					break;				case 'linked':					this.fire('calendar_interlinking_dlg', data);					break;				case 'comments':					this.fire('calendar_comment_dlg', data);					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type) {			case ('calendar_editmenu'):				Ext.apply(this, obj.info);				this.type		= obj.type;				this.title		= obj.title;				this.record		= obj.rec;								this.item_menu.showAt(obj.pos);				break;		}	}});// -----------------------------------------------------------------------// Edit Context Menu on Grid// -----------------------------------------------------------------------Eve.widgets.CalendarTaskAddMenu = Ext.extend( Eve.widgets.Menu, {	init : function(data){			Eve.widgets.CalendarAddMenu.superclass.init.call( this, data );		this.menu = new Ext.menu.Menu({		items : [ {				text	: "New Task"				,id		: "x-calendar-new-task"				,icon	: Eve.Resource.getIcon('new-task', 'task')			}]		});		this.registerView();	}	,registerView : function()	{		var that = this;		this.menu.on('itemclick', function(bi) {			var func = function(){	    		var info = {				root		: 'personal'				,path       : '\\'				,selectedDate: that.selectedDate				};			Eve.Resource.superbridge.broadcast(this, 'task_create_item_dlg' ,{info:info})			}			switch(bi.id) {				case 'x-calendar-new-task':						this.fire('proxy_dialog', {type: 'task', func : func });					break;			}		}, this );	}	,execute : function(callee, type, obj)	{		switch(type) {			case ('calendar_task_addmenu'):				this.selectedDate = obj.selectedDate;				this.menu.showAt(obj.pos);				break;		}	}});// -----------------------------------------------------------------------// Calendar Tree Add Menu// -----------------------------------------------------------------------Eve.widgets.CalendarBaseTreeMenu = Ext.extend( Eve.widgets.Menu, {	foldermenu	: {}	,groupmenu  : {}		,init : function(data) {		Eve.widgets.CalendarBaseTreeMenu.superclass.init.call( this, data);	}		,getData : function()	{		var data = {			info: {				id			: this.id				,groupId	: this.groupId				,parentId	: this.parentId				,root		: this.root				,path		: this.path			}			,title: this.title		}				return data;	}		,registerView : function()	{		this.personalFolderMenu.on('itemclick', function(bi) {			switch (bi.id) {				case 'show_only':					this.fire('calendar_check_only', this.getData());					break;								case 'settings':					this.fire('calendar_edit_setting_dlg', this.getData());					break;									case 'delete':					this.fire(this.section + '_delete_folder_dlg', this.getData());					break;			}		}, this);						// Folder Menu Handler		this.folderMenu.on('itemclick', function(bi) {			switch (bi.id) {				case 'show_only':					this.fire('calendar_check_only', this.getData());					break;									case 'settings':					this.fire('calendar_notification_dlg', this.getData());					break;								case 'color':					this.fire('calendar_edit_color_dlg', this.getData());					break;			}		}, this);						// Personal Node Menu Handler		this.personalMenu.on('itemclick', function(bi) {			switch (bi.id) {				case 'show_only':					this.fire('calendar_check_only', this.getData());					break;			}		}, this);		// Personal & Groups Menu Handler		this.groupMenu.on('itemclick', function(bi)		{			switch (bi.id) {				case 'show_only':					this.fire('calendar_check_only', this.getData());					break;									case 'settings':					this.fire('calendar_notification_dlg', this.getData());					break;			}		}, this);	}	,execute : function(callee, type, obj)	{		switch(type) {			case (this.section + '_treemenu'):				Ext.apply(this, obj.info);				this.title	= obj.title;				this.path	= obj.info.path;												// 1. If node is under Personal				// 2. If node is folder but its not in Personal				// 3. If node is 'Personal'				// 4. If node is Group node under 'Groups'				if (obj.type == 'folder' && obj.node.parentNode.id == 'EP_0') {					// Personal Folders					var amenu = this.personalFolderMenu;									} else if (obj.type == 'folder') {					// Shared or Group Folders					var amenu = this.folderMenu;									} else if (obj.type == 'group' && obj.node.id == 'EP_0') {					// Personal Node					var amenu = this.personalMenu;									} else if (obj.type == 'group' && obj.node.id != 'EP_-2' && obj.node.id != 'EP_-3') {					// Group Nodes					var amenu = this.groupMenu;				}								// For 'Groups' & 'Calendar Shared' we dont have any menu				if (amenu !== undefined)					amenu.showAt( obj.pos );								break;		}	}});// -----------------------------------------------------------------------//	Calendar Add Menu used in Calendar Tree// -----------------------------------------------------------------------Eve.widgets.CalendarTreeMenu = Ext.extend( Eve.widgets.CalendarBaseTreeMenu, {	init : function(data)	{		Eve.widgets.CalendarTreeMenu.superclass.init.call(this, data);				this.personalFolderMenu = new Ext.menu.Menu({			items : [{				text	: "Show only this calendar"				,id		: 'show_only'				,icon	: Eve.Resource.getIcon('show-only','calendar')			}, {				text	: "Settings"				,id		: 'settings'				,icon	: Eve.Resource.getIcon('settings','calendar')			}, {				text	: "Delete"				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')							}]		});				this.folderMenu = new Ext.menu.Menu({			items : [{				text	: "Show only this calendar"				,id		: 'show_only'				,icon	: Eve.Resource.getIcon('show-only','calendar')			}, {				text	: "Settings"				,id		: 'settings'				,icon	: Eve.Resource.getIcon('settings','calendar')							}, new Ext.menu.ColorItem({				selectHandler	: function(colorpicker, color) {					var info = {						id		: this.id						,groupId: this.groupId						,root	: this.root					}										this.fire('calendar_change_color', {info: info, color: color})				}				,scope			: this			})]		});		this.personalMenu = new Ext.menu.Menu({			items : [{				text	: "Show only this calendar"				,id		: 'show_only'				,icon	: Eve.Resource.getIcon('show-only','calendar')			}, new Ext.menu.ColorItem({				selectHandler	: function(colorpicker, color) {					var info = {						id		: this.id						,groupId: this.groupId						,root	: this.root					}										this.fire('calendar_change_color', {info: info, color: color})				}				,scope			: this			})]		});		this.groupMenu = new Ext.menu.Menu({			items : [{				text	: "Show only this calendar"				,id		: 'show_only'				,icon	: Eve.Resource.getIcon('show-only','calendar')			}, {				text	: "Settings"				,id		: 'settings'				,icon	: Eve.Resource.getIcon('settings','calendar')							}, new Ext.menu.ColorItem({				selectHandler	: function(colorpicker, color) {					var info = {						id		: this.id						,groupId: this.groupId						,root	: this.root					}										this.fire('calendar_change_color', {info: info, color: color})				}				,scope			: this			})]		});		this.registerView();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\calendar/CalendarDialogControl.js *//*--------------------------------------------------*//** * Hyperoffice Calendar section based on ExtJS Library 2.2 March 2009 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */// * * * * * * * * * * * * * * * * * * * * // 	Event, Meeting, Comments, Interlinking// * * * * * * * * * * * * * * * * * * * * Eve.lib.Calendar.EventDetails = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Calendar.EventDetails.superclass.init.call(this, data);				var items	= (this.isIL()) ? ["Details", "Meeting"] : ["Details", "Meeting", "Comments", "Linked Items"];		var tab		= {			items	: items			,related: [ [0 , 1] ]			,main	: [0]		}				var dialog	= {			width 	: 700			,height : 540			,y		: 50			,title	: 'Calendar'		}				//this.createDialog({tab: tab ,dialog: dialog, preRender: !this.isIL()})		this.createDialog({tab: tab ,dialog: dialog, preRender: false})				// Register handlers		this.registerViews();	}		,onDialogHide : function()	{		if (! this.isIL()) {			// Reset the tab index on window hide.			this.getTabPanel().setActiveTab(0);						// Reset the Comments dataview' store			this.getDataView().store.removeAll();		}				if (this.mode != 'interlink' && !this.isIL()) {			Eve._il.main.store.removeAll();		}				// Reset all Flags.		this.clearLoaded();				// Enable 'Edit Recurrence' in case of previously disabled!		Ext.getCmp(this.section + 'EditRecurrence').enable();				// Reset Recurrence View		Ext.getCmp(this.section + 'frmCalendar').show();		Ext.getCmp(this.section + 'frmRecurrence').hide();		Ext.getCmp(this.section + 'EditRecurrence').setText('Edit Recurrence');				// Reset SingleEvent value		delete this.singleEvent;				// Reset if it comes from QuickEvent		delete this.detailData	}		,onDialogShow : function()	{		Eve.lib.Calendar.EventDetails.superclass.onDialogShow.apply(this, arguments);		/** Syavash: Setting default reminder if available **/		if (this.mode == "create" && Eve.Preference.get('defaultReminderTime') != -1)		{			Ext.getCmp('calendarReminderRelativeMinutes').setValue(Eve.Preference.get('defaultReminderTime'));			Ext.getCmp('calendarhdnReminderPopup').setValue(1);			Ext.getCmp('calendarhdnReminderShowOnDesktop').setValue(1);		}							// Hide Meeting Tab		this.getTabPanel().hideTabStripItem(1);				// Set cboCalendar's value to selected tree node, if mode is create		if (this.mode == 'create' && this.isCached()) {			var cboCal = Ext.getCmp(this.section + 'cboCalendarGroups');						// Set the value of Calendar's combobox same as Tree's checked node			// Just if the dialog didn't called by quick create.			if (!this.detailData && Eve.Calendar._treePanel && Eve.calendar.Registery.Calendar.CheckedNodes.split(",").length == 1) {				var id	= Eve.calendar.Registery.Calendar.CheckedNodes.split(",")[0];								if (cboCal.store && cboCal.store.getById(id)) {					cboCal.setValue(id);					// Update the meeting tab status					cboCal.fireEvent('select', cboCal);				}			}						// Set Attendee's Dataview in Meeting			var tarDs	= Ext.getCmp(this.section+'dvCalendarMeetingAttendees').store;			var data	= Ext.data.Record.create([ 'id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType']);			var record	= new data({				id				: 'MA_0'				,attendee		: Eve.Preference.get('title')				,status			: 'No response given'				,statusId		: '0'				,attendeeId 	: 'IN_0'				,attendeeType	: 'Internal'			});						record.id = 'MA_0';			tarDs.removeAll();			tarDs.add(record);						// 'Add Comments' & 'See the guest list' should be checked by default			Ext.getCmp(this.section + 'addComments').setValue(true);			Ext.getCmp(this.section + 'seeTheGuestList').setValue(true);									// Called by quick create?			if (this.detailData) {				// Set the Subject Value (If passed by Quick create)				Ext.getCmp(this.section + 'txtDetailSubject').setValue(this.detailData.title);								// Set the Calendar Value				cboCal.setValue(this.detailData.calendar);				// Update the meeting tab status				cboCal.fireEvent('select', cboCal);								// Detail				Ext.getCmp(this.section + 'detailStartDate').setValue( this.detailData.startDate );				Ext.getCmp(this.section + 'detailEndDate').setValue( this.detailData.endDate );								Ext.getCmp(this.section + 'detailStartTime').setValue( this.detailData.startTime );				Ext.getCmp(this.section + 'detailEndTime').setValue( this.detailData.endTime );								// Meeting				Ext.getCmp(this.section + 'meetingStartDate').setValue( this.detailData.startDate );				Ext.getCmp(this.section + 'meetingEndDate').setValue( this.detailData.endDate );								Ext.getCmp(this.section + 'meetingStartTime').setValue( this.detailData.startTime );				Ext.getCmp(this.section + 'meetingEndTime').setValue( this.detailData.endTime );				var sd = new Date(this.detailData.startDate);			} else {				var dt = new Date();				var sd = new Date(this.rawSelectedDate);				switch (this.calType) {					case 'dailyCal':						Ext.getCmp(this.section + 'detailStartDate').setValue( this.selectedDate );						Ext.getCmp(this.section + 'detailEndDate').setValue( this.selectedDate );						Ext.getCmp(this.section + 'meetingStartDate').setValue( this.selectedDate );						Ext.getCmp(this.section + 'meetingEndDate').setValue( this.selectedDate );						break;					case 'weeklyCal':						var tempDate = new Date(sd)						tempDate.setDate(tempDate.getDate() + 7);												if (sd <= dt && dt < tempDate) {							sd = dt;						}												break;											case 'monthlyCal':						console.log(sd)						if (sd.getMonth() == dt.getMonth()) {							sd = dt;						}												break;											default:						sd = dt;				}								// Detail				Ext.getCmp(this.section + 'detailStartDate').setValue( sd );				Ext.getCmp(this.section + 'detailEndDate').setValue( sd );				var suffix = (Eve.Preference.get('timeFormat') == 'G:i A')? ' AM': '';				Ext.getCmp(this.section + 'detailStartTime').setValue( '9:00'+ suffix );				Ext.getCmp(this.section + 'detailEndTime').setValue( '9:30' + suffix );								// Meeting				Ext.getCmp(this.section + 'meetingStartDate').setValue( sd );				Ext.getCmp(this.section + 'meetingEndDate').setValue( sd );								Ext.getCmp(this.section + 'meetingStartTime').setValue( '9:00'+ suffix );				Ext.getCmp(this.section + 'meetingEndTime').setValue( '9:30' + suffix );			}						// Set Default values for Recurrence Patterns			var checkBoxes = Ext.getCmp(this.section + 'weekDaysMask').items.items;						// Weekly			for (var i = 0; i < checkBoxes.length; ++i) {				if (parseInt(checkBoxes[i].inputValue) == sd.getDay()) {					checkBoxes[i].setValue(true);				}			}						// Monthly			Ext.getCmp(this.section + 'DayInMonthnth').setValue(sd.getDate());			Ext.getCmp(this.section + 'instanceOfDayInMonthMonthly').setValue(Math.ceil( sd.getDate() / 7 ));			Ext.getCmp(this.section + 'dayOfWeekMonthly').setValue(sd.getDay() + 1);						// Yearly			Ext.getCmp(this.section + 'specificMonthYearnth').setValue(sd.getMonth() + 1);			Ext.getCmp(this.section + 'instanceOfDayInMonthYearly').setValue(Math.ceil( sd.getDate() / 7 ));			Ext.getCmp(this.section + 'dayOfWeekYearly').setValue(sd.getDay() + 1);			Ext.getCmp(this.section + 'specificMonthYearly').setValue(sd.getMonth() + 1);		}						}		// Attaches handler to form items	,registerViews : function()	{		// Attach a handler for 'Calendar' combobox		Ext.getCmp(this.section + 'cboCalendarGroups').on('select', function(el) {			var id	= el.getValue();			var frm	= Ext.getCmp(this.section + 'frmSharedCalendars');			var btnReminder = Ext.getCmp(this.section + 'btnCalendarReminderRelative');						if (id == "0" || id == "") {				frm.show();				btnReminder.show();				// Hide 'Meeting' tab				this.getTabPanel().hideTabStripItem(1);				this.root = 'personal';			} else {				frm.hide();				btnReminder.hide();				// Show 'Meeting' tab				this.getTabPanel().unhideTabStripItem(1);				this.root	 = 'group';				this.groupId = id;			}		}, this);						// Attach a handler for 'Edit Recurrence' button.		Ext.getCmp(this.section + 'EditRecurrence').on('click', function(el) {			var cboCalendar = Ext.getCmp(this.section + 'cboCalendarGroups');			if (cboCalendar.getValue().toString() == "") {				Ext.tools.msg('Pick a Calendar,please.', '');				return;			}			var frmCal = Ext.getCmp(this.section + 'frmCalendar');			var frmRec = Ext.getCmp(this.section + 'frmRecurrence');						frmCal.setVisible(frmCal.hidden);			frmRec.setVisible(frmRec.hidden);			frmRec.doLayout();						var text = (el.getText() == 'Edit Recurrence') ? 'Edit Calendar' : 'Edit Recurrence'			el.setText(text);		}, this);						// Attach handler for 'Daily' ... 'Yearly' radios		Ext.getCmp(this.section + 'frmPeriodRadios').items.each( function(el, idx) {			el.on('check', function(rd, checked) {				var frmPeriodView = Ext.getCmp(this.section + 'frmPeriodView');								if (checked) {					frmPeriodView.items.each( function(item) {						item.hide();					})										frmPeriodView.items.itemAt(idx).show();					frmPeriodView.doLayout();				}			}, this)		},this);						// Attach a handler for 'Add' button combobox on 'Meeting'		Ext.getCmp(this.section + 'AddParticipants').on('click', function() {			var dvAttendees	= Ext.getCmp(this.section + 'dvCalendarMeetingAttendees');			var cboAttendee = Ext.getCmp(this.section + 'AttendeesCbo');			var values		= cboAttendee.getValue();			var store		= Eve.registery.allContacts;			var records		= [];			values			= values.split(',');			// First remove filter			store.clearFilter();			for (var i = 0; i < values.length; ++i) {				var val	= values[i].trim();				if (val == '') {					continue;				}				var idx = store.findBy(function(rec, id) {					if (rec.get('email') == val) {						return true;					}				});				// Check for external emails validation				if (idx == "-1") {					if (! Ext.form.VTypes.email( val )) {						cboAttendee.markInvalid();						return;					}				}				// Already added?				if (dvAttendees.store.find('attendee', val) != "-1") {					Ext.Msg.alert('', '"' + val + '" Already has been added!');					cboAttendee.markInvalid();					return;				}				var data	= Ext.data.Record.create([ 'id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType']);				var record	= new data({					id				: 0					,attendee		: val					,status			: 'No response given'					,statusId		: '0'					,attendeeId 	: 'F_0'					,attendeeType	: ( idx != "-1" ) ? 'internal' : 'external'				});				//record.id = rec.id;				records.push( record );			}						dvAttendees.store.add(records);			cboAttendee.setValue('');		}, this);				// Attach a handler for 'Attendee Schedule' button on 'Meeting'		Ext.getCmp(this.section + 'btnAttendeeSchedule').on('click', function() {			this.fire('calendar_schedules_dlg', {}, true);			return;						var dvAttendee	= Ext.getCmp(this.section + 'dvCalendarMeetingAttendees');			var popFlag		= false;						dvAttendee.store.each( function(rec) {				if (rec.get('attendeeType').toLowerCase() == 'internal') {					popFlag = true;					return;				}			})						if (! popFlag) {				Ext.Msg.alert('No Internal Attendees', "At least one portal member should be added in the attendees list.");				return;			}						var params = {				CFID		: Eve.CFId				,CFTOKEN	: Eve.CFToken				,event		: 'modern.calendar.checkSchedules'				,currdate	: Ext.getCmp(this.section + 'meetingStartDate').getValue().format('n/j/y')				,meetingid	: Ext.getCmp(this.section + 'meetingId').getValue()			}						if (Ext.getCmp(this.section + 'meetingId').getValue() == 0){				var meetingAttendees = [];				dvAttendee.store.each( function(rec) {					var attendee = rec.get('attendee').match(/\((.*?)\)/);					if (attendee && attendee[1] && attendee[1].trim() != '') {						meetingAttendees.push(attendee[1]);					}				})				params.meetingAttendees = meetingAttendees.join(',');			}						var panel = {				xtype		: 'panel'				,id			: 'TempLayout'				,layout		: 'fit'				,items		: [ new Ext.ux.IFrameComponent({url: Eve.url + '?' + Ext.urlEncode(params)}) ]			};						var scheduleWindow = new Ext.Window({				title		: 'Attendee schedule'				,closeAction: 'close'				,id			: 'check-schedule-window'				,height		: 480				,width		: 762				,layout		: 'fit'				,resizable	: false				,items		: panel			});						scheduleWindow.show();					}, this);								Ext.getCmp(this.section + 'dvCalendarMeetingAttendees').on('render' , function(cmp){			cmp.view.el.on('click', function(e, item) {							var vsx		= Ext.get(item).up(cmp.view.itemSelector);				if (! vsx)					return;							var rec		= cmp.view.getRecord( vsx.dom );				var target	= Ext.get(item).dom.className.split(' ')[0];				if (target == "calendar-meeting_attendee_del"){					if (rec.get('attendeeId').split("_")[1] == "0") {						if (cmp.view.store.getCount() > 1) {							cmp.view.store.remove(rec)							cmp.view.refresh();						} else {							Ext.Msg.alert('', "You should have at least one attendee.");							return;						}					} else {						var groupId	= Ext.getCmp(this.section + 'cboCalendarGroups').getValue();						if (groupId.trim() == '') {							return;						}						var params 	= {							groupId		: groupId							,meetingId      : Ext.getCmp(this.section + 'meetingId').getValue()							,id				: ( rec.get('id').indexOf("_") != -1 )? rec.get('id').split("_")[1] : 0							,attendeeId     : rec.get('attendeeId')							,attendeeType   : rec.get('attendeeType')						}						this.fire("calendar-meeting_attendee_delete", params);					}									}			},this)					},this)	}		// Add Check Boxes to the 'Add Event' form based on Backend's data.	,addCheckBoxes : function(data)	{		// Remove Previously Created CheckBoxes If There's Any		this.removeCheckBoxes();				var xml		= data.responseXML;		var dq		= Ext.DomQuery;		var frm		= Ext.getCmp(this.section + 'frmSharedCalendars');		var gBox	= Ext.getCmp(this.section + 'gcSharedCalendars');		var col		= gBox.panel.items.get(gBox.items.getCount() % gBox.panel.items.getCount());				var root	= dq.selectNode('sharedCalendars', xml);		var rows	= dq.select('row', root);		var items	= [];				for (var i = 0; i < rows.length; ++i) {			var chBox 	= new Ext.form.Checkbox({				boxLabel		: dq.selectValue('title', rows[i])				,inputValue		: dq.selectValue('id', rows[i])				,checked		: (dq.selectValue('checked', rows[i]) == 'true')				,hideLabel		: true			});			gBox.items.add(chBox);			col.add(chBox);		}		gBox.panel.doLayout();		frm.add(gBox);		frm.doLayout();	}		,removeCheckBoxes : function()	{		var gBox	= Ext.getCmp(this.section + 'gcSharedCalendars');				if (gBox.panel) {			var col		= gBox.panel.items.get(gBox.items.getCount() % gBox.panel.items.getCount());			gBox.items.each( function(item) {				gBox.items.remove(item);				col.remove(item);			}, this);		}	}		,augment : function(callee, index, state)	{		var obj = callee.params;				obj.id = this.id;		if (this.root == 'group') {			if (this.mode == 'edit')				obj.groupId = this.groupId;			else				obj.groupId = Ext.getCmp(this.section + 'cboCalendarGroups').getValue() || this.groupId;		}				// Added by Ghazal		if (state == 'submit' && this.root == 'group' && (index == 0 || index == 1)){			var cmp = Ext.getCmp( this.section + 'dvCalendarMeetingAttendees');						if(cmp && cmp.store){				var temp = [];				var str;				var strArray = [];				cmp.store.each( function(record) {					temp = record.get('attendee').match('[<\(]([^\)>]*)');					str = (temp && temp[1]) || record.get('attendee');					str += "|" + record.get('statusId') + "|" + record.get('attendeeId').split("_")[1];					strArray.push(str);				});				str = strArray.join("$");				obj.meetingAttendeesFilter = str;			}		}		if(state == 'submit' && this.root == 'personal' && index == 0){			var temp;			temp = Ext.getCmp(this.section + 'hdnReminderPopup').getValue();			if(temp == "true")				obj.reminder_popup = temp;			temp = Ext.getCmp(this.section + 'hdnReminderSMS').getValue();			if(temp == "true")				obj.reminder_sms = temp;			temp = Ext.getCmp(this.section + 'hdnReminderShowOnDesktop').getValue();			if(temp == "true")				obj.remindershowondesktop = temp;			temp = Ext.getCmp(this.section + 'hdnReminderUseEmail').getValue();			if(temp == "true")				obj.use_email = temp;		}		//				obj.parentId = this.parentId;		obj.path	 = this.path || '\\';				if (this.selectedDate) {			obj.selectedDate = this.selectedDate;		}				if (this.mode != 'edit') {			obj.calType = this.calType;		}				var idx = this.getIndex(this.getTabPanel().activeTab);		switch(idx) {			// Comments			case (this.idxComments):				obj.objTypeId	= this.typeId;				obj.objId		= this.id;				delete obj.id;				break;							// Interlinking			case (this.idxInterlink):				obj.objectTypeId = this.typeId;				break;		}						if (this.singleEvent !== undefined) {			obj.appliedToAllRecurrences = (this.singleEvent) ? false : true;		}				return callee;	}		,showHideCmp : function()	{		// By default we assume the Calendar Combobox set to 'Personal' so disable 'Meeting' tab		// this.getTabPanel().hideTabStripItem(1);				if (this.mode != 'edit') {			Ext.getCmp(this.section + 'cboCalendarGroups').enable();		} else {			Ext.getCmp(this.section + 'cboCalendarGroups').disable();		}	}		,controller : function(obj)	{		this.id 		= obj.info.id;		this.parentId 	= obj.info.parentId;		this.groupId 	= obj.info.groupId;		this.root 		= obj.info.root;		this.path		= obj.info.path;				// Interlinking Stuff		obj.info.typeId = obj.info.typeId || Eve.Resource.getTypeId(obj.info.root, 'item', this.section);		obj.dialog		= this;		this.typeId		= obj.info.typeId;		this.objId		= obj.info.objId;		this.linkBack	= obj.info.linkBack				this.title			= obj.title		this.selectedDate	= obj.selectedDate;		this.rawSelectedDate= obj.rawSelectedDate;		this.calType		= obj.calType || 'listCal';				// Coming from quick add event?		if (this.detailData) {			this.selectedDate	= this.detailData.startDate;			this.calType		= 'xerxes';		}				if (!this.isIL()) {			// Pass It through for Comments.			Eve._cm.main.params = obj;			Eve._cm.main.type 	= "";			Eve._il.main.params = obj;		}		try {		this.panels[0].reset();		this.panels[1].reset();		} catch(e) {}				if (! this.isIL()) {			this.panels[this.idxComments].reset();		}				this.dialog.show();				// Check Elements.		this.showHideCmp();	}		,execute : function(callee, type, data)	{		switch(type) {			case (this.section + '_edit_item_dlg'):				this.mode = data.mode || 'edit';				this.controller(data);				//				if (this.singleEvent == data.info.singleEvent) {//					Ext.getCmp(this.section + 'EditRecurrence').disable();//				}								if (!this.getLoaded(0))					this.loadForm(0);								break;							case (this.section + '_create_item_dlg'):				this.mode = data.mode || 'create';								// If it called by quick create event				if (data.info.title !== undefined) {					this.detailData = data.info;				}								this.controller(data);								if (! this.isCached()) {					this.loadForm(0);				}								break;						case (this.section + '_success_create_folder'):			case (this.section + '_success_modify_folder'):			case (this.section + '_success_delete_folder'):				// Reset Cache				this.resetCache();										// Remove Previously created Checkboxes				(function() {					this.removeCheckBoxes();				}).defer(1000, this);								break;							// - - - - - - - - - - - - -			// Comments Method Calls			// - - - - - - - - - - - - -			case (this.section + '_comment_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxComments);				// ...Clear its load status ;)				this.clearLoaded(0);				break;			case (this.section + '_add_comment'):				this.submitForm(this.idxComments);				break;						case (this.section + '_success_modify_comment'):				this.deleteComment(data);				this.addComment(data);				break;						case (this.section + '_success_delete_comment'):				this.deleteComment(data);				break;							// - - - - - - - - - - - - -			// Interlinking Method Calls			// - - - - - - - - - - - - -			case (this.section + '_interlinking_dlg'):				this.mode = data.mode || 'edit';				// Set first tab as loaded to prevent its loading...				this.setLoaded(0);				this.controller(data);				this.getTabPanel().setActiveTab(this.idxInterlink);				// ...Clear its load status ;)				this.clearLoaded(0);				break;						case (this.section + '_reload_interlink_grid'):				this.updateCountOfTitle('+');				this.loadForm(this.idxInterlink);								var grid = Ext.getCmp(this.section + '_grid')				var tb = grid.getBottomToolbar();								// TODO: In Ext 3.0 in does not work, u have to send the button itself				tb.onClick('refresh');								break;		}	}	,staticLoad : function(xml)	{		var dq	 = Ext.DomQuery;		var root = xml.calendar;					for (var i = 0; i < this.panels.length; ++i) {			var form = this.panels[i].get().getForm();			form.transit.load(root);		}		this.addCheckBoxes({responseXML: root});		this.cached = true;	}	,loadSuccess : function(res)	{		var idx	= this.getIndex(this.getTabPanel().activeTab);		var dq	= Ext.DomQuery;		var xml	= res.responseXML;				switch(idx) {			// Event Details			case 0:				this.addCheckBoxes(res);								// Get the Reminder Button				var btnReminder = Ext.getCmp(this.section + 'btnCalendarReminderRelative');				/*				// Reset the value to None				btnReminder.menu.items.items[0].setChecked(true);								if (this.mode != 'create') {					var val = Ext.DomQuery.selectValue('relativeMinutes', xml, '0');										btnReminder.menu.items.each( function(el) {						if (el.value == val) {							el.setChecked(true);							return false;						}					});				}				*/				var cboCal = Ext.getCmp(this.section + 'cboCalendarGroups');				// Set cboCalendar's value to selected tree node, if mode is create				if (this.mode == 'create') {										if (Eve.Calendar._treePanel && Eve.calendar.Registery.Calendar.CheckedNodes.split(",").length == 1) {						var id		= Eve.calendar.Registery.Calendar.CheckedNodes.split(",")[0];							if (cboCal.store && cboCal.store.getById(id)) {								cboCal.setValue(id);							}												// Change original XML to prevent FormController from alerting the user						var root 	= dq.selectNode(cboCal.getName(), xml);						dq.selectNode('selectedValue', xml).firstChild.nodeValue = id;											}						// Update the meeting tab status					//	cboCal.fireEvent('select', cboCal);				} else {                    var root 	= dq.selectNode(cboCal.getName(), xml);                    var id      = dq.selectValue('selectedValue', root);					cboCal.setValue(id)				}								// Called by quick create?				if (this.detailData) {					Ext.getCmp(this.section + 'txtDetailSubject').setValue(this.detailData.title);					Ext.getCmp(this.section + 'cboCalendarGroups').setValue(this.detailData.calendar);										// Detail					Ext.getCmp(this.section + 'detailStartDate').setValue( this.detailData.startDate );					Ext.getCmp(this.section + 'detailEndDate').setValue( this.detailData.endDate );										Ext.getCmp(this.section + 'detailStartTime').setValue( this.detailData.startTime );					Ext.getCmp(this.section + 'detailEndTime').setValue( this.detailData.endTime );										// Meeting					Ext.getCmp(this.section + 'meetingStartDate').setValue( this.detailData.startDate );					Ext.getCmp(this.section + 'meetingEndDate').setValue( this.detailData.endDate );										Ext.getCmp(this.section + 'meetingStartTime').setValue( this.detailData.startTime );					Ext.getCmp(this.section + 'meetingEndTime').setValue( this.detailData.endTime );																				// Sync StartTime & EndTime cause they change in Weekly and Daily					dq.selectNode('startTime', xml).firstChild.nodeValue = Ext.getCmp(this.section + 'detailStartTime').getValue();					dq.selectNode('endTime', xml).firstChild.nodeValue = Ext.getCmp(this.section + 'detailEndTime').getValue();										delete this.detailData;				}								// Update the Meeting tab status. It's important to put it down here.				var el = Ext.getCmp(this.section + 'cboCalendarGroups');				el.fireEvent('select', el);								break;						// Interlinking			case (this.idxInterlink):				this.loadLinkingGrid(res)				break;		}				/** Syavash: Setting default reminder if available **/		if (this.mode == "create" && Eve.Preference.get('defaultReminderTime') != -1)		{			Ext.getCmp('calendarReminderRelativeMinutes').setValue(Eve.Preference.get('defaultReminderTime'));			Ext.getCmp('calendarhdnReminderPopup').setValue(1);			Ext.getCmp('calendarhdnReminderShowOnDesktop').setValue(1);		}						}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			var tabIndex = this.getIndex(this.getTabPanel().activeTab);			switch (tabIndex) {				case (this.idxComments):					this.addComment(xml);					break;								default:					this.id = dq.selectValue('id', xml).split("_")[1];										var info = {						id 			: this.id						,rawId		: dq.selectValue('id', xml)						,xml		: xml						,root		: this.root						,path		: this.path						,parentId	: dq.selectValue('parentID', xml)						,groupId	: this.groupId					}										var type = (obj.id == 0 || obj.id === undefined) ? "calendar_success_create_item" : "calendar_success_modify_item";					this.fire(type, {info: info, params: obj});					// Added By Ghazal										var recurrenceId    = dq.selectValue('recurrenceId', xml, undefined);					var recurrenceText  = dq.selectValue('recurrenceText', xml, undefined);					var reminderId		= dq.selectValue('reminderId', xml, 0);					Ext.getCmp(this.section + 'hdnReminderId').setValue(reminderId);					if(recurrenceId !== undefined && recurrenceId !== null && recurrenceId != "")					    Ext.getCmp(this.section + 'recurrenceId').setValue(recurrenceId);					if(recurrenceText !== undefined && recurrenceText !== null && recurrenceText != "")					    Ext.getCmp(this.section + 'recurrenceText').setText(recurrenceText);					    					Ext.getCmp(this.section + 'meetingId').setValue(dq.selectValue('meetingId', xml, 0));					var attendees = dq.select('meetingAttendees', xml);					var st = Ext.getCmp(this.section+'dvCalendarMeetingAttendees').store;					st.removeAll();					st.add(st.reader.readRecords(attendees).records);					//					// Is there any conflicts?					var conflicts = dq.selectNode('conflicts', xml);					if (conflicts) {						var ds = new Ext.data.Store({							mode	: 'local'							,reader	: new Ext.data.XmlReader({								record			: 'conflict'							}, [ 'conflictMode', 'conflictId', 'conflictSubject', 'conflictLocation', 'conflictStartDate', 'conflictEndDate'] )						});												var wp = new Ext.Window({							modal		: true							,title		: 'Events Conflict'							,layout		: 'fit'							,width		: 450							,height		: 320							,items		: [{								xtype		: 'panel'								,autoScroll	: true								,border		: false								,frame		: false								,items		: [{									xtype			: 'dataview'									,autoHeight		: true									,singleSelect	: true									,itemSelector	: 'div.x-group-select'									,overClass		: 'x-group-over'									//,selectedClass	: 'x-group-selected'									,tpl			: new Ext.XTemplate(										'<div style="padding:5px; color:red; text-align:center; background-color:#EEE;">',											'<p>Warning!</p>',											// '<span>The event conflicts with the following event(s) below. You may click on one of the conflicting events to reschedule it.</span>',											'<span>The event conflicts with the following event(s) below.</span>',										'</div>',										'<tpl for=".">',											'<div class="x-group-select">',												//'<div style="padding:5px; border:1px solid #999; background-color:#DDD; float:right">Reschedule</div>',												'<table>',												 '<tr>',													'<td>Subject&nbsp;&nbsp;&nbsp;</td>',													'<td><b>{conflictSubject}</b></td>',													'<td></td>',												 '</tr>',												 '<tr>',													'<td>Start</td>',													'<td>{conflictStartDate}</td>',													'<td></td>',												 '</tr>',												 '<tr>',													'<td>End</td>',													'<td>{conflictEndDate}</td>',												 '</tr>',												'</table>',											'</div>',										'</tpl>'									)									,store			: ds									/*									,listeners		: {										click	: function(cmp, idx, node, e) {											var record	= cmp.getRecord(node);											var data	= {												info		: {													id			: record.get('conflictId')													,root		: 'personal'												}											}											this.fire('calendar_edit_item_dlg', data, true);											wp.hide();										}										,scope	: this									}									*/								}]							}]							,buttons	: [{								text		: 'Ignore All'								,id			: 'calendarConflictCloseBtn'								,handler	: function() {									this.ownerCt.hide();								}							}, {								text		: 'Reschedule new event'								,handler	: function() {									this.fire('calendar_edit_item_dlg', { info: info }, true);									wp.hide();								}								,scope		: this							}]						})						ds.removeAll();						ds.add( ds.reader.readRecords(conflicts).records );						wp.show();					}								} // End of Switch		} // End of If	}	//Added by Ghazal , reminder validation	,submitForm : function()	{		var reminderWhen = Ext.getCmp(this.section + 'ReminderRelativeMinutes');		var reminderSubject = Ext.getCmp(this.section + 'hdnReminderSubject')				if (this.root == 'personal' && this.mode == 'create' && Ext.getCmp('calendarhdnReminderSubject').getValue() == '' && Eve.Preference.get('defaultReminderTime') != -1)			Ext.getCmp('calendarhdnReminderSubject').setValue(Ext.getCmp('calendartxtDetailSubject').getValue());				if( Ext.getCmp(this.section + 'cboCalendarGroups').getValue() == '0'){			if(	reminderWhen.getValue() != '-1' &&				reminderWhen.getValue()!= ""	&&				reminderSubject.getValue() == "")			{				Ext.tools.msg('Reminder\'s subject is required', '');				return;			}		}		Eve.lib.Calendar.EventDetails.superclass.submitForm.apply(this, arguments);	}});// * * * * * * * * * * * * * * * * * * * * // 	Settings// * * * * * * * * * * * * * * * * * * * * Eve.lib.Calendar.Settings = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,root	: 'personal'		,init : function(data)	{		Eve.lib.Calendar.Settings.superclass.init.call(this, data);				var tab		= {			items	: ["Sharing", "Notifications"]			,related: [ [0 , 1] ]		}				var dialog	= {			width 	: 600			,height : 450			,y		: 50			,title	: 'Settings'		}				this.createDialog({tab: tab ,dialog: dialog});		// Register handlers		this.registerViews();	}		,onDialogHide : function()	{		// Reset Attendees' Dataview		Ext.getCmp('dvCalendarAttendees').store.removeAll();				// Reset the tab index on window hide.		this.dialog.items.items[0].setActiveTab(0);				// Reset all Flags.		this.clearLoaded();	}	// Attaches handler to form items	,registerViews : function()	{		// Attach a handler for 'Group/Personal' combobox		Ext.getCmp('btnCalendarSharingAdd').on('click', function() {			var dv = Ext.getCmp('dvCalendarAttendees');			var ds = dv.store;			var cboAttendee = Ext.getCmp('cboCalendarSharingAttendee');			var cboStatus	= Ext.getCmp('cboCalendarSharingStatus');			var values	= cboAttendee.getValue();			var records = [];			values		= values.split(',');			// First remove filter			cboAttendee.store.clearFilter();			for (var i = 0; i < values.length; ++i) {				var val	= values[i].trim();								if (val == '') {					continue;				}												var idx = cboAttendee.store.findBy(function(rec, id) {					if (rec.get('email') == val) {						return true;					}				});				// Check for external emails validation				if (idx == "-1") {					cboAttendee.markInvalid();					return;				}								// Previously added?				if (ds.find('attendee', val) != "-1") {					Ext.Msg.alert('', '"' + val + '" Already has been added to attendees list!');					cboAttendee.markInvalid();					return;				}				var id		= cboAttendee.store.getAt(idx).get('id');				var data	= Ext.data.Record.create(['id', 'attendee', 'statusId', 'status'])				var record	= new data({					id			: id					,attendee	: val					,statusId	: cboStatus.getValue()					,status		: cboStatus.getRawValue()				})				record.id = id;				records.push( record );			}			ds.add(records);			cboAttendee.setValue('');		}, this);	}		,augment : function(callee)	{		var obj = callee.params;				obj.id 		 = this.id ;		obj.parentId = this.parentId;		obj.path	 = this.path;				if (this.root == 'group')		    obj.groupId = this.groupId;				return callee;	}		,showHideCmp : function(state)	{		if (state === undefined)		    return;		    		if (state == 0)	{			 this.getTabPanel().unhideTabStripItem(0);			 this.getTabPanel().setActiveTab(0);		}		else if (state == 1) {			this.getTabPanel().hideTabStripItem(0);		 	this.getTabPanel().setActiveTab(1);		}	}		,controller : function(obj, state)	{		if (obj) {			this.id 		= obj.info.id;			this.parentId 	= obj.info.parentId;			this.groupId 	= obj.info.groupId;            this.root		= (state == 1) ? obj.info.root : 'personal';			//this.root 		= 'personal';			this.path		= obj.info.path;		}				this.panels[0].reset();		this.panels[1].reset();		this.dialog.show();		this.showHideCmp(state);	}		,execute : function(callee, type, data)	{		switch(type) {			case ('calendar_add_setting_dlg'):				this.controller(data, 0);				if (!this.getLoaded(0) && !this.isCached())					this.loadForm(0);								break;						case ('calendar_edit_setting_dlg'):				this.controller(data, 0);				if (!this.getLoaded(1))				this.loadForm(0);				break;						case ('calendar_notification_dlg'):				this.controller(data, 1);				if (!this.getLoaded(1))				this.loadForm(1);				break;							case ('calendar_settings_attendee_delete'):				var dv = Ext.getCmp('dvCalendarAttendees');				var ds = dv.store;								var rec = ds.getById(data.info.id);				ds.remove(rec);								dv.view.refresh();								break;		}	}		,loadSuccess : function(res) {		var idx	 = this.getIndex(this.getTabPanel().activeTab);				switch(idx) {			// Settings			case 0:				break;		}	}		,submitSuccess : function(resp, action)	{		var obj = action.params;		if ( (typeof action.params).toLowerCase() == 'string' )			obj = Ext.urlDecode( action.params );				var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);				if (code == '0') {			this.id = dq.selectValue('id', xml).split("_")[1];			if(obj.shareName !== ""){				obj.title = obj.shareName;			}						var info = {				id 			: this.id				,rawId		: dq.selectValue('id', xml)				,color		: dq.selectValue('color', xml)				,xml		: xml				,root		: this.root			}			    			var type = ((obj.id == 0 || obj.id === undefined || obj.id == "" )&& this.root != 'group') ?				"calendar_success_create_folder" :		 		"calendar_success_modify_folder";						this.fire(type, {info: info, params: obj});		} // End of If	}});// * * * * * * * * * * * * * * * * * * * * // 	Participants (Group Membership, Portal)// * * * * * * * * * * * * * * * * * * * * Eve.lib.Calendar.Participants = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Calendar.Participants.superclass.init.call(this, data);				var tab		= {			items	: ["Participants"]		}				var dialog	= {			width 	: 400			,height : 300			,title	: 'Participants'		}				var d = this.createDialog({tab: tab ,dialog: dialog});				d.on('render', function() {			var fn = function() {				Ext.get('checkAllParticipants').on('click', function() {					var tbl = Ext.get('calParticipantTable');					if (tbl) {						var els		= tbl.select('.cal-participant-checkbox');						var checked = this.dom.checked;												els.each(function (el) {							el.dom.checked = checked;						})					}				})			}						fn.defer(1000)		})	}		,onDialogHide : function()	{		Ext.getCmp('dvCalendarParticipants').store.removeAll();				if (this.schedule) {			delete this.schedule;		}		// Reset all Flags.		this.clearLoaded();	}		,afterAddButtons : function(buttons, scope)	{		return [{			text	: 'Done'			,handler: function() {				this.appendRecords();			}			,scope	: this		}]	}		,appendRecords : function()	{			var chBoxes  = Ext.query('.cal-participant-checkbox', 'calParticipantTable');		if (chBoxes.length > 0) {			var srcDs = Ext.getCmp('dvCalendarParticipants').store;			var attendees = [];			// Called from Schedule?			if (this.schedule) {								for (var i = 0; i < chBoxes.length; ++i) {					if (chBoxes[i].checked) {						var rec = srcDs.getById(chBoxes[i].id);						attendees.push(rec.get('contactEmail'));					}				}				var data = {					attendees : attendees.join(',')				}								this.fire('calendar_schedules_load_attendees', data);			} else {				var tarDs = Ext.getCmp(this.section + 'dvCalendarMeetingAttendees').store;				for (var i = 0; i < chBoxes.length; ++i) {					if (chBoxes[i].checked) {						var rec = srcDs.getById(chBoxes[i].id);						if (tarDs.find('attendee', rec.get('contactEmail')) == -1) {							var data	= Ext.data.Record.create([ 'id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType']);							var record	= new data({								id				: rec.id								,attendee		: rec.get('contactEmail')								,status			: 'No response given'								,statusId		: '0'								,attendeeId 	: 'F_0'								,attendeeType	: ( Ext.getCmp(this.section + 'AttendeesCbo').getValue() == "-1" ) ? 'Internal' : 'External'							});							record.id = rec.id;							tarDs.add(record);						}					}				}							}					}				this.dialog.hide();	}		,augment : function(callee)	{		var obj = callee.params;		// Silly one, didn't expect more from back-end ;)		obj.folderId	= "-1";		obj.groupId		= this.groupId;				return callee;	}		,controller : function(obj)	{		if (obj) {			this.groupId 	= obj.info.groupId;			this.root 		= obj.info.root;		}		// Called from Schedules Dialog		if (obj.schedule) {			this.schedule = true;		}				// We don't want to prompt user for this dialog on hide.		this.noPromptNeeded = true;				this.panels[0].reset();		this.dialog.show();		this.loadForm(0);	}		,execute : function(callee, type, data)	{		switch(type) {			case ('calendar_participants_dlg'):				this.controller(data);				break;		}	}});// * * * * * * * * * * * * * * * * * * * *// 	Participants (Contacts)// * * * * * * * * * * * * * * * * * * * *Eve.lib.Calendar.ContactParticipants = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,root	: 'personal'	,groupId: 0	,init : function(data)	{		Eve.lib.Calendar.ContactParticipants.superclass.init.call(this, data);		var tab		= {			items	: ["Select Users"]		}		var dialog	= {			width 	: 600			,height : 300			,title	: 'Select Users'		}				var d = this.createDialog({tab: tab ,dialog: dialog});		d.on('render', function() {			var fn = function() {				Ext.get('checkAllContactParticipants').on('click', function() {					var tbl = Ext.get('calContactParticipantTable');										if (tbl) {						var chBoxes	= Ext.DomQuery.select('.cal-contact-participant-checkbox');						var checked = this.dom.checked;						if (chBoxes.length > 0) {							for (var i = 0; i < chBoxes.length; ++i) {								chBoxes[i].checked = checked;							}						}					}				})			}			fn.defer(1000)		})		this.cboPersonalGroup	= Ext.getCmp('cboCalContactPersonalContact');		this.cboCategories		= Ext.getCmp('cboCalContactCategories');		this.dvContacts			= Ext.getCmp('dvCalendarContactParticipants');				// Register handlers		this.registerViews();	}	// Attaches handler to form items	,registerViews : function()	{		// Attach a handler for 'Group/Personal' combobox		this.cboPersonalGroup.on('select', function() {			this.groupId = this.cboPersonalGroup.getValue() || 0;			this.root	 = (this.groupId == 0) ? 'personal' : 'group';			this.dvContacts.store.removeAll();			this.calledByCboPG = true;			this.loadForm(0);		}, this);		// Attach a handler for 'Categories' combobox		this.cboCategories.on('select', function(el) {			this.cboCategories.loadPrevent = true;			var folderId	= this.cboCategories.getValue();			this.ft			= false;						if (folderId.trim() != "") {				console.log(folderId)				this.folderId = folderId;				this.loadForm(0);			}		}, this);		// Attach a handler for 'Apply Filter' button		Ext.getCmp('btnContactParticipantsApplyFilter').on('click', function() {			this.submitForm(0);		}, this);	}	,onDialogHide : function()	{	try{		this.dvContacts.store.removeAll();		}catch(e){}		this.groupId = 0;		delete this.folderId;		if (this.schedule) {			delete this.schedule;		}		// Reset all Flags.		this.clearLoaded();	}	,afterAddButtons : function(buttons, scope)	{		return [{			text	: 'Add'			,handler: function() {this.appendRecords()}			,scope	: this		}]	}	,appendRecords : function()	{		var chBoxes  = Ext.query('.cal-contact-participant-checkbox'/*, 'calContactParticipantTable'*/);		if (chBoxes.length > 0) {			var srcDs = this.dvContacts.store;			var attendees = [];			// Called from Schedule?			if (this.schedule) {				for (var i = 0; i < chBoxes.length; ++i) {					if (chBoxes[i].checked) {						var rec		= srcDs.getById(chBoxes[i].id);						var email	= rec.get('contactEmail');						if (email.match(/@/)) {							Ext.Msg.alert('Contacts', "Contacts can't be added to check schedules.");							return;						}												attendees.push(email);					}				}				var data = {					attendees : attendees.join(',')				}				this.fire('calendar_schedules_load_attendees', data);			} else {				var tarDs = Ext.getCmp(this.section + 'dvCalendarMeetingAttendees').store;				for (var i=0; i < chBoxes.length; ++i) {					if (chBoxes[i].checked) {						var rec = srcDs.getById(chBoxes[i].id);						if (tarDs.find('attendee', rec.get('contactEmail')) == -1) {							var data	= Ext.data.Record.create([ 'id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType']);							var record	= new data({								id				: rec.id								,attendee		: rec.get('contactEmail')								,status			: 'No response given'								,statusId		: '0'								,attendeeId 	: 'F_0'								,attendeeType	: 'external'							});							record.id = rec.id;							tarDs.add(record);							if (this.schedule) {								if (! rec.get('contactEmail').match(/@/)) {									Ext.getCmp('calSchedulesRightDV').store.add(record);								} else {									Ext.Msg.alert('Contacts', "Contacts can't be added to check schedules.");									return;								}							}						}					}				}			}		}		/*		if (chBoxes.length > 0) {			var srcDs = this.dvContacts.store;			var tarDs, attendees = [];			// Called from Schedule?			if (this.schedule) {				tarDs = Ext.getCmp('calSchedulesUsersDV').store;			} else {				tarDs = Ext.getCmp(this.section + 'dvCalendarMeetingAttendees').store;			}			for (var i=0; i < chBoxes.length; ++i) {				if (chBoxes[i].checked) {					var rec = srcDs.getById(chBoxes[i].id);					if (tarDs.find('attendee', rec.get('contactEmail')) == -1) {						var data	= Ext.data.Record.create([ 'id', 'attendee', 'status', 'statusId', 'attendeeId', 'attendeeType']);						var record	= new data({							id				: rec.id							,attendee		: rec.get('contactEmail')							,status			: 'No response given'							,statusId		: '0'							,attendeeId 	: 'F_0'							,attendeeType	: 'external'						});						record.id = rec.id;						tarDs.add(record);						if (this.schedule) {							if (! rec.get('contactEmail').match(/@/)) {								Ext.getCmp('calSchedulesRightDV').store.add(record);							} else {								Ext.Msg.alert('Contacts', "Contacts can't be added to check schedules.");								return;							}						}					}				}			}						}					this.fire('calendar_schedules_update_resizer');		*/		this.dialog.hide();	}	,augment : function(callee)	{		var obj = callee.params;		obj.groupId = this.groupId;		if (this.folderId) {			obj.folderId = this.folderId;			delete this.folderId;		}		return callee;	}	,controller : function(data)	{		// We don't want to prompt user for this dialog on hide.		this.noPromptNeeded = true;		this.ft				= true;		// Called from Schedules Dialog		if (data.schedule) {			this.schedule = true;		}		this.panels[0].reset();		this.dialog.show();		// Load form		this.cboPersonalGroup.fireEvent('select', this.cboPersonalGroup);	}	,execute : function(callee, type, data)	{		switch(type) {			case ('calendar_contact_participants_dlg'):				this.controller(data);				break;		}	}	,loadSuccess : function(res)	{		this.cboPersonalGroup.loadPrevent = true;		if (this.ft === false) {			this.cboCategories.loadPrevent = false;		}		if (this.calledByCboPG) {			this.cboCategories.fireEvent('select', this.cboCategories);			this.calledByCboPG = false;		}		this.cboPersonalGroup.setValue(this.groupId);	}	,submitSuccess : function(resp, action)	{		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {			var store = this.dvContacts.store;			store.removeAll();			store.add( store.reader.readRecords(xml).records );		}	}});// * * * * * * * * * * * * * * * * * * * *// 	Schedules// * * * * * * * * * * * * * * * * * * * *Eve.lib.Calendar.Schedules = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,root	: 'group'	,eventElements : []	,init : function(data)	{		Eve.lib.Calendar.Schedules.superclass.init.call(this, data);		var tab		= {			items	: ["Check Schedules"]		}		var dialog	= {			width 	: 760			,height : 390			,title	: 'Check Schedules'		}		this.createDialog({tab: tab ,dialog: dialog});		this.dvLeft	 = Ext.getCmp('calSchedulesUsersDV');		this.dvRight = Ext.getCmp('calSchedulesRightDV');		this.reader	 = new Ext.data.XmlReader({			record	: 'event'			,id		: 'id'		}, ['startDate', 'endDate', 'showAsBusy'])				// Register handlers		this.registerViews();	}	// Attaches handler to form items	,registerViews : function()	{		this.dvRight.on('render', function() {			var parent = this.dvRight.getEl().parent();			parent.applyStyles({'overflow': 'auto'});			parent.on('scroll', function(e) {				var target = e.getTarget();								Ext.fly('calSchedulesUsersDV').dom.scrollTop = target.scrollTop;				Ext.fly('calSchedulesLeftHeaderContainer').dom.scrollLeft = target.scrollLeft;				var rz = Ext.get('calScheduleResizeCt');				if (rz) {					rz.setTop( target.scrollTop );				}			})		}, this);		// Attach a handler for StartTime		Ext.getCmp('calSchedulesStartTime').on('render', function() {				this.on('select', function(c) {				var resizer	= Ext.get('calScheduleResizeCt');				var start	= c.getValue();				var end		= Ext.getCmp('calSchedulesEndTime').getValue();				var dt = new Date();				dt			= Date.parseDate(start, Eve.Preference.get('timeFormat')/*'g:i A'*/);				var left	= (dt.getHours() * 60) + dt.getMinutes();				dt			= Date.parseDate(end, Eve.Preference.get('timeFormat')/*'g:i A'*/);				var width	= (dt.getHours() * 60) + dt.getMinutes();				if (resizer) {					resizer.setLeft(left);					resizer.setWidth(width - left);				}			})					});				// Attach a handler for EndTime		Ext.getCmp('calSchedulesEndTime').on('render', function() {			this.on('select', function(c) {				var resizer	= Ext.get('calScheduleResizeCt');				var start	= Ext.getCmp('calSchedulesStartTime').getValue();				var end		= c.getValue();				var dt = new Date();				dt			= Date.parseDate(start, Eve.Preference.get('timeFormat')/*'g:i A'*/);				var left	= (dt.getHours() * 60) + dt.getMinutes();				dt			= Date.parseDate(end, Eve.Preference.get('timeFormat')/*'g:i A'*/);				var width	= (dt.getHours() * 60) + dt.getMinutes();				if (resizer) {					resizer.setWidth(width - left);				}			})		});		// Attach a handler for Date Selector		Ext.getCmp('calSchedulesDateSelector').on('render', function(c) {			c.on('select', function(c) {				this.bySelector = true;				this.currentDate = c.getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/);				this.loadForm(0);				this.resetAll();			}, this)					}, this);		// Attach a handler for 'Add' button		Ext.getCmp('btnCalScheduleAdd').on('click', function() {			var dvAttendees	= this.dvLeft;			var cboAttendee = Ext.getCmp('calSchedulesAttendeesCbo');			var values		= cboAttendee.getValue();			var store		= Eve.registery.allContacts;			var attendees	= [];			values			= values.split(',');			// First remove filter			store.clearFilter();			for (var i = 0; i < values.length; ++i) {				var val	= values[i].trim();				if (val == '') {					continue;				}				var idx = store.findBy(function(rec, id) {					if (rec.get('email') == val) {						return true;					}				});				// Check for external emails validation				if (idx == "-1") {					if (! Ext.form.VTypes.email( val )) {						cboAttendee.markInvalid();						return;					}				}				// Already added?				if (dvAttendees.store.find('attendee', val) != "-1") {					Ext.Msg.alert('', '"' + val + '" Already has been added!');					cboAttendee.markInvalid();					return;				}								attendees.push(val);			}			this.sendRequest( attendees.join(',') );					}, this);		// Attach Event Handler for 'All Day' CheckBox		Ext.getCmp('calSchedulesAllDay').on('check', function(cmp, checked, ft) {			var startTime	= Ext.getCmp('calSchedulesStartTime');			var endTime		= Ext.getCmp('calSchedulesEndTime');						if (checked) {				startTime.setValue( '12:00 AM' );				endTime.setValue( '11:59 PM' );				startTime.disable();				endTime.disable();							} else {				if (! ft) {					startTime.setValue( '9:00 AM' );					endTime.setValue( '9:30 AM' );					startTime.enable();					endTime.enable();				}			}						startTime.fireEvent('select', startTime);			endTime.fireEvent('select', endTime);			// Tricky one ;)			if (checked) {				endTime.setValue( '12:00 AM' );			}			Ext.getCmp('calendarchkCalendarDetailAllDay').setValue( cmp.getValue() );		});	}	,setResizer : function()	{		if (this.resizer) {			console.log('Resizer deleted')			this.resizer.getEl().remove();			delete this.resizer;		}				// Create the selector's element		var ct	= Ext.fly('calSchedulesRightDV').parent();		var div = Ext.DomHelper.append(ct, {			tag		: 'div'			,id		: 'calScheduleResizeCt'			,html	: '&nbsp;'		}, true)		// Append the selector to DataView		this.resizer = new Ext.Resizable(div, {			handles		: 'w e'			,minWidth	: 30			,maxWidth	: 1440			,pinned		: true		});		// Attach Even Handler for Selector		this.resizer.on("resize", function(rz, width, height, e) {			var w = Math.ceil((width-7.5) / 15) * 15;			var l = Math.ceil((rz.el.getLeft(true)-7.5) / 15) * 15;			var r = Math.ceil((rz.el.getRight(true)-7.5) / 15) * 15;			if (l < 1) {				l = 1;			}			rz.el.setWidth(w);			rz.el.setLeft(l);			// Update StartTime & EndTime			var startHour	= Math.floor(l / 60);			var startMin	= l % 60;			if (startMin < 10) {				startMin = ['0', startMin].join('');			}			var endHour	= Math.floor(r / 60);			var endMin	= r % 60;			if (endMin < 10) {				endMin = ['0', endMin].join('');			}			var start	= [startHour, startMin].join(':');			var end		= [endHour, endMin].join(':');			var dt = new Date();			dt = Date.parseDate(start, 'G:i');			Ext.getCmp('calSchedulesStartTime').setValue(dt);			dt = Date.parseDate(end, 'G:i');			Ext.getCmp('calSchedulesEndTime').setValue(dt);		})		// Sync Height		this.syncResizerHeight();	}	,syncResizerHeight: function()	{		// Update the height of Resizer		var resizer	= Ext.get('calScheduleResizeCt');		var table	= Ext.get('calSchedulesRightTable');		if (! table) {			resizer.setHeight(0);			return;		}		var tHeight = table.getHeight();		var pHeight	= table.parent().getHeight();		if (tHeight < pHeight) {			resizer.setHeight(tHeight);		} else {			resizer.setHeight(pHeight);		}	}	,sendRequest : function(attendees)	{		if (!attendees || attendees.trim() == "") {			return;		}		Ext.Ajax.request({			url		: Eve.url			,params	: {				event				: 'modern.calendar.group.checkSchedules'				,groupId			: this.groupId				,meetingAttendees	: attendees				,currentDate		: this.currentDate			}			,success: function(res) {				Ext.getCmp('calSchedulesAttendeesCbo').setValue('');				this.fillDataViews(res.responseXML);				this.syncResizerHeight();			}			,scope	: this		})	}	,fillDataViews : function(xml)	{		var dq = Ext.DomQuery;				// Load DataViews		var records = this.dvLeft.store.reader.readRecords(xml).records;		this.dvLeft.store.add(records);		this.dvRight.store.add(records);		for (var i = 0; i < records.length; ++i) {			var record = records[i];						record.data.status	 = 'No response given';			record.data.statusId = 'statusId';			var eventsNode		= dq.selectNode('events', record.node);			record.data.events = this.reader.readRecords(eventsNode).records;			this.drawEvent(record);		}	}	,toPixels : function(date, format)	{		format = format || [Eve.Preference.get('dateFormat'), ' ', Eve.Preference.get('timeFormat')].join('')/*'n/j/y g:i A'*/;		var dt = new Date();		dt		= Date.parseDate(date, format);		var val	= (dt.getHours() * 60) + dt.getMinutes();		return val	}	,drawEvent : function(record)	{		var store	= this.dvRight.store;		var index	= store.indexOf(record);		var top		= index * 21;		for (var i = 0; i < record.data.events.length; ++i) {			var events	= record.data.events[i];			var left	= this.toPixels( events.get('startDate') );			var width	= this.toPixels( events.get('endDate') ) - left;			var cls;			switch (events.get('showAsBusy')) {				case '0': // Busy					cls = 'calScheduleEventBusy';					break;				case '1': // No Information					cls = 'calScheduleEventNoInfo';					break;				case '2': // Tentative					cls = 'calScheduleEventTentative';					break;				case '3': // Out Of Office					cls = 'calScheduleEventOut';					break;			}			var event = Ext.DomHelper.append(this.dvRight.getEl().parent(), {				tag		: 'div'				,cls	: 'calScheduleEvents ' + cls			}, true);			event.applyStyles({				'position'			: 'absolute'				,'top'				: top + 'px'				,'left'				: left + 'px'				,'width'			: (width == 0) ? '1px' : width + 'px'			})			// Push it to repo for garbage collector			this.eventElements.push({				index		: index				,el			: event			});		}	}	,onDialogHide : function()	{		this.resetAll();		// Reset all Flags.		this.clearLoaded();	}	,resetAll : function()	{		// Reset DataView's Store		this.dvLeft.store.removeAll();		this.dvRight.store.removeAll();		// Remove all created Events from DOM		for (var i = 0; i < this.eventElements.length; ++i) {			this.eventElements[i].el.remove();		}	}	,deleteItem : function(idx)	{		if (this.dvLeft.store.getCount() < 2) {			Ext.Msg.alert('', "You should have at least one attendee.");			return;		}		this.dvLeft.store.removeAt(idx);		this.dvRight.store.removeAt(idx);		this.dvLeft.refresh();		this.dvRight.refresh();		for (var i = 0; i < this.eventElements.length; ++i) {			if (idx == this.eventElements[i].index) {				this.eventElements[i].el.remove();			}		}		this.syncResizerHeight();	}	,augment : function(callee)	{		var obj = callee.params;		obj.groupId		= this.groupId;		obj.currentDate = this.currentDate;		if (this.bySelector) {			var dv = this.dvLeft;		} else {			var dv = Ext.getCmp('calendardvCalendarMeetingAttendees');		}				var ma = [];		dv.store.each( function(rec) {			ma.push(rec.get('attendee'));		})		obj.meetingAttendees = ma.join(',');		return callee;	}	,controller : function(data)	{		// We don't want to prompt user for this dialog on hide.		this.noPromptNeeded = true;		this.currentDate	= Ext.getCmp('calendardetailStartDate').getValue().format(Eve.Preference.get('dateFormat')/*'n/j/y'*/);		var store			= Ext.getCmp('calendardvCalendarMeetingAttendees').store;		if (store.getCount() < 1) {			Ext.Msg.alert('', "You should have at least on attendee.");			return;		}		// Reset Search Field		Ext.getCmp('calSchedulesAttendeesCbo').reset();		this.dialog.show();		this.loadForm(0);	}	,execute : function(callee, type, data)	{		switch(type) {			case ('calendar_schedules_dlg'):				this.controller(data);				break;			case ('calendar_schedules_delete'):				this.deleteItem(data.index - 1);				break;			case ('calendar_schedules_load_attendees'):				this.sendRequest(data.attendees);				break;			case ('calendar_schedules_update_resizer'):				this.syncResizerHeight();				break;		}	}	,loadSuccess : function(res)	{		var xml = res.responseXML;		// Set Start & End Dates		var startDate	= Ext.getCmp('calSchedulesStartDate');		var startTime	= Ext.getCmp('calSchedulesStartTime');		var endDate		= Ext.getCmp('calSchedulesEndDate');		var endTime		= Ext.getCmp('calSchedulesEndTime');		var dtSelector	= Ext.getCmp('calSchedulesDateSelector');		var chkAllDay	= Ext.getCmp('calSchedulesAllDay');					if (this.bySelector) {			delete this.bySelector;			startDate.setValue( dtSelector.getValue() );		} else {			startDate.setValue( Ext.getCmp('calendardetailStartDate').getValue() );			startTime.setValue( Ext.getCmp('calendarmeetingStartTime').getValue() );			endDate.setValue( Ext.getCmp('calendarmeetingEndDate').getValue() );			endTime.setValue( Ext.getCmp('calendarmeetingEndTime').getValue() );			dtSelector.setValue( startDate.getValue() );			chkAllDay.setValue( Ext.getCmp('calendarchkCalendarDetailAllDay').getValue() );						// Set view on 9:00 AM			this.dvRight.el.parent().scrollTo.defer(100, this.dvRight.el.parent(), ['left', 540]);		}		this.fillDataViews(xml);				this.setResizer();		// FireEvent makes selector to sync itself		// !important: It should be called after setResizer() called		startTime.fireEvent('select', startTime);		endTime.fireEvent('select', endTime);		chkAllDay.fireEvent('check', chkAllDay, chkAllDay.getValue(), true);	}	,submitSuccess : function(resp, action)	{		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var code = dq.selectValue("code", xml);		if (code == '0') {					}	}	,submitForm : function(id, close, changeTo)	{		var startDate	= Ext.getCmp('calSchedulesStartDate').getValue();		var endDate		= Ext.getCmp('calSchedulesEndDate').getValue();		var startTime	= Ext.getCmp('calSchedulesStartTime').getValue();		var endTime		= Ext.getCmp('calSchedulesEndTime').getValue();		// Detail		Ext.getCmp('calendardetailStartDate').setValue( startDate );		Ext.getCmp('calendardetailEndDate').setValue( endDate );		Ext.getCmp('calendardetailStartTime').setValue( startTime );		Ext.getCmp('calendardetailEndTime').setValue( endTime );		// Meeting		Ext.getCmp('calendarmeetingStartDate').setValue( startDate );		Ext.getCmp('calendarmeetingEndDate').setValue( endDate );		Ext.getCmp('calendarmeetingStartTime').setValue( startTime );		Ext.getCmp('calendarmeetingEndTime').setValue( endTime );		// Meeting DataView		var dv = Ext.getCmp('calendardvCalendarMeetingAttendees');		dv.store.removeAll();		this.dvLeft.store.each( function(record) {			console.log(record)			dv.store.add(record);		})		this.dialog.hide();	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\javascript/Library/EntryPoint.js *//*--------------------------------------------------*//** * Hyperoffice Links section based on ExtJS Library 2.1 May 2008 *  * khashayar@hyperoffice.com *  * http://www.hyperoffice.com */Eve.CreateDefaults = function(brdg) {	var data = {		superbridge	: brdg		,section	: null	}		// Interlinking Existing Dialogs	var linkExistingItemDlg	= new Eve.lib.Interlink.LinkExistingItemDialogBridge();		brdg.addBridge(linkExistingItemDlg);	linkExistingItemDlg.addPanel(new Eve.vc.ilLinkExistingItem());	linkExistingItemDlg.init(data);			// Interlinking New Dialogs	var linkNewItemDlg = new Eve.lib.Interlink.LinkNewItemDialogBridge();		brdg.addBridge(linkNewItemDlg);	linkNewItemDlg.addPanel(new Eve.vc.ilLinkNewItem());	linkNewItemDlg.init(data);			// Comment	var commentDlg = new Eve.lib.Comment.CommentDialogBridge();		brdg.addBridge(commentDlg);	commentDlg.addPanel(new Eve.vc.cmAddEdit());	commentDlg.init(data);		// Rest	var conn	= new Eve.lib.CRUDStore();	var bridge	= new Eve.lib.DefaultCRUD();	brdg.addBridge(bridge);	bridge.init({		superbridge	: brdg		,conn		: conn		,section	: null	});			var groupSelect = new Eve.GroupSelectBridge();		brdg.addBridge(groupSelect);	groupSelect.init({		superbridge	: brdg		,conn		: conn		,section	: null	});			var poReminder = new Eve.widgets.ReminderPopOut();		brdg.addBridge(poReminder);	poReminder.init(data);			var poInvitation = new Eve.widgets.InvitationPopOut();		brdg.addBridge(poInvitation);	poInvitation.init(data);			var poMeeting = new Eve.widgets.MeetingPopOut();		brdg.addBridge(poMeeting);	poMeeting.init(data);			//	Defaults	brdg.addBridge(Eve.Resource);	Eve.Resource.init(data);		brdg.addBridge(Eve.Interlink.Popup);	Eve.Interlink.Popup.init(data);			if (!Eve.DialogProxy) {		Eve.DialogProxy = new Eve.InterlinkProxy();				// Initialize the dialog proxy		brdg.addBridge( Eve.DialogProxy );		Eve.DialogProxy.init(data);	}};Ext.onReady( function() {	// Load the preferences then build the layout and the rest.	Eve.Preference.load({ success: function() {    /*             		var LandingPage = Eve.Preference.get("landingPage");		this.showLandingPage = false; 				var func = function(options, success, response){			var dq = Ext.DomQuery;			var reminderCount, invitCount, meetingCount;			var xml = response.responseXML;						reminderCount	= dq.selectValue('remindersCount', xml);			invitCount				= dq.selectValue('invitationsCount', xml);			meetingCount 	= dq.selectValue('meetingsCount', xml);			var obj = {				reminderCount : reminderCount				,invitCount: invitCount				,meetingCount:meetingCount			};						var functor = function() {			    if ( Eve.Resource.superbridge && Eve.Resource.superbridge.broadcast ) {									Eve.Resource.superbridge.broadcast( this, 'set_popOut_counts', obj );										if ( !this.showLandingPage) {						var currentSec = Eve.SectionManager.mapTo( LandingPage, true );						if ( currentSec.match( /shared\w/ )) {							currentSec = currentSec.replace( /shared/, "shared$" );						}												this.showLandingPage = true;						var groupId = Eve.Preference.get('landingGroupId');						var root	= (groupId == '0') ? 'personal' : 'group';												Eve.Resource.superbridge.broadcast( this, 'change_section', {							currentSec	: currentSec.toLowerCase()							,section	: Eve.SectionManager.mapTo( currentSec )							,forceLoad	: true							,info		: {								id			: 0								,groupId	: Eve.Preference.get('landingGroupId')								,groupPath	: Eve.Preference.get('landingGroupPath')								,root		: root							}						});					}				} else {					setTimeout( functor, 100 );			    }			};						functor();		};		Eve.TaskRunner.createTask( 'RefreshInterval', {			run: function(){				Ext.Ajax.request( {					url: Eve.url					,params: { event: 'modern.global.personal.backgroundCount' }					,callback : func				} );			}			,interval: Eve.Preference.getInteger('DesktopRefreshInterval' ) * 1000		} );		*///---------------------------------------------------------		var superbridge = Eve.Resource.superbridge = new Eve.lib.SuperBridge();		Eve.SectionManager = new Eve.lib.SectionManager();		Eve.SectionManager.init();				Eve.LayoutManager = new Eve.lib.LayoutManager();		superbridge.addBridge( Eve.LayoutManager );		Eve.LayoutManager.init( {superbridge: superbridge} );		Eve.MainLayout = new Eve.lib.MainLayout();				Eve.CreateDefaults( superbridge );						// I've no idea, what the hell are these?		Eve.DragDrop.unify( Ext.grid.GridDragZone, 'grid' );		Eve.DragDrop.unify( Ext.tree.TreeDragZone, 'tree' );				var LandingPage = Eve.Preference.get("landingPage");		LandingPage = (LandingPage == 'Search') ? 'Desktop' : LandingPage;				//var LandingGroupId = Eve.Preference.get("landingGroupId");		//var LandingGroupPath = ( Eve.Preference.get("landingGroupPath") == '\\')? '\\\\': Eve.Preference.get("landingGroupPath");		// REQUIRED < FUNNY		Eve.activeSec = Eve.SectionManager.getSectionId( LandingPage );		//Render Sections		var lookUp = [ 'Mail','MyCalendar','MyDocuments','MyContacts','MyTasks'];		var pbar = Ext.getCmp('progress-bar')		 for(var i=0; i<lookUp.length; i++){			(function() {				var lu = lookUp[i];				var lp = LandingPage;				var sp = superbridge;				var me = this;				setTimeout(function() {				//console.log("@@Benchmark -- Time(prerendering): ",(new Date()).getRTime() % 100000);				if( lu == "MyTasks" && lu == lp){										pbar.updateProgress(0.90, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');					if(lp != 'Desktop')						Eve.done = true;					pbar.updateProgress(0.95, 'Preparing for lift off...');										sp.broadcast(me, 'load_section', {						sectionName : lp					});				}				else if(lu != lp){										switch(lu){						case 'Mail':							pbar.updateProgress(0.40, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');							break;						case 'MyCalendar':							pbar.updateProgress(0.60, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');							break;						case 'MyDocuments':							pbar.updateProgress(0.70, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');							break;						case 'MyContacts':							pbar.updateProgress(0.80, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');							break;						case 'MyTasks':							pbar.updateProgress(0.90, 'Initializing '+ Eve.SectionManager.getSectionId(lu ) + ' section...');							break;					}					Eve.SectionManager.load( lu );					Ext.getCmp('MainCardLayout').getLayout().setActiveItem( Eve.SectionManager.getSectionId(lu ) );					if (lu == 'MyTasks' ) {						if(lp != 'Desktop')							Eve.done = true;					pbar.updateProgress(0.95, 'Preparing for lift off...');					sp.broadcast(me, 'load_section', {						sectionName : lp					});					}				}				},(i+1)*300);			})()		}		  } } );} );/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\admin/AdminDialogControl.js *//*--------------------------------------------------*//** * AdminDialogControl.js * Hyperoffice Settings section based on ExtJS Library 2.2 December 2009 *  * syavash@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Admin.UserDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,root	: 'user'	,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.UserDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 border	: false			,panel	: true		}						var output = this.createDialog({tab: tab ,dialog: dialog})		this.usersPanel = output;				this.registerViews();							}	,registerViews : function()	{		Ext.getCmp('AdminbtnContactUpload').on('click', function(btnUpload) {			var that = this;						var fp = new Eve.UploadFormPanel({				fileUpload	: true				,frame		: true				,autoHeight	: true				,bodyStyle	: 'padding: 10px 10px 0 10px;'				,labelWidth	: 50				,defaults	: {					anchor		: '95%'					,msgTarget	: 'side'				}				,items		: [{					 xtype		: 'fileuploadfield'					,emptyText	: 'Select an image'					,fieldLabel	: 'Photo'					,name		: 'upload_file'					,buttonCfg	: {						text		: ''						,iconCls	: 'eve-upload-icon'					}				}]				,buttons	: [{					text		: 'Save'     				,handler	: function(){						if (fp.getForm().isValid()) {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Uploading photo...'								,params	: {									event	: 'modern.administrator.user.savePicture'									,userId : that.id									,groupId: that.groupId									,m_shariat_m: true								}								,success: function(fp, o) {									var val = Ext.DomQuery.selectValue('imageUrl', o.response.responseXML)									if (val !== undefined) {										if (!val || val.trim() == '' ) {											Ext.Msg.alert("Error", "There's an error while uploading image!");											val = Eve.Resource.getIcon('item-icon','contact');										}																				Ext.get('AdminUserImage').set({src: val});										that.winImage.hide();									}									else{	 									var text = o.response.responseText;										Ext.Msg.alert('Error', text);									}								}							});						}					}				}, {					text	: 'Reset'					,handler: function() {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Removing photo...'								,params	: {									event	: 'modern.administrator.user.resetPicture'									,userId		: that.id									,groupId: that.groupId								}								,success: function() {									fp.getForm().reset();									Ext.get('AdminUserImage').set({src: Eve.Resource.getIcon('item-icon','contact')});									that.winImage.hide();								}							});					}				}]			});						that.winImage = new Ext.Window({				layout		: 'form'				,width		: 400				,title		: 'Image Upload'				,resizable	: false				,modal		: true				,items		: [fp]			});						that.winImage.show(btnUpload);					}, this);		//handler on dblClicking the user membership		Ext.getCmp('groups_dv').on('dblclick', function(dv, index, node, e){			var groupId = dv.getRecord(node).get('id');			this.fire('admin_users_edit_group_membership', {groupId: groupId, userId: Eve.Admin.selectedUser.id});		}, this)					}	,failureCallback: function()	{		Ext.getCmp('adminUserMainCard').getLayout().setActiveItem(0);		this.mask.hide();	}	,deleteForm : function(id)	{		var id = id || this.id;		Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this user?',			function(btn) {				if (btn == 'yes') {					this.fire('admin_delete_user', {info: {id: id}}, true);				}		}, this);	}		,afterAddButtons: function(buttons, scope){		var btn = [];		var that = this;		btnAssign = {				text	: 'Add user to group'				,tag	: 'addusertogroup'				,handler: function() {					that.fire('admin_user_assign_to_group', {userId: that.id, username: that.username});				}			}				buttons[0].hidden = false;		btn.push(buttons[0]);		btn.push(buttons[2]);		btn.push(btnAssign);		return btn;	}		,augment : function( callee )	{		var obj = callee.params;		obj.id = this.id;				if (this.mode == 'edit')			obj.userId = this.id;		obj.findBy = 'userId';		return callee;	}		,controller	: function(obj)	{		this.id 		= obj.info.id;		Eve.Admin.selectedUser = {};		Eve.Admin.selectedUser.id = this.id;		// We can also write this as a function for all of the panels		this.noPromptNeeded = true;							}	,loadSuccess : function (res)	{		Eve.Admin.selectedUser.fullName = Ext.DomQuery.selectValue('userDetails>firstName', res.responseXML) + ' ' + Ext.DomQuery.selectValue('userDetails>lastName', res.responseXML);		Ext.get('userDetailsHeader').update(Eve.Admin.Templates.getContactDialogTop().apply({fullname: Eve.Admin.selectedUser.fullName, username: Ext.DomQuery.selectValue('userDetails>userName', res.responseXML), createdDate: Ext.DomQuery.selectValue('userDetails>accountCreated', res.responseXML)}));		this.username = Ext.DomQuery.selectValue('userDetails>userName', res.responseXML);				var imagePath = Ext.DomQuery.selectValue('userDomain>imagePath', res.responseXML);				if (imagePath == '[NoImage]')			Ext.get('AdminUserImage').set({src: Eve.Resource.getIcon('item-icon','contact')});		else			Ext.get('AdminUserImage').set({src: imagePath});				if (this.username == "postmaster")		{			Ext.getCmp('adminTopLevel').show();			Ext.getCmp('adminReportToPanel').hide();		}		else		{			Ext.getCmp('adminTopLevel').hide();			Ext.getCmp('adminReportToPanel').show();		}	}	,handleUsersResponse: function( r, args ) {		var comboConf = {				triggerAction	: 'all'				,selectOnFocus	: true				,typeAhead      : true				,forceSelection : true				,minChars      	: 1				,mode           : 'local'				,loadPrevent: true							};		Ext.apply(Ext.getCmp('timeZones'), comboConf);		Ext.getCmp('timeZones').store.add( Ext.getCmp('timeZones').store.reader.readRecords(Ext.DomQuery.select('timeZones', r.responseXML)).records );		Ext.apply(Ext.getCmp('reportTo'), comboConf);		var rec = Ext.data.Record.create(['username', 'id']);		newRec = new rec({username: '[No Direct Report]', id: 0});		Ext.getCmp('reportTo').store.add(newRec);		Ext.getCmp('reportTo').store.add( Ext.getCmp('reportTo').store.reader.readRecords(Ext.DomQuery.select('admins', r.responseXML)).records );						Ext.apply(Ext.getCmp('userProfiles'), comboConf);		Ext.getCmp('userProfiles').store.add( Ext.getCmp('userProfiles').store.reader.readRecords(Ext.DomQuery.select('profileSearchResult', r.responseXML)).records );		Ext.apply(Ext.getCmp('userCalendars'), comboConf);		Ext.getCmp('userCalendars').store.add( Ext.getCmp('userCalendars').store.reader.readRecords(Ext.DomQuery.select('userCalendars', r.responseXML)).records );		Ext.apply(Ext.getCmp('userLocales'), comboConf);		Ext.getCmp('userLocales').store.add( Ext.getCmp('userLocales').store.reader.readRecords(Ext.DomQuery.select('locales', r.responseXML)).records );		Ext.apply(Ext.getCmp('userAccountLevel'), comboConf);		var levelStore = Ext.getCmp('userAccountLevel').store;		var userLevel = Eve.Preference.get('accountLevel');		var rec = Ext.data.Record.create(['id', 'text']);		levelStore.add(new rec({id: 1, text: 'Basic account'}));		if (userLevel == 2)			levelStore.add(new rec({id: 2, text: 'Group Creator'}));		if (userLevel >= 155)			levelStore.add(new rec({id: 155, text: 'Level 1 Administrator'}));		if (userLevel >= 145)			levelStore.add(new rec({id: 145, text: 'Level 2 Administrator'}));		if (userLevel >= 140)			levelStore.add(new rec({id: 140, text: 'Level 3 Administrator'}));		if (userLevel >= 255)			levelStore.add(new rec({id: 255, text: 'Level 4 Administrator (255)'}));		//Eve.mask.hide();	}	,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}		,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_edit_user_dlg'):				// Show the panel				var card = Ext.getCmp('adminUserMainCard');				card.getLayout().setActiveItem(1);				card.doLayout();				this.panels[0].reset();				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;							case ('admin_create_user_dlg'):				this.mode = 'create';				this.controller(data);				break;										case 'admin_user_load_constants':		        var request = Ext.Ajax.request({		                 url		: Eve.url						,params  	: {event: 'modern.administrator.user.loadConstants'}						,success	: this.handleUsersResponse						,failure	: this.handleFailure		                ,scope	: this						});			        break;			case 'admin_delete_user':				Ext.Ajax.request({					   url		: Eve.url					   ,success	: function(resp, options) {							var xml 		= resp.responseXML;							this.fire('admin_delete_user_success', {nodeId: data.info.id});						}					   ,params	: {event: 'modern.administrator.user.deleteUser', userId: data.info.id}					   ,scope	: this					});									break;							case 'admin_users_login_as_user':				var url = 'index.cfm?CFID=' + Eve.CFId + '&CFTOKEN=' + Eve.CFToken + '&event=security.loginAsUser&userId=' + data.userId;				window.open(url, 'login_as_user', 'width=800,height=600,scrollbars=yes,resizable=yes,titlebar=no,menubar=no,toolbar=no');				break;		}			}		,submitSuccess : function( resp, action )	{ 	}});Eve.lib.Admin.UserGroupPermissionsBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.UserGroupPermissionsBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 title	: 'Manage group membership'			,border	: false			,height: 580			,width: 700		}						this.createDialog({tab: tab ,dialog: dialog})	}		,afterAddButtons: function(buttons, scope){		var btn = [];		btn.push(buttons[1]);		btn.push(buttons[3]);		return btn;	}			,augment : function( callee )	{		var obj = callee.params;				if (this.mode == 'edit') {			obj.id = this.groupId;			obj.groupId = this.groupId;			obj.userId	= this.userId;			obj.findBy = 'userId';		}				return callee;	}		,controller	: function(obj)	{		this.groupId	= obj.groupId;		this.userId		= obj.userId;		Eve.Admin.UserGroupPermission.groupId = this.groupId;		this.dialog.show();					}	,loadSuccess : function (res)	{		Eve.Admin.UserGroupPermission.groupTitle = Ext.DomQuery.selectValue('group>title', res.responseXML);		// ComboBox		var cmp = Ext.getCmp('adminUserPermissionFolders');		cmp.setValue('');		cmp.store.each(function(rec){			rec.set('text',rec.get('text').replace('/groups/g' + Eve.Admin.UserGroupPermission.groupId, Eve.Admin.UserGroupPermission.groupTitle));		}, this);				var imagePath = Ext.DomQuery.selectValue('userDomain>imagePath', res.responseXML);				if (imagePath == '[NoImage]')			Ext.get('AdminPermissionUserImage').set({src: Eve.Resource.getIcon('item-icon','contact')});		else			Ext.get('AdminPermissionUserImage').set({src: imagePath});				Ext.get('adminUserGroupPermissionHeader').update(Eve.Admin.Templates.getUserPermissionTop().apply({lastname: Ext.DomQuery.selectValue('userDomain>lastName', res.responseXML), firstname: Ext.DomQuery.selectValue('userDomain>firstName', res.responseXML), group: Ext.DomQuery.selectValue('group>title', res.responseXML)}));						// Dataview		var dv = Ext.getCmp('dvAdminUserEditPermissions');		dv.store.each(function(rec){			rec.set('text', rec.get('path').replace('/groups/g' + Eve.Admin.UserGroupPermission.groupId, Eve.Admin.UserGroupPermission.groupTitle));		}, this);				dv.view.refresh();	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_users_edit_group_membership'):				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;			case ('admin_users_delete_group_membership_user'):				Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this group from user\'s groups?',						function(btn) {							if (btn == 'yes') {								this.userId = data.userId;								Ext.Ajax.request({									   url		: Eve.url									   ,success	: function(resp, options) {											var xml 		= resp.responseXML;											this.fire('admin_edit_user_dlg', {info: {id: this.userId}});										}									   ,params	: {event: 'modern.administrator.group.deleteUser', userId: data.userId, groupId: data.groupId, findBy: 'userId'}									   ,scope	: this									});												}					}, this);					break;			case ('admin_users_delete_group_membership_group'):				Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this group from user\'s groups?',						function(btn) {							if (btn == 'yes') {								this.userId = data.userId;								Ext.Ajax.request({									   url		: Eve.url									   ,success	: function(resp, options) {											var xml 		= resp.responseXML;											this.fire('admin_edit_group_dlg', {info: {id: Eve.Admin.selectedGroup}});																			}									   ,params	: {event: 'modern.administrator.group.deleteUser', userId: data.userId, groupId: data.groupId, findBy: 'userId'}									   ,scope	: this									});																																					}					}, this);												break;		}			}		,submitSuccess : function( resp, action )	{ 	}});Eve.lib.Admin.UserCreateBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.UserCreateBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 title	: 'Create user'			,border	: false			,height: 450			,width: 500		}						this.createDialog({tab: tab ,dialog: dialog})		this.registerView();	}	,registerView : function()	{		var that = this;		Ext.getCmp('adminCreateUserAddEmail').on('click', function() {			var url = [Eve.url, "?event=mailTemplate.edit", "&CFID=", Eve.CFId, "&CFTOKEN=", Eve.CFToken].join('');			var win = new Ext.Window({				title			: 'Email Notification'				,width			: 800				,height			: 500				,layout			: 'fit'				,constrainHeader: true				,maximizable	: true				,items			: [ new Ext.ux.IFrameComponent({url: url}) ]				,buttons		: [{					text	: 'Close'					,handler: function() {						win.hide();					}				}]				,listeners		: {					hide	: function() {						var panel	= that.panels[0].get();						var values	= panel.getForm().getValues();						that.loadForm(0);						panel.getForm().setValues(values);					}					,scope	: this				}			})			win.show(this.getEl());		});	}	,afterAddButtons: function(buttons, scope){		var btn = [];		btn.push(buttons[1]);		btn.push(buttons[3]);		return btn;	}				,augment : function( callee )	{		var obj = callee.params;		if (this.mode == 'edit') {			obj.userId	= this.userId;		}				return callee;	}		,controller	: function(obj)	{		this.panels[0].reset();		this.dialog.show();					}	,loadSuccess : function (res)	{		Ext.getCmp('AdminUserCreateTimezone').setValue('US/Eastern');		Ext.getCmp('AdminUserCreateLocale').setValue('en_US');		try{			var record = new Ext.data.Record.create(['id', 'name']);			var cmp = Ext.getCmp('cmbNotificationEmail');			cmp.store.insert(0, new record({id: '0', name: 'Default Email template'}));			cmp.store.insert(1, new record({id: '-1', name: 'Do not send an Email'}));			Ext.getCmp('cmbNotificationEmail').setValue('0');		}		catch(e){}	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_user_create'):				this.mode = 'create';				this.controller(data);				this.loadForm(0);				break;			case ('admin_user_assign_to_group'):				break;		}			}		,submitSuccess : function( resp, action )	{		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var userId = dq.selectValue("userId", xml);				var username = dq.selectValue("username", xml);				this.panels[0].reset();				Ext.getCmp('adminUsersTree').getRootNode().appendChild(new Ext.tree.TreeNode({text: username, id: userId, cls: 'admin-tree-users-blue'}));			}});Eve.lib.Admin.AddUserToGroupBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.AddUserToGroupBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 title	: 'Add User to Group'			,border	: false			,height: 220			,width: 400		}						this.createDialog({tab: tab ,dialog: dialog})	}		,augment : function( callee )	{		var obj = callee.params;		if (this.mode == 'edit') {			obj.userId	= this.userId;		}				return callee;	}		,controller	: function(obj)	{		this.userId		= obj.userId;		this.username = obj.username;		this.dialog.show();					}	,afterAddButtons: function(buttons, scope){		var btn = [];		buttons[1].text = 'Add to group';		btn.push(buttons[1]);		btn.push(buttons[3]);		return btn;	}		,loadSuccess : function (res)	{				Ext.get('userAddToGroupHeader').update(Eve.Admin.Templates.getUserAddToGroupTop().apply({username: this.username, userid: this.userId}));		Ext.getCmp('addToGroupUserId').setValue(this.userId);		Ext.getCmp('addToGroupUserName').setValue(this.username);	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_user_assign_to_group'):				this.mode = 'edit';				this.controller(data);				this.loadForm(0);				break;		}			}		,submitSuccess : function( resp, action )	{ 		this.fire('admin_edit_user_dlg', {info: {id: this.userId}});	}});/** * Group */Eve.lib.Admin.GroupCreateBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.GroupCreateBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 title	: 'Create group'			,border	: false			,height: 470			,width: 650		}						this.createDialog({tab: tab ,dialog: dialog})	}	,afterAddButtons: function(buttons, scope){		var btn = [];		btn.push(buttons[1]);		btn.push(buttons[3]);		return btn;	}				,augment : function( callee )	{		var obj = callee.params;		if (this.mode == 'subgroup')		{			obj.isSubGroup = true;			obj.groupId = this.groupId;			obj.parentId = this.groupId;			obj.createSubGroup = 'true';		}		return callee;	}		,controller	: function(obj)	{				this.dialog.show();					}	,loadSuccess : function (res)	{	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_group_create'):				this.mode = 'create';				this.controller(data);				break;							case ('admin_group_add_subgroup'):				this.mode = 'subgroup';				this.groupId = data.groupId || data.info.id;				console.log(data);				this.controller(data);												break;		}			}		,submitSuccess : function( resp, action )	{		var dq	 = Ext.DomQuery;		var xml  = resp.responseXML;		var groupId = dq.selectValue("groupId", xml);				var title = dq.selectValue("title", xml);				this.panels[0].reset();							if (this.mode == 'subgroup')			Ext.getCmp('adminGroupsTree').getNodeById(this.groupId).appendChild(new Ext.tree.TreeNode({text: title, id: groupId, cls: 'admin-tree-groups'}));		else			Ext.getCmp('adminGroupsTree').getRootNode().appendChild(new Ext.tree.TreeNode({text: title, id: groupId, cls: 'admin-tree-groups'}));			}});Eve.lib.Admin.GroupDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,root		: 'group'    ,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.GroupDialogBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Properties', 'Manage Users', 'Default User Permissions']			,related: [ [0, 1, 2] ]			     	   			,main	: [0, 1, 2]			,border: false		}				var dialog	= {			 border	: false			,panel	: true		}				var output = this.createDialog({tab: tab ,dialog: dialog})		this.groupsPanel = output;				this.registerViews();					}	,deleteForm : function(id)	{		var id = id || this.groupId;				Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this user?',				function(btn) {					if (btn == 'yes') {						this.fire('admin_delete_group', {info: {id: id}}, true);					}			}, this);	}	,afterAddButtons: function(buttons, scope){		var btn = [];		buttons[0].hidden = false;		btn.push(buttons[0]);		btn.push(buttons[2]);				var that = this;		btnAddSubgroup = {				text	: 'Add Subgroup'				,tag	: 'addusubgroup'				,handler: function() {					that.fire('admin_group_add_subgroup', {groupId: that.groupId});				}			}						btn.push(btnAddSubgroup);				return btn;	}		,augment : function( callee )	{		callee.params.groupId = this.groupId;		callee.params.id = this.groupId;				return callee;	}	,failureCallback: function()	{		Ext.getCmp('adminGroupMainCard').getLayout().setActiveItem(0);		this.mask.hide();	}	,controller	: function(obj)	{		this.noPromptNeeded = true;		this.groupId = obj.info.id;		this.panels[0].reset();			}	,loadSuccess : function (res)	{		Ext.getCmp('adminDefaultUserPermissionFolders').setValue('');		var imagePath = Ext.DomQuery.selectValue('foldersPermissions>logoPath', res.responseXML);				if (imagePath == '[NoImage]')			Ext.get('adminGroupLogoImage').set({src: Eve.Resource.getIcon('no-logo','general') });		else			Ext.get('adminGroupLogoImage').set({src: imagePath });       var cmp = Ext.getCmp('adminDefaultUserPermissionFolders');	   cmp.setValue('')	   cmp.store.each(function(rec){		   try{				var groupId = Ext.getCmp('adminGroupsTree').getSelectionModel().getSelectedNode().attributes.id;				rec.set('text', rec.get('text').replace('/groups/g' + groupId, Ext.getCmp('adminGroupsTree').getSelectionModel().getSelectedNode().text));		   }catch(e){}	   });	}		,handleGroupsResponse: function( r, args ) {		Eve.mask.hide();	}		,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}		,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_edit_group_dlg'):				// Show the panel				var card = Ext.getCmp('adminGroupMainCard');				card.getLayout().setActiveItem(1);				card.doLayout();				Eve.Admin.selectedGroup = data.info.id;				this.panels[0].reset();				this.mode = 'edit';				this.controller(data);				this.loadForm(0);								break;							case ('admin_delete_group'):				Ext.Ajax.request({					url		: Eve.url					,success: function(resp, options) {						var xml 		= resp.responseXML;						this.fire('admin_delete_group_success', {nodeId: data.info.id});					}					,params	: {						event	: 'modern.administrator.group.delete'						,groupId		: data.info.id						,id				: data.info.id					}					,scope	: this				});								break;		}	}	,registerViews : function()	{		Ext.getCmp('adminGroupLogoUpload').on('click', function(btnUpload) {			var that = this;						var fp = new Eve.UploadFormPanel({				fileUpload	: true				,frame		: true				,autoHeight	: true				,bodyStyle	: 'padding: 10px 10px 0 10px;'				,labelWidth	: 50				,defaults	: {					anchor		: '95%'					,msgTarget	: 'side'				}				,items		: [{					 xtype		: 'fileuploadfield'					,emptyText	: 'Select an image'					,fieldLabel	: 'Photo'					,name		: 'upload_file'					,buttonCfg	: {						text		: ''						,iconCls	: 'eve-upload-icon'					}				}]				,buttons	: [{					text		: 'Save'     				,handler	: function(){						if (fp.getForm().isValid()) {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Uploading photo...'								,params	: {									event	: 'modern.administrator.group.saveLogo'									,userId : that.id									,groupId: that.groupId									,m_shariat_m: true								}								,success: function(fp, o) {									var val = Ext.DomQuery.selectValue('imageUrl', o.response.responseXML)									if (val !== undefined) {										if (!val || val.trim() == '' ) {											Ext.Msg.alert("Error", "There's an error while uploading image!");											val = Eve.Resource.getIcon('item-icon','contact');										}																				Ext.get('adminGroupLogoImage').set({ src: val });										that.winImage.hide();									}									else{	 									var text = o.response.responseText;										Ext.Msg.alert('Error', text);									}								}							});						}					}				}, {					text	: 'Reset'					,handler: function() {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Removing photo...'								,params	: {									event	: 'modern.administrator.group.removeLogo'									,userId		: that.id									,groupId: that.groupId								}								,success: function() {									fp.getForm().reset();									Ext.get('adminGroupLogoImage').set({src: Eve.Resource.getIcon('no-logo','general') });									that.winImage.hide();								}							});					}				}]			});						that.winImage = new Ext.Window({				layout		: 'form'				,width		: 400				,title		: 'Image Upload'				,resizable	: false				,modal		: true				,items		: [fp]			});						that.winImage.show(btnUpload);					}, this);				//Handle dblClick on group current membership		Ext.getCmp('dvAdminGroupUsers').on('dblClick', function(dv, index, node, e){			if (dv.store.getAt(index).get('owner') != 1 && dv.store.getAt(index).get('invited') == 'false')				this.fire('admin_users_edit_group_membership', {groupId: Eve.Admin.selectedGroup, userId: dv.store.getAt(index).get('id') }, true);					},this);			}			,submitSuccess : function( resp, action )	{ 	}});//* * * * * * * * * * * * * * * * * * * * //	Participants (Group Membership, Portal)//* * * * * * * * * * * * * * * * * * * * Eve.lib.Admin.InviteParticipantsBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'		,init : function(data)	{		Eve.lib.Admin.InviteParticipantsBridge.superclass.init.call(this, data);				var tab		= {			items	: ["Invite users"]		}				var dialog	= {			width 	: 400			,height : 300			,title	: 'Invite users'		}				var d = this.createDialog({tab: tab ,dialog: dialog});				d.on('render', function() {			var fn = function() {				Ext.get('adminCheckAllParticipants').on('click', function() {					var tbl = Ext.get('adminParticipantTable');					if (tbl) {						var els		= tbl.select('.admin-participant-checkbox');						var checked = this.dom.checked;												els.each(function (el) {							el.dom.checked = checked;						})					}				})			}						fn.defer(1000)		})	}		,onDialogHide : function()	{		Ext.get('adminCheckAllParticipants').dom.checked = false;	}		,afterAddButtons : function(buttons, scope)	{		return [{			text	: 'Done'			,handler: function() {				this.appendRecords();			}			,scope	: this		}]	}		,appendRecords : function()	{			var chBoxes  = Ext.query('.admin-participant-checkbox', 'adminParticipantTable');		if (chBoxes.length > 0) {			var attendees = [];			for (var i = 0; i < chBoxes.length; ++i) {				if (chBoxes[i].checked) {					attendees.push(chBoxes[i].id);				}			}			var data = attendees.join(', ');			Ext.getCmp('adminGroupInviteUsers').setValue(data);		}				this.dialog.hide();	}		,augment : function(callee)	{		var obj = callee.params;		// Silly one, didn't expect more from back-end ;)		obj.folderId	= "-1";		obj.groupId		= this.groupId;				return callee;	}		,controller : function(obj)	{		if (obj) {			this.groupId 	= obj.groupId;		}		// Called from Schedules Dialog		if (obj.schedule) {			this.schedule = true;		}				// We don't want to prompt user for this dialog on hide.		this.noPromptNeeded = true;				this.panels[0].reset();		this.dialog.show();		this.loadForm(0);	}		,execute : function(callee, type, data)	{		switch(type) {			case ('admin_group_participants_dlg'):				this.controller(data);				break;		}	}});//* * * * * * * * * * * * * * * * * * * *//	Profile//* * * * * * * * * * * * * * * * * * * *Eve.lib.Admin.ProfileDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'	,root	: 'profile'	,panels	: []	,usersPanel : {}	,init : function(data)	{		Eve.lib.Admin.ProfileDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ['Details']			,main	: [0]		}		var dialog	= {			 border	: false			,panel	: true		}		var output = this.createDialog({tab: tab ,dialog: dialog})		this.usersPanel = output;		this.registerView();	}	,registerView : function()	{		Ext.getCmp('admin3ColumnSelector').on('render', function() {			// Handler			var hdlContextMenu = function(cmp, idx, node, e) {				e.stopEvent();								var record = cmp.store.getAt(idx);				var hidden = record.get('hidden') != '0';				// Context Menu				var menu = new Ext.menu.Menu({					items	: [{						text	: hidden ? 'Show' : 'Hide'						,id		: 'hide'					}]				})								menu.on('itemclick', function(bi) {					if (hidden) {						record.set('hidden', '0');					} else {						record.set('hidden', '1');					}				});				menu.showAt(e.getXY());			}			// Attach Handlers			this.fromMultiselect.view.on('contextmenu', hdlContextMenu);			this.toMultiselect.view.on('contextmenu', hdlContextMenu);			this.nextToMultiselect.view.on('contextmenu', hdlContextMenu);		});	}	,deleteForm : function(id)	{		var id = id || this.id;				var title	= 'Delete Confirmation';		var msg		= 'Are you sure you want to delete this user?';				Ext.Msg.confirm(title, msg, function(btn) {			if (btn == 'yes') {				this.fire('admin_delete_profile', {info: {id: this.id}}, true);			}		}, this);	}	,afterAddButtons: function(buttons, scope){		var btn = [];		buttons[0].hidden = false;		btn.push(buttons[0]);		btn.push(buttons[2]);		return btn;	}	,augment : function( callee )	{		var obj = callee.params;		if (this.mode == 'edit')			obj.id = this.id;		return callee;	}	,controller	: function(obj)	{		this.id 		= obj.info.id;		Eve.Admin.selectedProfile = {};		Eve.Admin.selectedProfile.id = this.id;		// We can also write this as a function for all of the panels		this.noPromptNeeded = true;		this.loadForm(0);			}	,handleProfilesResponse: function( r, args ) {		var comboConf = {				triggerAction	: 'all'				,selectOnFocus	: true				,typeAhead      : true				,forceSelection : true				,minChars      	: 1				,mode           : 'local'				,loadPrevent: true							};		Ext.apply(Ext.getCmp('adminProfileDetailsLandingGroup'), comboConf);		Ext.getCmp('adminProfileDetailsLandingGroup').store.add( Ext.getCmp('adminProfileDetailsLandingGroup').store.reader.readRecords(Ext.DomQuery.select('group', r.responseXML)).records );				var itemSelectorStrategy = new Eve.form.ItemSelectorStrategy();		itemSelectorStrategy.load(Ext.getCmp('adminProfileUserAssignment'), r.responseXML);		Ext.getCmp('adminProfileUserAssignment').loadPrevent = true;	}	,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case 'admin_profile_load_constants':		        var request = Ext.Ajax.request({		                 url		: Eve.url						,params  	: {event: 'modern.administrator.profile.loadConstants'}						,success	: this.handleProfilesResponse						,failure	: this.handleFailure		                ,scope	: this						});			        break;							case 'admin_edit_profile_dlg':				// Show the panel				var card = Ext.getCmp('adminProfileMainCard');				card.getLayout().setActiveItem(1);				card.doLayout();				this.mode = 'edit';				this.controller(data);				Ext.getCmp('adminProfileUserAssignment').allToFrom();				break;			case 'admin_delete_profile':				Ext.Ajax.request({					url		: Eve.url					,success: function(resp, options) {						var xml 		= resp.responseXML;						this.fire('admin_delete_profile_success', {nodeId: data.info.id});					}					,params	: {						event	: 'modern.administrator.profile.deleteProfile'						,id		: data.info.id					}					,scope	: this				});				break;		}	}	,loadSuccess : function(res)	{		var dq = Ext.DomQuery;		var cmbGroup = Ext.getCmp('adminProfileDetailsLandingGroup');		if( Eve.SectionManager.isGroupSection(dq.selectValue('defaultLandingPage', res.responseXML)) )			cmbGroup.setValue(dq.selectValue('landingGroupId', res.responseXML));		else			cmbGroup.setValue(cmbGroup.store.getAt(0).get('title'));				// Deciede to Show/Hide LandingGroupId		var landingPage = Ext.getCmp('adminProfileDetailsLandingPage');		var value		= dq.selectValue('defaultLandingPage', res.responseXML);		var index		= landingPage.store.find('value', new RegExp('^' + value + '$'));		landingPage.fireEvent('select', landingPage, landingPage.store.getAt(index), index);				if (Ext.getCmp('adminProfileDetailsProfileName').getValue() == "Default")			Ext.getCmp('adminProfileDetailsProfileName').setDisabled(true);		else			Ext.getCmp('adminProfileDetailsProfileName').setDisabled(false);				if (dq.selectValue('lockDesktop', res.responseXML) != '0')		{			Ext.getCmp('adminProfileLockDesktopLock').setValue(true);			Ext.getCmp('adminProfileLockDesktopPermit').setValue(false);		}		else		{			Ext.getCmp('adminProfileLockDesktopPermit').setValue(true);			Ext.getCmp('adminProfileLockDesktopLock').setValue(false);		}			}	,submitSuccess : function( resp, action )	{		store = Ext.getCmp('adminProfileUserAssignment').toStore		for (var i = 0; i < store.data.length; i++)		    store.getAt(i).set('name', Ext.getCmp('adminProfileDetailsProfileName').getValue());		Ext.getCmp('adminProfileUserAssignment').allToFrom();	}});Eve.lib.Admin.ProfileCreateBridge = Ext.extend( Eve.lib.TabDialogController, {	mode 	: 'create'    ,panels	: []	,usersPanel : {}	,loaded: false	,init : function(data)	{		Eve.lib.Admin.ProfileCreateBridge.superclass.init.call(this, data);				var tab		= {			items	: ['Details']			,main	: [0]		}				var dialog	= {			 title	: 'Create profile'			,border	: false			,height: 470			,width: 580		}						this.createDialog({tab: tab ,dialog: dialog})	}	,afterAddButtons: function(buttons, scope){		var btn = [];		btn.push(buttons[1]);		btn.push(buttons[3]);		return btn;	}				,augment : function( callee )	{		var obj = callee.params;		return callee;	}		,controller	: function(obj)	{		this.dialog.show();					}	,execute : function(callee, type, data)	{		switch( type.toLowerCase() ) {			case ('admin_profile_create'):				this.mode = 'create';				this.controller(data);				this.loadForm(0);								break;			case ('admin_user_assign_to_group'):				break;		}			}	,loadSuccess : function (res)	{		// Deciede to Show/Hide LandingGroupId		var landingPage = Ext.getCmp('adminProfileCreateLandingPage');		landingPage.setValue('Desktop');		if (this.loaded != true)		{			console.log('LOAD!');			Ext.getCmp('adminProfileCreateDetailsLandingGroup').store = Ext.getCmp('adminProfileDetailsLandingGroup').store;			this.loaded = true;		}				Ext.getCmp('adminProfileCreateLandingGroupContainer').hide();	}		,submitSuccess : function( resp, action )	{		var dq	 = Ext.DomQuery;		var xml	 = resp.responseXML;		var id	 = dq.selectValue("profileId", xml);		var name = dq.selectValue("profileName", xml);		this.panels[0].reset();		var root = Ext.getCmp('adminProfileTree').getRootNode();		root.appendChild(new Ext.tree.TreeNode({			text	: name			,id		: id			,cls	: 'admin-tree-profiles'		}));	}});/*	*	*	*	*	*	*	*	*	*	*	*	*	*	*	* *			Folder Permission dialog */Eve.lib.Admin.FolderPermissionDialogBridge = Ext.extend( Eve.lib.TabDialogController, {	mode	: 'create'	,init : function(data)	{		Eve.lib.Admin.FolderPermissionDialogBridge.superclass.init.call(this, data);		var tab		= {			items	: ["Folder Permissions"]		}		var dialog	= {			width 	: 630			,height : 370			,title	: 'Folder Permissions'		}		this.createDialog({tab: tab ,dialog: dialog});	}	,onDialogHide : function()	{	}	,afterAddButtons : function(buttons, scope)	{	}	,augment : function(callee)	{		var obj = callee.params;		obj.groupId = this.id;		obj.id = this.id;		return callee;	}	,controller : function(obj)	{		this.id 		= obj.info.id;				this.dialog.show();		this.loadForm(0);					}	,execute : function(callee, type, data)	{		switch(type) {			case ('admin_group_folderpermission_dlg'):				this.controller(data);				break;		}	}	,submitSuccess : function( resp, action )	{	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\admin/Admin.js *//*--------------------------------------------------*//** * Admin.js * Hyperoffice Settings section based on ExtJS Library 2.2 December 2009 *  * syavash@hyperoffice.com *  * http://www.hyperoffice.com *//************************************************************************ * 					 Users management section 							* ************************************************************************/Eve.Admin.AdminBridge = Ext.extend( Eve.lib.Bridge, { 	init: function( obj ){ 		// Add this as a superbridge		Eve.Admin.AdminBridge.superclass.init.call(this, obj); 	}	,forceLoad: function(data){			} 	,execute: function( callee, type, object ){ 		switch( type ){			case 'show_admin_users':				Ext.getCmp('adminCardLayout').getLayout().setActiveItem(1);				Ext.getCmp('adminUserMainCard').getLayout().setActiveItem(0);				break;			case 'show_admin_groups':				Ext.getCmp('adminCardLayout').getLayout().setActiveItem(2);				Ext.getCmp('adminGroupMainCard').getLayout().setActiveItem(0);				break;			case 'show_admin_profiles':				Ext.getCmp('adminCardLayout').getLayout().setActiveItem(3);				Ext.getCmp('adminProfileMainCard').getLayout().setActiveItem(0);				break;			default: 				 		} 	}});	Eve.Admin.Templates = {	getContactDialogTop : function() {			return new Ext.XTemplate(					'<div style="padding-top: 20px; padding-bottom: 20px;">',						'<b>{fullname}</b> ({username}) {[this.getLoginLink(values)]}<br />',						'Account created on {createdDate}',					'</div>',					{						getLoginLink: function(values) {						if (values.username != '' && values.username != 'postmaster' && Eve.Preference.get('accountLevel') >= 145)							return '<a href="javascript:void(0);" onclick="Eve.Resource.superbridge.broadcast(this, \'admin_users_login_as_user\', {userId: Eve.Admin.selectedUser.id})">Login as user</a>';						else							return '';						}											});		},	getUserAddToGroupTop : function() {			return new Ext.Template(					'<div style="padding: 20px;">',						'To Add the user to the group, simply select the group below and click "subscribe user to group".',  						'<br />',						'UserID: <b>{userid}</b> <br />',						'Username: <b>{username}</b><br />',					'</div>'			)		},	getUserPermissionTop : function() {			return new Ext.Template(					'<div style="padding-top: 5px; padding-bottom: 10px;">',						'<b style="font-size: 16px; padding-bottom: 5px;">{firstname} {lastname}</b> <br />',						'Member of group: {group}<br />',					'</div>'			)		}		}Eve.Admin.UserDetails = function() { 	return new Eve.FormPanel({			 border: false			,bodyStyle: 'overflow: auto;'			,items: [{				defaults: {border: false}				,layout: 'column'				,border: false				,items: [{					defaults: {border: false}					,columnWidth: 0.15					,bodyStyle	: 'padding: 30px;'					,items		: [{						html		: '<img id="AdminUserImage" src="' + Eve.Resource.getIcon('item-icon','contact') + '" width="73" height="77" style="padding-bottom: 2px;" />'					}, {						xtype	: 'button'						,id		: 'AdminbtnContactUpload'						,text	: 'Edit Image'					}]				},{					 columnWidth: 0.85					,layout		: 'form'					,bodyStyle	: 'padding-bottom: 10px;'					,items		: [{						 border		: false						,id			: 'userDetailsHeader'						,html		: Eve.Admin.Templates.getContactDialogTop().apply({fullname: '', username: '', createdDate: ''})					},{						 xtype: 'combo'						,fieldLabel: 'Account level'						,id : 'userAccountLevel'						,name: 'accountlevel'						,smname: 'accountLevel'						,displayField: 'text'						,listWidth: 147						,valueField: 'id'						,store: new Ext.data.SimpleStore({							fields: ['id', 'text']						})					},{						  id: 'adminReportToPanel'					     ,layout: 'form'						 ,items: {							 xtype: 'combo'							,fieldLabel: 'Reports to'							,name: 'adminParentId'							,id: 'reportTo'							,listWidth: 147							,smname: 'adminParent'							,store:	new Ext.data.Store({								data	:[]								,fields	:[ 'username', 'id' ]								,reader	: new Ext.data.XmlReader({									record	: 'row'								}, [ 'username', 'id' ])							})							,displayField: 'username'							,valueField: 'id'						}					},{						html: '<u><b>Top Level: No direct report</b></u>'						,id: 'adminTopLevel'						,hidden: true						,style: 'padding: 5px;'					},{						 xtype: 'combo'						,fieldLabel: 'Profile label'						,smname: 'userProfile>id'						,listWidth: 147						,name: 'profileId'						,id: 'userProfiles'						,store:	new Ext.data.Store({							data	:[]							,fields	:[ 'name', 'id' ]							,reader	: new Ext.data.XmlReader({								record	: 'row'							}, [ 'name', 'id' ])						})						,displayField: 'name'						,valueField: 'id'					},{						 xtype: 'textfield'						,name: 'password'						,width: 164						,fieldLabel: 'Password'						,inputType: 'password'						,smname: 'userDomain>password'					}]				}]			},{			  xtype: 'tabpanel'			 ,activeTab	: 0 			 ,deferredRender		: false			 ,height: 250			 ,items: [{				 title: 'Personal information'				,layout: 'form'				,frame		: false				,border		: false				,bodyStyle	: 'padding: 20px'				,items: {					 width: 600					,layout: 'form'					,border: false					,items:					[{						 layout: 'column'						,border: false						,items: 							[{								layout: 'form'								,border: false								,columnWidth: 0.5								,items: [{						        	 xtype: 'textfield'						        	,fieldLabel: 'First Name'									,smname: 'firstName'									,id: 'firstname'									,name: 'first_name'						        	,anchor: '90%'						        }]							},{								layout: 'form'								,columnWidth: 0.5								,border: false								,items: [{						        	 xtype: 'textfield'						        	,width: 171						        	,fieldLabel: 'Last Name'									,name: 'last_name'									,smname: 'lastName'						        }]							}]					},{					 	 xtype: 'textfield'						,fieldLabel: 'Organization'						,name: 'organization'						,smname: 'organization'			        	,anchor: '96%'					},{						 xtype: 'textfield'						,fieldLabel: 'Address'						,name: 'address'						,smname: 'address'			        	,anchor: '96%'					},{						 layout: 'column'						,border: false						,items: 							[{								 layout: 'form'								,border: false								,columnWidth: 0.4								,items: [{						        	 xtype: 'textfield'						        	,fieldLabel: 'City'									,name: 'city'									,smname: 'city'						        	,anchor: '90%'						        }]							},{								 layout: 'form'								,labelWidth: 40								,columnWidth: 0.2								,border: false								,items: [{						        	 xtype: 'textfield'						        	,fieldLabel: 'State'									,name: 'state'									,smname: 'state'						        	,anchor: '90%'						        }]							},{								 layout: 'form'								,labelWidth: 30								,columnWidth: 0.4								,border: false								,items: [{						        	 xtype: 'textfield'						        	,fieldLabel: 'Zip'									,name: 'zip'									,smname: 'zip'						        	,anchor: '90%'						        }]						     							}]					},{						 xtype: 'textfield'						,fieldLabel: 'Country'						,name: 'country'						,smname: 'country'						,anchor: '96%'					},{						 layout: 'column'						,border: false						,items: 							[{								 layout: 'form'								,border: false								,columnWidth: 0.5								,items: [{						        	 xtype: 'combo'						        	,fieldLabel: 'Time Zone'									,id: 'timeZones'									,name: 'timeZone'									,smname: 'timeZone'						        	,anchor: '90%'									,store: 										new Ext.data.Store({														data	:[]														,fields	:[ 'value' ]														,reader	: new Ext.data.XmlReader({															record	: 'row'														}, [ 'value' ])													})																		,displayField: 'value'									,valueField: 'value'						        },{						        	 xtype: 'combo'						        	,fieldLabel: 'Locale'									,name: 'userLocale'									,id: 'userLocales'									,smname: 'userLocale>local'						        	,anchor: '90%'									,store: 										new Ext.data.Store({														data	:[]														,fields	:[ 'localeName', 'localeValue' ]														,reader	: new Ext.data.XmlReader({															record	: 'row'														}, [ 'localeName', 'localeValue' ])													})																		,displayField: 'localeName'									,valueField: 'localeValue'															        }]							},{								 layout: 'form'								,columnWidth: 0.5								,border: false								,items: [{						        	 xtype: 'combo'									,name: 'userCalendar'									,smname: 'calendar'						        	,fieldLabel: 'Calendar'									,id: 'userCalendars'									,store: 										new Ext.data.Store({														data	:[]														,fields	:[ 'value' ]														,reader	: new Ext.data.XmlReader({															record	: 'row'														}, [ 'value' ])													})																			,displayField: 'value'									,valueField: 'value'															        	,width: 154						        }]						     							}]											},{			layout:'column'			,hidden : (Eve.Preference.getInteger('accountLevel') >= 155) ? false : true			,items:[{					columnWidth	: .3					,layout : 'form'					,items:[					new Ext.form.Checkbox({						labelSeparator	: ''						,boxLabel 		: 'Account Frozen'						,hideLabel		: true						,name 			: 'accountFrozen'					})]			},{				columnWidth	: .4				,layout : 'form'				,items:{                        html : '<label></label>'                        ,cls : 'lamp-tip'                        ,id : 'accountFrozenTip'                        ,listeners : {                            render : function(cmp){								var tip = new Ext.ToolTip({                                    target: 'accountFrozenTip'                                    ,width: 270									,html	:['As a security measure, user accounts are ',											'frozen after 10 unsuccessful login attempts. ',											'They are then prompted to contact the portal administrator. You may freeze ',											'and unfreeze accounts using this checkbox, it is also recommended that you ',											'contact the user if the account is frozen.'].join('')                                   , trackMouse:true                                });                            }                        }                    }			}]		}										]}			 },{				 title: 'Group memberships'				,height: 200				,items: {					 xtype: 'panel'					,height: 220					,items: [{				html : 	'<div class="x-grid3-header">'							+ '<table style="width:100%;">'							+ '<tr class="x-grid3-hd-row">'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-1" style="width:235px;"><div class="x-grid3-hd-inner x-grid3-hd-2">Title</div></td>'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-2" style="width:255px"><div class="x-grid3-hd-inner x-grid3-hd-2">Membership type</div></td>'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-2" style="width:50px"><div class="x-grid3-hd-inner x-grid3-hd-2"> </div></td>'								+ '<td class="x-grid3-hd x-grid3-cell x-grid3-td-3"><div class="x-grid3-hd-inner x-grid3-hd-2"></div></td>'							+ '</tr>'							+ '</table>'						+ '</div>'						}, {							border: false,							autoScroll: true,							items: {								xtype: 'xdataview',								height: 190,								name: 'groups',								id: 'groups_dv',								store: new Ext.data.Store({									reader: new Ext.data.XmlReader({										record: 'row',										id: 'id'									}, ['id', 'title', 'administrator', 'active', 'owner'])								}),								itemSelector: 'div.opt_item',								singleSelect: true,								selectedClass: 'x-group-selected',								emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',								tpl			: new Ext.XTemplate(										'<div class="x-grid3-body" style="width: 550px">',										'<tpl for=".">',											'<div class="opt_item x-grid3-row x-grid3-row-collapsed" style="padding:2px 0px;">',												'<table class="x-grid3-row-table" style="table-layout: fixed; width: 540px;">',												'<tr>',													'<td style="width:235px;" >{title}</td>',													'<td style="width: 255px;" >{[this.showMembership(values)]}</td>',													'<td style="width:50px;" >',													'<img style="display:{[this.setDisplay(values.commentEditPermission)]};" src="' + Eve.imagePath + 'general/edit.png" onclick="Eve.Resource.superbridge.broadcast(this, \'admin_users_edit_group_membership\', {groupId: {id}, userId: {[this.getSelectedUser(values)]}})" />&nbsp;',													'<img style="display:{[this.setDisplay(values.commentDeletePermission)]};" src="' + Eve.imagePath + 'general/delete.png" onclick="Eve.Resource.superbridge.broadcast(this,\'admin_users_delete_group_membership_user\', {groupId: {id}, userId: {[this.getSelectedUser(values)]}})" />',													'</td>',													'<td> </td>',												'</tr>',												'</table>',											'</div>',											'</tpl>',										'</div>',										{											showMembership : function(values)											{												if (values.active == 1)													var membership = 'Active';												else													var membership = 'Passive';																									if (values.owner == 1)													membership += ' [Owner]';												else if (values.administrator == 1)													membership += ' [Admin]';																									return membership;											}											,setDisplay: function(values)											{												return 'inline';											}											,getSelectedUser: function(values)											{												return Eve.Admin.selectedUser.id;											}										}																	)							}											}]				}												 			 }]		}]							});	}Eve.Admin.UsersPanel = function(superbridge, manager, dialog) {	var conn	= Eve.widgets.TreeStore;			var treeBridge	= new Eve.Admin.UsersTreeBridge();		superbridge.addBridge(treeBridge);	manager.registerComponents(treeBridge);	treeBridge.init({		superbridge	: superbridge		,conn		: conn		,section	: 'admin'		,prefix		: 'AD'		,manager	: manager	});		return new Ext.Panel({		layout	: 'border'		,border	: false		,items	: [{			id			: 'usersWestRegion'			,region		: 'west'			,title		: 'Users'			,layout		: 'fit'			,width		: 200			,collapsible: true			,tools		: [{				id			: 'plus'				,qtip		: 'Add'				,handler	: function() {					Eve.Resource.superbridge.broadcast(this, 'admin_user_create');				}			}]			,items		: [{				 layout		: 'border'				,border		: false				,items		: [{					 region		: 'north'					,border		: false					,layout		: 'fit'					,height		: 35					,items		: [{						 layout		: 'form'						,labelWidth	: 40						,border		: false						,cls		: 'x-grid3-header'						,bodyStyle	: 'background: none; padding: 5px; border-bottom: 1px solid #D0D0D0'						,items		: {							xtype			: 'textfield',							fieldLabel		: 'Search',							id				: 'userSearch',							enableKeyEvents	: true,							anchor			: '99%',							listeners		: {								keyup: function() {									if (Ext.getCmp('userSearch').getValue() != '') {										Ext.getCmp('usersTreeCard').getLayout().setActiveItem(1);										var output = '';										for (var i, i = 0; i < Eve.Admin.usersArr.length; i++) {											if (Eve.Admin.usersArr[i].text.search(new RegExp(Ext.getCmp('userSearch').getValue(), "i")) != -1) {												output += ['<li class="x-tree-node"><div onclick="Eve.Resource.superbridge.broadcast(this, \'admin_edit_user_dlg\', {info: {id: ', Eve.Admin.usersArr[i].id, '}});" class="x-tree-node-el"><div class="', Eve.Admin.usersArr[i].cls, '-search"></div> ', Eve.Admin.usersArr[i].text.replace(new RegExp('(' + Ext.getCmp('userSearch').getValue() + ')', "i"), '<b>$1</b>') , '</div></li>'].join('')											}										}										document.getElementById('usersSearchResult').innerHTML = output;																				/*										Ext.getCmp('usersSearchResult').store.removeAll();										rec = Ext.data.Record.create(['id', 'username']);										for (var i = 0; i < Eve.Admin.usersArr.length; i++) {											if (Eve.Admin.usersArr[i].text.search(new RegExp(Ext.getCmp('userSearch').getValue(), "i")) != -1) {												newRec = new rec(Eve.Admin.usersArr[i]);												Ext.getCmp('usersSearchResult').store.add(newRec);											}										}*/									} else {										Ext.getCmp('usersTreeCard').getLayout().setActiveItem(0);									}								}							}						}					}]				}, {					layout: 'fit'					,region: 'center'					,border: false					,items: [{						layout: 'card',						id: 'usersTreeCard',						activeItem: 0,						border: false,						items: [{							layout: 'fit'							,border: false							,items: {									bodyStyle: 'overflow: auto;',									border: false,									items: treeBridge.view							}						}, {							layout: 'fit'							,border: false							,bodyStyle: 'overflow: auto;'							,items: {								html: '<div><ul id="usersSearchResult"></ul></div>'/*								xtype: 'xdataview',								name: 'usersSearchResult',								id: 'usersSearchResult',								itemSelector: 'div.opt_item',								emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',								tpl: new Ext.XTemplate('<div><ul>', '<tpl for=".">', '<li class="x-tree-node"><div onclick="Eve.Resource.superbridge.broadcast(this, \'admin_edit_user_dlg\', {info: {id: {id}}});" class="x-tree-node-el"><div class="{[this.getColor(values)]}"></div> {[this.getResultText(values)]}</li>', '</tpl>', '</ul></div>', {									getResultText: function(values){										return values.text.replace(new RegExp('(' + Ext.getCmp('userSearch').getValue() + ')', "i"), '<b>$1</b>');									},									getColor: function(values)									{										if (values.accountLevel < 140)											return "admin-tree-users-blue-search";										else											return "admin-tree-users-red-search"																			}								}),								store: new Ext.data.SimpleStore({									fields: ['id', 'text', 'accountLevel']								})*/							}						}]					}]				}]			}]		},{			 id		: 'usersCenterRegion'			,region	: 'center'			,layout	: 'fit'			,items	: [{				layout			: 'card'				//,anchor			: '85% 100%'				//,border			: false				,id				: 'adminUserMainCard'				,activeItem		: 1				,items			: [{					html			: "<div class='admin-panel-message'>Choose a user to administer from the tree to the left or click the 'new user' button to create a new user</div>"					,border			: false				}, dialog.dialog]				,listeners : {					render: function()					{						(function() {							console.log('test');							Ext.getCmp('adminUserMainCard').getLayout().setActiveItem(0);						}).defer(1000)					}								}			}]		}]	})}Eve.Admin.UserGroupPermission = function(){	return new Eve.FormPanel({		items: [{				defaults: {border: false}				,layout: 'column'				,border: false				,items: [{						defaults: {border: false}						,columnWidth: 0.15						,items		: [{							html		: '<img id="AdminPermissionUserImage" src="' + Eve.Resource.getIcon('item-icon','contact') + '" width="73" height="77" style="padding-left: 10px; padding-bottom: 5px;" />'						}]					},{						 defaults: {border: false}											,columnWidth: 0.85						,items: [{ 							id: 'adminUserGroupPermissionHeader',							html: Eve.Admin.Templates.getUserPermissionTop().apply({lastname: '', firstname: '', group: ''})											         },{				    	 	xtype: 'checkbox'				 	    	,name: 'administrator'				 	    	,boxLabel: 'User is Administrator'				 	    	,hideLabel: true						}]				 	}]		},{			xtype: 'fieldset',			title: 'Permissions',			autoHeight: true,			anchor: '100%',			items: {				layout: 'form',				labelWidth: 200,				defaults: {					displayField: 'text',					valueField: 'value',					mode: 'local',					typeAhead: true,					editable: false,					selectOnFocus: true,					triggerAction: 'all',					loadPrevent: true,					anchor: '90%'				},				items: [{					xtype: 'combo',					name: 'tasksPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the tasks section'], ['1', 'Only view tasks'], ['2', 'View and add tasks'], ['3', 'View, add, edit, and delete tasks that they create'], ['4', 'View, add, edit, and delete tasks that any user creates']]					}),					fieldLabel: 'Tasks Permissions'				}, {					xtype: 'combo',					name: 'contactsPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the contacts section'], ['1', 'Only view contacts'], ['2', 'View and add contacts'], ['3', 'View, add, edit, and delete contacts that they create'], ['4', 'View, add, edit, and delete contacts that any user creates']]					}),					fieldLabel: 'Contacts Permissions'				}, {					xtype: 'combo',					name: 'calendarPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the calendar section'], ['1', 'Only view calendar events'], ['2', 'View and add calendar events'], ['3', 'View, add, edit, and delete calendar events that they create'], ['4', 'View, add, edit, and delete calendar events that any user creates']]					}),					fieldLabel: 'Calendar Permissions'				}, {					xtype: 'combo',					name: 'votingPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the voting section'], ['1', 'Only view voting items'], ['2', 'View and interact with voting items'], ['3', 'View, add, and interact with voting items'], ['4', 'View, add, edit, and delete voting items that he creates'], ['5', 'View, add, edit, and delete voting items that any user creates']]					}),					fieldLabel: 'Voting Permissions'				}, {					xtype: 'combo',					name: 'linksPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the links section'], ['1', 'Only view links'], ['2', 'View and add links'], ['3', 'View, add, edit, and delete links that he creates'], ['4', 'View, add, edit, and delete links that any user creates']]					}),					fieldLabel: 'Links Permissions'				}, {					xtype: 'combo',					name: 'forumsPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the forums section'], ['1', 'Only view messages'], ['2', 'View and add messages'], ['3', 'View, add, edit, and delete messages that he creates'], ['4', 'View, add, edit, and delete messages that any user creates'], ['5', 'Forums administrator (add, edit, and delete messages/topics)']]					}),					fieldLabel: 'Forums Permissions'				}, {					xtype: 'combo',					name: 'wikiPermissions',					store: new Ext.data.SimpleStore({						fields: ['value', 'text'],						data: [['0', 'Banned from the Wiki section'], ['1', 'Only view wiki pages'], ['2', 'View and add wiki pages '], ['3', 'View, add, edit, and delete wiki pages that he creates'], ['4', 'View, add, edit, and delete wiki pages that any user creates']]					}),					fieldLabel: 'Wiki Permissions'				}]			}		},{			xtype: 'fieldset',			title: 'Permissions',			autoHeight: true,			anchor: '100%',			items: [{			    layout: 'column'			    ,border: false			    ,defaults: {layout: 'form'}			    ,items:			    	[{			    		columnWidth: 0.9			    		,items: [{							xtype: 'combo',							name: 'opt',							smname: 'documentPermissionIterator',							id: 'adminUserPermissionFolders',							store 	: new Ext.data.Store({								reader 	: new Ext.data.XmlReader({									record 	: 'row'								}, [{name: 'text', mapping:'path'},{name: 'path'}])								,listeners : {									load : function(st, records, options){											if (records.length > 500)												Ext.Msg.alert('Warning', 'This group currently has more than 500 folders in it. Please manage the permissions inside the shared documents section by right-clicking on the folder you would like to manage and clicking on "details" and then clicking on the "permissions" tab');									}								}							}),							displayField: 'text',							valueField: 'path',							fieldLabel: 'Directory',							mode: 'local',							typeAhead: true,							editable: false,							defaultSelection: false,							emptyText: 'Pick a directory...',							selectOnFocus: true,							triggerAction: 'all',							anchor: '99%'											    		}]					},{						columnWidth: 0.1						,items: [{							 text: 'Add'							,xtype: 'button'							,handler: function() {								var row = {};								var cbo = Ext.getCmp('adminUserPermissionFolders');								row.path = cbo.getValue();								row.text = cbo.getRawValue();								if (row.path == '')	{									Ext.Msg.alert('Note', 'Please select a folder from combobox in order to add permission');									return;								}																if (Ext.getCmp('dvAdminUserEditPermissions').store.find('path', new RegExp('^' + row.path + '$')) != -1) {									Ext.Msg.alert('Note', 'Please remove the current permissions for ' + row.path + ' before adding a new set of permissions to the same folder.');									return;								}																								if (Ext.getCmp('adminUserPermissionRead').getValue())									row.canRead = 1;								else									row.canRead = -1;								if (Ext.getCmp('adminUserPermissionWrite').getValue())									row.canWrite = 1;								else									row.canWrite = -1;								if (Ext.getCmp('adminUserPermissionDelete').getValue())									row.canDelete = 1;								else									row.canDelete = -1;								if (Ext.getCmp('adminUserPermissionCreateDir').getValue())									row.canCreateDirs = 1;								else									row.canCreateDirs = -1;																var rec = Ext.data.Record.create(['id', 'index', 'canDelete', 'canRead', 'canCreateDirs', 'canWrite', 'path', 'text']);								var newRec = new rec(row);								Ext.getCmp('dvAdminUserEditPermissions').store.add(newRec);																Ext.getCmp('adminUserPermissionRead').setValue(false);								Ext.getCmp('adminUserPermissionWrite').setValue(false);								Ext.getCmp('adminUserPermissionDelete').setValue(false);								Ext.getCmp('adminUserPermissionCreateDir').setValue(false);															}						}]											}]			},{				layout: 'column'				,border: false				,defaults: {layout: 'form'}				,items: [{				     columnWidth: 0.2				    ,items: [{						xtype: 'checkbox'						,boxLabel: 'Read'						,id: 'adminUserPermissionRead'						,hideLabel: true				    }]				},{				     columnWidth: 0.2				    ,items: [{						xtype: 'checkbox'						,boxLabel: 'Write'						,id: 'adminUserPermissionWrite'						,hideLabel: true				    }]				},{				     columnWidth: 0.2				    ,items: [{						xtype: 'checkbox'						,boxLabel: 'Delete'						,id: 'adminUserPermissionDelete'						,hideLabel: true				    }]				},{				     columnWidth: 0.4				    ,items: [{						xtype: 'checkbox'						,boxLabel: 'Create Directories'						,id: 'adminUserPermissionCreateDir'						,hideLabel: true				    }]				    				}]			},{				xtype: 'panel',				height: 100,				bodyStyle: 'border: 1px solid #D0D0D0; background: #fff;',				layout: 'fit',				items: [{					xtype: 'xdataview',					name: 'folderPermissions',					id: 'dvAdminUserEditPermissions',					smname: 'documentPermissionIterator',				    field		: ['path', 'canRead', 'canWrite', 'canDelete', 'canCreateDirs', 'text'],					itemSelector: 'div.opt_item',					singleSelect: true,					emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',					autoScroll: true,					hideLabel: true,					tpl: new Ext.XTemplate(						'<div>',							'<tpl for=".">',								'<div class="opt_item">',								'{[this.createPermissionRow(values, xindex)]}',								'</div>',							'</tpl>',						'</div>', {						createPermissionRow: function(values, xindex) {							var store = Ext.getCmp('dvAdminUserEditPermissions').store;							var output = '';							var permissions = [];															if (values.canRead != 0) {																if (values.text) {										output += values.text;								} else {										output += values.path.replace('/groups/g' + Eve.Admin.UserGroupPermission.groupId, Eve.Admin.UserGroupPermission.groupTitle);								}																if (values.canRead == 1)									permissions.push('Read');								if (values.canWrite == 1)									permissions.push('Write');								if (values.canDelete == 1)									permissions.push('Delete');								if (values.canCreateDirs == 1)									permissions.push('Create dirs');								if (permissions.length == 0)									permissions.push('No permission');								output += ' (' + permissions.join(', ') + ')';								output = '<div style="padding: 5px; padding-left: 10px; border-bottom: 1px solid #D0D0D0;">' + output + '<div style="float: right;"><img src="' + Eve.imagePath + 'general/delete.png" onclick="Ext.getCmp(\'dvAdminUserEditPermissions\').store.removeAt(' + (xindex -1) + '); Ext.getCmp(\'dvAdminUserEditPermissions\').view.refresh()" /></div></div>';																} else { 								store.remove( store.getById(values.index) );							}							return output;						}					}),					store: new Ext.data.Store({						reader: new Ext.data.XmlReader({							record: 'row',							id: 'index'						}, ['index', 'canDelete', 'canRead', 'canCreateDirs', 'canWrite', 'path'])					})				}]			}]		}]	});}Eve.Admin.UserCreate = function() {	return new Eve.FormPanel({				 layout: 'form'		,labelWidth: 110		,bodyStyle: 'padding: 10px'		,items: [{			 fieldLabel: 'First name'			,xtype: 'textfield'			,name: 'first_name'			,allowBlank: false		    ,anchor: '99%'		},{			 fieldLabel: 'Last name'			,xtype: 'textfield'			,name: 'last_name'			,allowBlank: false		    ,anchor: '99%'		    ,style: 'margin-bottom: 5px'		},{			 fieldLabel: 'Login name'			,xtype: 'textfield'			,allowBlank: false			,name: 'login'		    ,anchor: '99%'		},{			 fieldLabel: 'Password'			,name: 'password'			,xtype: 'textfield'			,minLength: 5		    ,anchor: '99%'			,inputType: 'password'		},{			 fieldLabel: 'Password (verify)'			,name: 'vpassword'			,xtype: 'textfield'		    ,anchor: '99%'			,minLength: 5			,inputType: 'password'		    ,style: 'margin-bottom: 5px'		},{			 fieldLabel: 'External Email'			,name: 'externalemail'			,xtype: 'textfield'		    ,anchor: '99%'			,validator: Ext.form.VTypes.email		},{	      	 xtype: 'combo'	      	,fieldLabel: 'Time Zone'			,name: 'timeZone'			,smname: 'timeZones'	      	,anchor: '99%'			,id: 'AdminUserCreateTimezone'			,mode: 'local'			,typeAhead: true			,editable: false			,selectOnFocus: true			,triggerAction: 'all'			,store: 				new Ext.data.Store({								data	:[]								,fields	:[ 'value' ]								,reader	: new Ext.data.XmlReader({									record	: 'row'								}, [ 'value' ])							})												,displayField: 'value'			,valueField: 'value'		},{		  	xtype: 'combo'		  	,fieldLabel: 'Locale'			,name: 'userLocale'			,smname: 'locales'			,id: 'AdminUserCreateLocale'		  	,anchor: '99%'			,mode: 'local'			,typeAhead: true			,editable: false			,selectOnFocus: true			,triggerAction: 'all'			,store: 				new Ext.data.Store({								data	:[]								,fields	:[ 'localeName', 'localeValue' ]								,reader	: new Ext.data.XmlReader({									record	: 'row'								}, [ 'localeName', 'localeValue' ])							})												,displayField: 'localeName'			,valueField: 'localeValue'											},{			 xtype: 'combo' 			,fieldLabel: 'Profile'			,smname: 'profileSearchResult'			,name: 'profileId'			,mode: 'local'			,typeAhead: true			,editable: false			,selectOnFocus: true			,triggerAction: 'all'			,anchor: '99%'			,store: 				new Ext.data.Store({								data	:[]								,fields	:[ 'name', 'id' ]								,reader	: new Ext.data.XmlReader({									record	: 'row'								}, [ 'name', 'id' ])							})												,displayField: 'name'			,valueField: 'id'								},{				bodyStyle: 'padding: 20px;'				,html: 'The system can automatically inform your users of their new account and how to use some of the most common features. The email will be sent to their newly created hyperoffice account as well as any existing email address you provide above.'		},		{			 layout: 'column'			,items: [{						 layout: 'form'						,columnWidth: 0.9						,items: {							 xtype: 'combo'							,id:'cmbNotificationEmail'							,fieldLabel: 'Notification email'							,smname: 'mailTemplates'							,name: 'SendNotify'							,mode: 'local'							,typeAhead: true							,editable: false							,selectOnFocus: true							,triggerAction: 'all'							,anchor: '99%'							,store: new Ext.data.Store({								data	:[]								,fields	:[ 'name', 'id' ]								,reader	: new Ext.data.XmlReader({									record	: 'row'								}, [ 'name', 'id' ])							})								,displayField: 'name'							,valueField: 'id'						}														},{						layout: 'form'						,columnWidth: 0.1						,items: {							xtype	: 'button'							,id		: 'adminCreateUserAddEmail'							,text	: 'Add'						}				}]				}]					});}Eve.Admin.UserAddToGroup = function(){	return new Eve.FormPanel(		{			items: [			        {			        	border: false						,id: 'userAddToGroupHeader'			        	,html: Eve.Admin.Templates.getUserAddToGroupTop().apply({username: '', userid: ''})			        },{			        	 border: false			        	,bodyStyle: 'padding-left: 20px'			        	,items: [{							 xtype: 'combo'							,smname: 'groupId'														,defaultSelection	: false							,id					: 'adminGroupCombo'							,emptyText      	: 'Pick a group...'							,tpl				: Eve.indentComboXTemplate('text')							,fieldLabel			: 'Group'							,hiddenName			: 'groupIds'							,valueField			: 'value'							,displayField		: 'text'							,allowBlank			: false							,mode               : 'local'				        },{				        	xtype: 'hidden'				        	,id: 'addToGroupUserId'				        	,name: 'userId'				        },{				        	xtype: 'hidden'				        	,name: 'userName'				        	,id: 'addToGroupUserName'				        }				        ]			        }			        	        ]	});}Eve.vc.createFormPanel( 'AdminUserDetails'			, Eve.Admin.UserDetails );Ext.override( Eve.vc.AdminUserDetails, {	  loadEvent 	: function(){return 'modern.administrator.edit.user';}	 ,submitEvent 	: function(){return 'modern.administrator.user.modifyUser';}});Eve.vc.createFormPanel( 'AdminUserCreate'			, Eve.Admin.UserCreate  );Ext.override( Eve.vc.AdminUserCreate, {	  loadEvent 	: function(){return 'modern.administrator.add.user';}	 ,submitEvent 	: function(){return 'modern.administrator.user.createUser';}});Eve.vc.createFormPanel( 'AdminUserGroupPermission'			, Eve.Admin.UserGroupPermission );Ext.override( Eve.vc.AdminUserGroupPermission, {	  loadEvent 	: function(){return 'modern.administrator.edit.userPermissions';}	 ,submitEvent 	: function(){return 'modern.administrator.group.modifyGroupPermission';}});Eve.vc.createFormPanel( 'AdminUserAddToGroup'			, Eve.Admin.UserAddToGroup );Ext.override( Eve.vc.AdminUserAddToGroup, {	  loadEvent 	: function(){return 'modern.administrator.user.getGroups';}	 ,submitEvent 	: function(){return 'modern.administrator.user.subscribeToGroup';}});/************************************************************************ * 					 Groups management section 							* ************************************************************************/Eve.Admin.GroupsPanel = function(superbridge, manager, dialog) {	var conn	= Eve.widgets.TreeStore;			var treeBridge	= new Eve.Admin.GroupsTreeBridge();		superbridge.addBridge(treeBridge);	manager.registerComponents(treeBridge);	treeBridge.init({		superbridge	: superbridge		,conn		: conn		,section	: 'admin'		,prefix		: 'AD'		,manager	: manager	});				return new Ext.Panel({		layout: 'border'		,border: false		,items: [{		        	 id: 'groupsWestRegion'		        	,region: 'west'		        	,layout: 'fit'					,title: 'Groups'					,width		: 200					,collapsible: true					,tools		: [{						id			: 'plus'						,qtip		: 'Add'						,handler	: function() {							Eve.Resource.superbridge.broadcast(this, 'admin_group_create');						}						,hidden: !(Eve.Preference.get("accountLevel") >= 1)					}]										,items: [{						 layout: 'border'						,border: false						,items: [{							 region: 'north'							,border: false							,layout: 'fit'							,height: 35							,items: [{								 layout: 'form'								,labelWidth: 40								,border: false								,cls: 'x-grid3-header'								,bodyStyle: 'background: none; padding: 5px; border-bottom: 1px solid #D0D0D0'								,items: {									xtype: 'textfield',									fieldLabel: 'Search',									id: 'groupSearch',									enableKeyEvents: true,									anchor: '99%',									listeners: {										keyup: function()										{											if (Ext.getCmp('groupSearch').getValue() != '') {												Ext.getCmp('groupsTreeCard').getLayout().setActiveItem(1);																								Ext.getCmp('groupsSearchResult').store.removeAll();																								rec = Ext.data.Record.create(['id', 'text']);												for (var i = 0; i < Eve.Admin.groupsArr.length; i++) {																										if (Eve.Admin.groupsArr[i].text.search(new RegExp(Ext.getCmp('groupSearch').getValue(), "i")) != -1) {														newRec = new rec(Eve.Admin.groupsArr[i]);														Ext.getCmp('groupsSearchResult').store.add(newRec);													}												}											}											else 												Ext.getCmp('groupsTreeCard').getLayout().setActiveItem(0);										}																			}								}							}]						},						{							 layout: 'fit'							,region: 'center'							,border: false							,items: [{								layout: 'card',								id: 'groupsTreeCard',								activeItem: 0,								border: false,								items: [{										 layout: 'fit'										,border: false												,items: 																			{											bodyStyle: 'overflow: auto;',											border: false,											items: treeBridge.view										}									}, {										 layout: 'fit'										,border: false										,bodyStyle: 'overflow: auto;'										,items: { 											xtype: 'xdataview',											name: 'groupsSearchResult',											id: 'groupsSearchResult',											itemSelector: 'div.opt_item',											emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',											tpl: new Ext.XTemplate('<div><ul>', '<tpl for=".">', '<li class="x-tree-node"><div onclick="Eve.Resource.superbridge.broadcast(this, \'admin_edit_group_dlg\', {info: {id: {id}}});" class="x-tree-node-el"><div class="admin-tree-groups-search"></div> {[this.getResultText(values)]}</li>', '</tpl>', '</ul></div>', {												getResultText: function(values){													return values.text.replace(new RegExp('(' + Ext.getCmp('groupSearch').getValue() + ')', "i"), '<b>$1</b>');												}											}),											store: new Ext.data.SimpleStore({												fields: ['id', 'text']																						})										}																		}]							}]						}]				}]		        },{		        	 id		: 'groupsCenterRegion'		        	,region	: 'center'		        	,layout	: 'fit'		        	,border	: false					//,bodyStyle			: 'background-color:#F1F1F1'					,items	: [{						layout			: 'card'						//,anchor			: '85% 100%'						//,border			: false						,id				: 'adminGroupMainCard'						,activeItem		: 1						,items			: [{							html			: "<div class='admin-panel-message'>Choose a group to administer from the tree to the left or click the 'new group' button to create a new group</div>"							,border			: false						}, dialog.dialog]					}]		        }	        ]	})}Eve.Admin.GroupDetailsManageUsers = function() { 	return new Eve.FormPanel({		border: false		,autoScroll: true		,items:		[{			 width: 600			,layout: 'form'			,border: false			,items: [{				 xtype: 'textfield'				,fieldLabel: 'Usernames'				,anchor: '95%'				,name: 'users'				,id: 'adminGroupInviteUsers'			},{				 xtype: 'textarea'				,fieldLabel: 'Message'				,anchor: '95%'				,name: 'message'							,id: 'adminGroupInviteMessage'							},{				layout: 'column'				,items: [{					 layout: 'form'					,columnWidth: 0.5					,items: {html: '<a href="javascript:void(0);" onclick="javascript:Eve.Resource.superbridge.broadcast(this, \'admin_group_participants_dlg\', {groupId: Eve.Admin.selectedGroup})">Select users from directory</a>'}				},{					 layout: 'form'					,columnWidth: 0.25					,items: {						xtype: 'button'						,text: 'Invite users to group'						,handler: function() {							Ext.Ajax.request({								url		: Eve.url								,params	: {									event			: 'modern.administrator.group.inviteUserToGroup'									,users			: Ext.getCmp('adminGroupInviteUsers').getValue()									,message		: Ext.getCmp('adminGroupInviteMessage').getValue()									,groupId		: Eve.Admin.selectedGroup 								}							,success: function(res) {									var result = Ext.DomQuery.selectValue('resultText', res.responseXML)									Ext.getCmp('adminGroupInviteUsers').setValue('');									Ext.getCmp('adminGroupInviteMessage').setValue('');									Ext.Msg.alert('Invitation result', result);																		Eve.Resource.superbridge.broadcast(this, 'admin_edit_group_dlg', {										info: {											id: Eve.Admin.selectedGroup										}									});																	}								,scope	: this							})											}					}				},{					 layout: 'form'					,columnWidth: 0.25					,items: {						xtype: 'button'						,text: 'Add users to group'						,handler: function() {					Ext.Ajax.request({						url		: Eve.url						,params	: {							event			: 'modern.administrator.group.addUserToGroup'							,users			: Ext.getCmp('adminGroupInviteUsers').getValue()							,message		: Ext.getCmp('adminGroupInviteMessage').getValue()							,groupId		: Eve.Admin.selectedGroup 						}						,success: function(res) {							var result = Ext.DomQuery.selectValue('resultText', res.responseXML)							Ext.getCmp('adminGroupInviteUsers').setValue('');							Ext.getCmp('adminGroupInviteMessage').setValue('');							Ext.Msg.alert('Add result', result);														Eve.Resource.superbridge.broadcast(this, 'admin_edit_group_dlg', {								info: {									id: Eve.Admin.selectedGroup								}							});																				}						,scope	: this					})																}					}				}]				        			},{				 xtype: 'fieldset'				,title: 'Current Group Members'				,autoHeight: true				,style: 'margin-top: 10px;'				,anchor: '100%'				,items: [{					 xtype: 'panel'					,style: 'border: 1px solid #D0D0D0; background: #fff;'					,items: [{						 xtype: 'panel'						,layout: 'form'						,bodyStyle: 'padding: 3px; padding-left: 7px; border-bottom: 1px solid #D0D0D0;'						,cls: 'x-grid3-header'						,labelWidth: 40						,items: [{							 xtype: 'textfield'							,fieldLabel: 'Search'							,id: 'adminGroupMembersSearchTextfield'							,anchor: '99%'							,enableKeyEvents: true							,listeners: {								keyup: function()								{									Ext.getCmp('dvAdminGroupUsers').store.filterBy(											function(rec, id) {																								if (this.getValue() == '')													return true;																								if (rec.data.userName.match(new RegExp(this.getValue(), 'i')) || rec.data.lastName.match(new RegExp(this.getValue(), 'i')) || rec.data.firstName.match(new RegExp(this.getValue(), 'i')))													return true;												else													return false;											}, Ext.getCmp('adminGroupMembersSearchTextfield'));																	}							}						}]				    },{						hideLabel: true,						xtype: 'xdataview',						name: 'usersGroup',						id: 'dvAdminGroupUsers',						itemSelector: 'div.x-group-select',						selectedClass: 'x-group-selected',						singleSelect: true,						emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',						height: 200,						autoScroll: true,						tpl: new Ext.XTemplate(										'<div style="padding: 5px; background: #fff;">',											'<tpl for=".">', 												'<div style="margin: 5px; padding: 9px;" class="x-group-select">',													'<img src="{[this.userImagePath(values)]}" alt="{username}" style="float: left; width: 50px; height: 50px; padding-right: 10px;" /> <div style="float: left;">{firstName} {lastName}<br />({[this.getOwner(values)]})</div>',													'<div style="float: right;">{[this.editPermissionButton(values)]} {[this.deleteButton(values)]}</div><div style="clear: both;"></div>',												'</div>', 											'</tpl>',										'</div>',									{										deleteButton: function(values)										{											if (values.owner != 1)												return '<img src="' + Eve.imagePath + 'general/delete.png" onclick="Eve.Resource.superbridge.broadcast(this, \'admin_users_delete_group_membership_group\', {groupId: ' + Eve.Admin.selectedGroup + ', userId: ' + values.id + '})" />';											else												return '';										}, 										editPermissionButton: function(values)										{											if (values.owner != 1 && values.invited == 'false')												return '<img src="' + Eve.imagePath + 'general/edit.png" onclick="Eve.Resource.superbridge.broadcast(this, \'admin_users_edit_group_membership\', {groupId: ' + Eve.Admin.selectedGroup + ', userId: ' + values.id + '})" />';											else												return '';																					},										userImagePath: function(values)										{											if (values.UserImagePath == '/hyperoffice2nd/views/styles/modernstyle/images/noUserImage.gif')												return Eve.imagePath + 'contact/item-icon.png';											else												return values.UserImagePath																					},										getOwner: function(values)										{											return (values.owner == 1 ? "Owner" : (values.administrator == 1 ? "Administrator" : (values.invited != "false" ? "Invitation Sent" : "Basic Group Member")));										}									}),						store: new Ext.data.Store({							reader: new Ext.data.XmlReader({								record: 'row',								id: 'id'							}, ['id', 'firstName', 'lastName', 'userName', 'owner', 'administrator', 'invited', 'UserImagePath'])						})					}]				}]			}]		}]	});}Eve.Admin.GroupDetailsProperties = function() {	return new Eve.FormPanel({		 id: 'GroupDetailsProperties'		,border: false		,autoScroll: true		,items:		[{			 width: 700			,layout: 'form'			,border: false			,items: [{				xtype: 'textfield'				,fieldLabel: 'Group Name'				,smname: 'foldersPermissions>title'				,name: 'title'				,anchor: '99%'			},{				 html		: '<img id="adminGroupLogoImage" src="' + Eve.Resource.getIcon('no-logo','general') + '" width="100" height="100" style="padding-bottom: 2px;" />'				,bodyStyle	: 'padding-left: 105px;'			},{			layout 	: 'column'			,items : [{				columnWidth : .31				,items		:[{				xtype	: 'button'				,id		: 'adminGroupLogoUpload'				,text	: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edit Logo&nbsp;&nbsp;&nbsp;&nbsp;'				,style	: 'padding-left: 110px; padding-bottom: 10px;'			}]			},{				columnWidth : .4				,items		:[{html:'<span style="vertical-align:middle">We recommend using a ( 260px x 84px ) jpeg image'}]			}]			}				,{				xtype: 'textarea'				,fieldLabel: 'Description'				,name: 'description'				,smname: 'foldersPermissions>description'				,anchor: '99%'			},{				xtype: 'fieldset',				title: 'Sections',				autoHeight: true,				anchor: '84%',				style: 'margin-left:105px',				items: [{					 layout: 'column'					,items: [{						layout: 'form'						,defaults: {							hideLabel: true											}						,items: [{							xtype: 'checkbox'							,boxLabel: 'Allow group members to see all members'							,name: 'AllowMembersToSeeAllGroupMembers'							,smname: 'foldersPermissions>allowMembersToSeeAllGroupMembers'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a calendar section'							,name: 'usecalendar'							,smname: 'foldersPermissions>useCalendar'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a tasks section'							,name: 'usetasks'							,smname: 'foldersPermissions>useTasks'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a forums section'							,name: 'useforums'							,smname: 'foldersPermissions>useForums'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a wiki section'							,name: 'usewiki'							,smname: 'foldersPermissions>useWiki'						}]					},{						layout: 'form'						,defaults: {							hideLabel: true											}						,items: [{							xtype: 'checkbox'							,boxLabel: 'Group has a contacts section  '							,name: 'usecontacts'							,smname: 'foldersPermissions>useContacts'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a shared documents section'							,name: 'uselibrary'							,smname: 'foldersPermissions>useLibrary'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a voting section'							,name: 'usevoting'							,smname: 'foldersPermissions>useVoting'						},{							xtype: 'checkbox'							,boxLabel: 'Group has a links section'							,name: 'uselinks'							,smname: 'foldersPermissions>useLinks'						}]						}]				}]			},{				 xtype: 'panel'				,style: 'display: none;'				,items: {					xtype: 'checkbox'					,bodyStyle: 'display: none'					,name: 'useMotd'				}			},{				xtype: 'checkbox'					,fieldLabel: 'Public calendar'					,boxLabel: 'Password protect the public calendar'					,handler: function(obj, checked)					{						if (checked)							Ext.getCmp('adminGroupEditPassword').setVisible(true);						else							Ext.getCmp('adminGroupEditPassword').setVisible(false);					}				},{					xtype: 'textfield'					,fieldLabel: 'Calendar Url'					,selectOnFocus: true					,name: 'publicCalendarUrl'					,anchor: '100%'										},{					xtype: 'fieldset',					title: 'Password',					autoHeight: true,					anchor: '100%',					id: 'adminGroupEditPassword',					hidden: true,					items: [						{							xtype: 'textfield'							,anchor: '95%'							,name: 'group_password'							,inputType: 'password'							,fieldLabel: 'Password'						},{							xtype: 'textfield'							,anchor: '95%'							,name: 'group_password_v'							,inputType: 'password'							,fieldLabel: 'Password (verify)'						}]				}]		}]	});}Eve.Admin.GroupCreate = function() {	return new Eve.FormPanel({		 id: 'GroupCreate'		,border: false		,bodyStyle: 'padding: 5px;'		,items:		[{			 width: 600			,layout: 'form'			,border: false			,items: [{				xtype: 'textfield'				,fieldLabel: 'Group Name'				,smname: 'foldersPermissions>title'				,name: 'title'				,anchor: '95%'			},{				xtype: 'textarea'				,fieldLabel: 'Description'				,name: 'description'				,smname: 'foldersPermissions>description'				,anchor: '95%'			},{				xtype: 'fieldset',				title: 'Sections',				autoHeight: true,				anchor: '100%',				items: [{					 layout: 'column'					,items: [{						layout: 'form'						,defaults: {							hideLabel: true											}						,items: [{							xtype: 'checkbox'							,boxLabel: 'Allow group members to see all members'							,name: 'AllowMembersToSeeAllGroupMembers'							,smname: 'foldersPermissions>allowMembersToSeeAllGroupMembers'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a calendar section'							,name: 'usecalendar'							,smname: 'foldersPermissions>useCalendar'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a tasks section'							,name: 'usetasks'							,smname: 'foldersPermissions>useTasks'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a forums section'							,name: 'useforums'							,smname: 'foldersPermissions>useForums'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a wiki section'							,name: 'usewwiki'							,smname: 'foldersPermissions>useWiki'							,checked: true						}]					},{						layout: 'form'						,defaults: {							hideLabel: true											}						,items: [{							xtype: 'checkbox'							,boxLabel: 'Group has a contacts section  '							,name: 'usecontacts'							,smname: 'foldersPermissions>useContacts'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a shared documents section'							,name: 'uselibrary'							,smname: 'foldersPermissions>useLibrary'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a voting section'							,name: 'usevoting'							,smname: 'foldersPermissions>useVoting'							,checked: true						},{							xtype: 'checkbox'							,boxLabel: 'Group has a links section'							,name: 'uselinks'							,smname: 'foldersPermissions>useLinks'							,checked: true						}]						}]				}]			},{				xtype: 'checkbox'				,fieldLabel: 'Public calendar'				,boxLabel: 'Password protect the public calendar'				,handler: function(obj, checked)				{					if (checked)						Ext.getCmp('adminGroupCreatePassword').setVisible(true);					else						Ext.getCmp('adminGroupCreatePassword').setVisible(false);				}			},{				xtype: 'fieldset',				title: 'Password',				autoHeight: true,				anchor: '100%',				id: 'adminGroupCreatePassword',				hidden: true,				items: [					{						xtype: 'textfield'						,anchor: '95%'						,fieldLabel: 'Password'						,name: 'group_password'						,inputType: 'password'					},{						xtype: 'textfield'						,anchor: '95%'						,fieldLabel: 'Password (verify)'						,name: 'group_password_v'						,inputType: 'password'					}]			}]		},{			xtype: 'hidden',			name: 'canread',			value: 'true'		},{			xtype: 'hidden',			name: 'canwrite',			value: 'true'		},{			xtype: 'hidden',			name: 'candelete',			value: 'true'		},{			xtype: 'hidden',			name: 'cancreatedirs',			value: 'true'		},{			xtype: 'hidden',			name: 'isSubGroup',			value: '0'		}]	});}Eve.Admin.GroupFolderPermissions = function() {	return new Eve.FormPanel({		 id: 'GroupFolderPermissions'		 ,autoScroll: true		,border: false		,items:		[{			 width: 600			,border: false			,layout: 'form'			,items: [{				xtype: 'fieldset',				title: 'Permissions',				autoHeight: true,				anchor: '100%',				items: [{					xtype: 'combo',					name: 'path',					smname: 'directories',					id: 'adminFolderUserPermissionFolders',					displayField: 'path',					valueField: 'path',					fieldLabel: 'Directory',					mode: 'local',					typeAhead: true,					editable: false,					defaultSelection: false,					emptyText: 'Pick a directory...',					tpl: new Ext.XTemplate(						'<tpl for=".">',							'<div class="x-combo-list-item">{[this.replaceGroupName(values)]}</div>',						'</tpl>',						{							replaceGroupName: function(values)							{								return values.path;								//return values.path.replace('/groups/g' + Eve.Admin.UserGroupPermission.groupId, Eve.Admin.UserGroupPermission.groupTitle);							}						}					),					selectOnFocus: true,					triggerAction: 'all',					anchor: '99%'										},{					layout: 'column'					,border: false					,defaults: {layout: 'form'}					,items: [{					     columnWidth: 0.15					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Read'							,name: 'p_read'							,id: 'adminFolderUserPermissionRead'							,hideLabel: true					    }]					},{					     columnWidth: 0.15					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Write'							,id: 'adminFolderUserPermissionWrite'							,name: 'p_write'							,hideLabel: true					    }]					},{					     columnWidth: 0.15					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Delete'							,id: 'adminFolderUserPermissionDelete'							,name: 'p_delete'							,hideLabel: true					    }]					},{					     columnWidth: 0.25					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Create Directories'							,name: 'p_createdir'							,id: 'adminFolderUserPermissionCreateDir'							,hideLabel: true					    }]					},{					     columnWidth: 0.3						    ,items: [{								xtype: 'checkbox'								,boxLabel: 'Inherit permissions'								,name: 'p_removeperms'								,id: 'adminFolderUserPermissionRemovePermissions'								,hideLabel: true						    }]					}]				},{							 width: 600					,layout: 'form'					,border: false					,items: [{		                    layout : 'form'		                    ,height : 170		                    ,bodyStyle: 'padding: 10px;'		                    ,frame	: false		                    ,border	: false		                    ,items: [{		                        xtype		: 'itemselector'		                        ,hideLabel	: true		                        ,msWidth	: 263		                        ,msHeight	: 130		                        ,width		: 550		                        ,height		: 150		                        ,valueField	: 'id'		                        ,displayField   : 'firstName'		                        ,fromNodeField: 'groupUsers'		                        ,fromLegend	: 'Available users'		                        ,toLegend	: 'Users to modify'		                        ,dataFields	: ['administrator', 'owner', 'username', 'lastName', 'firstName', 'id']		                        ,smname		: 'data'		                        ,name		: 'selectedUsers'		                        ,fromData	: []		                        ,toData		: []		                        ,fromTpl	: '<tpl for="."><div class="ux-mselect-item' + ((Ext.isIE || Ext.isIE7) ? '" unselectable=on' : ' x-unselectable"') + '>{lastName}, {firstName} ({username}) {[(values.owner == 1 ? "(Owner)" : "")]} {[(values.administrator == 1 ? "(Administrator)" : "")]} </div></tpl>'		                        ,toTpl	: '<tpl for="."><div class="ux-mselect-item' + ((Ext.isIE || Ext.isIE7) ? '" unselectable=on' : ' x-unselectable"') + '>{lastName}, {firstName} ({username}) {[(values.owner == 1 ? "(Owner)" : "")]} {[(values.administrator == 1 ? "(Administrator)" : "")]} </div></tpl>'		                        ,drawUpIcon	: false		                        ,drawBotIcon: false		                        ,drawTopIcon: false		                        ,drawDownIcon: false		                        ,drawAllRightIcon: false		                        ,drawAllLeftIcon: false		                    }]					}]				}]			}]		}]	});}Eve.Admin.GroupDetailsDefaultUserPermissions = function(){	return new Eve.FormPanel(		{		 id: 'GroupDetailsDefaultUserPermissions'		,border: false		,autoScroll: true		,items: [{			 width: 600			,border: false			,layout: 'form'			,items: [{				xtype: 'fieldset',				title: 'Permissions',				autoHeight: true,				anchor: '100%',				items: {					layout: 'form',					labelWidth: 200,					defaults: {						displayField: 'text',						valueField: 'value',						mode: 'local',						typeAhead: true,						editable: false,						selectOnFocus: true,						triggerAction: 'all',						loadPrevent: true,						anchor: '90%'					},					items: [{						xtype: 'combo',						name: 'tasksPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the tasks section'], ['1', 'Only view tasks'], ['2', 'View and add tasks'], ['3', 'View, add, edit, and delete tasks that they create'], ['4', 'View, add, edit, and delete tasks that any user creates']]						}),						fieldLabel: 'Tasks Permissions'					}, {						xtype: 'combo',						name: 'contactsPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the contacts section'], ['1', 'Only view contacts'], ['2', 'View and add contacts'], ['3', 'View, add, edit, and delete contacts that they create'], ['4', 'View, add, edit, and delete contacts that any user creates']]						}),						fieldLabel: 'Contacts Permissions'					}, {						xtype: 'combo',						name: 'calendarPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the calendar section'], ['1', 'Only view calendar events'], ['2', 'View and add calendar events'], ['3', 'View, add, edit, and delete calendar events that they create'], ['4', 'View, add, edit, and delete calendar events that any user creates']]						}),						fieldLabel: 'Calendar Permissions'					}, {						xtype: 'combo',						name: 'votingPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the voting section'], ['1', 'Only view voting items'], ['2', 'View and interact with voting items'], ['3', 'View, add, and interact with voting items'], ['4', 'View, add, edit, and delete voting items that he creates'], ['5', 'View, add, edit, and delete voting items that any user creates']]						}),						fieldLabel: 'Voting Permissions'					}, {						xtype: 'combo',						name: 'linksPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the links section'], ['1', 'Only view links'], ['2', 'View and add links'], ['3', 'View, add, edit, and delete links that he creates'], ['4', 'View, add, edit, and delete links that any user creates']]						}),						fieldLabel: 'Links Permissions'					}, {						xtype: 'combo',						name: 'forumsPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the forums section'], ['1', 'Only view messages'], ['2', 'View and add messages'], ['3', 'View, add, edit, and delete messages that he creates'], ['4', 'View, add, edit, and delete messages that any user creates'], ['5', 'Forums administrator (add, edit, and delete messages/topics)']]						}),						fieldLabel: 'Forums Permissions'					}, {						xtype: 'combo',						name: 'wikiPermissions',						store: new Ext.data.SimpleStore({							fields: ['value', 'text'],							data: [['0', 'Banned from the Wiki section'], ['1', 'Only view wiki pages'], ['2', 'View and add wiki pages '], ['3', 'View, add, edit, and delete wiki pages that he creates'], ['4', 'View, add, edit, and delete wiki pages that any user creates']]						}),						fieldLabel: 'Wiki Permissions'					}]				}			},{				xtype: 'fieldset',				title: 'Permissions',				autoHeight: true,				anchor: '100%',				items: [{				    layout: 'column'				    ,border: false				    ,defaults: {layout: 'form'}				    ,items:				    	[{				    		columnWidth: 0.9				    		,items: [{								xtype: 'combo',								name: 'opt',								smname: 'DocumentPermissionIterator',								id: 'adminDefaultUserPermissionFolders',								store 	: new Ext.data.Store({									reader 	: new Ext.data.XmlReader({										record 	: 'row'									}, [{name: 'text', mapping:'path'},{name: 'path'}])								,listeners : {									load : function(st, records, options){											if (records.length > 500)												Ext.Msg.alert('Warning', 'This group currently has more than 500 folders in it. Please manage the permissions inside the shared documents section by right-clicking on the folder you would like to manage and clicking on "details" and then clicking on the "permissions" tab');									}								}								}),								displayField: 'text',								valueField: 'path',								fieldLabel: 'Directory',								mode: 'local',								typeAhead: true,								editable: false,								defaultSelection: false,								emptyText: 'Pick a directory...',								/*tpl: new Ext.XTemplate(									'<tpl for=".">',										'<div class="x-combo-list-item">{[this.replaceGroupName(values)]}</div>',									'</tpl>',									{										replaceGroupName: function(values)										{											return values.path.replace('/groups/g' + Eve.Admin.UserGroupPermission.groupId, Eve.Admin.UserGroupPermission.groupTitle);										}									}								),*/								selectOnFocus: true,								triggerAction: 'all',								anchor: '99%'													    		}]						},{							columnWidth: 0.1							,items: [{								 text: 'Add'								,xtype: 'button'								,handler: function() {//									Eve.Resource.superbridge.broadcast(this, 'admin_group_folderpermission_dlg');//									return;									var row = {};									var cbo	= Ext.getCmp('adminDefaultUserPermissionFolders');									row.path = cbo.getValue();									row.text = cbo.getRawValue();																		if (row.path == '') {										Ext.Msg.alert('Note', 'Please select a folder from combobox in order to add permission');										return;									}																		if (Ext.getCmp('dvAdminDefaultUserEditPermissions').store.find('path', new RegExp('^' + row.path + '$')) != -1)	{										Ext.Msg.alert('Note', 'Please remove the current permissions for ' + row.path + ' before adding a new set of permissions to the same folder.');										return;									}																											if (Ext.getCmp('adminDefaultUserPermissionRead').getValue())										row.canRead = 1;									else										row.canRead = -1;									if (Ext.getCmp('adminDefaultUserPermissionWrite').getValue())										row.canWrite = 1;									else										row.canWrite = -1;									if (Ext.getCmp('adminDefaultUserPermissionDelete').getValue())										row.canDelete = 1;									else										row.canDelete = -1;									if (Ext.getCmp('adminDefaultUserPermissionCreateDir').getValue())										row.canCreateDirs = 1;									else										row.canCreateDirs = -1;																		var rec = Ext.data.Record.create(['id', 'index', 'canDelete', 'canRead', 'canCreateDirs', 'canWrite', 'path', 'text']);									var newRec = new rec(row);									Ext.getCmp('dvAdminDefaultUserEditPermissions').store.add(newRec);																		Ext.getCmp('adminDefaultUserPermissionRead').setValue(false);									Ext.getCmp('adminDefaultUserPermissionWrite').setValue(false);									Ext.getCmp('adminDefaultUserPermissionDelete').setValue(false);									Ext.getCmp('adminDefaultUserPermissionCreateDir').setValue(false);																	}							}]													}]				},{					layout: 'column'					,border: false					,defaults: {layout: 'form'}					,items: [{					     columnWidth: 0.2					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Read'							,id: 'adminDefaultUserPermissionRead'							,hideLabel: true					    }]					},{					     columnWidth: 0.2					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Write'							,id: 'adminDefaultUserPermissionWrite'							,hideLabel: true					    }]					},{					     columnWidth: 0.2					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Delete'							,id: 'adminDefaultUserPermissionDelete'							,hideLabel: true					    }]					},{					     columnWidth: 0.4					    ,items: [{							xtype: 'checkbox'							,boxLabel: 'Create Directories'							,id: 'adminDefaultUserPermissionCreateDir'							,hideLabel: true					    }]					    					}]				},{					xtype		: 'panel',					height		: 100,					bodyStyle	: 'border: 1px solid #D0D0D0; background: #fff;',					layout		: 'fit',					items		: [{						xtype		: 'xdataview',						name		: 'folderPermissions',						id			: 'dvAdminDefaultUserEditPermissions',						smname		: 'DocumentPermissionIterator',					    field		: ['path', 'canRead', 'canWrite', 'canDelete', 'canCreateDirs', 'text'],						itemSelector: 'div.opt_item',						emptyText	: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',						autoScroll	: true,						hideLabel	: true,						tpl			: new Ext.XTemplate(							'<div>',								'<tpl for=".">',									'{[this.createPermissionRow(values, xindex)]}',								'</tpl>',							'</div>', {							createPermissionRow: function(values, xindex)							{								var output = '';								var permissions = [];								if (values.canRead != 0 && values.canRead != '') {									if (values.text) {										output += values.text;									} else {										var tree	= Ext.getCmp('adminGroupsTree');										var att		= tree.getSelectionModel().getSelectedNode().attributes;										output	   += values.path.replace('/groups/g' + att.id, att.text);									}									if (values.canRead == 1)										permissions.push('Read');									if (values.canWrite == 1)										permissions.push('Write');									if (values.canDelete == 1)										permissions.push('Delete');									if (values.canCreateDirs == 1)										permissions.push('Create dirs');									if (permissions.length == 0)										permissions.push('No permission');									output += ' (' + permissions.join(', ') + ')';									output = '<div style="padding: 5px; padding-left: 10px; border-bottom: 1px solid #D0D0D0;">' + output + '<div style="float: right;"><img src="' + Eve.imagePath + 'general/delete.png" onclick="Ext.getCmp(\'dvAdminDefaultUserEditPermissions\').store.removeAt(' + (xindex -1) + '); Ext.getCmp(\'dvAdminDefaultUserEditPermissions\').view.refresh()" /></div></div>';								} else {									var dv = Ext.getCmp('dvAdminDefaultUserEditPermissions');									dv.store.remove(dv.store.getById(values.index));								}								return output;							}						}),						store: new Ext.data.Store({							reader: new Ext.data.XmlReader({								record: 'row',								id: 'index'							}, ['index', 'canDelete', 'canRead', 'canCreateDirs', 'canWrite', 'path'])						})					}]				}]			},{					xtype: 'button'					,text: 'To apply folder permissions to multiple users click here.'					,handler: function() {						Eve.Resource.superbridge.broadcast(this, 'admin_group_folderpermission_dlg', {info: {id: Eve.Admin.selectedGroup}});					}					,minWidth  : 600			}]		}]	});};//* * * * * * * * * * * * * * * * * * * * //Participants (Group Membership, Portal)//* * * * * * * * * * * * * * * * * * * * Eve.Admin.GroupInviteParticipants = function(){	return new Eve.FormPanel({     labelWidth	: 70		,labelAlign	: 'left'     ,frame		: false     ,bodyStyle	: 'padding: 20px'     ,items 		: [{			xtype			: 'panel'			,border			: true			,autoScroll		: true			,style			: 'margin-top: 5px; background-color:#FFF;'			,items			: [{				html : 	'<table width="100%" class="x-form-item ev-dataview-header"><tr>'							+ '<td style="width:20px;"><input type="checkbox" id="adminCheckAllParticipants" /></td>'							+ '<td style="width:200px;">Name</td>'						+ '</tr></table>'			}, {				xtype			: 'xdataview'				,name			: 'contacts'				,id				: 'dvAdminParticipants'				,hideLabel		: true				,itemSelector	: 'div.search-item'				,emptyText		: '<div style="text-align:center; padding-top: 10px"><i>No contact.</i></div>'				,height			: 150				,store			: new Ext.data.Store({					reader	: new Ext.data.XmlReader({						record		: 'row'						,id			: 'id'					}, ['id', 'contact', 'contactEmail'])				})				,tpl			: new Ext.XTemplate(					'<table id="adminParticipantTable" width="100%" class="x-form-item">',					'<tpl for=".">',					 '<tr>',						'<td width="20px">&nbsp;<input type="checkbox" id="{id}" class="admin-participant-checkbox" /></td>',						'<td width="290px">{[this.convert(values.contact)]}</td>',					 '</tr>',					'</tpl>',					'</table>',	{						convert : function(c) {return c.replace('<', '&lt;')}					}				)			}]		}]	})};Eve.vc.createFormPanel( 'AdminGroupDetailsProperties'			, Eve.Admin.GroupDetailsProperties );Ext.override( Eve.vc.AdminGroupDetailsProperties, {	  loadEvent 	: function(){return 'modern.administrator.edit.group';}	 ,submitEvent 	: function(){return 'modern.administrator.group.updateGroup';}});Eve.vc.createFormPanel( 'AdminGroupCreate'			, Eve.Admin.GroupCreate );Ext.override( Eve.vc.AdminGroupCreate, {	  submitEvent 	: function(){return 'modern.administrator.group.createGroup';}});Eve.vc.createFormPanel( 'AdminGroupDetailsManageUsers'			, Eve.Admin.GroupDetailsManageUsers );Ext.override( Eve.vc.AdminGroupDetailsManageUsers, {	  loadEvent 	: function(){return 'modern.administrator.edit.group';}	 ,submitEvent 	: function(){return 'modern.administrator.group.updateGroup';}});Eve.vc.createFormPanel( 'AdminGroupDetailsDefaultUserPermissions'			, Eve.Admin.GroupDetailsDefaultUserPermissions );Ext.override( Eve.vc.AdminGroupDetailsDefaultUserPermissions, {	  loadEvent 	: function(){return 'modern.administrator.edit.group';}	 ,submitEvent 	: function(){return 'modern.administrator.group.updateGroup';}});Eve.vc.createFormPanel( 'AdminGroupFolderPermissions'			, Eve.Admin.GroupFolderPermissions );Ext.override( Eve.vc.AdminGroupFolderPermissions, {	  loadEvent 	: function(){return 'modern.administrator.edit.folder';}	 ,submitEvent 	: function(){return 'modern.administrator.group.modifyFolder';}});Eve.vc.createFormPanel( 'AdminGroupInviteParticipants', Eve.Admin.GroupInviteParticipants );Ext.override( Eve.vc.AdminGroupInviteParticipants, {	  loadEvent 	: function(){return 'modern.contact.group.getGroupContacts';}	 ,submitEvent 	: function(){return '';}});/************************************************************************ * 					 Profiles section ************************************************************************/Eve.Admin.ProfileDetails = function() {	return new Eve.FormPanel({		 border: false		,bodyStyle: 'overflow: auto;'		,id : 'ProfileDetailProperties'		,items: [{						layout : 'form'						,width : 400						,labelWidth : 150						,style : 'margin-bottom:10px'						,items : [{							xtype : 'textfield'							,fieldLabel : 'Profile Name'							,name: 'ProfileName'							,smname: 'name'							,id: 'adminProfileDetailsProfileName'							,anchor : '95%'						}, {							xtype			: 'combo'							,id				: 'adminProfileDetailsLandingPage'							,fieldLabel		: 'Default Landing Page'							,anchor			: '95%'							,name			: 'landingPage'							,smname			: 'defaultLandingPage'							,triggerAction	: 'all'							,selectOnFocus	: true							,typeAhead      : true							,editable		: false							,allowBlank		: true							,minChars      	: 1							,valueField		: 'value'							,displayField	: 'text'							,mode           : 'local'							,loadPrevent	: true							,store			: new Ext.data.SimpleStore({								fields	: ['value', 'text', 'shared'],								data	: [['Desktop', 'Desktop', false],									   ['Mail', 'Mail', false],									   ['MyCalendar', 'My Calendar', false],									   ['MyDocuments', 'My Documents', false],									   ['MyContacts', 'My Contacts', false],									   ['MyTasks', 'My Tasks', false],									   ['MyLinks', 'My Links', false],									   ['Notes', 'Notes', false],									   ['Reminders', 'Reminders', false],									   ['Search', 'Search', false],									   ['Homepage', 'Homepage', true],									   ['SharedCalendar', 'Shared Calendar', true],									   ['SharedContacts', 'Shared Contacts', true],									   ['SharedDocuments', 'Shared Documents', true],									   ['SharedTasks', 'Shared Tasks', true],									   ['Forum', 'Forum', true],									   ['Voting', 'Voting', true],									   ['Wiki', 'Wiki', true],									   ['SharedLinks', 'Shared Links', true]								]							})							,listeners		: {								select	: function(cbo, record, index) {									var cboLandingGroup = Ext.getCmp('adminProfileDetailLandingGroupContainer');									if (record.get('shared')) {										cboLandingGroup.show();									} else {										cboLandingGroup.hide();									}								},								change: function(element, newVal, oldVal)								{									if (!Ext.getCmp('profilecheck' + newVal).getValue())									{										Ext.Msg.alert('Error', 'You can not set landing page to a disabled section.')										element.setValue(oldVal);									}								}													}						}, {							layout			: 'form'							,id				: 'adminProfileDetailLandingGroupContainer'							,items			: [{								xtype			: 'combo'								,fieldLabel		: 'Landing Group'								,name			: 'landinggroup'								,id				: 'adminProfileDetailsLandingGroup'								,smname			: 'group'								,anchor			: '95%'								,triggerAction	: 'all'								,selectOnFocus	: true								,typeAhead      : true								,forceSelection : true								,editable		: false								,minChars      	: 1								,valueField		: 'id'								,displayField	: 'title'								,mode           : 'local'								,store		: new Ext.data.Store({									data	: []									,fields	: [ 'title', 'id' ]									,reader	: new Ext.data.XmlReader({										record	: 'row'									}, [ 'title', 'id' ])								})							}]						}]					},{		  xtype		: 'tabpanel'		  ,id		: 'adminPortalDetailTabPanel'		 ,activeTab	: 0		 ,deferredRender: false					 ,listeners : {						 tabchange : function(tabPabel, panel){							panel.doLayout();						 }					 }		 ,items: [{			 title: 'Portal Customization'			,layout: 'form'			,bodyStyle: 'padding: 5px;'			,height : 290			,frame	: false			,border	: false			,items: [{				layout : 'column'				,items : [{					layout : 'form'					,columnWidth : .3					,labelWidth : 1					,items  : [{						xtype			: 'checkbox'						,boxLabel		: 'Personal'						,name			: 'personalmain'						,id				: 'adminPortalPersonal'						,labelSeparator : ''						,checked		: true						,listeners		: {							check	: function(cBox, checked) {								var boxes = Ext.select('.admin-portal-cust-personal', false, 'adminPortalCustomizationTabPersonal');								boxes.each(function(box) {									Ext.getCmp(box.dom.id).setValue(checked);								})							}						}					}, {						layout : 'column'						,items : [{							layout		: 'form'							,id			: 'adminPortalCustomizationTabPersonal'							,style		: 'margin-left:20px'							,columnWidth: 1							,defaults: {								listeners: {									check: function(element, checked) {										if (!checked) {											if (element.getId() == 'profilecheck' + Ext.getCmp('adminProfileDetailsLandingPage').getValue())											{												element.setValue(true);												Ext.Msg.alert('Error', 'You can not disable default landing page.');											}										} else {											Ext.getCmp('adminPortalPersonal').setValue(true);										}									}								}							}							,items		: [{								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'desktop'								,boxLabel		: 'Desktop'								,id				: 'profilecheckDesktop'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'mail'								,id				: 'profilecheckMail'								,boxLabel		: 'Mail'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'myCalendar'								,boxLabel		: 'My Calendar'								,id				: 'profilecheckMyCalendar'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'myDocuments'								,id				: 'profilecheckMyDocuments'								,boxLabel		: 'My Documents'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'myContacts'								,id				: 'profilecheckMyContacts'								,boxLabel		: 'My Contacts'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'myTasks'								,id				: 'profilecheckMyTasks'								,boxLabel		: 'My Tasks'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'myLinks'								,id				: 'profilecheckMyLinks'								,boxLabel		: 'My Links'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'notes'								,id				: 'profilecheckNotes'																	,boxLabel		: 'Notes'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'reminders'								,id				: 'profilecheckReminders'								,boxLabel		: 'Reminders'								,cls			: 'admin-portal-cust-personal'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'search'								,boxLabel		: 'Search'								,id				: 'profilecheckSearch'								,cls			: 'admin-portal-cust-personal'							}]						}]					}]				}, {					layout : 'form'					,columnWidth : .3					,labelWidth : 1					,items  : [{						xtype			: 'checkbox'						,boxLabel		: 'Groups'						,id				: 'adminPortalGroup'						,name			: 'groupsmain'						,checked		: true						,labelSeparator : ''						,listeners		: {							check	: function(cBox, checked) {								var boxes = Ext.select('.admin-portal-cust-groups', false, 'adminPortalCustomizationTabGroups');								boxes.each(function(box) {									Ext.getCmp(box.dom.id).setValue(checked)								})							}						}					}, {						layout : 'column'						,items : [{							layout		: 'form'							,id			: 'adminPortalCustomizationTabGroups'							,style		: 'margin-left:20px'							,columnWidth: 1							,defaults: {								listeners: {									check: function(element, checked) {										if (!checked) {											if (element.getId() == 'profilecheck' + Ext.getCmp('adminProfileDetailsLandingPage').getValue())											{												element.setValue(true);												Ext.Msg.alert('Error', 'You can not disable default landing page.');											} else {												Ext.getCmp('adminPortalGroup').setValue(true);																							}										}									}								}							}							,items		: [{								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'homePage'								,id				: 'profilecheckHomepage'								,boxLabel		: 'Homepage'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'sharedCalendar'								,id				: 'profilecheckSharedCalendar'								,boxLabel		: 'Shared Calendar'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'sharedTasks'								,id				: 'profilecheckSharedTasks'								,boxLabel		: 'Shared Tasks'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'sharedDocuments'								,id				: 'profilecheckSharedDocuments'								,boxLabel		: 'Shared Documents'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'sharedContacts'								,id				: 'profilecheckSharedContacts'								,boxLabel		: 'Shared Contacts'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'sharedLinks'								,id				: 'profilecheckSharedLinks'								,boxLabel		: 'Shared Links'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'forum'								,id				: 'profilecheckForum'								,boxLabel		: 'Forum'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'voting'								,id				: 'profilecheckVoting'								,boxLabel		: 'Voting'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'wiki'								,id				: 'profilecheckWiki'								,boxLabel		: 'Wiki'								,cls			: 'admin-portal-cust-groups'							}, {								xtype			: 'checkbox'								,labelSeparator : ''								,name			: 'publisher'								,id				: 'profilecheckPublisher'								,boxLabel		: 'Publisher'								,cls			: 'admin-portal-cust-groups'							}]						}]					}]				}, {					layout : 'form'					,columnWidth : 0.3					,items : [{						xtype : 'checkbox'						,labelSeparator : ''						,name: 'im'						,boxLabel : 'IM'					}]				}]			}]		},{		title: 'User Assignment'		,items: {					layout : 'form'					,height : 290					,bodyStyle: 'padding: 25px;'					,frame	: false					,border	: false					,items: [{						xtype		: 'itemselector'						,hideLabel	: true						,msWidth	: 263						,msHeight	: 130						,width		: 550						,height		: 150						,fromNodeField: 'users'						,valueField	: 'id'						,displayField   : 'username'						,fromLegend	: 'Available users'						,name		: 'users'						,collectSeparator: '*'						,smname		: 'data'						,toLegend	: 'Users to assign'						,dataFields	: ['firstName', 'lastName', 'name', 'username', 'id']						,fromData	: []						,toData		: []						,fromTpl	: '<tpl for="."><div class="ux-mselect-item' + ((Ext.isIE || Ext.isIE7) ? '" unselectable=on' : ' x-unselectable"') + '>{lastName}, {firstName} ({username}) - {name}</div></tpl>'						,drawUpIcon	: false						,drawBotIcon: false						,drawTopIcon: false						,drawDownIcon: false						,drawAllRightIcon: false						,drawAllLeftIcon: false						,id: 'adminProfileUserAssignment'					}, {						xtype : 'button'						,minWidth  : 545						,text : 'You can either save the profile\n\						or if you would like to lock their personal \n\						desktops, click here.'						,handler : function() {							Ext.getCmp('adminPortalDetailTabPanel').setActiveTab(2);						}					}]		}		}, {			 title : 'Desktop Preferences'			 ,items : {				layout : 'form'				,bodyStyle: 'padding: 10px;overflow: auto;'				,frame	: false				,border	: false				,height : 350				,labelWidth : 180				,items : [{					layout : 'column'					,items : [{						layout : 'form'						,columnWidth : .4						,items : [{							xtype : 'radio'							,boxLabel	: 'Allow users to customize their desktop'							,name		: 'desktopprefs'							,id			: 'adminProfileLockDesktopPermit'							,inputValue		: 'permit'							,checked	: true							,hideLabel	: true							,listeners	: {								check		: function(cmp, checked) {									if (checked) {										Ext.getCmp('adminPortalDetailPrefForm').hide();									}								}							}						}]					}, {						layout : 'column'						,columnWidth : .4						,items : [{							xtype		: 'radio'							,boxLabel	: 'Lock the desktop'							,id			: 'adminProfileLockDesktopLock'							,inputValue		: 'lock'							,name		: 'desktopprefs'							,hideLabel	: true							,listeners	: {								check		: function(cmp, checked) {									if (checked) {										Ext.getCmp('adminPortalDetailPrefForm').show();									}								}							}						}]					}]				}, {					layout	: 'form'					,id		: 'adminPortalDetailPrefForm'					,hidden	: true					,items	: [{						html : 'Drag sections up and down or from column to column to configure the users desktops. Right-click on a section to hide or show the section.'						,style : 'margin:5px;background:#CFFFD1;padding:10px;margin:5px 0;width:770px;'					}, {						layout	: 'form'						,items	: [{							 xtype				: "threecolumnitemselector"							 ,id				: 'admin3ColumnSelector'							,hideLabel			: true							,dataFields			: ["index", "id", "displayName", "hidden"]							,fromData			: []							,toData				: []							,toNextData			: []							,msWidth			: 250							,msHeight			: 156							,width				: 800							,height				: 170							,valueField			: "id"							,displayField		: "displayName"							,column1NodeField	: "DesktopColumnOrder1"							,column2NodeField	: "DesktopColumnOrder2"							,column3NodeField	: "DesktopColumnOrder3"							,smname				: 'domain'							,fromName			: 'col1'							,toName				: 'col2'							,nextToName			: 'col3'							,fromLegend			: "Cloumn 1"							,toLegend			: "Cloumn 2"							,nextToLegend		: "Column 3"						}]					}, {						layout : 'form'						,items : [{							xtype : 'combo'							,loadPrevent: true							,fieldLabel : 'Schedule days to display'							,name		: 'desktop_max_schedule_days'							,store		: new Ext.data.SimpleStore({								fields	: ['id', 'value'],								data	: [['1', '1'],										   ['2', '2'],										   ['3', '3'],										   ['4', '4'],										   ['5', '5'],										   ['6', '6'],										   ['7', '7'],										   ['14', '14'],										   ['31', '31']]							})							,displayField	: 'value'							,valueField		: 'id'							,value			: 1							,smname			: 'desktopMaxScheduleDays'							,triggerAction	: 'all'							,selectOnFocus	: true							,forceSelection : true							,typeAhead      : true							,xxtype			: 'combo'							,mode           : 'local'						}, {							 xtype : 'combo'							,loadPrevent: true							,fieldLabel : 'Reminder days to display'							,name		: 'desktop_max_reminder_days'							,store		: new Ext.data.SimpleStore({								fields	: ['id', 'value'],								data	: [['1', '1'],										   ['2', '2'],										   ['3', '3'],										   ['4', '4'],										   ['5', '5'],										   ['6', '6'],										   ['7', '7'],										   ['14', '14'],										   ['31', '31']]							})							,displayField	: 'value'							,smname			: 'desktopMaxReminderDays'							,valueField		: 'id'							,value			: 1							,triggerAction	: 'all'							,selectOnFocus	: true							,forceSelection : true							,typeAhead      : true							,mode           : 'local'						}]					}]				}]			 }		 }]		}]	});}Eve.Admin.ProfilesPanel = function(superbridge, manager, dialog) {	var conn	= Eve.widgets.TreeStore;	var treeBridge	= new Eve.Admin.ProfileTreeBridge();	superbridge.addBridge(treeBridge);	manager.registerComponents(treeBridge);	treeBridge.init({		superbridge	: superbridge		,conn		: conn		,section	: 'admin'		,prefix		: 'AD'		,manager	: manager	});	return new Ext.Panel({		layout: 'border'		,border: false		,items: [		        {		        	 id: 'profilesWestRegion'		        	,region: 'west'		        	,layout: 'fit'					,title: 'Profiles'					,width		: 200					,collapsible: true					,tools		: [{						id		: 'plus'						,qtip		: 'Add'						,handler	: function() {							Eve.Resource.superbridge.broadcast(this, 'admin_profile_create');						}					}]					,items: [{						 layout: 'border'						,border: false						,items: [{							 region: 'north'							,border: false							,layout: 'fit'							,height: 35							,items: [{								 layout: 'form'								,labelWidth: 40								,border: false								,cls: 'x-grid3-header'								,bodyStyle: 'background: none; padding: 5px; border-bottom: 1px solid #D0D0D0'								,items: {									xtype: 'textfield',									fieldLabel: 'Search',									id: 'profileSearch',									enableKeyEvents: true,									anchor: '99%',									listeners: {										keyup: function()										{											if (Ext.getCmp('profileSearch').getValue() != '') {												Ext.getCmp('profilesTreeCard').getLayout().setActiveItem(1);																								Ext.getCmp('profilesSearchResult').store.removeAll();																								rec = Ext.data.Record.create(['id', 'text']);												for (var i = 0; i < Eve.Admin.profilesArr.length; i++) {																										if (Eve.Admin.profilesArr[i].text.search(new RegExp(Ext.getCmp('profileSearch').getValue(), "i")) != -1) {														newRec = new rec(Eve.Admin.profilesArr[i]);														Ext.getCmp('profilesSearchResult').store.add(newRec);													}												}											}											else 												Ext.getCmp('profilesTreeCard').getLayout().setActiveItem(0);										}																			}								}							}]						},						{							 layout: 'fit'							,region: 'center'							,border: false							,items: [{								layout: 'card',								id: 'profilesTreeCard',								activeItem: 0,								border: false,								items: [{										 layout: 'fit'										,border: false												,items: 																			{											bodyStyle: 'overflow: auto;',											border: false,											items: treeBridge.view										}									}, {										 layout: 'fit'										,border: false										,bodyStyle: 'overflow: auto;'										,items: { 											xtype: 'xdataview',											name: 'profilesSearchResult',											id: 'profilesSearchResult',											itemSelector: 'div.opt_item',											emptyText: '<div style="text-align:center; padding-top: 10px"><i>No items</i></div>',											tpl: new Ext.XTemplate('<div><ul>', '<tpl for=".">', '<li class="x-tree-node"><div onclick="Eve.Resource.superbridge.broadcast(this, \'admin_edit_profile_dlg\', {info: {id: {id}}});" class="x-tree-node-el"><div class="admin-tree-profiles-search"></div> {[this.getResultText(values)]}</li>', '</tpl>', '</ul></div>', {												getResultText: function(values){													return values.text.replace(new RegExp('(' + Ext.getCmp('profileSearch').getValue() + ')', "i"), '<b>$1</b>');												}											}),											store: new Ext.data.SimpleStore({												fields: ['id', 'text']																						})										}																		}]							}]						}]				}]		        },{		        	 id		: 'profilesCenterRegion'		        	,region	: 'center'		        	,layout	: 'fit'					,items	: [{						layout			: 'card'						//,anchor			: '85% 100%'						//,border			: false						,id				: 'adminProfileMainCard'						,activeItem		: 1						,items			: [{							html			: "<div class='admin-panel-message'>Choose a profile to administer from the tree to the left or click the 'new profile' button to create a new profile</div>"							,border			: false						}, dialog.dialog]					}]		        }	        ]	})}Eve.Admin.ProfileCreate = function() {	return new Eve.FormPanel({			 border: false            ,id : 'ProfileCreateDetailProperties'			,items: [{                            layout : 'form'                            ,width : 400                            ,labelWidth : 150                            ,style : 'margin-bottom:10px'                            ,items : [{                                xtype : 'textfield'                                ,fieldLabel : 'Profile Name'                                ,name: 'ProfileName'                                ,smname: 'name'                                ,anchor : '95%'                            }, {                                xtype			: 'combo'                                ,id				: 'adminProfileCreateLandingPage'                                ,fieldLabel		: 'Default Landing Page'                                ,anchor			: '95%'                                ,name			: 'landingPage'                                ,smname			: 'defaultLandingPage'    							,triggerAction	: 'all'    							,selectOnFocus	: true    							,typeAhead      : true    							,forceSelection : true    							,minChars      	: 1    							,valueField		: 'value'    							,displayField	: 'text'    							,mode           : 'local'    							,loadPrevent	: true        						,store			: new Ext.data.SimpleStore({        							fields	: ['value', 'text', 'shared'],        							data	: [['Desktop', 'Desktop', false],        							       ['Mail', 'Mail', false],        							       ['MyCalendar', 'My Calendar', false],        							       ['MyDocuments', 'My Documents', false],        							       ['MyContacts', 'My Contacts', false],        							       ['MyTasks', 'My Tasks', false],        							       ['MyLinks', 'My Links', false],        							       ['Notes', 'Notes', false],        							       ['Reminders', 'Reminders', false],        							       ['Search', 'Search', false],        							       ['Homepage', 'Homepage', true],        							       ['SharedCalendar', 'Shared Calendar', true],        							       ['SharedContacts', 'Shared Contacts', true],        							       ['SharedDocuments', 'Shared Documents', true],        							       ['SharedTasks', 'Shared Tasks', true],        							       ['Forum', 'Forum', true],        							       ['Voting', 'Voting', true],        							       ['Wiki', 'Wiki', true],        							       ['SharedLinks', 'Shared Links', true]									]        						})								,listeners		: {									select	: function(cbo, record, index) {										var cboLandingGroup = Ext.getCmp('adminProfileCreateLandingGroupContainer');										if (record.get('shared')) {											cboLandingGroup.show();										} else {											cboLandingGroup.hide();										}									},									change: function(element, newVal, oldVal)									{										if (!Ext.getCmp('addprofilecheck' + newVal).getValue())										{											Ext.Msg.alert('Error', 'You can not set landing page to a disabled section.')											element.setValue(oldVal);										}									}									}                            }, {								layout			: 'form'								,id				: 'adminProfileCreateLandingGroupContainer'								,items			: [{									xtype			: 'combo'									,fieldLabel		: 'Landing Group'									,name			: 'landinggroup'									,id				: 'adminProfileCreateDetailsLandingGroup'									,smname			: 'group'									,anchor			: '95%'									,triggerAction	: 'all'									,selectOnFocus	: true									,typeAhead      : true									,forceSelection : true									,allowBlank		: true									,loadPrevent	: true									,minChars      	: 1									,valueField		: 'id'									,displayField	: 'title'									,mode           : 'local'									,store		: new Ext.data.Store({										data	: []										,fields	: [ 'title', 'id' ]										,reader	: new Ext.data.XmlReader({											record	: 'row'										}, [ 'title', 'id' ])									})								}]							}]                        },{								layout: 'form'                                ,bodyStyle: 'padding: 5px;'                                ,height : 290								,frame	: false								,border	: false								,items: [{                                    layout : 'column'                                    ,items : [{                                        layout : 'form'                                        ,columnWidth : .3                                        ,labelWidth : 1                                        ,items  : [{                                            xtype : 'checkbox'                                            ,boxLabel : 'Personal'                                            ,name: 'personalmain'                                            ,labelSeparator : ''                                            ,checked: true                                        }, {                                            layout : 'column'                                            ,items : [{                                                layout : 'form'                                                ,style : 'margin-left:20px'                                                ,columnWidth : 1                    							,defaults: {                    								listeners: {                    									check: function(element, checked) {                    										if (!checked) {                    											if (element.getId() == 'addprofilecheck' + Ext.getCmp('adminProfileCreateLandingPage').getValue())                    											{                    												element.setValue(true);                    												Ext.Msg.alert('Error', 'You can not disable default landing page.');                    											}                    										}                    									}                    								}                    							}                                                                                                   ,items : [{                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'desktop'                                                    ,boxLabel : 'Desktop'                                                    ,id: 'addprofilecheckDesktop'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'mail'                                                    ,boxLabel : 'Mail'                                                    ,id: 'addprofilecheckMail'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'myCalendar'                                                    ,boxLabel : 'My Calendar'                                                    ,id: 'addprofilecheckMyCalendar'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'myDocuments'                                                    ,boxLabel : 'My Documents'                                                    ,id: 'addprofilecheckMyDocuments'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'myContacts'                                                    ,boxLabel : 'My Contacts'                                                    ,id: 'addprofilecheckMyContacts'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'myTasks'                                                    ,boxLabel : 'My Tasks'                                                    ,id: 'addprofilecheckMyTasks'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'myLinks'                                                    ,boxLabel : 'My Links'                                                    ,id: 'addprofilecheckMyLinks'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'notes'                                                    ,boxLabel : 'Notes'                                                    ,id: 'addprofilecheckNotes'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'reminders'                                                    ,boxLabel : 'Reminders'                                                    ,id: 'addprofilecheckReminders'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'search'                                                    ,boxLabel : 'Search'                                                    ,id: 'addprofilecheckSearch'                                                }]                                            }]                                        }]                                    }, {                                        layout : 'form'                                        ,columnWidth : .3                                        ,labelWidth : 1                                        ,items  : [{                                            xtype : 'checkbox'                                            ,boxLabel : 'Groups'                                            ,name: 'groupsmain'                                            ,checked: true                                            ,labelSeparator : ''                                        }, {                                            layout : 'column'                                            ,items : [{                                                layout : 'form'                                                ,style : 'margin-left:20px'                                                ,columnWidth : 1                    							,defaults: {                    								listeners: {                    									check: function(element, checked) {                    										if (!checked) {                    											if (element.getId() == 'addprofilecheck' + Ext.getCmp('adminProfileCreateLandingPage').getValue())                    											{                    												element.setValue(true);                    												Ext.Msg.alert('Error', 'You can not disable default landing page.');                    											}                    										}                    									}                    								}                    							}                                                                                                ,items : [{                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'homePage'                                                    ,boxLabel : 'Homepage'                                                    ,id: 'addprofilecheckHomepage'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'sharedCalendar'                                                    ,boxLabel : 'Shared Calendar'                                                    ,id: 'addprofilecheckSharedCalendar'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'sharedTasks'                                                    ,boxLabel : 'Shared Tasks'                                                    ,id: 'addprofilecheckSharedTasks'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'sharedDocuments'                                                    ,boxLabel : 'Shared Documents'                                                    ,id: 'addprofilecheckSharedDocuments'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'sharedContacts'                                                    ,boxLabel : 'Shared Contacts'                                                    ,id: 'addprofilecheckSharedContacts'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'sharedLinks'                                                    ,boxLabel : 'Shared Links'                                                    ,id: 'addprofilecheckSharedLinks'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'forum'                                                    ,boxLabel : 'Forum'                                                    ,id: 'addprofilecheckForums'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'voting'                                                    ,boxLabel : 'Voting'                                                    ,id: 'addprofilecheckVoting'                                                }, {                                                    xtype : 'checkbox'                                                    ,labelSeparator : ''                                                    ,name: 'wiki'                                                    ,boxLabel : 'Wiki'                                                    ,id: 'addprofilecheckWiki'                                                }]                                            }]                                        }]                                    }, {                                    	layout : 'form'                                        ,columnWidth : 0.3                                        ,items : [{                                            xtype : 'checkbox'                                            ,labelSeparator : ''                                            ,name: 'im'                                            ,boxLabel : 'IM'                                        }]                                    }]                                }]                         }]	});}Eve.vc.createFormPanel( 'AdminProfileDetails', Eve.Admin.ProfileDetails );Ext.override( Eve.vc.AdminProfileDetails, {	  loadEvent 	: function(){return 'modern.administrator.edit.profile';}	 ,submitEvent 	: function(){return 'modern.administrator.profile.createModify';}});Eve.vc.createFormPanel( 'AdminProfileCreate', Eve.Admin.ProfileCreate );Ext.override( Eve.vc.AdminProfileCreate, {	 loadEvent		: function(){return 'modern.administrator.edit.profile';}	,submitEvent 	: function(){return 'modern.administrator.profile.createModify';}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\admin/AdminMenu.js *//*--------------------------------------------------*//** * AdminMenu.js * Hyperoffice Settings section based on ExtJS Library 2.2 December 2009 *  * syavash@hyperoffice.com *  * http://www.hyperoffice.com */  Eve.Admin.TreeMenu = {	getUserMenu: function() {		return new Ext.menu.Menu({			items : [{				text	: "Login as user"				,id		: 'login'				,icon	: Eve.Resource.getIcon('folder-new','link')			}, {				text	: "Add to group"				,id		: 'add'				,icon	: Eve.Resource.getIcon('checked', 'general')			}, {				text	: "Delete"				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}]			,listeners	: {				itemclick: function(item) {					switch (item.id) {						case 'login':							var n = item.parentMenu.contextNode;							console.log('login as', n.attributes);							break;						case 'add':							var n = item.parentMenu.contextNode;							Eve.Resource.superbridge.broadcast(this, 'admin_user_assign_to_group', {userId: n.attributes.id, username: n.attributes.text});							break;						case 'delete':							Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this user?',									function(btn) {										if (btn == 'yes') {											var n = item.parentMenu.contextNode;											Eve.Resource.superbridge.broadcast(this, 'admin_delete_user', {info: {id: n.attributes.id}});										}								}, this);							break;					}				}			}		});	}	,getGroupMenu: function() {		return new Ext.menu.Menu({			items : [{				text	: "Add Subgroup"				,id		: 'add-subgroup'			}, {				text	: "Delete"				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}]			,listeners	: {				itemclick: function(item) {					switch (item.id) {						case 'add-subgroup':							var n = item.parentMenu.contextNode;							Eve.Resource.superbridge.broadcast(this, 'admin_group_add_subgroup', {info: {id: n.attributes.id}});							break;						case 'delete':							Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this group?',								function(btn) {									if (btn == 'yes') {										var n = item.parentMenu.contextNode;										Eve.Resource.superbridge.broadcast(this, 'admin_delete_group', {info: {id: n.attributes.id}});									}							}, this);							break;					}				}			}		});	}	,getProfileMenu: function() {		return new Ext.menu.Menu({			items : [{				text	: "Delete"				,id		: 'delete'				,icon	: Eve.Resource.getIcon('delete', 'general')			}]			,listeners	: {				itemclick: function(item) {					switch (item.id) {						case 'delete':							Ext.Msg.confirm('Delete Confirmation', 'Are you sure you want to delete this profile?',								function(btn) {									if (btn == 'yes') {										var n = item.parentMenu.contextNode;										Eve.Resource.superbridge.broadcast(this, 'admin_delete_profile', {info: {id: n.attributes.id}});									}							}, this);														break;					}				}			}		});	}}/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\admin/AdminTree.js *//*--------------------------------------------------*//** * AdminTree.js * Hyperoffice Settings section based on ExtJS Library 2.2 December 2009 *  * syavash@hyperoffice.com *  * http://www.hyperoffice.com */Eve.Admin.UsersTreeBridge = function(){	Eve.Admin.UsersTreeBridge.superclass.constructor.apply( this, arguments );	}Ext.extend( Eve.Admin.UsersTreeBridge, Eve.lib.Bridge, {	loaded: false,	init: function(obj){				Eve.Admin.UsersTreeBridge.superclass.init.call(this, obj);		this.view = new Ext.tree.TreePanel({			 border	: false			,id		: 'adminUsersTree'			,animate: false			,root	: new Ext.tree.TreeNode({				id		: 0				,text	: 'Users'				,leaf	: false				,userId	: 0				,cls	: 'admin-tree-users'			})			,contextMenu: Eve.Admin.TreeMenu.getUserMenu()		    ,listeners	: {		        contextmenu: function(node, e) {		            var c = node.getOwnerTree().contextMenu;		            c.contextNode = node;		            c.showAt(e.getXY());		        }		    }					});			}		,reader : new Ext.data.XmlReader({			record : 'row'		}, [			{name: 'id'				,type: 'string'}			,{name: 'firstname'		,type: 'string', mapping: 'firstName'}			,{name: 'lastname'		,type: 'string', mapping: 'lastName'}			,{name: 'text'			,type: 'string', mapping: 'username'}			,{name: 'parent'		,type: 'string', mapping: 'adminParent'}			,{name: 'accountLevel'	,type: 'string', mapping: 'accountLevel'}		]	)	,handleResponse: function( r, args )	{		var ret		= this.reader.readRecords( r.responseXML );		var nodes	= ret.records;		Eve.Admin.usersArr = [];		for (var i = 0; i < nodes.length; ++i) {			var node = nodes[i].data;			var parent;			Eve.Admin.usersArr.push(node);			node.cls	= (node.accountLevel < 140) ? 'admin-tree-users-blue' : 'admin-tree-users-red';			node.text	= [nodes[i].data.firstname, ' ', nodes[i].data.lastname, ' (', nodes[i].data.text, ')'].join('');			parent		= (node.parent == 0) ? this.view.getRootNode() : this.view.getNodeById(node.parent);						var tn = new Ext.tree.TreeNode(node);			if (parent) {				parent.appendChild(tn);			}		}				this.view.getRootNode().expand();		Eve.mask.hide();								this.fire('admin_user_load_constants');			}	,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}	,execute: function(callee, type, object){		var tree = this.view;				switch (type) {			case 'show_admin_users':								if (!this.loaded)				{					Eve.mask.show(Ext.fly('usersWestRegion') );												        var request = Ext.Ajax.request({		                 url		: Eve.url						,params  	: {event: 'modern.cobrand.all.users'}						,success	: this.handleResponse						,failure	: this.handleFailure		                ,scope	: this					        });					        			        					var sel  = this.view.getSelectionModel();					sel.on( 'selectionchange', function(sm, node) {						if (node) {							if (node.attributes.userId == 0)								return ;														this.fire('admin_edit_user_dlg', {								info: {									id: node.attributes.id								}							}, true);						} else {							Ext.getCmp('adminUserMainCard').getLayout().setActiveItem(0);						}					}, this);											this.loaded = true;				}				break;							case 'admin_delete_user_success':				node = this.view.getNodeById(object.nodeId);				node.remove();				break;				}	}	,forceLoad: function () {			}	});/************** * Groups */Eve.Admin.GroupsTreeBridge = function(){	Eve.Admin.GroupsTreeBridge.superclass.constructor.apply( this, arguments );	}Ext.extend( Eve.Admin.GroupsTreeBridge, Eve.lib.Bridge, {	loaded: false,	init: function(obj)	{		Eve.Admin.GroupsTreeBridge.superclass.init.call(this, obj);		this.view = new Ext.tree.TreePanel({			 border		: false			,id			: 'adminGroupsTree'			,animate	: false			,root		: new Ext.tree.TreeNode({groupId: 0, text: 'Groups', leaf: false, cls: 'admin-tree-groups'})			,contextMenu: Eve.Admin.TreeMenu.getGroupMenu()		    ,listeners	: {		        contextmenu: function(node, e) {		            var c = node.getOwnerTree().contextMenu;		            c.contextNode = node;		            c.showAt(e.getXY());		        }		    }		});				}		,reader : new Ext.data.XmlReader({			record : 'row'		}, [				  {name: 'id'				, type: 'string'}				 ,{name: 'text'				, type: 'string', mapping: 'title'}				 ,{name: 'parent'			, type: 'string', mapping: 'parent>id'}			]	)			,handleResponse: function( r, args ) {		var ret		= this.reader.readRecords( r.responseXML );		var nodes	= ret.records;				Eve.Admin.groupsArr = [];		for (var i = 0; i < nodes.length; ++i) {			var node = nodes[i].data;			var parent;			Eve.Admin.groupsArr.push(node); 						node.cls = 'admin-tree-groups';						if (node.parent == 0)				parent = this.view.getRootNode();			else				parent = this.view.getNodeById(node.parent);						if (parent)				parent.appendChild(new Ext.tree.TreeNode(node));		}						this.view.getRootNode().expand();		Eve.mask.hide();			}	,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);		Eve.mask.hide();	}		,execute: function(callee, type, object){		var tree = this.view;				switch (type) {			case 'show_admin_groups':								if (!this.loaded)				{					Eve.mask.show(Ext.fly('groupsWestRegion') );							        var request = Ext.Ajax.request({			                 url		: Eve.url							,params  	: {event: 'modern.cobrand.get.groups'}							,success	: this.handleResponse							,failure	: this.handleFailure			                ,scope	: this							});											var sel  = this.view.getSelectionModel();						sel.on( 'selectionchange', function(sm, node)					{						if (node) {							if (node.attributes.groupId == 0)								return ;														this.fire('admin_edit_group_dlg', {								info: {									id: node.attributes.id								}							}, true);						} else {							Ext.getCmp('adminGroupMainCard').getLayout().setActiveItem(0);						}					}, this);										this.loaded = true;				}				break;							case 'admin_delete_group_success':				node = this.view.getNodeById(object.nodeId);				node.remove();				break;							default:						break;										}	}	,forceLoad: function () {			}	});/** * Profiles */Eve.Admin.ProfileTreeBridge = function(){	Eve.Admin.ProfileTreeBridge.superclass.constructor.apply( this, arguments );}Ext.extend( Eve.Admin.ProfileTreeBridge, Eve.lib.Bridge, {	loaded: false,	init: function(obj)	{		Eve.Admin.ProfileTreeBridge.superclass.init.call(this, obj);		this.view = new Ext.tree.TreePanel({			 border: false			,id: 'adminProfileTree'			,contextMenu: Eve.Admin.TreeMenu.getProfileMenu()			,animate: false			,root: new Ext.tree.TreeNode({id: 0, profileId: -1, text: 'Profile', leaf: false, cls: 'admin-tree-profiles'})		    ,listeners: {		        contextmenu: function(node, e) {		            var c = node.getOwnerTree().contextMenu;		            c.contextNode = node;		            c.showAt(e.getXY());		        }		    }		});	}	,reader : new Ext.data.XmlReader({			record : 'row'		}, [				  {name: 'id'				, type: 'string'}				 ,{name: 'text'				, type: 'string', mapping: 'name'}				 ,{name: 'leaf'				, type: 'boolean', defaultValue: false}			]	)	,handleResponse: function( r, args )	{		var ret		= this.reader.readRecords( r.responseXML );		var nodes	= ret.records;		Eve.Admin.profilesArr = [];		for (var i = 0; i < nodes.length; ++i) {			var node = nodes[i].data;			Eve.Admin.profilesArr.push(node);			node.cls = 'admin-tree-profiles';			var parent = this.view.getRootNode();			if (parent)				parent.appendChild(new Ext.tree.TreeNode(node));		}						this.view.getRootNode().expand();		Eve.mask.hide();				this.fire('admin_profile_load_constants');			}	,handleFailure : function( r, e ) {		Ext.Msg.alert("Error", "The server didn't respond in timely fashion!");		console.log(e);	}	,execute: function(callee, type, object){		var tree = this.view;		switch (type) {			case 'show_admin_profiles':								if (!this.loaded)				{					Eve.mask.show(Ext.fly('profilesWestRegion') );								        var request = Ext.Ajax.request({			                 url		: Eve.url							,params  	: {event: 'modern.administrator.profile.getProfiles'}							,success	: this.handleResponse							,failure	: this.handleFailure			                ,scope	: this					});												var sel  = this.view.getSelectionModel();						sel.on( 'selectionchange', function(sm, node)					{						if (node) {							if (node.attributes.profileId == -1)								return ;														this.fire('admin_edit_profile_dlg', {								info: {									id: node.attributes.id								}							}, true);						} else {							Ext.getCmp('adminProfileMainCard').getLayout().setActiveItem(0);						}					}, this);					this.loaded = true;				}								break;			case 'admin_delete_profile_success':								node = this.view.getNodeById(object.nodeId);				node.remove();				break;		}	}	,forceLoad: function () {	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\admin/AdminFactory.js *//*--------------------------------------------------*//** * AdminFactory.js * Hyperoffice Settings section based on ExtJS Library 2.2 December 2009 *  * syavash@hyperoffice.com *  * http://www.hyperoffice.com */Eve.lib.Admin.Factory = function() {}Ext.extend( Eve.lib.Admin.Factory, Eve.lib.Factory, {	section: 'admin'	 	,createBefore : function(superbridge)	{		// Section Manager		this.manager = new Eve.lib.SectionBridge(this.section);		superbridge.addBridge(this.manager);	}	,createNorth : function (superbridge)	{		var view = {			get : function() { return [{				tbar: new Ext.Toolbar({					items : [{						xtype	: 'splitbutton',						text	: 'New',						menu	: new Ext.menu.Menu({							items: [{								text		: 'User'								,id			: 'user'								,hidden		: !(Eve.Preference.get("accountLevel") >= 140)							},{								text		: 'Group'								,id			: 'group'							},{								text		: 'Profile'								,id			: 'profile'								,hidden		: !(Eve.Preference.get("accountLevel") >= 155)							}]							,listeners: {								itemclick: function(item) {									switch (item.id) {										case 'user':											Eve.Resource.superbridge.broadcast(this, 'admin_user_create');											break;										case 'group':											Eve.Resource.superbridge.broadcast(this, 'admin_group_create');											break;										case 'profile':											Eve.Resource.superbridge.broadcast(this, 'admin_profile_create');											break;									}								}							}						})					}, {						text		: 'Users'						,hidden		: !(Eve.Preference.get("accountLevel") >= 140)						,toggleGroup: 'adminTB'						,enableToggle: true						,listeners	: {							click		: function() {								superbridge.broadcast(this, 'show_admin_users');							}						 }					}, {						text		: 'Groups'						,toggleGroup: 'adminTB'						,enableToggle: true						,listeners	: {							click		: function() {								superbridge.broadcast(this, 'show_admin_groups');								Ext.getCmp('GroupDetailsProperties').doLayout();							}						}					}, {						text		: 'Profiles'						,hidden		: !(Eve.Preference.get("accountLevel") >= 155)						,toggleGroup: 'adminTB'						,enableToggle: true						,listeners	: {							click		: function() {								superbridge.broadcast(this, 'show_admin_profiles');								Ext.getCmp('ProfileDetailProperties').doLayout();							}						}					}]				})			}]}		}		return { view : view, config: { titleBar: false, height: 25, split: false, border: false } };	}	,createCenter : function( superbridge )	{		var view = {			get : function() {return [{}]}		}		Eve.admin = new Eve.Admin.AdminBridge();		superbridge.addBridge(Eve.admin);		this.manager.registerComponents(Eve.admin);		Eve.admin.init({			superbridge	: superbridge			,view		: view			,section	: this.section			,manager    : this.manager		});		var userDialogBridge 	= new Eve.lib.Admin.UserDialogBridge();		superbridge.addBridge(userDialogBridge);		userDialogBridge.addPanel(new Eve.vc.AdminUserDetails());		userDialogBridge.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});				var groupDialogBridge 	= new Eve.lib.Admin.GroupDialogBridge();		superbridge.addBridge(groupDialogBridge);						groupDialogBridge.addPanel(new Eve.vc.AdminGroupDetailsProperties());		groupDialogBridge.addPanel(new Eve.vc.AdminGroupDetailsManageUsers());		groupDialogBridge.addPanel(new Eve.vc.AdminGroupDetailsDefaultUserPermissions());		groupDialogBridge.addPanel(new Eve.vc.AdminGroupFolderPermissions());						groupDialogBridge.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});		var FolderDialogBridge 	= new Eve.lib.Admin.FolderPermissionDialogBridge();		superbridge.addBridge(FolderDialogBridge);				FolderDialogBridge.addPanel(new Eve.vc.AdminGroupFolderPermissions());		FolderDialogBridge.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});                        var profileDialogBridge = new Eve.lib.Admin.ProfileDialogBridge();		superbridge.addBridge(profileDialogBridge);		profileDialogBridge.addPanel(new Eve.vc.AdminProfileDetails());		profileDialogBridge.init({			superbridge	: superbridge			,section	: this.section			,origin		: 'item'		});                				var panelView = new Ext.Panel({			 layout		: 'card'			,id			: 'adminCardLayout'			,activeItem	: 0			,items		: [{				html		: '<table class="admin-splash-table" cellspacing="0">' +								'<tr><th colspan="2">What would you like to do?</th></tr>' +								'<tr><td><b>Users:</b></td><td>This section will allow you to Add, Edit, and Delete users in your portal.You can also add users to groups and change their personal information.</td></tr>' +								'<tr><td><b>Groups:</b></td><td>This section will allow you to administer your groups including tasks such as creating new groups, inviting or assigning users to a group, modifying the permissions of group members, manage folder permissions, and managing news headlines.</td></tr>' +								'<tr><td><b>Profiles:</b></td><td>Profiles are a fantastic way to customize the user experience based on different audiences.You can simplify your portals interface by removing modules, choose where you want the user to be directed when they first login, and even control the users desktop experience.</td></tr>' +							  '</table>'			},				Eve.Admin.UsersPanel(superbridge, this.manager, userDialogBridge),				Eve.Admin.GroupsPanel(superbridge, this.manager, groupDialogBridge),				Eve.Admin.ProfilesPanel(superbridge, this.manager, profileDialogBridge)			]		});				return { view : view, config: { border: false, items : panelView, layout: 'fit' } };	}		,createWest : function(superbridge) { }	,createDialogs : function(superbridge)	{		var userGroupPermissionsBridge 	= new Eve.lib.Admin.UserGroupPermissionsBridge();		superbridge.addBridge(userGroupPermissionsBridge);		userGroupPermissionsBridge.addPanel(new Eve.vc.AdminUserGroupPermission());		userGroupPermissionsBridge.init({			superbridge	: superbridge			,section	: this.section		});				var userCreateBridge 	= new Eve.lib.Admin.UserCreateBridge();		superbridge.addBridge(userCreateBridge);		userCreateBridge.addPanel(new Eve.vc.AdminUserCreate());		userCreateBridge.init({			superbridge	: superbridge			,section	: this.section		});						var groupCreateBridge 	= new Eve.lib.Admin.GroupCreateBridge();		superbridge.addBridge(groupCreateBridge);		groupCreateBridge.addPanel(new Eve.vc.AdminGroupCreate());		groupCreateBridge.init({			superbridge	: superbridge			,section	: this.section		});					var profileCreateBridge 	= new Eve.lib.Admin.ProfileCreateBridge();		superbridge.addBridge(profileCreateBridge);		profileCreateBridge.addPanel(new Eve.vc.AdminProfileCreate());		profileCreateBridge.init({			superbridge	: superbridge			,section	: this.section		});				var userAddToGroupBridge 	= new Eve.lib.Admin.AddUserToGroupBridge();		superbridge.addBridge(userAddToGroupBridge);		userAddToGroupBridge.addPanel(new Eve.vc.AdminUserAddToGroup());		userAddToGroupBridge.init({			superbridge	: superbridge			,section	: this.section		});				var groupInviteUsersBridge 	= new Eve.lib.Admin.InviteParticipantsBridge();		superbridge.addBridge(groupInviteUsersBridge);		groupInviteUsersBridge.addPanel(new Eve.vc.AdminGroupInviteParticipants());		groupInviteUsersBridge.init({			superbridge	: superbridge			,section	: this.section		});	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\Admin/ColorField.js *//*--------------------------------------------------*//** * @class Ext.form.ColorField * @extends Ext.form.TriggerField * Provides a very simple color form field with a ColorMenu dropdown. * Values are stored as a six-character hex value without the '#'. * I.e. 'ffffff' * @constructor * Create a new ColorField * <br />Example: * <pre><code>var cf = new Ext.form.ColorField({	fieldLabel: 'Color',	hiddenName:'pref_sales',	showHexValue:true});</code></pre> * @param {Object} config */Ext.form.ColorField = function(config){    Ext.form.ColorField.superclass.constructor.call(this, config);	this.on('render', this.handleRender);};Ext.extend(Ext.form.ColorField, Ext.form.TriggerField,  {    /**     * @cfg {Boolean} showHexValue     * True to display the HTML Hexidecimal Color Value in the field     * so it is manually editable.     */    showHexValue : false,		/**     * @cfg {String} triggerClass     * An additional CSS class used to style the trigger button.  The trigger will always get the     * class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified (defaults to 'x-form-color-trigger'     * which displays a calendar icon).     */    triggerClass : 'x-form-color-trigger',	    /**     * @cfg {String/Object} autoCreate     * A DomHelper element spec, or true for a default element spec (defaults to     * {tag: "input", type: "text", size: "10", autocomplete: "off"})     */    // private    defaultAutoCreate : {tag: "input", type: "text", size: "10",						 autocomplete: "off", maxlength:"6"},		/**	 * @cfg {String} lengthText	 * A string to be displayed when the length of the input field is	 * not 3 or 6, i.e. 'fff' or 'ffccff'.	 */	lengthText: "Color hex values must be either 3 or 6 characters.",		//text to use if blank and allowBlank is false	blankText: "Must have a hexidecimal value in the format ABCDEF.",		/**	 * @cfg {String} color	 * A string hex value to be used as the default color.  Defaults	 * to 'FFFFFF' (white).	 */	defaultColor: 'FFFFFF',		maskRe: /[a-f0-9]/i,	// These regexes limit input and validation to hex values	regex: /[a-f0-9]/i,	//private	curColor: 'ffffff',	    // private    validateValue : function(value){		if(!this.showHexValue) {			return true;		}		if(value.length<1) {			this.el.setStyle({				'background-color':'#' + this.defaultColor			});			if(!this.allowBlank) {				this.markInvalid(String.format(this.blankText, value));				return false			}			return true;		}		if(value.length!=3 && value.length!=6 ) {			this.markInvalid(String.format(this.lengthText, value));			return false;		}		this.setColor(value);        return true;    },    // private    validateBlur : function(){        return !this.menu || !this.menu.isVisible();    },		// Manually apply the invalid line image since the background	// was previously cleared so the color would show through.	markInvalid : function( msg ) {		Ext.form.ColorField.superclass.markInvalid.call(this, msg);		this.el.setStyle({			'background-image': 'url(../lib/resources/images/default/grid/invalid_line.gif)'		});	},    /**     * Returns the current color value of the color field     * @return {String} value The hexidecimal color value     */    getValue : function(){		return "#"+this.curColor || this.defaultValue || "FFFFFF";    },    /**     * Sets the value of the color field.  Format as hex value 'FFFFFF'     * without the '#'.     * @param {String} hex The color value     */    setValue : function(hex){		Ext.form.ColorField.superclass.setValue.call(this, hex);		this.setColor(hex);    },		/**	 * Sets the current color and changes the background.	 * Does *not* change the value of the field.	 * @param {String} hex The color value.	 */	setColor : function(hex) {		this.curColor = hex;				this.el.setStyle( {			'background-color': '#' + hex,			'background-image': 'none'		});		if(!this.showHexValue) {			this.el.setStyle({				'text-indent': '-100px'			});			if(Ext.isIE) {				this.el.setStyle({					'margin-left': '100px'				});			}		}	},		handleRender: function() {		this.setDefaultColor();	},		setDefaultColor : function() {		this.setValue(this.defaultColor);	},    // private    menuListeners : {        select: function(m, d){            this.setValue(d);        },        show : function(){ // retain focus styling            this.onFocus();        },        hide : function(){            this.focus();            var ml = this.menuListeners;            this.menu.un("select", ml.select,  this);            this.menu.un("show", ml.show,  this);            this.menu.un("hide", ml.hide,  this);        }    },		//private	handleSelect : function(palette, selColor) {		this.setValue(selColor);	},    // private    // Implements the default empty TriggerField.onTriggerClick function to display the ColorPicker    onTriggerClick : function(){        if(this.disabled){            return;        }        if(this.menu == null){            this.menu = new Ext.menu.ColorMenu();			this.menu.palette.on('select', this.handleSelect, this );        }        this.menu.on(Ext.apply({}, this.menuListeners, {            scope:this        }));        this.menu.show(this.el, "tl-bl?");    }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\Admin/Personal.js *//*--------------------------------------------------*/Eve.Personal.PersonalBridge = Ext.extend( Eve.lib.Bridge, {    init: function( obj ){        Eve.Personal.PersonalBridge.superclass.init.call(this, obj);    }    ,forceLoad: function(data){		this.fire('personal_edit_detail_dlg', data);    }    ,execute: function( callee, type, object ){}});	Eve.Personal.PersonalDetails = function() {    return new Eve.FormPanel({             border: false			,layout: 'fit'            ,items: [{                    xtype: 'tabpanel'                    ,activeTab	: 0                    ,deferredRender : false                    ,listeners : {                        tabchange : function(tabPabel, tab){                            tab.doLayout();                        }                    }                    ,items: [{                        title: 'Personal information'                        ,layout: 'form'											,autoScroll: true                        ,frame		: false                        ,border		: false                        ,bodyStyle	: 'padding: 20px'                        ,items: {                            layout: 'form'                            ,border: false                            ,items:[{                                    layout : 'column'                                    ,items : [{                                        layout : 'form'                                        ,columnWidth : .20                                        ,style : 'margin:0 auto;text-align:center;'                                        ,items : [{                                            html : '<img id="personal_img_avatar" src="' + Eve.Resource.getIcon('item-icon','contact') + '" width="120" height="120" style="padding-bottom:2px" />'                                        }, {                                            xtype	: 'button'                                            ,text	: 'Edit Picture'											,id		: 'personal_edit_pic'                                            ,style	: 'margin:0 auto;'                                        }]                                    }, {                                        layout : 'form'                                        ,columnWidth : .40                                        ,items : [{                                            xtype : 'textfield'                                            ,fieldLabel : 'First Name'                                            ,name : 'first_name'											,smname: 'firstName'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'Last Name'                                            ,name : 'last_name'											,smname: 'lastName'                                            ,anchor: '90%'                                        }, {                                           xtype : 'textfield'                                           ,fieldLabel : 'Alternate E-mail'                                           ,name : 'externalemail'										   ,smname: 'externalEmail'                                           ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'Organization'                                            ,name : 'organization'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'Address'                                            ,name : 'address'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'City'                                            ,name : 'city'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'State/Provice'                                            ,name : 'state'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'Zip/Postal Code'                                            ,name : 'zip'                                            ,anchor: '90%'                                        }, {                                            xtype : 'textfield'                                            ,fieldLabel : 'Country/Region'                                            ,anchor: '90%'                                            ,name : 'country'                                        }, {                                            xtype: 'combo'                                            ,fieldLabel: 'Time Zone'											,id: 'personal_time_zone'                                            ,name: 'timezone'											//,smname: 'timeZones'                                            ,anchor: '90%'											,mode: 'local'											,store: new Ext.data.Store({												reader 	: new Ext.data.XmlReader({													record 	: 'row'													,id		: 'value'												}, ['value', 'text', 'shortList'])											})											,allData: []											,filterData: []											,filterItems: function(cmb){												cmb.allData = cmb.store.data.items ;												cmb.store.filterBy(cmb.filterByFn, cmb);												cmb.filterData = cmb.store.data.items ;												cmb.store.removeAll();												cmb.store.add(cmb.filterData);											}											,filterByFn : function(record, id){												if(record.get('shortList') == 'true')													return true;												return false;											}											,displayField: 'text'											,valueField: 'value'											,selectOnFocus 	: true											,triggerAction 	: 'all'											,lazyInit		: false                                        },new Ext.form.Checkbox({											labelSeparator	: ''											,boxLabel 		: 'Display all time zones'											,name			: 'displayall'											,listeners		: {												check: function(checkbox, checked)												{													var cmb = Ext.getCmp('personal_time_zone');													if (checked) {														cmb.store.removeAll();														cmb.store.add(cmb.allData);																											} else {														cmb.filterItems(cmb);													}												}											}											}) ,{                                            xtype: 'combo'                                            ,fieldLabel: 'Your Locale'											,id: 'personal_locale'                                            ,name: 'userLocale'											,smname: 'userPersonalSettingController_locales'											,mode: 'local'                                            ,anchor: '90%'											,store 	: new Ext.data.Store({												reader 	: new Ext.data.XmlReader({													record 	: 'row'													,id		: 'localeValue'												}, ['localeValue','localizedLocale'])											})											,displayField: 'localizedLocale'											,valueField: 'localeValue'											,selectOnFocus 	: true											,triggerAction 	: 'all'											,lazyInit		: false                                        }]                                    }]                            },{                                        layout : 'form'	,                                        //,items : [{                                         //   xtype:'fieldset',                                            autoHeight:true,											anchor : '40%',											style  : 'margin:20px 0px 0px 20%;',                                            defaultType: 'textfield',                                            defaults: {				                                // regex: new RegExp('^[0-9\-\(\)\.\+ext ]*$')				                                //,regexText: 'Please enter a valid phone number'                            				},                                           // collapsible: true,                                            items :[{                                                    fieldLabel: 'Work Phone'                                                    ,name: 'workphone'													,smname: 'workPhone'                                                    ,anchor: '90%'                                                },{                                                    fieldLabel: 'Home Phone'                                                    ,name: 'homephone'													,smname: 'homePhone'                                                    ,anchor: '90%'                                                },{                                                    fieldLabel: 'Mobile Phone'                                                    ,name: 'phone'													,smname: 'mobilePhone'                                                    ,anchor: '90%'                                                }, {                                                    fieldLabel: 'Fax Number'                                                    ,name: 'faxnumber'													,smname: 'faxNumber'                                                    ,anchor: '90%'                                                }                                            ]                                    //    }]                                    }]                        }                    },{                        title: 'General Preferences'                        ,layout: 'form'						,autoScroll: true                        ,frame		: false                        ,border		: false                        ,bodyStyle	: 'padding: 20px'                        ,items : [{                            layout : 'form'                            ,border : false                            ,items : [{                                xtype:'fieldset'                                ,title: 'General Settings'                                ,collapsible: true                                ,autoHeight:true                                ,width : 600                                ,labelWidth : 200                                ,defaultType: 'combo'                                ,items :[{                                        fieldLabel: 'Items per Page'										,xxtype: 'combo'										,smname: 'itemsPerPage'                                        ,name: 'items_per_page'                                        ,anchor: '90%'										,displayField	: 'itemsPerPage'										,valueField		: 'userGeneralSettingController_items_per_page'										,mode			: 'local'										,typeAhead		: true										,selectOnFocus 	: true										,triggerAction 	: 'all'										,editable		: false										,store: new Ext.data.SimpleStore({											fields : ['userGeneralSettingController_items_per_page', 'itemsPerPage'],											data : [												 ['15', '15']												,['20', '20']												,['25', '25']												,['30', '30']												,['35', '35']												,['40', '40']												,['45', '45']												,['50', '50']											]										})                                    },{                                        fieldLabel: 'Item Deletion'										,xxtype: 'combo'                                        ,name: 'item_deletion'										,smname: 'itemDeletion'                                        ,anchor: '90%'										,displayField	: 'itemDeletion'										,valueField		: 'item_deletion'										,mode			: 'local'										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,triggerAction 	: 'all'										,store: new Ext.data.SimpleStore({											fields : ['item_deletion', 'itemDeletion'],											data : [												 ['1', 'Prompt me when deleting an item']												,['0', 'Don\'t prompt me when deleting an item']											]										})                                    },{                                        fieldLabel: 'Folder Deletion'																			,xxtype: 'combo'                                        ,name: 'folder_deletion'										,smname: 'folderDeletion'                                        ,anchor: '90%'										,displayField: 'folderDeletion'										,valueField: 'folder_deletion'										,value: '0'										,mode			: 'local'										,typeAhead		: true										,editable		: false										,selectOnFocus 	: true										,triggerAction 	: 'all'										,store: new Ext.data.SimpleStore({											fields : ['folder_deletion', 'folderDeletion'],											data : [												 ['0', 'Prompt me when deleting a folder']												,['1', 'Don\'t prompt me when deleting a folder']											]										})                                    },{                                    	 hidden: Eve.Preference.get('myContacts') == '1' ? false : true                                    	,xtype: 'panel'                                    	,layout: 'form'                                    	,items: [{	                                        fieldLabel: 'Default Contact Category'	                                        ,name: 'default_contacts_category'											,id: 'personal_default_cat'											,xtype: 'combo'											,mode: 'local'	                                        ,anchor: '90%'											,smname: 'userGeneralSettingController_personalContacts'											,store 	: new Ext.data.Store({												reader 	: new Ext.data.XmlReader({													record 	: 'row'													,id		: 'id'												}, ['id', 'title'])											})											,displayField: 'title'											,valueField: 'id'											,selectOnFocus 	: true											,triggerAction 	: 'all'											,lazyInit		: false                                    	}]                                    }                                ]                            }, {                                xtype		: 'fieldset'                                ,title		: 'Portal Interface'                                ,autoHeight	: true                                ,collapsible: true                                ,defaultType: 'radio'                                ,width		: 600                                ,labelWidth : 200                                ,items		: [{                                    fieldLabel		: 'Classic'									,id				: 'personal-general-portal-classic'                                    ,name			: 'directory'									,inputValue		: 'nicolasstyle'                                    ,anchor			: (Ext.isChrome) ? '100%' : '140%'									,labelSeparator	: ''									,boxLabel		: 'A scaled down version of HyperOffice ideal for slower internet connections and older browsers.'                                }, {									fieldLabel		: 'Modern'                                    ,name			: 'directory'									,inputValue		: 'modernstyle'                                    ,anchor			: (Ext.isChrome) ? '100%' : '140%'									,labelSeparator	: ''									,boxLabel		: 'The latest version of HyperOffice complete with enhanced user interface features such as color-coded calendars as well as drag-and-drop and right-click functionality.'                                }]                            }, {                                xtype		: 'fieldset'                                ,title		: 'SMS Settings'                                ,autoHeight	: true                                ,collapsible: true                                ,width		: 600                                ,labelWidth : 200                                ,items		: [                                      		                                       {                                    	layout: 'column',                                    	items: [{                                             layout 		: 'form'                                            ,columnWidth 	: .95                                            ,items: {												 xtype			: 'numberfield'			                                    ,fieldLabel		: 'Phone Number'			                                    ,name			: 'sms_number'			                                    ,smname			: 'SMSPreferences>number'												,allowDecimals	: false												,allowNegative	: false			                                    ,anchor			: '95%'												,emptyText		: "i.e. 2125551212 don't enter space, dashes, etc"                                    		}                                    	},{                                            layout : 'form'                                            ,columnWidth : .05                                            ,items : [{                                                html : '<label></label>'                                                ,cls : 'lamp-tip'                                                ,id : 'sms_numberTip'                                                ,listeners : {                                                    render : function(){                                                        var tip = new Ext.ToolTip({                                                            target: 'sms_numberTip',                                                            width:300,                                                            html: 'This number will also be used for SMS notifications, please log out and log back in to apply these settings fully after saving.',                                                            trackMouse:true                                                        });                                                    }                                                }                                            }]                                        }]                                    }                                , {									xtype			: 'combo'									,xxtype			: 'combo'                                    ,fieldLabel		: 'Carrier'                                    ,name			: 'sms_carrier'                                    ,smname			: 'SMSPreferences>carrier'									,mode			: 'local'									,displayField	: 'display'									,valueField		: 'value'									,value			: ''									,typeAhead		: true									,editable		: false									,selectOnFocus 	: true									,triggerAction 	: 'all'                                    ,anchor			: '90%'									,store			: new Ext.data.SimpleStore({										fields : ['value', 'display'],										data : [											 ['', '- None -']											,['message.alltel.com', 'Alltel']											,['txt.att.net', 'AT&T']											,['txt.bellmobility.ca', 'Bell Canada']											,['myboostmobile.com', 'Boost Mobile']											,['csouth1.com', 'Cellular South']											,['cwemail.com', 'Centennial Wireless']											,['gocbw.com', 'Cincinnati Bell']											,['sms.mycricket.com', 'Cricket Wireless']											,['mymetropcs.com', 'Metro PCS']											,['messaging.nextel.com', 'Nextel']											,['qwestmp.com', 'Qwest']											,['pcs.rogers.com', 'Rogers']											,['messaging.sprintpcs.com', 'Sprint']											,['tms.suncom.com', 'Suncom']											,['tmomail.net', 'T-Mobile']											,['msg.telus.com', 'Telus']											,['email.uscc.net', 'U.S. Cellular']											,['vtext.com', 'Verizon']											,['vmobl.com', 'Virgin Mobile USA']										]									})                                }]                            }, {                                xtype : 'fieldset'                                ,title : 'Calendar Setting'                                ,autoHeight : true                                ,collapsible : true                                ,defaultType : 'combo'                                ,width : 600                                ,labelWidth : 200                                ,items : [{                                    fieldLabel : 'Calendar Type'									,id		: 'personal_calendar_type'                                    ,name : 'userCalendar'									,smname: 'userCalendars'                                    ,anchor : '90%'									,mode			: 'local'									,typeAhead		: true									,editable		: false									,selectOnFocus 	: true									,triggerAction 	: 'all'									,lazyInit		: false									,store: new Ext.data.Store({										reader 	: new Ext.data.XmlReader({											record 	: 'row'											,id		: 'value'										}, ['value'])									})									,displayField: 'value'									,valueField: 'value'                                },{                					xtype			: 'combo'                					,xxtype			: 'combo'                					,fieldLabel		: 'Default Reminder'            						,name			: 'defaultReminderTime'        							,smname			: 'defaultReminderTime'                					,id				: 'personalSettingsReminderWhen'                					,mode			: 'local'                					,valueField		: 'value'                					,displayField	: 'text'                					,typeAhead		: true                					,editable		: false                					,selectOnFocus 	: true                					,triggerAction 	: 'all'                					,anchor 		: '90%'                					,store			: new Ext.data.SimpleStore({                						fields	: ['text', 'value']                						,data	: [                							 ['None', '-1']                							,['At Event Time', '0']                							,['5 Minutes Before', '5']                							,['15 Minutes Before', '15']                							,['30 Minutes Before', '30']                							,['1 Hour Before', '60']                							,['2 Hour Before', '120']                							,['3 Hour Before', '180']                							,['4 Hour Before', '240']                							,['5 Hour Before', '300']                							,['6 Hour Before', '360']                							,['7 Hour Before', '420']                							,['8 Hour Before', '480']                							,['9 Hour Before', '540']                							,['10 Hour Before', '600']                							,['11 Hour Before', '660']                							,['12 Hour Before', '720']                							,['1 Day Before', '1440']                							,['2 Days Before', '2880']                							,['1 Week Before', '10080']                						]                					})                				}]                            }, {                                xtype : 'fieldset'                                ,title : 'Edit your mail settings'                                ,collapsible : true                                ,autoHeight : true                                ,width : 600                                ,labelWidth : 200                                ,items : [{                                    html : 'Your mail settings are accessible within the mail section by clicking on the "settings" button but they can also be modified using the button below.'                                    ,style : 'padding-bottom:10px'                                }, {                                    xtype : 'button'                                    ,text : 'Mail Settings'                                    ,handler : function(){                                        var obj  = {                                            info: {                                                id: ''                                            }					};                                        Eve.Resource.superbridge.broadcast(this, 'personal_mail_setting_dlg', obj )                                    }                                }]                            }]                        }]                    }, {                        title: 'Account'                        ,layout: 'form'                        ,frame		: false						,autoScroll: true                        ,border		: false                        ,bodyStyle	: 'padding: 20px'                        ,items : [{                            xtype : 'fieldset'                            ,title : 'Change Password'                            ,defaultType : 'textfield'                            ,autoHeight : true                            ,collapsible : true                            ,width : 600                            ,labelWidth : 200                            ,items : [{                                fieldLabel : 'Current Password'                                ,name : 'current_password'                                ,id		: 'userPrefsCurrentPassword'                                ,inputType : 'password'                                ,anchor: '90%'                            }, {                                fieldLabel : 'New Password'                                ,name : 'new_password'                                ,inputType : 'password'                                ,id		: 'userPrefsPassword'                                ,anchor: '90%'                            }, {                                fieldLabel : 'New Password(Verify)'                                ,name : 'new_password_again'                                ,id		: 'userPrefsPasswordAgain'                                ,inputType : 'password'                                ,anchor: '90%'                            }]                        }, {                            xtype : 'fieldset'                            ,title : 'Hint Question'                            ,defaultType : 'textfield'                            ,autoHeight : true                            ,collapsible : true                            ,width : 600                            ,labelWidth : 200                            ,items : [{                                fieldLabel : 'Password'                                ,inputType : 'password'                                ,name : 'old_password2'                                ,id		: 'userPrefsOldHintPassword'                                ,anchor: '90%'                            }, {                                fieldLabel : 'Hint Question'                                ,name : 'new_hint_question'                                ,id		: 'userPrefsHintQuestion'                                ,anchor: '90%'                            }, {                                fieldLabel : 'Hint Answer'                                ,name : 'new_hint_answer'                                ,id		: 'userPrefsHintAnswer'                                ,anchor: '90%'                            }]                        }, {                            xtype : 'fieldset'                            ,title : 'Cancel Account'                            ,autoHeight : true                            ,collapsible : true                            ,width : 600                            ,labelWidth : 200                            ,hidden: !(Eve.Preference.get("accountLevel") >= 155)                            ,items : [{                                html : 'You have already made an investment in HyperOffice. Oftentimes we resolve customer issues once we understand what the problem is. Before taking the next step give us a call and give us a chance to protect your investment.'                                ,style : 'padding-bottom:10px'                            }, {                                xtype : 'button'                                ,text : 'Cancel Account'                                ,handler : function(){                                		var url = "http://www.hyperoffice.com/cancel-pages/001.php?cid="+Eve.Preference.get('cobrandId')+"&name="+Eve.Preference.get('firstName')+'%20'+Eve.Preference.get('lastName')+"&company="+Eve.Preference.get('organization')+"&status="+((Eve.Preference.getBoolean('accounttrial')==false)?"Customer":"Trial")																		window.open(url);                                 	//Ext.MessageBox.alert('Cancel Account', 'To cancel your account please contact our billing department at 1-301-255-0018 x150.')                                }                            }]                        }]                    }]            }]    });}Eve.Personal.PersonalPanel = function(superbridge, manager, dialog) {    return new Ext.Panel({        layout: 'border'        ,border: false        ,items: [{            region: 'center'            ,layout: 'fit'            ,items: [dialog.dialog]        }]    })}Ext.ns('Ext.ux.form.HtmlEditor');Ext.ux.form.HtmlEditor.Image = Ext.extend(Ext.util.Observable, {    // private    cmd: 'image',    // private    init: function(cmp){        this.cmp = cmp;        this.cmp.on('render', this.onRender, this);    },    // private    onRender: function(){        var cmp = this.cmp;        var btn = this.cmp.getToolbar().addButton({            iconCls: 'x-edit-image',            handler: function(){                if (!this.imageWindow){                    this.imageWindow = new Ext.Window({                        title: 'Insert Image',                        width: '400px',                        closeAction: 'hide',                        items: [{                            itemId: 'insert-image',                            xtype: 'form',                            border: false,                            plain: true,                            bodyStyle: 'padding: 10px;',                            labelWidth: 60,                            labelAlign: 'right',                            items: [{                                xtype: 'label',                                html: '<div style="text-align: left; margin-bottom: 10px">Please enter the link of image you want to insert:</div>'                            }, {                                xtype: 'textfield',                                allowBlank: false,                                fieldLabel: 'Image link',                                width: '290px',                                name: 'imageLink',                                 listeners: {                                    specialkey: function(f, e){                                        if ((e.getKey() == e.ENTER || e.getKey() == e.RETURN) && f.isValid()) {                                            this.doInsertImage();                                        }else{                                            f.getEl().frame();                                        }                                    },                                    scope: this                                }                            }]                        }],                        buttons: [{                            text: 'Insert',                            handler: function(){                                var frm = this.imageWindow.getComponent('insert-image').getForm();                                if (frm.isValid()){                                    this.doInsertImage();                                }else{                                    frm.findField('imageLink').getEl().frame();                                }    						},                            scope: this                        }, {                            text: 'Cancel',                            handler: function(){                                this.imageWindow.hide();                            },                            scope: this                        }]                    });                }else{                    this.imageWindow.getEl().frame();                }                this.imageWindow.show();            },            scope: this,            tooltip: {                title: 'Insert Image'            },            overflowText: 'Image link'        });    },    // private    doInsertImage: function(){        var frm = this.imageWindow.getComponent('insert-image').getForm();        if (frm.isValid()) {            var imageLink = frm.findField('imageLink').getValue();            if (imageLink) {                this.insertImage(imageLink);            } else {                return false;            }            frm.reset();            this.imageWindow.hide();        }    },    insertImage: function(w){        this.cmp.insertAtCursor('<img src="' + w + '" alt="" >');    }});/** * Mail Setting **/// PreferencesEve.Personal.MailPreferences = function() {    return new Eve.FormPanel({        labelWidth : 200        ,frame	: false        ,bodyStyle : 'padding: 5px 5px 0'        ,items : [{            fieldLabel : 'Replying'            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'replyIncludesOriginal'			,name	: 'reply_includes_original'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Don\'t include original message in reply ']					,['1', 'Include original message in reply ']				]			})        }, {            fieldLabel : 'Send Saving'            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'saveSentDefault'			,name	: 'save_sent_default'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Don\'t save sent messages by default']					,['1', 'Save sent messages by default']				]			})        }, {            fieldLabel : 'Send Confirmation'            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'confirmSentMessages'			,name	: 'confirm_sent_messages'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Don\'t confirm message sends']					,['1', 'Confirm message sends']				]			})        }, {            fieldLabel : 'Message Deletion'            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'deleteMailToTrash'			,name	: 'delete_to_trash'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Remove deleted mail immediately']					,['1', 'Send deleted mail to the Trash folder']				]			})        }, {            fieldLabel : 'Use Reply-To'            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'useReplyTo'			,name	: 'use_replyto'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Do not specify a reply e-mail address']					,['1', 'Mail recipients should reply to the address below']				]			})        }, {            fieldLabel : 'Use Reply-To Address'            ,xtype : 'textfield'            ,smname : 'replyTo'			,name	: 'replyto'            ,anchor : '90%'        }, {            fieldLabel : 'Default Font'            ,xtype : 'combo'                        ,xxtype : 'combo'            ,smname : 'defaultFontFamily'			,name	: 'default_font'            ,anchor : '90%'			,displayField	: 'value'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value'],				data : [					 ['Arial']					,['Arial Black']					,['Arial Narrow']					,['Courier New']					,['System']					,['Tahoma']					,['Times New Roman']					,['Verdana']				]			})        }, {            fieldLabel : 'Font Size'            ,xtype : 'combo'            ,xxtype : 'combo'            ,smname : 'defaultFontSize'			,name	: 'default_font_size'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['8',  '1 (8 pt)']					,['10', '2 (10 pt)']					,['12', '3 (12 pt)']					,['14', '4 (14 pt)']					,['18', '5 (18 pt)']					,['24', '6 (24 pt)']					,['36', '7 (36 pt)']				]			})        }, new Ext.form.ColorField({            fieldLabel: 'Font Color'			,id: 'mail_color_field'			,smname : 'defaultFontColor'			,name	: 'default_font_color'            ,hiddenName:'fontColor'            ,showHexValue:true        }),{            hideLabel : true            ,xtype : 'combo'			,xxtype: 'combo'            ,smname : 'useSignature'			,name	: 'use_signature'            ,anchor : '90%'			,displayField	: 'text'			,valueField		: 'value'			,mode			: 'local'			,typeAhead		: true			,editable		: false			,selectOnFocus 	: true			,triggerAction 	: 'all'			,store: new Ext.data.SimpleStore({				fields : ['value', 'text'],				data : [					 ['0', 'Don\'t use e-mail signature']					,['1', 'Use e-mail signature']				]			})        }, {	            xtype : 'htmleditor'	            ,hideLabel : true				,name	: 'signature'	            ,anchor	: '100%'	            ,height: 150	            ,plugins: [	                       new Ext.ux.form.HtmlEditor.Image()	                      ]        }]    })}// FilterEve.Personal.storeMailFilter = new Ext.data.SimpleStore({    fields : ['id', 'title'],    data : []});Eve.Personal.MailFilter = function() {	var criteria = new Ext.data.SimpleStore({		fields : ['text', 'value'],		data : [			['contains' , '1'],			['does not contain' , '2'],			['begins with' , '3'],			['ends with' , '4']		]	});    return new Eve.FormPanel({        frame	: false        ,bodyStyle : 'padding: 5px 5px 0'        ,items : [{            layout : 'column'            ,items : [{                layout : 'form'                ,columnWidth : .5                ,labelWidth : 75                ,items : [{                    xtype : 'combo'					,xxtype: 'combo'					,id: 'from_type_filter'                    ,fieldLabel : 'From Field'                    ,name : 'from_matchtype'                    ,anchor : '90%'					,displayField	: 'text'					,valueField		: 'value'					,value			: '1'					,mode			: 'local'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,store			: criteria                }, {                    xtype : 'combo'                    ,xxtype : 'combo'					,id	: 'sender_type_filter'                    ,fieldLabel : 'Sender Field'                    ,name : 'sender_matchtype'                    ,anchor : '90%'					,displayField	: 'text'					,valueField		: 'value'					,value			: '1'					,mode			: 'local'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,store			: criteria                }, {                    xtype : 'combo'                    ,xxtype : 'combo'					,id	: 'toCC_type_filter'                    ,fieldLabel : 'To\\CC Field'                    ,name : 'tocc_matchtype'                    ,anchor : '90%'					,displayField	: 'text'					,valueField		: 'value'					,value			: '1'					,mode			: 'local'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,store			: criteria                }, {                    xtype : 'combo'                    ,xxtype : 'combo'					,id: 'subject_type_filter'                    ,fieldLabel : 'Subject'                    ,name : 'subject_matchtype'                    ,anchor : '90%'					,displayField	: 'text'					,valueField		: 'value'					,value			: '1'					,mode			: 'local'					,typeAhead		: true					,editable		: false					,selectOnFocus 	: true					,triggerAction 	: 'all'					,store			: criteria                }]            }, {                layout : 'form'                ,columnWidth : .5                ,labelWidth : 75                ,items : [{                    xtype : 'textfield'					,id: 'from_text_filter'                    ,fieldLabel : 'The Phrase'                    ,anchor : '90%'					,name : 'from_field_v'                }, {                    xtype: 'textfield'					,id: 'sender_text_filter'                    ,fieldLabel: 'The Phrase'                    ,anchor: '90%'					,name: 'sender_field_v'                }, {                    xtype : 'textfield'					,id: 'toCC_text_filter'                    ,fieldLabel : 'The Phrase'                    ,anchor : '90%'					,name: 'tocc_field_v'                }, {                    xtype : 'textfield'					,id: 'subject_text_filter'                    ,fieldLabel : 'The Phrase'                    ,anchor : '90%'					,name: 'subject_field_v'                }]            }]        }, {            layout : 'form'            ,bodyStyle : 'padding: 25px'            ,labelWidth : 110            ,items : [{                layout : 'column'                ,items : [{                    layout : 'form'                    ,columnWidth : .83                    ,items : [{                        xtype	: 'combo'						,id		: 'personal_mail_folders'						,mode	: 'local'                        ,fieldLabel : 'Move message to'						,allowBlank : false                        ,name : 'transfer_to'						,smname: 'mailFilterAndBlockSettingController_mailFolders'                        ,anchor : '95%'						,valueField		: 'id'						,displayField	: 'title'						,typeAhead		: true						,lazyInit		: false						,triggerAction 	: 'all'						,forceSelection : true                        ,store		:new Ext.data.Store({							reader 	: new Ext.data.XmlReader({								record 	: 'row'								,id		: 'id'							}, ['title', 'id'])						})                    }]                }, {                    layout : 'form'                    ,columnWidth : .17                    ,items : [{                        xtype : 'button'                        ,text : 'Add'						,filterId: 0                        ,minWidth : 80						,id : 'mail_filter_btn_add'                    }]                }]            }, new Ext.Panel({                height : 203,                border : true,                autoScroll : true,                style : 'margin-top: 25px; background-color:#FFF;',                items : new Ext.DataView({                        id : 'dvMailFilter'						,itemSelector: 'div.x-group-select'						,selectedClass: 'x-group-selected'												,singleSelect: true                        ,tpl : new Ext.XTemplate(							'<div style="height:200px; overflow-y:auto">',							'<tpl for=".">',							'<div class="x-group-select">',							'<div style="float:left; padding:3px;font:8pt Arial ">',							'<tpl if="this.getMatchType(values.fromMatchType)">',							'if message from field {[this.getMatchType(values.fromMatchType)]} {from}<br/>',							'</tpl>',							'<tpl if="this.getMatchType(values.senderMatchType)">',							'if message sender field {[this.getMatchType(values.senderMatchType) ]} {sender}<br/>',							'</tpl>',							'<tpl if="this.getMatchType(values.ccToMatchType)">',							'if message to/cc field {[this.getMatchType(values.ccToMatchType)]} {ccTo}<br/>',							'</tpl>',							'<tpl if="this.getMatchType(values.subjectMatchType)">',							'if message subject field {[this.getMatchType(values.subjectMatchType)]} {subject}<br/>',							'</tpl>',							'-> send message to <b>{folder}</b>',							'</div>',							'<div style="float:right">',							'<img class="btn-delete" src="'+Eve.Resource.getIcon("delete","general")+'" height="20" style="float:left;cursor:pointer" title="delete">',							'</div>',							'<div style="clear:both;"></div>',							'</div></tpl>',							'</div>',							{								getMatchType: function(matchType){									switch(matchType){										default :										case '0':											return false;										case '1':											return 'contains';										case '2':											return 'does not contain';										case '3':											return 'begins with';										case '4':											return 'ends with';										case 'contains':										case 'does not contain':										case 'begins with':										case 'ends with':											return matchType;									}								}							}						)                        ,emptyText	: '<div style="text-align:center; padding-top: 10px"><i>No Data</i></div>'                        ,store		:new Ext.data.Store({							reader 	: new Ext.data.XmlReader({								record 	: 'row'							}, ['fromMatchType', 'from', 'senderMatchType', 'sender',								'ccToMatchType', 'ccTo', 'subjectMatchType', 'subject', 'folder', 'folderId'])						})                                      })            })]        }]    })}// White/Black Email ListEve.Personal.mailListTpl = new Ext.XTemplate(    '<tpl for="."><div style="padding:2px;font-size:12px;" class="search-item">',    '<div style="width:220px;float:left;overflow:hidden;white-space:nowrap;" title={email}>{email}</div>',	'<div style="float:right;">',	'<a href="#" onclick="window.Eve.Resource.superbridge.broadcast(window, &quot;whiteblack_mail_delete&quot;, { id:\'{id}\',type:\'{type}\', index:{#}  })">',	'<img src="{[this.getDelIcon()]}" style="cursor:pointer;">',	'</a></div>',	'<div style="clear:both;"></div>',    '</div>',	'</tpl>',	{		getDelIcon : function(){			return Eve.Resource.getIcon("delete","general");		}	})Eve.Personal.MailWhiteBlackList = function() {    return new Eve.FormPanel({        frame	: false        ,bodyStyle : 'padding: 5px 5px 0'        ,items : [{            html : 'Type in all of the addresses you would like to whitelist or blacklist in a comma-delimited list below. You can also use *@domain.com to list an entire domain.'            ,style : 'margin:5px'        }, {            xtype : 'textarea'            ,name : 'balckAndWhileList'			,id	  : 'white_black_list'            ,hideLabel : true            ,anchor : '100%'        }, {            layout : 'column'            ,items : [{                layout : 'form'                ,columnWidth : .5                ,bodyStyle : 'position:relative;left:20px'                ,items : [{                    xtype : 'button'                    ,text : 'Add to Whitelist'					,id	  : 'btn_add_white'                }]            }, {                layout : 'form'                ,columnWidth : .5                ,bodyStyle : 'position:relative;left:168px'                ,items : [{                    xtype : 'button'                    ,text : 'Add to Blacklist'					,id	  : 'btn_add_black'                }]            }]        },{			html:'<hr/>'			,style: 'margin:6px auto;'		},{            layout : 'column'            ,items : [{                columnWidth : .5                ,bodyStyle : 'margin-left:2px'                ,items : [{					html: '<b>Whitelist</b>'                }]            }, {                columnWidth : .5                ,bodyStyle : 'margin-left:12px'                ,items : [{					html: '<b>Blacklist</b>'                }]            }]		}, {            layout : 'column'            ,bodyStyle : 'margin-top:3px'            ,items : [{                columnWidth : .5                ,items : [{                    layout : 'column'                    ,items : [{                        layout : 'form'                        ,columnWidth : .73                        ,items : [{                            xtype : 'textfield'                            ,name : 'Whitelist'							,id	  : 'txtWhite'                            ,hideLabel : true                            ,anchor : '98%'                        }]                    }, {                        columnWidth : .27                        ,items : [{                            xtype : 'button'                            ,text : 'Search'                            ,handler : function(){                        		Eve.Resource.superbridge.broadcast(this, 'whiteblack_search_white_mail', {query: Ext.getCmp('txtWhite').getValue().trim()})                        	/*								var txt = Ext.getCmp('txtWhite').getValue().trim();								var st = Ext.getCmp('dvMailWhiteList').store;								st.filter('email', new RegExp(Ext.escapeRe(txt),"i"));*/                            }                        }]                    }]                }, new Ext.Panel({                    height : 197                    ,width : 270                    ,border : true                    ,autoScroll : true                    ,style : 'margin-top: 5px; background-color:#FFF;border:1px solid;'                    ,items : {						xtype: 'dataview'						,height : 195                        ,id : 'dvMailWhiteList'						,selectedClass: 'x-group-selected'						,multiSelect: true                        ,tpl : Eve.Personal.mailListTpl                        ,emptyText : '<div style="text-align:center; padding-top: 10px"><i>No Data</i></div>'						,store 	: new Ext.data.Store({							reader 	: new Ext.data.XmlReader({								record 	: 'row'								,id		: 'id'							}, ['id', 'email', 'type'])						})                        ,itemSelector : 'div.search-item'                    }                })		   ]            }, {                layout : 'form'                ,columnWidth : .5                ,bodyStyle : 'margin-left:10px'                ,items : [{                    layout : 'column'                    ,items : [{                        layout : 'form'                        ,columnWidth : .73                        ,items : [{                            xtype : 'textfield'                            ,name : 'Blacklist'							,id	: 'txtBlack'                            ,hideLabel : true                            ,anchor : '98%'                        }]                    }, {                        columnWidth : .27                        ,items : [{                            xtype : 'button'                            ,text : 'Search'                            ,handler : function(){                        		Eve.Resource.superbridge.broadcast(this, 'whiteblack_search_black_mail', {query: Ext.getCmp('txtBlack').getValue().trim()})                        	/*								var txt = Ext.getCmp('txtBlack').getValue().trim();								var st = Ext.getCmp('dvMailBlackList').store;								st.filter('email', new RegExp(Ext.escapeRe(txt),"i"));*/                            }                        }]                    }]                }, new Ext.Panel({                    height : 197                    ,width : 270                    ,border : true                    ,style : 'margin-top: 5px; background-color:#FFF;border:1px solid;'                    ,items : {                        id : 'dvMailBlackList'						,height : 195						,xtype: 'xdataview'                        ,tpl : Eve.Personal.mailListTpl                        ,emptyText : '<div style="text-align:center; padding-top: 10px"><i>No Data</i></div>'						,store 	: new Ext.data.Store({							reader 	: new Ext.data.XmlReader({								record 	: 'row'								,id		: 'id'							}, ['id', 'email','type'])						})                        ,itemSelector : 'div.search-item'						,selectedClass: 'x-group-selected'						,multiSelect: true                    }                })]            }]        }, {            xtype : 'button'            ,text : 'Import my contacts to the Whitelist'            ,style : 'margin:0 auto;padding-top:15px;'            ,handler : function(){        		Eve.Resource.superbridge.broadcast(this, 'personal_whiteblack_import_contacts', {} )            }        }]    })}// Email Spam SettingExt.ux.SliderTip = Ext.extend(Ext.Tip, {    minWidth: 10,    offsets : [0, -10],    init : function(slider){        slider.on('dragstart', this.onSlide, this);        slider.on('drag', this.onSlide, this);        slider.on('dragend', this.hide, this);        slider.on('destroy', this.destroy, this);    },    onSlide : function(slider){        this.show();        this.body.update(this.getText(slider));        this.doAutoWidth();        this.el.alignTo(slider.thumb, 'b-t?', this.offsets);    },    getText : function(slider){        return slider.getValue();    }});Eve.Personal.MailSpamSetting = function() {    return new Eve.FormPanel({        frame	: false        ,bodyStyle : 'padding: 5px 5px 0'        ,items : [{            layout : 'column'            ,items : [{                layout : 'form'                ,columnWidth : .2                ,items : [{                    html : 'Spam Threshold'                    ,style : 'font-weight:bold;text-align:center;margin:0 auto;'                }, new Ext.Slider({                    height: 150                    ,increment : 1                    ,vertical : true					,id		: 'spam_tresh_holder'					,name: 'spamThresholdLevel'                    ,minValue: 1                    ,maxValue: 10                    ,style : 'margin:15px auto 0;'                    ,plugins: new Ext.ux.SliderTip()                    ,listeners : {                        change : function(slider, value){                            Eve.Resource.superbridge.broadcast(this, 'change_spam_level', value )                        }                    }                })]            }, {                layout : 'form'                ,columnWidth : .8                ,items : [new Ext.Panel({                    id : 'spamContextContainer'                    ,width: 400                    ,height: 100                    ,bodyBorder : true                    ,style : 'margin:45px auto;padding:0 10px;background:white;'                    ,html: ''                })]            }]        }, {            layout : 'column'            ,items : [{                layout : 'form'                ,labelWidth : 180                ,columnWidth : .65                ,style : 'margin:30px 0'                ,items : [{                    xtype : 'combo'					,id : 'spam_delivery_folderId'					,mode : 'local'					,smname: 'mailFilterAndBlockSettingController_mailFolders'                    ,name : 'spamDeliveryFolderId'                    ,bypassCheck: true                    ,fieldLabel : 'Deliver spam to'					,anchor : '95%'					,valueField		: 'id'					,displayField	: 'title'					,typeAhead		: true					,lazyInit		: false					,triggerAction 	: 'all'					,forceSelection : true					,allowBlank		: false					,store		:new Ext.data.Store({						reader 	: new Ext.data.XmlReader({							record 	: 'row'							,id		: 'id'						}, ['title', 'id'])					})					,listeners: {						select: function(cmp, rec, index){							var checkLayout = Ext.getCmp('modify_spam_subject');							if(index == 0)								checkLayout.hide();							else								checkLayout.show();						}					}                }, {                    xtype : 'combo'					,id	: 'quarantine_delivery_folderId'					,mode : 'local'                    ,fieldLabel : 'Deliver Quarantined mail to'					,smname: 'mailFilterAndBlockSettingController_mailFolders'                    ,name : 'quarantineDeliveryFolderId'                    ,bypassCheck: true					,anchor : '95%'					,valueField		: 'id'					,displayField	: 'title'					,typeAhead		: true					,lazyInit		: false					,triggerAction 	: 'all'					,forceSelection : true					,allowBlank		: false					,store		:new Ext.data.Store({						reader 	: new Ext.data.XmlReader({							record 	: 'row'							,id		: 'id'						}, ['title', 'id'])					})				                }]            }, {                layout : 'form'                ,labelWidth : 150                ,columnWidth : .35                ,style : 'margin:30px 0'				,id	: 'modify_spam_subject'                ,items : [{                    xtype : 'checkbox'					,name : 'modifySpamSubjects'					//,name : 'spamProbe'                    ,fieldLabel : 'Add the phrase "Spam?" to the subject'                }]            }]        }, {            layout : 'form'            ,labelWidth : 180            ,items : [{                layout : 'column'                ,items : [{                    layout : 'form'                    ,columnWidth : .4                    ,items : [{                        xtype : 'checkbox'                        ,fieldLabel : 'Use SPAM signature databases'						,smname: 'dcc'                        ,name : 'useSpamSignatureDatabase'						,listeners: {							check: function(cmp, value){								if(value)									Eve.Resource.superbridge.broadcast(this,'use_spam_signature', {razor:true, dcc:true, pyzor: true});								else									Eve.Resource.superbridge.broadcast(this,'use_spam_signature', {razor:false, dcc:false, pyzor: false});							}						}                    }]                }, {                    layout : 'form'                    ,columnWidth : .6                    ,items : [{                        html : '<label></label>'                        ,cls : 'lamp-tip'                        ,id : 'useSpamSignatureDatabaseTip'                        ,listeners : {                            render : function(){                                var tip = new Ext.ToolTip({                                    target: 'useSpamSignatureDatabaseTip',                                    width:300,                                    html: 'This setting uses external community-run \n\                                    SPAM databases to check the signature of your message\n\                                    against to see if it is listed as a known SPAM message.',                                    trackMouse:true                                });                            }                        }                    }]                }]            }, {                layout : 'column'                ,items : [{                    layout : 'form'                    ,columnWidth : .4                    ,items : [{                        xtype : 'checkbox'                        ,fieldLabel : 'Use Greylisting'                        ,name : 'greylisting'                    }]                }, {                    layout : 'form'                    ,columnWidth : .6                    ,items : [{                        html : '<label></label>'                        ,cls : 'lamp-tip'                        ,id : 'useGreylistingTip'                        ,listeners : {                            render : function(){                                var tip = new Ext.ToolTip({                                    target: 'useGreylistingTip',                                    width:300,                                    html: 'Greylisting is significantly reduced your \n\                                    SPAM levels by ensuring that all of the servers trying\n\                                     to send you mail adhere to internet standards for retry \n\                                    provisions. Spammers rarely follow these rules so this is \n\                                    a very effective tool.',                                    trackMouse:true                                });                            }                        }                    }]                }]            }]        }]    })}// Email Forwarding/AutoresponderEve.Personal.MailForwardingAutoresponder = function() {    return new Eve.FormPanel({        frame	: false        ,bodyStyle : 'padding: 5px 5px 0'        ,labelWidth : 150        ,items : [{            layout : 'form'            ,style : 'margin-bottom:30px'            ,items : [{                xtype : 'combo'				,xxtype: 'combo'                ,fieldLabel : 'Use Forwarding'                ,smname : 'useForwarding'				,name : 'use_forwarding'                ,anchor : '90%'				,displayField	: 'text'				,valueField		: 'value'				,mode			: 'local'				,typeAhead		: true				,editable		: false				,selectOnFocus 	: true				,triggerAction 	: 'all'				,store: new Ext.data.SimpleStore({					fields : ['value', 'text'],					data : [						 ['0', 'Don\'t use e-mail forwarding']						,['1', 'Forward all e-mail to the address below']						,['2',  'Forward a copy' ]					]				})            }, {                xtype : 'textfield'                ,fieldLabel : 'Forwarding Address'                ,smname : 'forwardingAddress'				,name	: 'forwarding_address'                ,anchor : '90%'            }]        }, {            layout : 'form'            ,items : [{                xtype : 'combo'				,xxtype: 'combo'                ,fieldLabel : 'Use Autoresponder'                ,smname : 'useAutoResponder'				,name: 'use_autoresponder'                ,anchor : '90%'				,displayField	: 'text'				,valueField		: 'value'				,mode			: 'local'				,typeAhead		: true				,editable		: false				,selectOnFocus 	: true				,triggerAction 	: 'all'				,store: new Ext.data.SimpleStore({					fields : ['value', 'text'],					data : [						 ['0', 'Disable autoresponder']						,['1', 'Autorespond to messages with the below message']					]				})            }, {                xtype : 'textfield'                ,fieldLabel : 'Autoresponder From'                ,name : 'autoResponseFrom'                ,anchor : '90%'            },  {                xtype : 'textfield'                ,fieldLabel : 'Autoresponder Subject'				,smname	: 'autoResponseSubject'                ,name : 'autoresponseSubject'                ,anchor : '90%'            }, {                xtype : 'textarea'                ,fieldLabel : 'Autoresponder Message'				,smname: 'autoResponse'                ,name : 'autoresponse'                ,anchor : '90%'            }]        }]    })}/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       PersonalDialogInitialize * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */Eve.vc.createFormPanel( 'PersonalDetails', Eve.Personal.PersonalDetails );Eve.vc.createFormPanel( 'PersonalMailPreferences', Eve.Personal.MailPreferences );Eve.vc.createFormPanel( 'PersonalMailFilter', Eve.Personal.MailFilter );Eve.vc.createFormPanel( 'PersonalMailWhiteBlackList', Eve.Personal.MailWhiteBlackList );Eve.vc.createFormPanel( 'PersonalMailSpamSetting', Eve.Personal.MailSpamSetting );Eve.vc.createFormPanel( 'PersonalForwardingAutoresponder', Eve.Personal.MailForwardingAutoresponder );/* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * *       Personal Events * * * * * * * * * *  * * * * * * * * * * * * * * * * * * * */Ext.override( Eve.vc.PersonalDetails, {      loadEvent 	: function(){ return 'modern.preferences.user.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.user.modify'; }});Ext.override( Eve.vc.PersonalMailPreferences, {      loadEvent 	: function(){ return 'modern.preferences.mail.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.mail.modify'; }});Ext.override( Eve.vc.PersonalMailFilter, {      loadEvent 	: function(){ return 'modern.preferences.mail.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.mail.modify'; }});Ext.override( Eve.vc.PersonalMailWhiteBlackList, {      loadEvent 	: function(){ return 'modern.preferences.mail.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.mail.modify'; }});Ext.override( Eve.vc.PersonalMailSpamSetting, {      loadEvent 	: function(){ return 'modern.preferences.mail.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.mail.modify'; }});Ext.override( Eve.vc.PersonalForwardingAutoresponder, {      loadEvent 	: function(){ return 'modern.preferences.mail.edit'; }     ,submitEvent 	: function(){ return 'modern.preferences.mail.modify'; }});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\Admin/PersonalDialogControl.js *//*--------------------------------------------------*//** * @Author Hamidreza Bidgoli <bidgoli[dot]wd[at]gmail[dot]com */Eve.lib.Personal.PersonalDialogBridge = Ext.extend( Eve.lib.TabDialogController, {    mode 	: 'create'    ,panels	: []    ,personalPanel : {}    ,init : function(data){        Eve.lib.Personal.PersonalDialogBridge.superclass.init.call(this, data);        var tab	= {            items : ['Details']            ,main : [0]        }        var dialog	= {            border : false           ,panel : true        }        var output = this.createDialog({tab: tab ,dialog: dialog, buttonAlign: 'center'});        this.personalPanel = output;		this.registerViews();    }	,registerViews : function(){		Ext.getCmp('personal_edit_pic').on('click', function(btnUpload) {			var that = this;						var fp = new Eve.UploadFormPanel({				fileUpload	: true				,frame		: true				,autoHeight	: true				,bodyStyle	: 'padding: 10px 10px 0 10px;'				,labelWidth	: 50				,defaults	: {					anchor		: '95%'					,msgTarget	: 'side'				}				,items		: [{					 xtype		: 'fileuploadfield'					,emptyText	: 'Select an image'					,fieldLabel	: 'Photo'					,name		: 'upload_file'					,buttonCfg	: {						text		: ''						,iconCls	: 'eve-upload-icon'					}				}]				,buttons	: [{					text		: 'Save'     				,handler	: function(){						if (fp.getForm().isValid()) {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Uploading photo...'								,params	: {									event	: 'modern.administrator.user.savePicture'									,userId : Eve.Preference.get('id')									,m_shariat_m: true								}								,success: function(fp, o) {									var val = Ext.DomQuery.selectValue('imageUrl', o.response.responseXML)									if (val !== undefined) {										if (!val || val.trim() == '' ) {											Ext.Msg.alert("Error", "There's an error while uploading image!");											val = Eve.Resource.getIcon('item-icon','contact');										}																				Ext.get('personal_img_avatar').set({src: val});										that.winImage.hide();									}									else{	 									var text = o.response.responseText;										Ext.Msg.alert('Error', text);									}								}							});						}					}				}, {					text	: 'Reset'					,handler: function() {							fp.getForm().submit({								url		: Eve.url								,waitMsg: 'Removing photo...'								,params	: {									event	: 'modern.administrator.user.resetPicture'									,userId		: Eve.Preference.get('id')								}								,success: function() {									fp.getForm().reset();									Ext.get('personal_img_avatar').set({src: Eve.Resource.getIcon('item-icon','contact')});									that.winImage.hide();								}							});					}				}]			});						that.winImage = new Ext.Window({				layout		: 'form'				,width		: 400				,title		: 'Image Upload'				,resizable	: false				,modal		: true				,items		: [fp]			});						that.winImage.show(btnUpload);					}, this);				}    ,augment : function( callee, index, type ){        var obj = callee.params;		if(this.mode == 'create')			obj.multipleControllers ='userPersonalSettingController,userGeneralSettingController'		if(this.mode == 'edit')            obj.id = this.id;				if (Ext.getCmp('userPrefsHintAnswer').getValue() || Ext.getCmp('userPrefsHintQuestion').getValue() || Ext.getCmp('userPrefsOldHintPassword').getValue())			obj.btnChangeHint = "true";					if (Ext.getCmp('userPrefsCurrentPassword').getValue() || Ext.getCmp('userPrefsPassword').getValue() || Ext.getCmp('userPrefsPasswordAgain').getValue())			obj.btnChangePass = "true";        return callee;    }    ,controller	: function(obj){    }    ,execute : function(callee, type, data){		switch(type){			case 'personal_edit_detail_dlg':				if (!this.getLoaded(0))					this.loadForm(0);				this.mode = 'edit';				break;		}    }    ,loadSuccess : function(res) {		var dq = Ext.DomQuery;				this.id = dq.selectValue('userDomain/id', res.responseXML);				var catField =  Ext.getCmp('personal_default_cat');		//var rec = Ext.data.Record.create(['title', 'id']);		//var newRec = new rec({title: '[ All Contacts ]', id: '0'});		//catField.store.insert(0, newRec);		var selField = dq.selectValue('defaultContactsCategory', res.responseXML);		if (selField !== undefined && selField > 0)			catField.setValue(selField);				 Ext.getCmp('personal_time_zone').setValue(dq.selectValue('LocaleSettings/timeZone', res.responseXML));		 Ext.getCmp('personal_locale').setValue(dq.selectValue('LocaleSettings/local', res.responseXML));		 Ext.getCmp('personal_calendar_type').setValue(dq.selectValue('LocaleSettings/calendar', res.responseXML));		var imagePath = Ext.DomQuery.selectValue('userDomain>imagePath', res.responseXML);				if (imagePath == '[NoImage]')			Ext.get('personal_img_avatar').set({src: Eve.Resource.getIcon('item-icon','contact')});		else			Ext.get('personal_img_avatar').set({src: imagePath});		var cmb = Ext.getCmp('personal_time_zone');				cmb.store.loadData(dq.select('timeZones', res.responseXML));		cmb.filterItems(cmb);		 		 	}	,submitSuccess : function( resp, action )	{		if ( Ext.getCmp('personal-general-portal-classic').getValue() ) {			Eve.Resource.changeStyle();		}    }    ,afterAddButtons : function(buttons, scope){		var btn = [];		buttons[0].hidden = false;		btn.push(buttons[0]);		return btn;    }});// Mail SettingEve.lib.Personal.MailSettingDialogBridge = Ext.extend( Eve.lib.TabDialogController, {    mode 	: 'create'    ,panels	: []    ,init : function(data){        Eve.lib.Personal.MailSettingDialogBridge.superclass.init.call(this, data);        var items	= ['Mail Preferences', 'Filters', 'White/Black', 'Spam Settings', 'Forwarding/Autoresponder'];        var tab		= {                items		: items				,related	: [[0, 1, 3, 4]]        }        var dialog	= {                width 	: 600                ,height : 540                ,title	: 'Mail Settings'        }        this.createDialog({tab: tab ,dialog: dialog});		this.filterRecord =  Ext.data.Record.create( [			'fromMatchType', 'from', 'senderMatchType', 'sender',			'ccToMatchType', 'ccTo', 'subjectMatchType', 'subject', 'folder', 'folderId'		]);		this.registerView();    }    ,registerView : function(){		var dv = Ext.getCmp('dvMailFilter');		var btnCreateModify = Ext.getCmp('mail_filter_btn_add');		dv.on('click', function(dv, index, node, e){			var record = dv.getRecord( node );						if(e.getTarget().className == 'btn-delete'){				Ext.Ajax.request({				url: Eve.url				,params: {					event: 'modern.preferences.mailFilters.delete'					,id: index + 1				}				,success: function(){					dv.store.remove(record);				}				,scope: this							});							}			else{				var values = [					{id : 'from_type_filter',		value: (record.get('fromMatchType') != '0')? record.get('fromMatchType') :'1'}					,{id: 'from_text_filter',		value: (record.get('from') != '0')? record.get('from') : ''}					,{id: 'sender_type_filter',		value: (record.get('senderMatchType') != '0')? record.get('senderMatchType') : '1'}					,{id: 'sender_text_filter',		value: (record.get('sender') != '0' )?record.get('sender') : '' }					,{id: 'toCC_type_filter',		value: (record.get('ccToMatchType')!= '0' )?record.get('ccToMatchType') : '1' }					,{id: 'toCC_text_filter',		value: (record.get('ccTo')!= '0' )?record.get('ccTo') : ''}					,{id: 'subject_type_filter',	value: (record.get('subjectMatchType')!= '0' )?record.get('subjectMatchType') : '1'}					,{id: 'subject_text_filter',	value: (record.get('subject')!= '0' )?record.get('subject') : ''}					,{id: 'personal_mail_folders',	value: record.get('folderId')}				]				this.panels[1].get().getForm().setValues(values);			}		}, this);		dv.on('selectionChange', function(dv , selections){				 if(selections.length == 0) 					btnCreateModify.filterId = 0				 else					 btnCreateModify.filterId = selections[0].viewIndex + 1;						(selections.length == 0) ? btnCreateModify.setText('Add') :  btnCreateModify.setText('Edit');				this.panels[1].reset();				var mailFolders = Ext.getCmp('personal_mail_folders');				mailFolders.setValue(mailFolders.store.getAt(0).get('id'));		},this);		btnCreateModify.on('click', function(btn, e){			if(!this.panels[1].get().getForm().isValid())				return;						var data = this.panels[1].get().getForm().getValues();			var mailFolder = data['transfer_to'];			data['from_matchtype'] = Ext.getCmp('from_type_filter').getValue();			data['sender_matchtype'] = Ext.getCmp('sender_type_filter').getValue();			data['tocc_matchtype'] = Ext.getCmp('toCC_type_filter').getValue();			data['subject_matchtype'] = Ext.getCmp('subject_type_filter').getValue();			data['transfer_to'] = Ext.getCmp('personal_mail_folders').getValue();			data.id = btn.filterId ;			data.event = 'modern.preferences.mailFilters.createModify';			Ext.Ajax.request({				url: Eve.url				,params: data				,success: function(){					var record = new this.filterRecord({						fromMatchType		: (data['from_field_v'].trim() == "")? '0': data['from_matchtype']						,from				:  data['from_field_v']						,senderMatchType	: (data['sender_field_v'].trim() == "")? '0': data['sender_matchtype']						,sender				:  data['sender_field_v']						,ccToMatchType		: (data['tocc_field_v'].trim() == "")? '0' : data['tocc_matchtype']						,ccTo				: data['tocc_field_v']						,subjectMatchType	: (data['subject_field_v'].trim() == "")? '0' : data['subject_matchtype']						,subject			: data['subject_field_v']						,folder				: mailFolder						,folderId			: data['transfer_to']					});					if(data.id != 0){						dv.store.removeAt(data.id - 1)						dv.store.insert(data.id - 1, record)					}					else						dv.store.add(record);				}				,scope: this							})					},this)		//Add to White List		Ext.getCmp('btn_add_white').on('click', function(btn, e){			this.addToList('w');		},this);		//Add to Black List		Ext.getCmp('btn_add_black').on('click', function(btn, e){			this.addToList('b');		},this);		//Multi delete in White list		this.whiteBlackDelMenu = new Ext.menu.Menu({				items : [ {						text	: "Delete"						,id		: "delete"						,icon	: Eve.Resource.getIcon('delete', 'general')						,handler: function(){							var ids = [];							var selectedRecords = this.activeWhiteBlack.getSelectedRecords();							console.log("---", selectedRecords)							var len = selectedRecords.length;							if(len > 0){								for(var i =0; i<len; i++){									ids.push( selectedRecords[i].get('id') );								}								this.fire('whiteblack_mail_delete',{id: ids.join(','), type: selectedRecords[0].get('type')}, true );							}						}						,scope: this				}]				,scope: this		});		Ext.getCmp('dvMailWhiteList').on('contextmenu', function(dv, index, node, e){			e.stopEvent();			if(dv.getSelectedNodes().indexOf(node)== -1)				dv.select(node)			this.activeWhiteBlack = dv;			this.whiteBlackDelMenu.showAt(e.getXY());		}, this);		Ext.getCmp('dvMailBlackList').on('contextmenu', function(dv, index, node, e){			e.stopEvent();			this.activeWhiteBlack = dv;			this.whiteBlackDelMenu.showAt(e.getXY());		}, this);	}	,augment : function( callee, index, state ){        var obj = callee.params;		obj.id = -1;		obj.multipleControllers = 'mailSettingController,mailFilterAndBlockSettingController,mailAutomationSettingController,mailSpamSettingController';		if(state == 'submit'){			obj.spamProbe = this.spamProbe;			obj.spamAssassin = this.spamAssassin;						if (this.razor)				obj.razor = this.razor;						if (this.pyzor)				obj.pyzor = this.pyzor;						if (this.dcc)				obj.dcc = this.dcc;						obj.SpamThresholdLevel = this.spamTreshHold;		}		return callee;    }    ,controller	: function(obj){        this.showHideCmp();		this.getTabPanel().setActiveTab(0);		this.clearLoaded();        this.dialog.show();    }    ,execute : function(callee, type, data){        switch(type) {            case (this.section + '_mail_setting_dlg'):                this.mode = data.mode || 'edit';                this.controller(data);				if (!this.getLoaded(0))					this.loadForm(0);                break;            case 'personal_whiteblack_import_contacts':        		Ext.Msg.confirm('Confirmation', 'Are you sure you want to import all your personal contacts to whitelist?',        				function(btn) {        					if (btn == 'yes') {        						Ext.Ajax.request({        							url: Eve.url        							,params: {        								event: 'modern.preferences.mail.importContactsToWhite'        							}        							,success: function()        							{        								Ext.Msg.alert('Success', 'Your personal contacts are successfully imported to whitelist.');        							}        						});        					}        			}, this);            	            	            	            	break;			case 'change_spam_level':                var context = {};                context.title = "Level " + data;				this.spamTreshHold = data;                switch(data){                    case 1:                        break;                    case 2:                        break;                    case 3:                        context.body = "This setting requires SPAM to reach a \n\                            designation threshold <br> of at least 4.5 points";                        break;                    case 4:                        break;                    case 5:                        break;                    case 6:                        break;                    case 7:                        break;                    case 8:                        break;                    case 9:                        break;                    case 10:                        break;                }                var panel = Ext.getCmp('spamContextContainer');                var template = new Ext.Template(                    '<b style="line-height:3">{title}</b>',                    '<p style="line-height:1.5">{body}</p>'                );                template.overwrite(panel.body,context);                break;				case 'use_spam_signature':					if (data.razor)						this.razor = data.razor;					else						delete(this.razor);										if (data.pyzor)						this.pyzor = data.pyzor;					else						delete(this.pyzor);										if (data.dcc)						this.dcc = data.dcc;					else						delete(this.dcc);										break;				case 'whiteblack_mail_delete':					this.deleteMail(data)					break;									case 'whiteblack_search_white_mail':					Ext.Ajax.request({						url: Eve.url						,params: {							event: 'modern.preferences.mail.searchBlackWhite'							,type: 'w'							,query: data.query						}						,success: this.handleWhiteSearchResponse					});					break;									case 'whiteblack_search_black_mail':					Ext.Ajax.request({						url: Eve.url						,params: {							event: 'modern.preferences.mail.searchBlackWhite'							,type: 'b'							,query: data.query						}						,success: this.handleBlackSearchResponse					});					break;					        }    }        ,handleWhiteSearchResponse: function( r, args)    {    	Ext.getCmp('dvMailWhiteList').store.removeAll();		Ext.getCmp('dvMailWhiteList').store.add( Ext.getCmp('dvMailWhiteList').store.reader.readRecords(Ext.DomQuery.select('mails', r.responseXML)).records );    }    ,handleBlackSearchResponse: function( r, args)    {    	Ext.getCmp('dvMailBlackList').store.removeAll();		Ext.getCmp('dvMailBlackList').store.add( Ext.getCmp('dvMailBlackList').store.reader.readRecords(Ext.DomQuery.select('mails', r.responseXML)).records );    }    ,submitSuccess : function( resp, action ){    }	,onTabChange: function(tPanel, tab){		this.setLoaded(2);		//Hide save button in Filter and Whit/Black tabs		this.panels[1].get().ownerCt.buttons[0].hide();		this.panels[2].get().ownerCt.buttons[0].hide();		Eve.lib.Personal.MailSettingDialogBridge.superclass.onTabChange.apply(this, arguments);		if(this.getIndex(tab) == 3){			Ext.getCmp('spam_tresh_holder').setValue(this.spamTreshHold);		}	}	,loadSuccess: function( resp ){		var dq = Ext.DomQuery;		var xml = resp.responseXML;		var temp;		this.razor = dq.selectValue('mailSpamSettingController_domain/razor', xml);		this.pyzor = dq.selectValue('mailSpamSettingController_domain/pyzor', xml);		this.dcc = dq.selectValue('mailSpamSettingController_domain/dcc', xml);		this.spamAssassin = dq.selectValue('mailSpamSettingController_domain/spamAssassin', xml);		this.spamProbe = dq.selectValue('mailSpamSettingController_domain/spamProbe', xml);		try{			temp = dq.selectValue('userMailPreferences/defaultFontColor', xml, '#000000');			Ext.getCmp('mail_color_field').setValue(temp.split('#')[1]);			var spamQuarantineSt = Ext.getCmp('quarantine_delivery_folderId').store;			var rec2 = spamQuarantineSt.getAt(spamQuarantineSt.find('title', 'Quarantine'));			var rec1 = spamQuarantineSt.getAt(spamQuarantineSt.find('title', 'Inbox'));			spamQuarantineSt.removeAll();			spamQuarantineSt.add([rec1, rec2]);			temp = dq.selectValue('mailSpamSettingController_domain/quarantineDeliveryFolderId', xml);			temp = (temp == "0")? rec1.get('id'): temp;			Ext.getCmp('quarantine_delivery_folderId').setValue(temp);						var spamDelivery = Ext.getCmp('spam_delivery_folderId');			var spamDeliverySt = spamDelivery.store;			rec2 = spamDeliverySt.getAt(spamDeliverySt.find('title', 'Spam'));			spamDeliverySt.removeAll();			spamDeliverySt.add([rec2, rec1]);			temp = dq.selectValue('mailSpamSettingController_domain/spamDeliveryFolderId', xml);			temp = (temp == "0")? rec1.get('id'): temp;			spamDelivery.setValue(temp);			spamDelivery.fireEvent('select', spamDelivery, '',spamDeliverySt.find('id', temp) );			this.spamTreshHold = dq.selectValue('mailSpamSettingController_domain/spamThresholdLevel', xml, '6');			//Ext.getCmp('spam_tresh_holder').setValue(this.spamTreshHold);		}		catch(e){}		//Loading Filter		var filterStore = Ext.getCmp('dvMailFilter').store;		filterStore.removeAll();		var filterData = dq.selectValue('mailFilterAndBlockSettingController_domain/filterData', xml, undefined);		if(filterData){			var records = filterData.split('\n');			var fields ;			var folders = Ext.getCmp('personal_mail_folders').store;			for (var i=0, len=records.length; i < len; i++){				fields = records[i].split('\t');				var folderTitle = "";				try{					folderTitle  = folders.getById(fields[10]).get('title');				}catch(e){console.log(e)};				filterStore.add(new this.filterRecord({					fromMatchType		: fields[0]					,from				: fields[1]					,senderMatchType	: fields[2]					,sender				: fields[3]					,ccToMatchType		: fields[4]					,ccTo				: fields[5]					,subjectMatchType	: fields[6]					,subject			: fields[7]					,folder				: folderTitle					,folderId			: fields[10]				}));			}		}	}	    ,afterAddButtons : function(buttons, scope){        var btn = [];//        buttons[0].hidden = false;//        btn.push(buttons[0]);        btn.push(buttons[1]);        if(typeof buttons[3] != 'undefined'){            btn.push(buttons[3]);        }else{            btn.push(buttons[2]);        }        return btn;    }	,addToList : function(type){		var stores = [];		var isValid = true;		stores['w'] = Ext.getCmp('dvMailWhiteList').store;		stores['b'] = Ext.getCmp('dvMailBlackList').store;		var textarea = Ext.getCmp('white_black_list');		var list	= textarea.getValue().trim();		if(list && list != ""){			var tempList = list.split(',');			for (var i =0, len= tempList.length; i<len; i++){				if(stores['b'].find('email',tempList[i].trim())!= -1)				{					if(len != 1)						list = list.replace(tempList[i] + ',', '');					else						list = list.replace(tempList[i], '');					isValid = false;				}				if(stores['w'].find('email',tempList[i].trim())!= -1){					if(len != 1)						list = list.replace(tempList[i] + ',', '');					else						list = list.replace(tempList[i] , '');					isValid = false;				}			}		}		if(!isValid){			Ext.tools.msg('Some of emails may not be delivered', '');		}		if(list.trim() == ""){			textarea.setValue("");			return;		}		var add = function(response, opts){						Ext.getCmp('white_black_list').setValue('');			Ext.Msg.alert('Success', 'The requested emails have been added successfully.');			/** Syavash: We are not going to add the new ones to dataviews **/			return;						var reader 	= new Ext.data.XmlReader({								record 	: 'row'								,id		: 'id'			}, ['id',  'email', 'type']);			var records = reader.readRecords(response.responseXML).records;						for(var i=0, len= records.length; i<len; i++){				stores[type].insert(0,records[i]);			}			textarea.setValue("");		}		Ext.Ajax.request({			url: Eve.url			,params: {				event: 'modern.preferences.mail.createBlackWhite'				,whiteBlackType: type				,whiteBlackMails: list			}			,success: add		})	}	,deleteMail : function(data){			Ext.Ajax.request({			url: Eve.url			,params: {				event: 'modern.preferences.mail.deleteBlackWhite'				,whiteBlackType: data.type				,id: data.id			}			,success: function(response, opts){				var dv;				var ids = data.id.split(',')				if(data.type == 'w')					dv = Ext.getCmp('dvMailWhiteList');				else					dv = Ext.getCmp('dvMailBlackList');				for(var i=0; i< ids.length; i ++){					dv.store.removeAt(dv.store.indexOfId(ids[i]));				}				//dv.refresh();			}		})	}});/*--------------------------------------------------*//* File: C:\Inetpub\wwwroot\hyperoffice2nd\views\Styles\ModernStyle\Admin/PersonalFactory.js *//*--------------------------------------------------*//** * @Author Hamidreza Bidgoli <bidgoli[dot]wd[at]gmail[dot]com */Eve.lib.Personal.Factory = function() {}Ext.extend( Eve.lib.Personal.Factory, Eve.lib.Factory, {	section: 'personal'        	,createBefore : function(superbridge)	{            this.manager = new Eve.lib.SectionBridge(this.section);            superbridge.addBridge(this.manager);	}	,createNorth : function (superbridge){}	,createCenter : function( superbridge ) {            var view = {                    get : function() {return [{}]}            }            Eve.personal = new Eve.Personal.PersonalBridge();            superbridge.addBridge(Eve.personal);            this.manager.registerComponents(Eve.personal);            Eve.personal.init({                    superbridge	: superbridge                    ,view		: view                    ,section	: this.section                    ,manager    : this.manager            });            var personalDialogBridge 	= new Eve.lib.Personal.PersonalDialogBridge();			superbridge.addBridge(personalDialogBridge);            personalDialogBridge.addPanel(new Eve.vc.PersonalDetails());            personalDialogBridge.init({                    superbridge	: superbridge                    ,section	: this.section                    ,origin		: 'item'            });            var panelView = new Ext.Panel( {                     layout: 'card'                    ,activeItem: 0                    ,items : [Eve.Personal.PersonalPanel(superbridge, this.manager, personalDialogBridge)]                    });            return { view : view, config: { border: false, items : panelView, layout: 'fit' } };        }		,createWest : function(superbridge) {}	,createDialogs : function(superbridge){            var itemDlg	= new Eve.lib.Personal.MailSettingDialogBridge();            superbridge.addBridge(itemDlg);            itemDlg.addPanel(new Eve.vc.PersonalMailPreferences());            itemDlg.addPanel(new Eve.vc.PersonalMailFilter());            itemDlg.addPanel(new Eve.vc.PersonalMailWhiteBlackList());            itemDlg.addPanel(new Eve.vc.PersonalMailSpamSetting());            itemDlg.addPanel(new Eve.vc.PersonalForwardingAutoresponder());            itemDlg.init({                superbridge		: superbridge                ,section		: this.section                ,origin		: 'item'                ,reminderType	: 'absolute'            });	}	 	 });

