if (typeof(ZtAssistant) == "undefined") { function ZtAssistant(opts, htmlContainer, PSCtrl) { this.opts = opts; this.ztVPivotData; this.htmlContainer = htmlContainer; this.PSCtrl = PSCtrl; //PortalStudio Control this.helpsList = []; this.helpsPos = -1; this.helpElement = null; this.helpPSTooltip = null; this.helpActive = false; this._inId = LibJavascript.AlfaKeyGen(5); this.scroll = { left: 0, top: 0 }; window[this._inId] = this; this.EnableAssistant = function() { if (this.helpActive == false) { this.helpActive = true; this.ExecuteAssistant(); } else { this.RemoveAssistant(); this.helpActive = false; } } this.IsActive = function() { return this.helpActive; } this._isHidden = function(el) { return (el.offsetParent === null) } this.IsEmpty = function() { return this.helpsList.length == 0; } this.Next = function() { if (!this.helpActive) return; if(this.helpsList.length > 0 && (this.helpsPos+1) < this.helpsList.length ) { this.RemoveAssistant(); var lctrl = this.helpsList[this.helpsPos]; this.helpsPos++; var ctrl = this.helpsList[this.helpsPos]; if( lctrl && ctrl && (lctrl.page != ctrl.page) ) { if ( this.opts && this.opts.GoToPage ) { this.opts.GoToPage(ctrl.page+1); return; } } if(!lctrl && ctrl) { if ( this.opts && this.opts.GoToPage ) { this.opts.GoToPage(ctrl.page+1); return; } } var hele = document.getElementById(ctrl.htmlId); if ( hele == null || this._isHidden(hele) ) { this.Next(); return; } this.Execute(ctrl); } else { this.helpsPos = -1; this.RemoveAssistant(); } } this.Previous = function() { if (!this.helpActive) return; if(this.helpsList.length > 0 && (this.helpsPos-1) < this.helpsList.length && (this.helpsPos-1 >=0 )) { this.RemoveAssistant(); var lctrl = this.helpsList[this.helpsPos]; this.helpsPos--; var ctrl = this.helpsList[this.helpsPos]; if( lctrl && ctrl && (lctrl.page != ctrl.page) ) { if ( this.opts && this.opts.GoToPage ) { this.opts.GoToPage(ctrl.page+1); return; } } if(!lctrl && ctrl) { if ( this.opts && this.opts.GoToPage ) { this.opts.GoToPage(ctrl.page+1); return; } } var hele = document.getElementById(ctrl.htmlId); if ( hele == null || this._isHidden(hele) ) { this.Previous(); return; } this.Execute(ctrl); } else { this.helpsPos = -1; this.RemoveAssistant(); } } this.SetScroll = function( top, left ) { this.scroll.top = top; this.scroll.left = left; } this.Scroll = function( top, left ) { this.SetScroll(top, left) this.ContinueAssistant(); } this.Execute = function( _ctrlE ) { if (!this.helpActive) return; this.helpElement = document.getElementById(_ctrlE.htmlId); var c = this.helpElement; var o = this.helpsList[this.helpsPos]; if( o && o.cssClass != undefined ) { LibJavascript.CssClassNameUtils.addClass( this.helpElement, o.cssClass ); } else { LibJavascript.CssClassNameUtils.addClass( this.helpElement, 'pstooltiphelp' ); } if(c) { var html = '
' +'
' +'
[num]
' +'
[title]
' +'
' +'
[note]
' +'
' +'
' +'
' +'
[num]
' +'
/
' +'
[tot]
' +'
' +'
'; if( o && o.jsActions != undefined ) { var i; for(i=0; i
' } } html += '
' html += '
' html += '' var prevfunc ='window.'+ this._inId + '.Previous()'; var nextfunc ='window.'+ this._inId + '.Next()'; var closefunc ='window.'+ this._inId + '.EnableAssistant()'; html = Strtran(html, '[note]', Trim(ToHTag( _ctrlE.note, 'xssPrevent'))) html = Strtran(html, '[num]', (this.helpsPos+1)) html = Strtran(html, '[tot]', (this.helpsList.length)) html = Strtran(html, '[title]', Trim(ToHTag(_ctrlE.title, 'xssPrevent'))) html = Strtran(html, '[nextclick]', nextfunc) html = Strtran(html, '[previousclick]', prevfunc) html = Strtran(html, '[closeclick]', closefunc) if( this.helpsPos > 0 ) html = Strtran(html, '[previous]', 'visible') // Maurizio else html = Strtran(html, '[previous]', 'hidden') // Maurizio if( this.helpsPos < this.helpsList.length-1 ) html = Strtran(html, '[next]', 'visible') // Maurizio else html = Strtran(html, '[next]', 'hidden') // Maurizio this.helpPSTooltip = new PSTooltip(c, {'text' : html, 'html': true, 'arrow_size': 8}, false); this.helpPSTooltip.setScroll(this.scroll.top, this.scroll.left) c.addEventListener('psFocusHelp', function () {}, false); c.addEventListener('psLostFocusHelp', function () {}, false); c.focus(); var event = new Event('psFocusHelp'); c.dispatchEvent(event); } else { LibJavascript.CssClassNameUtils.addClass( this.helpElement, 'pstooltiphelp' ); } } this.ExecuteAssistant = function(){ this.RemoveAssistant(); this.helpsPos = -1; this.helpElement = null; this.helpPSTooltip = null; if(this.helpsList.length > 0) { this.Next(); } } this.ContinueAssistant = function(id, page){ if (!this.helpActive) return; this.RemoveAssistant(); if( !id && this.helpsPos < 0 ){ return this.Next(); } if( id ){ var i; this.helpsPos = -1; for ( i=0; i 0 && (this.helpsPos) < this.helpsList.length && (this.helpsPos>=0 )) { var ctrl = this.helpsList[this.helpsPos]; if( page != undefined && ctrl.page != page) { for ( i=0; i 0 && (this.helpsPos) < this.helpsList.length && (this.helpsPos>=0 )) { var ctrl = this.helpsList[this.helpsPos]; this.Execute(ctrl); } else { this.RemoveAssistant(); } } } }