text: /*!
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   * Defines cv.util object which contains many handy utility functions.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   * 
   * Class: History
   * 
   * Contains undo/redo functionality.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement ent
   * 
   * Class: Dialog
   * 
   * Base class for displaying dialogs in Analyzer. 
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation. 
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation. 
   * 
   * Class: cv.io
   * 
   * Common report related AJAX APIs.
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   * Class: cv.Report
   *
   * This is the main report class used in Analyzer.  This class is split
   * across multiple cv_rptReportN files.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   * 
   * Class: cv.Report
   * 
   * Continued.  Mostly contains gem manipulation functionality.
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   * Class: cv.Report
   *
   * Continued.  Contains mostly selection and client side viz related code.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation.
   *
   * AttributeGem, MetricGem and FilterGem
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   * 
   * Class: Dialog This class is responsible for displaying various dialogs for
   * report creation page. Note: filter dialog is handled by FilterDialog class
   * due to its complexity.
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation. 
   * 
   * Class: FilterDialog
   * This class is responsible for displaying the filter dialog.
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation. 
   * 
   * Extends class FilterDialog to support numeric filters.
   * 
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation. 
   * 
   * Class: ReportDocument
   * This class is responsible for managing XML report document on the browser side. It should
   * not contain or depend on any HTML DOM structure logic, and any other external object.
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation.
   *
   * Classes:
   * ReportDropTarget: supports dropping fields into reports.
   * FilterPaneDropTarget: supports dropping fields into report filter zones.
   * TrashAreaDropTarget: dropzone items dragged into this target will be removed from the report.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation.
   *
   * Class: FieldHelp
   * Field information
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   * Class: ReportResizer
   *
   * Implements functionality for resizing table columns in reports
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation.
   *
   * Class: ReportHeaders
   * Implements pivot table fixed headers, in-table dragging, scrollbars and mousehweel.
   *
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions
   * of the software license agreement entered into between the entity licensing
   * such code and Pentaho Corporation.
   *
   * This file contains functionality related to integrating Analyzer with PUC
   */
  
  /**
   * The Pentaho proprietary code is licensed under the terms and conditions of
   * the software license agreement entered into between the entity licensing such
   * code and Pentaho Corporation.
   *
   * Class: ReportEditor
   *
   * Integrate the editor UI with the Report instance.
   *
   */
  
  function pentahoLoad(){enableSaveButtons()}function enableEditButton(){console_enabled&&window.parent.enableContentEdit&&window.parent.enableContentEdit(!0)}function disableEditButton(){console_enabled&&window.parent.enableContentEdit&&window.parent.enableContentEdit(!1)}function lowerEditButton(){console_enabled&&window.parent.setContentEditSelected&&window.parent.setContentEditSelected(!0)}function resetEditButton(){console_enabled&&window.parent.setContentEditSelected&&window.parent.setContentEditSelected(!1)}function enableSaveButtons(){console_enabled&&window.parent.enableAdhocSave&&window.parent.enableAdhocSave(!0)}function disableSaveButtons(){console_enabled&&window.parent.enableAdhocSave&&window.parent.enableAdhocSave(!1)}function refreshBrowsePanel(){console_enabled&&window.parent.mantle_refreshRepository&&window.parent.mantle_refreshRepository()}function WaqrProxy(){this.wiz=new Wiz,this.repositoryBrowserController=new RepositoryBrowserControllerProxy}function Wiz(){currPgNum=0}function savePg0(){}function RepositoryBrowserControllerProxy(){this.getPossibleFileExtensions=function(){return[".xanalyzer"]},this.remoteSave=function(e,t,n,r,i){e.indexOf(".xanalyzer")!=-1&&e.indexOf(".xanalyzer")==e.length-10&&(e=e.substr(0,e.length-10)),cv.getActiveReport().reportDoc.setReportProperty("name",unescape(e.replace("+","%20")));var s=cv.getActiveReport().manager.saveReport("saveAs",e,t+n);s==1&&refreshBrowsePanel()}}function drill(e,t){var n=!1;try{window.parent.PentahoMobile&&(n=!0)}catch(r){}var i=new Date,s="drillpopup"+i.getTime(),o=dojo.byId("drillForm");o.setAttribute("action",cv.contextPath+"drill");if(n){var u=window.parent.PentahoMobile.openUrl("about:blank","Drill Results");o.target=u}else window.open("",s,"scrollbars=no,menubar=no,height=550,width=800,resizable=yes,toolbar=no,status=no"),o.setAttribute("target",s);var a=dojo.byId("drillForm_reportXML");a.setAttribute("value",cv.getActiveReport().getReportXml()),a=dojo.byId("drillForm_colIndex"),a.setAttribute("value",e),a=dojo.byId("drillForm_rowIndex"),a.setAttribute("value",t),o.submit()}function linkReport(json){var ctxArray=eval("("+json+")");cv.getActiveReport().linkDlg.performAction(ctxArray)}function keepAndShow(json){var context=eval("("+json+")");cv.getActiveReport().clickChart(context)}dojo.require("dijit.Menu"),dojo.require("dijit.Dialog"),pen.define("analyzer/cv_base",[],function(){dojo.mixin(window.cv,{prefs:{suppressMsg:{},fadeTime:250,wipeTime:250,isDebug:0,skipDirtyAlert:!1},defaultNS:"http://www.pentaho.com",contextPath:"",dojoWidgets:{},helpTopics:{},helpWin:null,securityToken:null,nsResolver:function(e){return"http://www.pentaho.com"},getFieldHelp:null,getActiveReport:null,init:function(){var e=dojo.byId("stok");e&&(cv.securityToken=e.value);var t=!1;try{t=window.parent&&window.parent.PentahoMobile}catch(n){}!console_enabled&&!t&&(document.getElementsByTagName("body")[0].className+=" pentaho-page-background")}}),dojo.addOnLoad(cv,"init"),djConfig.bindEncoding="utf8",window.cvConst={}}),dojo.require("dojo.dnd.Manager"),dojo.require("dojox.xml.parser"),dojo.require("dojox.fx"),dojo.require("dojox.xml.parser"),dojo.require("dijit.PopupMenuItem"),dojo.require("dijit.MenuItem"),dojo.require("dijit.Tooltip"),dojo.require("dijit.layout.TabController"),dojo.require("dojo.parser"),dojo.require("dojo.cache"),dojo.require("dijit.layout._TabContainerBase"),dojo.require("dijit.layout.TabContainer"),dojo.require("dijit.DialogUnderlay"),pen.define("analyzer/cv_util",["analyzer/cv_base"],function(){cv.util={initDojoWidget:null,alertErrorOnPageOpen:function(e,t){alert(e),t&&(window.location=t)},delayThese:function(e,t,n,r){if(!e.length){typeof r=="function"&&r();return}typeof n=="undefined"&&typeof t=="number"?(n=t,t=function(){}):t||(t=function(){},n||(n=0)),setTimeout(function(){e.shift()(),t(),cv.util.delayThese(e,t,n,r)},n)},checkNumber:function(e){return e===""?!1:!isNaN(Number(e))},checkPositiveInteger:function(e){if(!cv.util.checkNumber(e))return!1;var t=parseInt(e);return t<=0||t!=parseFloat(e)?!1:!0},escapeHtml:function(e,t){return e=e.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/"/gm,"&quot;"),t||(e=e.replace(/'/gm,"&#39;")),e},escapeJavaScript:function(e){return e.replace(/(["'\f\b\n\t\r])/gm,"\\$1")},getAttribute:function(e,t){var n=e.getAttribute(t);return n&&(n=n.replace(/\xA0/g," ")),n},substituteParams:function(e,t){var n=typeof t=="object"?t:cv.util.toArray(arguments,1);return e.replace(/\%\{(\w+)\}/g,function(e,t){if(typeof n[t]!="undefined"&&n[t]!=null)return n[t];dojo.raise("Substitution not found: "+t)})},toArray:function(e,t){var n=[];for(var r=t||0;r<e.length;r++)n.push(e[r]);return n},summary:function(e,t){return!t||e.length<=t?e:e.substring(0,t).replace(/\.+$/,"")+"..."},connectPopupMenu:function(e,t){for(var n=0;t&&n<t.length;++n){var r=t[n],i=this.getDojoWidget(r.id);i&&(dojo.connect(i,"onClick",r.src?r.src:e,r.handler),dojo.connect(i,"onClick",function(){dijit.popup.close()}),r.disabled&&i.setDisabled(!0))}},showPopupMenu:function(e,t,n){t+=7,n+=7;var r=dojo.window.getBox().w,i=dojo.window.getBox().h;dijit.popup.open({popup:e,x:t,y:n}),n+e.domNode.offsetHeight>i&&(n=i-e.domNode.offsetHeight-30,dijit.popup.open({popup:e,x:t,y:n}));var s=dojo.connect(e,"onBlur",function(){dijit.popup.close(),dojo.disconnect(s)});e.focus()},destroyDojoWidgets:function(){for(var e in cv.dojoWidgets)try{cv.dojoWidgets[e]&&cv.dojoWidgets[e].destroy(!0)}catch(t){}},disconnectPopupMenu:function(e,t){for(var n=0;t&&n<t.length;++n){var r=this.getDojoWidget(t[n].id);r&&dojo.disconnect(r,"onClick",e,t[n].handler)}},displayWidget:function(e,t){if(this.getDojoWidget(e)){var n=this.getDojoWidget(e).domNode;n&&(t?dojo.style(n,"display",""):dojo.style(n,"display","none"))}},getAncestorByClass:function(e,t){while(e&&!dojo.hasClass(e,t))e=e.parentNode;return e},getFirstChildByClass:function(e,t){var n=dojo.query(" ."+t,e);if(n!==undefined&&n.length>0)return n[0]},getAncestorByTag:function(e,t){t=t.toLowerCase();while(e){if(e.tagName&&e.tagName.toLowerCase()==t)return e;e=e.parentNode}return null},getDojoWidget:function(id){if(cv.dojoWidgets[id])return cv.dojoWidgets[id];var wi=dijit.byId(id);if(!wi){wi=dojo.byId(id);if(!wi)return null;wi=dojo.parser.instantiate([wi]),wi&&wi.length>0?wi=wi[0]:wi=null}if(wi){this.initDojoWidget&&this.initDojoWidget(wi),cv.dojoWidgets[id]=wi;with(wi.domNode.style)zIndex=1002}return wi},stopDrag:function(){dojo.dnd.manager().stopDrag(),dojo.publish("/dnd/cancel")},helpdialog:null,getHelp:function(e){dojo.isObject(e)&&e.target&&(e=e.target.id),!e||e=="null"?e="":e.indexOf(".html")<0&&(e=cv.helpTopics&&cv.helpTopics[e]?cv.helpTopics[e]:""),e=cv.contextPath+"help/topic.html?"+e;if(window.location.search&&window.location.search.indexOf("embeddedHelp=true")>-1){this.helpDialog==null&&(this.helpDialog=new cv.HelpDialog,this.helpDialog.init()),this.helpDialog.showDlg(e);return}var t=dojo.window.getBox();cv.helpWin&&!cv.helpWin.closed&&cv.helpWin.close();var n=window.open(e,"helpWnd","height="+t.h*.8+",width="+t.w*.8+",menubar=0,status=0,toolbar=0,location=0,resizable=1");n&&(cv.helpWin=n),n.focus()},getSelectionList:function(e){var t=e.getElementsByTagName("INPUT"),n=[],r=t.length;for(var i=0;i<r;++i)t[i].checked&&n.push(t[i].name);return n.length==0&&(n=null),n},hide:function(){for(var e=0;e<arguments.length;++e)dojo.addClass(dojo.byId(arguments[e]),"hidden")},disableTextSelection:function(e){e.onselectstart=function(){return!1},dojo.style(e,{"-moz-user-select":"-moz-none","-khtml-user-select":"none","-webkit-user-select":"none","user-select":"none"})},initDivButton:function(e,t,n){dojo.isString(e)&&(e=dojo.byId(e));if(!e)return;dojo.connect(e,"onmouseover",this,"_divButtonActive"),dojo.connect(e,"onmousedown",this,"_divButtonPressed"),dojo.connect(e,"onmouseout",this,"_divButtonInactive"),dojo.connect(e,"onclick",this,"_divButtonInactive"),t?dojo.connect(e,"onclick",t,n):n&&dojo.connect(e,"onclick",n),cv.util.disableTextSelection(e)},isHidden:function(e){return dojo.hasClass(dojo.byId(e),"hidden")},gravity:function(node,e){node=dojo.byId(node);var mouse={y:e.clientY,x:e.clientX};with(dojo.html)var bb=dojo.coords(node),nodecenterx=bb.x+bb.w/2,nodecentery=bb.y+bb.h/2;with(cv.util.gravity)return(mouse.x<nodecenterx?WEST:EAST)|(mouse.y<nodecentery?NORTH:SOUTH)},overElement:function(e,t){if(!e)return!1;var n,r,i;switch(t.type){case"mouseout":case"mouseleave":if(t.target==e)return!1;break;default:if(t.target==e)return!0}if(e.tagName=="AREA"&&e.getAttribute("shape").toUpperCase()=="RECT"){var s=e.coords.split(","),o=dojo.query("img[usemap='#"+e.parentNode.getAttribute("name")+"']")[0];i=dojo.coords(o,!0),i.x+=parseInt(s[0]),i.y+=parseInt(s[1]),i.h+=parseInt(s[4])-parseInt(s[1]),i.w+=parseInt(s[3])-parseInt(s[0])}else i=dojo.coords(e,!0);var u=t.clientX,a=t.clientY;return u>i.x+i.w||u<i.x||a>i.y+i.h||a<i.y?!1:!0},setButtonDisabled:function(e,t){if(!e)return;if(t==e.disabled)return;if(e.tagName=="IMG"){var n=e.src.indexOf(".png")>-1?".png":".gif";e.src=t?e.src.replace(n,"_disabled"+n):e.src.replace("_disabled"+n,n)}else t?dojo.addClass(e,"disabled"):dojo.removeClass(e,"disabled");e.disabled=t},_divButtonActive:function(e){if(e.target.disabled)return;dojo.addClass(this.getAncestorByClass(e.target,"reportBtn"),"btnActive")},_divButtonInactive:function(e){var t=this.getAncestorByClass(e.target,"reportBtn");dojo.removeClass(t,"btnActive")},_divButtonPressed:function(e){if(e.target.disabled)return},onToggleSectionCheckbox:function(e){e.target.checked?dojox.fx.wipeIn({duration:cv.prefs.wipeTime,node:e.target.id+"DIV"}).play():dojox.fx.wipeOut({duration:cv.prefs.wipeTime,node:e.target.id+"DIV"}).play()},parseMDXExpression:function(e,t){var n=e.lastIndexOf("].[");if(n==-1)return"";e=e.substring(n);var r=/\]\.\[(.+)\]$/,i=r.exec(e);if(!i)return"";var s=i[1];return s=s.replace("]]","]"),s=="#null"?cvCatalog.attributeNullValue:s.search(/\S/)<0?cvCatalog.attributeBlankValue:t?cv.util.escapeHtml(s):s},parseAjaxMsg:function(e){if(dojo.isString(e)){if(e.indexOf('<form name="login"')>0){var t={loginCallback:function(){cv.getActiveReport()&&cv.getActiveReport().refreshReport()}};if(console_enabled&&window.parent.authenticate)return window.parent.authenticate(t),"sessionExpired";cv.getActiveReport()&&(cv.getActiveReport().setReportPropsDirty(!1),cv.getActiveReport().history.setSaved()),window.location.reload()}var n=e.indexOf("<message");if(n<0)return;var r=e.indexOf("</message>");if(r<0){r=e.indexOf("/>",n);if(r<0)return;r+=2}else r+=10;e=dojox.xml.parser.parse(e.substring(n,r)),cv.setDomDefaultNamespace(e)}if(dojo.isObject(e)&&e.documentElement&&e.documentElement.tagName=="message"){var i=e.documentElement.getAttribute("id"),s=e.documentElement.attributes,o={};for(var u=0;u<s.length;++u){var a=s.item(u);a.name&&(o[a.name]=a.value)}var f=e.documentElement.selectSingleNode("cv:selectionItems");return f!=null&&cv.getActiveReport().reportDoc.replaceSelectionItems(f.cloneNode(!0)),o}return null},parseURLQuery:function(e){e||(e=window.location.search);if(e.length==0)return null;var t=e.substring(1).split("&"),n={};for(var r=0;r<t.length;++r){var i=t[r].indexOf("=");i>0&&(n[t[r].substring(0,i)]=decodeURIComponent(t[r].substring(i+1)))}return n},getURLQueryValue:function(e,t){var n=this.parseURLQuery(t);return n?n[e]:null},removeNode:function(e){e&&e.parentNode.removeChild(e)},setCommonMsgTooltip:function(e){if(!e)return;var t=this.getDojoWidget("commonMsgTooltip");t&&(t.domNode.innerHTML=e)},setDivActive:function(e,t){t?dojo.addClass(e,"active"):dojo.removeClass(e,"active")},setHelpTopics:function(e){for(var t=0;t<e.length;++t){var n=typeof e[t]=="string"?dojo.byId(e[t]):e[t];dojo.connect(n,"onclick",this,"getHelp"),cv.helpTopics[e[t]]=e[++t]}},setMenuItem:function(e,t,n){dojo.isString(e)&&(e=this.getDojoWidget(e));if(!e)return;if(t){var r=e.iconNode;t&&t=="checked"?r.src=cv.contextPath+"images/checkmark.png":r.src=dojo.moduleUrl("dojo","resources/blank.gif").toString()}n&&e.setDisabled(n=="disabled"?!0:!1)},setSectionCollapsed:function(e){var t=!0,n=dojo.byId(e);n&&(n.type=="checkbox"?n.checked=!1:n.tagName=="IMG"&&(this.hide(n.id+"DIV"),n.name="closed",n.src=n.src.replace(/opened\./,"closed."),t=!1)),t&&dojox.fx.wipeOut({duration:0,node:dojo.byId(e+"DIV")}).play()},show:function(){for(var e=0;e<arguments.length;++e){if(arguments[e].tagName){dojo.removeClass(arguments[e],"hidden");continue}dojo.removeClass(dojo.byId(arguments[e]),"hidden")}},updateMenuItemCaption:function(e,t,n){var r=this.getDojoWidget(e);if(!r)return;t=cvCatalog[t],n&&(t=cv.util.substituteParams(t,n)),r.setLabel(t)},TRACE:function(e){if(cv.prefs.isDebug<2)return;try{if(e=="_INIT")this.TRACEWIN=window.open("","cvtrace","resizable=1,scrollbars=1"),this.TRACEWIN.document.open(),this.TRACEWIN.document.writeln("<b>INITIALIZE ClearView JS Trace</b><p>");else if(e=="_EXIT")this.TRACEWIN.document.writeln("<b>EXIT ClearView JS Trace</b>"),this.TRACEWIN.document.close(),this.TRACEWIN.close();else if(e=="_START")this.TSBASE=this.TSSTART=new Date,this.TRACEWIN.document.writeln("<b>Start Profiling at: "+this.TSSTART+"</b><br>");else if(e=="_END")this.TRACEWIN.document.writeln("<b>Finish Profiling - Total: "+(new Date-this.TSSTART)+" ms</b><p>");else if(e=="_CLEAR")this.TRACEWIN.document.clear();else{var t=new Date;this.TRACEWIN.document.writeln("&nbsp;&nbsp;&nbsp;&nbsp;"+e+": "+(t-this.TSBASE)+" ms<br>"),this.TSBASE=new Date}}catch(n){}},createEvent:function(e){var t=new Object;return t.target=e,t.clientX=0,t.clientY=0,t.stopPropagation=function(){},t.preventDefault=function(){},t},convertStringtoDate:function(e){var t=e;return t=t.replace(/-/g,"/"),t=t.replace("T"," "),t=t.replace("Z"," GMT-0000"),new Date(Date.parse(t))},formatDateString:function(e){var t=this.convertStringtoDate(e),n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=n[t.getMonth()],i=t.getDate(),s=t.getFullYear(),o=t.toLocaleTimeString();return o.indexOf("0")==0&&(o=o.substring(1)),r+" "+i+", "+s+" "+o},goToURL:function(e){try{window.location=e}catch(t){if(!(dojo.isIE&&t.message.indexOf("Unspecified error")>-1))throw t}},selectByValue:function(e,t){for(var n=0;n<e.length;n++)e.options[n].value==t?e.options[n].selected=!0:e.options[n].selected=!1},addChartMenuItems:function(e){var t=[],n=cv.pentahoVisualizations.slice();n.sort(function(e,t){var n=e.menuOrdinal?e.menuOrdinal:1e4,r=t.menuOrdinal?t.menuOrdinal:1e4;return n-r});for(var r=0;r<n.length;r++){n[r].menuSeparator&&e.addChild(new dijit.MenuSeparator({id:"menu-item100000"+r}));var i=new dijit.MenuItem({id:n[r].id,customType:!0,label:n[r].name});e.addChild(i),t.push(i)}if(cv.analyzerProperties["chart.retain.jfreechart"]){var s=new dijit.Menu;dojo.addClass(s.domNode,"pentaho-menu-outer pentaho-menu");var o=new dijit.PopupMenuItem({label:cvCatalog.VIZ_LEGACY,popup:s});e.addChild(new dijit.MenuSeparator),e.addChild(o);var i=new dijit.MenuItem({id:"VERTICAL_BAR",label:cvCatalog.VIZ_VERTICAL_BAR});s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"STACKED_VERTICAL_BAR",label:cvCatalog.VIZ_STACKED_VERTICAL_BAR}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"PCT_STACKED_VERTICAL_BAR",label:cvCatalog.VIZ_PCT_STACKED_VERTICAL_BAR}),s.addChild(i),t.push(i),s.addChild(new dijit.MenuSeparator({id:"menu-item520"})),i=new dijit.MenuItem({id:"HORIZONTAL_BAR",label:cvCatalog.VIZ_HORIZONTAL_BAR}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"STACKED_HORIZONTAL_BAR",label:cvCatalog.VIZ_STACKED_HORIZONTAL_BAR}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"PCT_STACKED_HORIZONTAL_BAR",label:cvCatalog.VIZ_PCT_STACKED_HORIZONTAL_BAR}),s.addChild(i),t.push(i),s.addChild(new dijit.MenuSeparator({id:"menu-item523"})),i=new dijit.MenuItem({id:"LINE",label:cvCatalog.VIZ_LINE}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"MULTIPLE_PIE",label:cvCatalog.VIZ_MULTIPLE_PIE}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"STACKED_AREA",label:cvCatalog.VIZ_STACKED_AREA}),s.addChild(i),t.push(i),i=new dijit.MenuItem({id:"SCATTER",label:cvCatalog.VIZ_SCATTER}),s.addChild(i),t.push(i)}return t}},cv.util.gravity.NORTH=1,cv.util.gravity.SOUTH=2,cv.util.gravity.EAST=4,cv.util.gravity.WEST=8,dojo.declare("cv.Collapsible",null,{constructor:function(e,t,n,r,i){this.header=e,this.body=t,this.cssOpen=r?r:"folderClose",this.cssClose=i?i:"folderOpen",this.isOpen=n==1,this.setState(this.isOpen,!0),cv.util.disableTextSelection(e),dojo.connect(e,"onclick",this,"onClickHeader")},onClickHeader:function(e){if(!this.animation||this.animation.status()!="playing")this.isOpen=!this.isOpen,this.setState(this.isOpen,!0);e.stopPropagation()},setState:function(e,t){e?(dojo.removeClass(this.header,this.cssOpen),dojo.addClass(this.header,this.cssClose),t?(this.body.style.display="block",this.animation=null):this.animation=dojox.fx.wipeIn({duration:cv.prefs.wipeTime,node:this.body}).play()):(dojo.removeClass(this.header,this.cssClose),dojo.addClass(this.header,this.cssOpen),t?(this.body.style.display="none",this.animation=null):this.animation=dojox.fx.wipeOut({duration:cv.prefs.wipeTime,node:this.body}).play())}}),dojo.declare("cv.dnd.Avatar",[dojo.dnd.Avatar],{constructor:function(e,t){this.manager=e,this.node=t},update:function(){}}),dojo.declare("cv.dnd.Manager",[dojo.dnd.Manager],{opacity:.8,startDrag:function(e,t,n){if(!t||t.length==0)return;if(cv.getActiveReport().isResizing)return;this.inherited(arguments)},makeAvatar:function(){var formula=this.nodes[0].getAttribute("formula"),node;if(formula){node=document.createElement("DIV");var dragClass;if(dojo.hasClass(this.nodes[0],"filterItem")||dojo.hasClass(this.nodes[0],"filterGroup")){dragClass="filterDragObject";if(this.nodes[0].id.indexOf("filter_metric")==0)node.innerHTML=cvCatalog.filterMetric;else{var spans=this.nodes[0].getElementsByTagName("span");node.innerHTML=cv.textContent(spans[0])}node.setAttribute("formula",this.nodes[0].id)}else{var type=this.nodes[0].getAttribute("metrictype")?"V":cv.getFieldHelp().getDndType(formula);dragClass=type=="V"?"metricDragObject":"attributeDragObject",node.innerHTML=cv.util.escapeHtml(cv.textContent(this.nodes[0])),node.setAttribute("formula",formula)}dojo.addClass(node,"commonDragObject"),dragClass&&dojo.addClass(node,dragClass),this.opacity<1&&dojo.style(node,"opacity",this.opacity)}else if(this.type=="DB"){node=document.createElement("DIV");var box=dojo.position(this.nodes[0]);with(node.style)border="2px dashed black",height=box.h+"px",width=box.w+"px",backgroundColor="silver";this.opacity<1&&dojo.style(node,"opacity",this.opacity)}else{node=this.nodes[0].cloneNode(!0),this.dragClass&&dojo.addClass(node,this.dragClass),this.opacity<1&&dojo.style(node,"opacity",this.opacity);var ltn=node.tagName.toLowerCase(),isTr=ltn=="tr";if(isTr||ltn=="tbody"){var doc=this.nodes[0].ownerDocument,table=doc.createElement("table");if(isTr){var tbody=doc.createElement("tbody");table.appendChild(tbody),tbody.appendChild(node)}else table.appendChild(node);var tmpSrcTr=isTr?this.nodes[0]:this.nodes[0].firstChild,tmpDstTr=isTr?node:node.firstChild,domTds=tdp.childNodes,cloneTds=tmpDstTr.childNodes;for(var i=0;i<domTds.length;i++)cloneTds[i]&&cloneTds[i].style&&(cloneTds[i].style.width=dojo.contentBox(domTds[i]).w+"px");node=table}}if(dojo.isIE<7&&this.createIframe){with(node.style)top="0px",left="0px";var outer=document.createElement("div");outer.appendChild(node),this.bgIframe=new dojo.html.BackgroundIframe(outer),outer.appendChild(this.bgIframe.iframe),node=outer}return node.style.zIndex=999,node.style.position="absolute",new cv.dnd.Avatar(dojo.dnd.manager(),node)}}),dojo.dnd._manager=new cv.dnd.Manager,dojo.extend(dijit.MenuItem,{onClick:function(){dijit.popup.close()}})}),dojo.require("dojox.collections.Stack"),pen.define("analyzer/cv_history",["analyzer/cv_base","analyzer/cv_util"],function(){dojo.declare("cv.History",null,{constructor:function(e,t,n){this.owner=e,this.undoStack=new dojox.collections.Stack,this.redoStack=new dojox.collections.Stack,this.savedState=null,this.originalState=null,this.refreshedState=new Array,t&&n&&(dojo.connect(this,"add",t,n),dojo.connect(this,"undo",t,n),dojo.connect(this,"redo",t,n),dojo.connect(this,"rewindTo",t,n),dojo.connect(this,"forwardTo",t,n),dojo.connect(this,"setTo",t,n),dojo.connect(this,"setSaved",t,n),dojo.connect("after",this,"setRefreshed",t,n))},add:function(e){e.init(this.owner),!this.originalState&&this.undoStack.count==0&&(this.originalState=e),this.undoStack.push(e),this.redoStack.clear()},current:function(){return this.undoStack.peek()},next:function(){return this.redoStack.peek()},undo:function(){if(!this.hasUndo())return;this.current().setPluginDataJSON(cv.getActiveReport().getPluginDataJSON());var e=this.undoStack.pop();e&&(this.redoStack.push(e),this.owner.manager.cmdUndo.title.indexOf("Column Resize")<0&&(e=this.current()),e.back())},redo:function(){if(!this.hasRedo())return;this.current().setPluginDataJSON(cv.getActiveReport().getPluginDataJSON());var e=this.redoStack.pop();e&&(this.undoStack.push(e),e.forward())},rewindTo:function(e,t){while(this.hasUndo()&&(e!=this.current()||e==null))this.redoStack.push(this.undoStack.pop());return this.hasUndo()?(t&&this.current().back(),this.current()):null},forwardTo:function(e,t){while(this.hasRedo()&&e!=this.next())this.undoStack.push(this.redoStack.pop());return this.hasRedo()?(this.undoStack.push(this.redoStack.pop()),t&&this.current().forward(),this.current()):null},setTo:function(e){if(!e)return!1;if(this.undoStack.contains(e))while(e!=this.current())this.redoStack.push(this.undoStack.pop());else{if(!this.redoStack.contains(e))return!1;while(e!=this.next())this.undoStack.push(this.redoStack.pop());this.undoStack.push(this.redoStack.pop())}return!0},hasUndo:function(){return this.undoStack.count>1},hasRedo:function(){return this.redoStack.count>0},setSaved:function(){this.savedState=this.current()},setRefreshed:function(e){e||(this.refreshedState=new Array),this.refreshedState[this.refreshedState.length]=this.current()},isStateDirty:function(){return this.savedState!=this.current()},isStateRefreshed:function(){for(var e=0;e<this.refreshedState.length;e++)if(this.refreshedState[e]==this.current())return!0;return!1},isEmpty:function(){return this.undoStack.count<=1&&this.redoStack.count<=0}})}),dojo.require("dojo.html"),dojo.require("dojox.xml.parser"),pen.define("analyzer/cv_browser",["analyzer/cv_base","analyzer/cv_util","analyzer/cv_history"],function(){cv.setDomDefaultNamespace=function(e){typeof e.setProperty!="undefined"&&e.setProperty("SelectionNamespaces","xmlns:cv='"+cv.defaultNS+"'")},dojo.isIE?(Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(n===0)return-1;var r=0;arguments.length>0&&(r=Number(arguments[1]),r!==r?r=0:r!==0&&r!==Infinity&&r!==-Infinity&&(r=(r>0||-1)*Math.floor(Math.abs(r))));if(r>=n)return-1;var i=r>=0?r:Math.max(n-Math.abs(r),0);for(;i<n;i++)if(i in t&&t[i]===e)return i;return-1}),cv.textContent=function(e,t){if(t==undefined)return dojox.xml.parser.textContent(e);if(e.nodeType!=1)return dojox.xml.parser.textContent(e,t);e.text=t},cv.createNode=function(e,t,n){return e.createNode(1,t,n?n:cv.defaultNS)},cv.addOption=function(e,t){e.add(t)},dojo.html.BackgroundIframe=function(e){var t="<iframe src=\"javascript:'<html><head></head><body></body></html>'\" style='position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;z-index: -1; filter:Alpha(Opacity=\"0\");'>";this.iframe=dojo.doc().createElement(t),this.iframe.tabIndex=-1,e?(e.appendChild(this.iframe),this.domNode=e):(dojo.body().appendChild(this.iframe),this.iframe.style.display="none")},dojo.extend(dojo.html.BackgroundIframe,{iframe:null,onResized:function(){if(this.iframe&&this.domNode&&this.domNode.parentNode){var e=dojo.marginBox(this.domNode);if(e.w==0||e.h==0){setTimeout(dojo.hitch(this,this.onResized),100);return}this.iframe.style.width=e.width+"px",this.iframe.style.height=e.height+"px"}},size:function(node){if(!this.iframe)return;var coords=dojo.coords(node,!0);with(this.iframe.style)width=coords.w+"px",height=coords.h+"px",left=coords.l+"px",top=coords.t+"px"},setZIndex:function(e){if(!this.iframe)return;dojo.dom.isNode(e)?this.iframe.style.zIndex=dojo.style(e,"z-index")-1:isNaN(e)||(this.iframe.style.zIndex=e)},show:function(){this.iframe&&(this.iframe.style.display="block")},hide:function(){this.iframe&&(this.iframe.style.display="none")},remove:function(){this.iframe&&(this.iframe.parentNode.removeChild(this.iframe),delete this.iframe,this.iframe=null)}}),cv.contentMinWidth=750,cv.setMinWidth=function(){var e=dojo.window.getBox().w;e<=cv.contentMinWidth?(document.body.style.width=cv.contentMinWidth+"px",this.xScrolling=!0):(document.body.style.width=e+"px",this.xScrolling=!1)}):(Element.prototype.selectNodes=function(e){var t=this.ownerDocument.evaluate(e,this,cv.nsResolver,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),n=[];if(t){var r=t.iterateNext();while(r)n.push(r),r=t.iterateNext()}return n},Element.prototype.selectSingleNode=function(e){var t=this.ownerDocument.evaluate(e,this,cv.nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return t?t.singleNodeValue:null},cv.textContent=function(e,t){return t==undefined?dojox.xml.parser.textContent(e):dojox.xml.parser.textContent(e,t)},cv.createNode=function(e,t,n){return e.createElementNS(n?n:cv.defaultNS,t)},cv.addOption=function(e,t){e.appendChild(t)}),cv.isMobile=function(){return cv.isMobileSafari()||window.orientation!==undefined},cv.isMobileSafari=function(){return navigator.userAgent.match(/(iPad|iPod|iPhone)/)!=null};if(cv.isMobile()){function logDebug(e,t){var n=e.changedTouches[0].target;window.console.log(e.type+" mouseEvent: "+t+" target:"+n+" html:"+n.outerHTML)}var checkEventProximity=function(){var e=Math.abs(window.lastMoveEvent.changedTouches[0].screenX-window.touchstartX)<10&&Math.abs(window.lastMoveEvent.changedTouches[0].screenY-window.touchstartY)<10;return e};function fireMouseEvent(e,t,n,r){var i=t.changedTouches,s=i[0].clientX,o=i[0].clientY,u=document.createEvent("MouseEvent");u.initMouseEvent(e,!0,!0,window,1,s,o,s,o,!1,!1,!1,!1,0,typeof r!="undefined"?r:null),n.dispatchEvent(u)}window.touchstartTime=0,window.lastTouchstartTime=0,window.hasMoved=!1;var touchHandler=function(e){try{if(e.touches.length>1||e.changedTouches.length>1){window.contextMenuInPlay=!1;return}var t=dojo.dnd.manager(),n=e.changedTouches[0].target;if(n.nodeName=="INPUT"||n.nodeName=="BUTTON"||n.nodeName=="TEXTAREA")return;var r=e.changedTouches,i=r[0].screenX,s=r[0].screenY;switch(e.type){case"touchstart":if((new Date).getTime()-window.lastTouchstartTime<350){fireMouseEvent("dblclick",e,n),e.preventDefault(),window.hasMoved=!0;return}window.contextMenuInPlay=!0,window.touchstartTime=(new Date).getTime(),window.touchstartX=e.changedTouches[0].screenX,window.touchstartY=e.changedTouches[0].screenY,window.lastMoveEvent=e,window.lastTouchstartTime=window.touchstartTime,window.lastOver=n,fireMouseEvent("mouseover",e,n),fireMouseEvent("mousedown",e,n),e.preventDefault();break;case"touchmove":window.hasMoved=!0,window.lastMoveEvent=e,(t.source||e.touches.length==1)&&e.preventDefault(),n=document.elementFromPoint(i-cv.getOriginAdjustment().x,s-cv.getOriginAdjustment().y),fireMouseEvent("mousemove",e,n),window.lastOver&&n!=window.lastOver&&fireMouseEvent("mouseout",e,window.lastOver,n),fireMouseEvent("mouseover",e,n,window.lastOver),window.lastOver=n;break;case"touchend":if(e.touches>0||!window.contextMenuInPlay)return;if(window.lastWasMultiTouch)return;(!window.hasMoved||checkEventProximity())&&(new Date).getTime()-window.touchstartTime>200?(fireMouseEvent("contextmenu",e,n),e.preventDefault()):(computedTarget=document.elementFromPoint(i-cv.getOriginAdjustment().x,s-cv.getOriginAdjustment().y),fireMouseEvent("mouseup",e,computedTarget),fireMouseEvent("click",e,computedTarget),n!=computedTarget&&(fireMouseEvent("mouseup",e,n),fireMouseEvent("click",e,n))),window.lastOver&&fireMouseEvent("mouseout",e,window.lastOver,n),window.hasMoved=!1,window.lastMoveEvent=null;break;default:return}}catch(o){console.log("error in touch handler: "+o)}};document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),cv.getOriginAdjustment=function(){var e;return window.addEventListener("orientationchange",function(){e=null}),function(){return window.inMobile?e?e:(e=getMyOriginOffset(),e):{x:0,y:0}}}()}}),dojo.require("dijit.Dialog"),dojo.require("dojox.fx"),pen.define("analyzer/cv_dlg",["analyzer/cv_base","analyzer/cv_util","analyzer/cv_history","analyzer/cv_browser"],function(){cv.Dialog=function(){this.theForm=null,this.type=null,this.dlgTemplate=null,this.prefix=null,this.cache={},this.status=null,this.helpTopic=null,this.defaultMsg=null,this.lastSaveTime=null,this.isShowing=!1,this.defaultFocus=null,this._parentReport=null},cv.Dialog.prototype={show:null,save:null,prev:null,cancel:function(){cv.dlgWidget.hide(),this._parentReport!=null&&this._parentReport.refreshReport()},next:function(){this.save()},onSave:function(){if(this.lastSaveTime&&new Date-this.lastSaveTime<1e3)return;this.save(),this.lastSaveTime=new Date},onHide:function(){if(!this.isShowing)return;this.asyncRequest&&(this.asyncRequest.cancel(),this.asyncRequest=null),this.asyncRequestId&&(cv.io.cancelAsyncRequest(this.asyncRequestId),this.asyncRequestId=null),this.isShowing=!1},showError:function(e,t){this.msgClass="error",this._showAlert(e,t)},showWarning:function(e,t,n,r,i,s,o){this.msgClass="warn",this._parentReport=s,this._showAlert(e,t,n,r,i,o)},showConfirm:function(e,t,n,r,i){this.msgClass="info",this._showAlert(e,t,n,r,i)},_showAlert:function(e,t,n,r,i,s){this.type="alertDlg",this.dlgTemplate="alertDlg.html";var o="<img class='alertMsgIcon' src='images/icons/"+this.msgClass+"_l.gif'><div class='alertMsgText'>";if(dojo.isString(e))cvCatalog[e]?o+=cvCatalog[e]:o+=e;else{if(!dojo.isArray(e))return;e[0]=cvCatalog[e[0]],o+=cv.util.substituteParams.apply(this,e)}o+="</div>";if(!this.load(o))return;if(t){var u=dojo.byId("dlgHelp");u&&(u.className="titleBarButton",cv.util.setHelpTopics(["dlgHelp",t]))}var a=dojo.byId("alertDlgSuppressMsg");i?(cv.util.show(a.parentNode),a.onchange=function(){cv.prefs.suppressMsg[i]=a.checked}):cv.util.hide(a.parentNode);var f=dojo.byId("alertDlgOptionMsg");s?(dojo.byId("alertDlgOptionText").innerHTML=cvCatalog[s],cv.util.show(f.parentNode)):cv.util.hide(f.parentNode);var l=dojo.byId("dlgBtnCancel");if(n){var c=dojo.byId("dlgBtnSave");dojo.connect(c,"onclick",cv.dlgWidget,"hide"),n.srcObj?dojo.connect(c,"onclick",n.srcObj,n.srcFunc):dojo.connect(c,"onclick",n.srcFunc),n.srcFunc=="onSaveReport"&&(dojo.byId("dlgBtnSave").innerHTML=cvCatalog.btnLabelSave),cv.util.show(c),dojo.byId("dlgBtnCancel").innerHTML=cvCatalog.btnLabelCancel}r&&(r.srcObj?dojo.connect(l,"onclick",r.srcObj,r.srcFunc):dojo.connect(l,"onclick",r.srcFunc)),this.showDialog()},showDialog:function(){if(cv.dlgWidget.animationInProgress&&cv.dlgWidget.isShowing())setTimeout(dojo.hitch(this,"showDialog"),250);else{cv.dlgWidget.show();if(dojo.byId("borderContainer")){var e=dojo.position(dojo.byId("borderContainer"),!0),t=dojo._getBorderBox(cv.dlgWidget.domNode);dojo.style(cv.dlgWidget.domNode,"top",Math.floor((e.h-t.h)/2)+"px")}this.isShowing=!0}},displayMsg:function(){if(!this.msgBar)return;var e=this.defaultMsg;arguments.length==1?e=arguments[0]:arguments.length>1&&(e=cv.util.substituteParams.apply(this,arguments)),this.msgBar.innerHTML=e?e:"",e&&(cv.util.show(this.msgBar),dojox.fx.fadeIn({duration:cv.prefs.fadeTime,node:this.msgBar}).play())},displayError:function(){this.displayMsg.apply(this,arguments[0].indexOf("<span")==0?arguments:["<span class='dlgError'>"+arguments[0]+"</span>"].concat(Array.prototype.slice.call(arguments,1)))},byId:function(e){return dojo.isString(e)?dojo.byId(this.prefix+e):dojo.byId(e)},load:function(){this.status=null;if(!this.cache[this.type]){var e=this;dojo.xhrPost({url:cv.contextPath+"templates/"+this.dlgTemplate,handleAs:"text",sync:!0,load:function(t,n){if(cv.util.parseAjaxMsg(t)){this.status="errorDlgLoad";return}e.cache[e.type]=t},error:function(t,n){e.status="errorDlgLoad"}})}if(this.status!=null)return!1;var t=this.load.arguments.length>0?cv.util.substituteParams(this.cache[this.type],this.load.arguments):this.cache[this.type];cv.dlgWidget==undefined&&(cv.dlgWidget=cv.util.getDojoWidget("theDialog")),cv.dlgWidget.setContent('<form id="theDialogForm" action="" onsubmit="return false">'+t+"</form>"),this.defaultMsg=null,this.theForm=dojo.byId("theDialogForm"),this.titleBar=dojo.byId("dialogTitleBar"),this.msgBar=dojo.byId("dialogMessageBar"),this.msgBar&&cv.util.hide(this.msgBar),dojo.connect(this.titleBar,"onmousedown",this,"onDragStart"),dojo.connect(document,"onmouseup",this,"onDragEnd");var n=dojo.byId("dlgBtnSave");n&&this.type!="alertDlg"&&dojo.connect(n,"onclick",this,"onSave");var n=dojo.byId("dlgBtnNext");return n&&dojo.connect(n,"onclick",this,"next"),n=dojo.byId("dlgHelp"),n&&(this.helpTopic?(dojo.connect(n,"onclick",this,"showHelpWnd"),n.title=cvCatalog.btnTitleHelp):cv.util.hide(n)),dojo.connect(dojo.byId("dlgBtnCancel"),"onclick",this,"cancel"),!0},updateHtml:function(e,t){var n=this.byId(e);if(!n){n=this.theForm[this.prefix+e];if(n&&n.length>0&&n[0].type=="radio"){for(var r=0;r<n.length;++r)n[r].value==t&&(n[r].checked=!0);return}}if(!n)return;n.tagName=="INPUT"||n.tagName=="SELECT"?n.type=="checkbox"?n.checked=t=="true"?!0:!1:n.value=t:n.innerHTML=t},updateXml:function(e,t){if(!e)return;var n=t.id.substr(t.id.indexOf(this.prefix)+this.prefix.length);if(!n)return;switch(t.type){case"checkbox":e.setAttribute(n,t.checked?"true":"false");break;default:e.setAttribute(n,t.value)}},getRadioGroupValue:function(e){var t=this.theForm[e];for(var n=0;n<t.length;++n)if(t[n].checked)return t[n].value},showHelpWnd:function(e){if(!e.target)return;cv.util.getHelp(e.target.id=="dlgHelp"?this.helpTopic:e)},onDragStart:function(e){var t=cv.dlgWidget.domNode;this.currentPos=dojo.position(t),this.cursorPos={x:e.pageX,y:e.pageY},this.mouseMoveHandle=dojo.connect(document,"onmousemove",this,"onDragMove")},onDragEnd:function(e){dojo.disconnect(this.mouseMoveHandle)},onDragMove:function(e){var x=this.currentPos.x+e.pageX-this.cursorPos.x,y=this.currentPos.y+e.pageY-this.cursorPos.y,viewport=dojo.window.getBox();x<viewport.w-100&&x>20&&(this.currentPos.x=x,this.cursorPos.x=e.pageX),y<viewport.h-100&&y>20&&(this.currentPos.y=y,this.cursorPos.y=e.pageY);with(cv.dlgWidget.domNode.style)left=this.currentPos.x+"px",top=this.currentPos.y+"px"},setInvalidInputField:function(e){this.invalidInputField&&dojo.removeClass(this.invalidInputField,"invalid"),this.invalidInputField=e?dojo.byId(e):null,this.invalidInputField&&dojo.addClass(this.invalidInputField,"invalid")}},dojo.declare("cv.Dialog",cv.Dialog)}),dojo.provide("clearview.widget.CVTooltip"),dojo.require("dijit.Tooltip"),pen.define("analyzer/cv_tooltip",["analyzer/cv_base","analyzer/cv_util","analyzer/cv_history","analyzer/cv_browser"],function(){dojo.declare("clearview.widget.CVTooltip",[dijit.Tooltip],{_connectNodes:[],handles:[],addConnectNode:function(e,t){if(t&&dojo.indexOf(this._connectNodes,e)>-1)return;this.handles.push(dojo.connect(e,"onmouseover",this,"mouseOver")),this._connectNodes.push(e),this.addTarget(e)},startup:function(){dojo.addClass(this.domNode,"cvTooltip"),dojo.subscribe("/dnd/start",dojo.hitch(this,"close"))},mouseOver:function(e){this._mouse={x:e.pageX,y:e.pageY};var t=e.target;this._connectNode=t,cv.formatTooltip?(cv.formatTooltip(this.domNode,t),this.cancelShowing=!1):this.domNode.innerHTML="Tooltip has not been initialized for this element"},close:function(){this.inherited(arguments),this.domNode.style.display="none"},uninitialize:function(){this.close(),dojo.forEach(this.handles,dojo.disconnect)},_onTargetMouseLeave:function(e){cv.util.overElement(this._connectNode,e)||(cv.util.overElement(this.domNode,e)?this.outHandle=dojo.connect(this.domNode,"onmouseout",this,"closeDelayedTip"):(this.close(),this.domNode.style.display="none"))},closeDelayedTip:function(e){pos=dojo.coords(this.domNode,!0);var t=event.clientX,n=event.clientY;if(t>=pos.x+pos.w||t<=pos.x||n>=pos.y+pos.h||n<=pos.y)this._onTargetMouseLeave(e),dojo.disconnect(this.outHandle)},open:function(e){if(dojo.dnd.manager().source)return;var t=dojo.coords(e),n=t.x+t.w-15,r=t.y-15;this.domNode.style.display="",dijit.placeOnScreen(this.domNode,{x:n,y:r},["TL","TR","BL","BR"],{x:10,y:5})}}),dojo.declare("clearview.widget.ChartTooltip",[dijit.Tooltip],{_connectNodes:[],addConnectNode:function(e,t){if(t&&dojo.indexOf(this._connectNodes,e)>-1)return;this.handles=[dojo.connect(e,"onmouseover",this,"onMouseOver"),dojo.connect(e,"onmouseout",this,"onMouseOut")],this._connectNodes.push(e)},fillInTemplate:function(e,t){this._connectNode=dojo.byId(this.connectId),this.inherited(arguments),this.addOnLoad(this,"_loadedContent"),dojo.addClass(this.domNode,"dojoTooltip");var n=this.getFragNodeRef(t);dojo.style(this.domNode,dojo.style(n)),this.applyPopupBasicStyle()},postCreate:function(e,t){this.inherited(arguments)},onMouseOut:function(e){this._onUnHover(e)},onMouseOver:function(e){if(e.ctrlKey)return;var t=dojo.byId("rubberBand");if(t&&t.style.visibility=="visible")return;this._mouse={x:e.pageX,y:e.pageY};var n=e.target;this._connectNode=n,this._loadedContent();var r=n.getAttribute("cvtitle"),i,s,o=r.indexOf("~~~~~");o!=-1?(i=r.substring(0,o),s=r.substring(o+5)):(i=r,s="");var u=n.getAttribute("cvhref"),a=cv.getActiveReport().reportDoc.getSelectionItems(),f=i+"<div class='fieldTooltipFooter'>";u&&(f=f+"<hr>Double-click to "+s);var l=a.length;if(l>0){var c="<hr>"+a.length+" item"+(l==1?"":"s")+" selected";f+=c}f+="</div>",this.domNode.innerHTML=f,this._tracking||(this.mouseMoveEvent=dojo.connect(document.documentElement,"onmousemove",this,"onMouseMove"),this._tracking=!0),this._onHover(e)},onMouseMove:function(e){this._mouse={x:e.pageX,y:e.pageY},this._position(),cv.util.overElement(this._connectNode,e)||cv.util.overElement(this.domNode,e)?this._onHover(e):this._onUnHover(e)},_onHover:function(e){if(this._hover)return;this._hover=!0,this.open()},_onUnHover:function(e){if(!this._hover)return;this._hover=!1,this.close(),this.isShowingNow||(dojo.disconnect(this.mouseMoveEvent),this._tracking=!1)},open:function(){if(this.isShowingNow)return;this._position(),this.isShowingNow=!0},close:function(){this.isShowingNow&&(this._showTimer&&(clearTimeout(this._showTimer),delete this._showTimer),this._hideTimer&&(clearTimeout(this._hideTimer),delete this._hideTimer),dojo.disconnect(this.mouseMoveEvent),this._tracking=!1,dojo.style(this.domNode,"display","none"),this.inherited(arguments))},_position:function(){dojo.style(this.domNode,"display","block"),dijit.placeOnScreen(this.domNode,{x:this._mouse.x,y:this._mouse.y},["TL","TR","BL","BR"],{x:10,y:5})},_loadedContent:function(){this.isShowingNow&&this._position()},checkSize:function(){},uninitialize:function(){this.close(),dojo.disconnect(this.mouseMoveEvent),dojo.forEach(this.handles,dojo.disconnect)}}),dojo.provide("clearview.widget.ChartTooltip"),dojo.declare("clearview.widget.CVTooltipRefresh",dijit.Tooltip,{position_x:null,position_y:null,node:null,_mouse:null,_this:null,constrainToContainer:!0,addConnectNode:function(e,t,n){this.position_x=t,this.position_y=n,this.node=e,this._mouse={x:this.position_x,y:this.position_y},this._mouse.x-=this.domNode.offsetWidth/2+140,this._mouse.y+=12},removeConnectNode:function(e){this.node=e},fillInTemplate:function(e,t){this.inherited(arguments),this.addOnLoad(this,"_loadedContent"),dojo.addClass(this.domNode,"progressPaneUp");var n=this.getFragNodeRef(t);dojo.style(this.domNode,dojo.style(n)),this.applyPopupBasicStyle()},postCreate:function(e,t){_this=this,this.inherited(arguments)},_onMouseOver:function(e){this._mouse={x:this.position_x,y:this.position_y};var t=this.node;this._connectNode=t;if(this.isShowingNow)return;this._thisShow(),this._tracking||(dojo.connect(document.documentElement,"onmousemove",this,"_MouseMove"),this._tracking=!0),this._onHover(e)},_MouseMove:function(e){this._mouse={x:this.position_x,y:this.position_y},cv.util.overElement(this.domNode,e)?this._onHover(e):this._onUnHover(e)},close:function(){this.inherited(arguments,[!0]),this._tracking=!1,dojo.disconnect(document.documentElement,"onmousemove",this,"_MouseMove"),this.isShowingNow=!1,dojo.style(this.domNode,"display","none")},open:function(){if(this.isShowingNow)return;this.inherited(arguments),this.isShowingNow=!0},_showInMS:function(e){this._thisShow(),setTimeout(this.close,e)},_thisShow:function(){if(this.isShowingNow)return;dojo.style(this.domNode,"display","block"),dijit.placeOnScreen(this.domNode,{x:this._mouse.x,y:this._mouse.y},["TR","BL"],{x:10,y:15}),this.isShowingNow=!0},_position:function(){this.move(this._mouse.x,this._mouse.y,[10,5],"TL,TR,BL,BR")},uninitialize:function(){dojo.disconnect(document.documentElement,"onmousemove",this,"_MouseMove"),dojo.disconnect(this._connectNode,"onmouseover",this,"_onMouseOver")}})}),dojo.provide("clearview.widget.CVTooltipRefresh"),pen.define("analyzer/common",["analyzer/cv_base","analyzer/cv_util","analyzer/cv_history","analyzer/cv_browser","analyzer/cv_dlg","analyzer/cv_tooltip"],function(){}),pen.define("analyzer/report/cv_rptConst",["analyzer/common"],function(){dojo.mixin(cvConst,{MAX_FILTER_EXPRESSIONS:10,MAX_FILTER_MEMBERS:200,dndAcceptedTypes:{measures:["V","VM","BV"],columnAttributes:["L","T","LC","TC","LR","TR","BL","BT"],rowAttributes:["L","T","LC","TC","LR","TR","BL","BT"],filters:["V","L","T","VM","LC","TC","LR","TR","BT","BV","BL"],reportArea:["V","L","T","VM","LC","TC","LR","TR","BT"],trashcan:["VM","LC","TC","LR","TR","FT","BV","BL","BT"]},dndTypes:{measures:"M",columnAttributes:"C",rowAttributes:"R",filters:"FT"},TYPE_ATTRIBUTE:0,TYPE_METRIC:1,TYPE_FILTER:4,defaultGemTypes:{rowAttributes:0,columnAttributes:0,measures:1,filters:4},defaultFormatExp:"Case\nWhen [Measures].CurrentMember > 0\nThen '|#,##0|arrow=up'\nWhen [Measures].CurrentMember < 0\nThen '|#,##0|arrow=down'\nElse '|#,##0'\nEnd"}),dojo.mixin(cv.prefs,{chartOption:"VERTICAL_BAR",autoRefresh:!0,manyReportItems:8e3,maxReportItems:15e3,maxFilterValues:3e3,maxColumnFields:4,numProgressImg:1,fieldListView:"cmdViewCategory"}),cv.pentahoVisualizations=[],cv.pentahoVisualizationHelpers={},dojo.mixin(cvCatalog,{emptyReportAreaHTML:"<div class='reportEmpty'>%{3}<br><br><img src='%{2}'><br>%{1}<br><div style='padding-top: 5px; font-size: 0.7em;'>"+cvCatalog.emptyVizHelp+"</div>"+"<div class='button-panel contrast-background pentaho-bottom-bar contrast-color' style='font-size: .7em; left: 0px; position: absolute; bottom: 0px; width: 100%;'>"+"<div style='float: right; padding: 6px 10px;'>"+cvCatalog.reportHelpGettingStarted+"<button id='%{0}GettingStarted' class='pentaho-button' style='margin-left: 10px;'>Help</button></div></div>"+"</div>",filterTemplateSingleLine:"<div formula='%{0}' id='%{1}' class='filterItem'><div class='filterIndent'><img class='filterAction' id='remove_%{1}' title='Remove filter' onclick='cv.getActiveReport().removeFilter(\"%{1}\")' src='images/report/Remove.png'><img class='filterAction EDIT_Only' id='edit_%{1}' title='Edit filter' onclick='cv.getActiveReport().filterDlg.show(\"%{1}\")' src='images/report/editFilter.png'>&nbsp;</div><span><b>%{2}</b>&nbsp;%{3}</span><img class='lockImg' title='Filter locked' src='images/icons/locked.gif'></div>",filterTemplateMultiLine:"<div class='filterItem filterLine'><div class='filterIndent'>&nbsp;</div><span><b>%{0}</b> is restricted as following:</span><img class='lockImg' title='Filter locked' src='images/icons/locked.gif'></div>",filterTemplateAttr:"<div formula='%{0}' id='%{1}' class='filterItem'><div class='filterIndent2'><img class='filterAction' id='remove_%{1}' title='Remove filter' onclick='cv.getActiveReport().removeFilter(\"%{1}\")' src='images/report/Remove.png'><img class='filterAction EDIT_Only' id='edit_%{1}' title='Edit filter' onclick='cv.getActiveReport().filterDlg.show(\"%{1}\")' src='images/report/editFilter.png'>&nbsp;</div><span>%{2}</span></div>",filterTemplateSelection:"<div class='filterGroup' id='filter_selection'><div id='filter_selection_1' class='filterItem'><div class='filterIndent'><img class='filterAction' title='Remove filter' onclick='cv.getActiveReport().removeSelectionFilters()' src='images/report/Remove.png'>&nbsp;</div><span>"+cvCatalog.filterSummarySelectionItems+" (<a href='#' onclick=\"cv.getActiveReport().filterDlg.showSelectionFilter('INCLUDE')\">"+cvCatalog.btnSelectionKeepOnly+"</a>"+" | <a href='#' onclick=\"cv.getActiveReport().filterDlg.showSelectionFilter('EXCLUDE')\">"+cvCatalog.btnSelectionExclude+"</a>)"+"</span></div></div>",filterTemplateMetric:"<div formula='%{0}' id='filter_metric_0' class='filterItem'><div class='filterIndent'><img class='' id='remove_filter_metric' title='Remove filter' onclick='cv.getActiveReport().removeCurrentGem()' src='images/report/Remove.png'><img class='EDIT_Only' id='edit_filter_metric' title='Edit filter' onclick='cv.getActiveReport().filterDlg.showMetricFilter()' src='images/report/editFilter.png'>&nbsp;</div><div style='float:left;'>%{1}</div></div>",filterConditionEdit:"<table><tr><td width=10></td><td width=210><select id='FT_condMetric' style='width:98%;' size=1></select></td><td width=160><select id='FT_condOp' size=1><option value='GREATER_THAN' selected>%{GT}</option><option value='LESS_THAN'>%{LT}</option><option value='GREATER_THAN_EQUAL'>%{GTE}</option><option value='LESS_THAN_EQUAL'>%{LTE}</option><option value='EQUAL'>%{E}</option><option value='NOT_EQUAL'>%{NE}</option><option value='BETWEEN'>%{B}</option><option value='IS_NOT_EMPTY'>%{NE}</option></select></td><td width=105><input id='FT_condOp1' style='width:95px' type='text' class='inputNum'><span> and <input id='FT_condOp2' style='width:95px' type='text' class='inputNum'></span></td><td width=16 class='filterConditionDelete' id='FT_remove_{%id}' title='Delete condition'></td><td width=16></td></tr></table>",filterConditionStatic:"<table><tr><td width=10></td><td width=210>%{metric}</td><td width=160>%{op}</td><td width=105><span>%{op1}</span><span class='%{op2Css}'> and <span>%{op2}</span></span></td><td width=16 class='filterConditionDelete' id='FT_remove_{%id}' title='Delete condition'></td><td width=16></td></tr></table>",reportNoDataMsgHTML:"<div class='noData'><span class='noDataHeader'>%{0}</span><span class='noDataHint'>Your current combination of <a class='appCmdLink' href='#' onclick='return cv.getActiveReport().manager.onToggleReportPane(\"cmdLayout\");'>Fields</a> and <a class='appCmdLink' href='#' onclick='return cv.getActiveReport().manager.onToggleReportPane(\"cmdFilters\");'>Filters</a> did not generate any data. <a class='appCmdLink helpLinkReportNoData' href='#'>View Help</a> to learn more.<p><a class='appCmdLink' href='#' onclick='cv.getActiveReport().history.undo();return false;'>Undo</a> your last action.</span></div>",reportSuccessMsgHTML:"<div class='noData'><span class='noDataHeader'>%{0}</span></div>",reportSuccessMsgChartHTML:"<div class='noData'><img src='images/icon_chart_abstract.png' /><br><div class='noDataHeader'>%{0}</div></div>",refreshPanelCancel:"<div class='refreshPaneCanceledMode'>%{0}</div>",refreshPanelComplete:"<div class='refreshPaneComplete'>&nbsp;&nbsp;%{0}&nbsp;</div>"})}),dojo.require("dojox.xml.parser"),pen.define("analyzer/report/cv_rptIO",["analyzer/report/cv_rptConst"],function(){cv.io={maxConnectionTries:3,ajaxLoad:function(e,t,n,r){var i=null;t.time=(new Date).getTime(),dojo.xhrPost({url:cv.contextPath+e,content:t,load:function(e){n?i=e:n||r(e)},sync:n,headers:{"Content-Encoding":"utf8"}});if(n)return i},initAsyncRequest:function(e){return e.prevId==null&&(e.prevId=""),this.ajaxLoad("ajax/initRequest",e,!0)},cancelAsyncRequest:function(e){if(!e)return;this.ajaxLoad("ajax/cancelRequest",{requestId:e},!1)},refreshReport:function(e){var t=(new Date).getTime();e.showProgressPane("reportRefreshing"),e.refreshRequest&&e.refreshRequest.cancel(),e.refreshRequestErrorCounter=0;var n=this.initAsyncRequest({reportXML:e.getReportXml(),prevId:e.refreshRequestId,format:"HTML",action:"REFRESH",dirtyFlag:e.isDirty()});if(!n)return e.handleReportMsg({type:"exception",initId:n}),!0;var r=e.handleReportMsg(n);return r&&t>=e.refreshTimeStamp?(e.refreshRequestId=r.text,e.refreshTimeStamp=t,this.getReportHTML(e),!0):!1},getReportHTML:function(e,t,n){if(!e.refreshRequestId||t&&t!=e.refreshRequestId)return;t||(t=e.refreshRequestId),e.refreshRequest&&(e.refreshRequest.cancel(),e.refreshRequest=null),n||(n=3);var r=this;e.refreshRequest=dojo.xhrPost({url:cv.contextPath+"ajax/getReportHTML",content:{requestId:t,timeout:n,reportViewWidth:e.reportWidth,reportViewHeight:e.reportHeight,time:(new Date).getTime()},load:function(n){var i=!0;n&&(i=!1,e.loadReportHTML(n)),i&&setTimeout(dojo.hitch(r,"getReportHTML",e,t,1),3e3)},error:function(t){r._retryConnection(t,e.refreshRequestErrorCounter)?e.refreshRequestErrorCounter++:(t.message!="xhr cancelled"&&e.handleReportMsg({type:"exception",message:t.message}),retry=!1)},sync:!1})},selectChart:function(e,t,n,r,i){e.refreshRequest&&(e.refreshRequest.cancel(),e.refreshRequest=null);var s=this;e.refreshRequest=dojo.xhrPost({url:cv.contextPath+"ajax/selectChart",content:{reportXML:e.getReportXml(),reportViewWidth:e.reportWidth,reportViewHeight:e.reportHeight,rbX:t.left,rbY:t.top,rbWidth:t.width,rbHeight:t.height,itemWidth:n,itemHeight:r,pageMember:i,time:(new Date).getTime()},load:function(t){t&&(retry=!1,e.loadSelectedChart(t))},error:function(t){s._retryConnection(t,e.refreshRequestErrorCounter)?e.refreshRequestErrorCounter++:(t.message!="xhr cancelled"&&e.handleReportMsg({type:"exception",message:t.message}),retry=!1)},sync:!1})},getReportInFormat:function(e,t,n,r,i){var s=this.initAsyncRequest({reportXML:e,action:"REFRESH",format:t,dirtyFlag:i,prevId:""});if(!s)return;var o=dojox.xml.parser.parse(e),u=o.documentElement.selectSingleNode("cv:commonStorageAttributes/cv:path"),a=o.documentElement.getElementsByTagName("path")[0].getAttribute("name"),f=cv.contextPath+"ajax/getReportInFormat?requestId="+s+"&format="+t+"&stok="+cv.securityToken;n&&(f=f+"&includeSubtotals="+n),r&&(f=f+"&formatNumbers="+r),a!=null&&a!=""&&(f=f+"&reportName="+encodeURIComponent(a)),t=="EXCEL"&&document.all?dojo.byId("downloadIframe").setAttribute("src",f):window.open(f)},getReportDrillCSV:function(e,t,n,r){var i=this.initAsyncRequest({reportXML:e,action:"REFRESH",format:"CSV",dirtyFlag:r,prevId:""});if(!i)return;var s=cv.contextPath+"drill/getReportDrillCSV?requestId="+i+"&colIndex="+t+"&rowIndex="+n;window.open(s)},_retryConnection:function(e,t){if(t<this.maxConnectionTries&&e&&e.message){e=e.message;var n=/XMLHttpTransport\sError:\s(12\d\d\d)/,r=n.exec(e);if(r&&r[1])switch(r[1]){case"12002":case"12029":case"12030":case"12031":case"12152":return!0}}return!1}}}),dojo.require("dojox.collections.Dictionary"),dojo.require("dojox.xml.parser"),dojo.require("dojox.fx"),dojo.require("dijit.layout.TabContainer"),dojo.require("dijit.layout.ContentPane"),dojo.require("analyzer.LayoutPanel"),dojo.require("analyzer.TabPanel"),pen.define("analyzer/report/cv_rptReport",["analyzer/report/cv_rptIO"],function(){dojo.declare("cv.Report",null,{constructor:function(e){this.id=e.id,this.mode=e.mode,this.manager=e.manager,this.uiController=e.uiController,this.containerNode=e.containerNode,this.progressPaneId=e.progressPaneId,this.handles=[],this.history=new cv.History(this,e.manager,e.uiController),this.visualizationController=null,this.currentVizAction="select",this.multiCharts=!1,this.highlights=null,e.reportDoc?this.reportDoc=e.reportDoc:(this.reportDoc=new cv.ReportDocument,this.reportDoc.initialize(e.reportXml)),e.cube&&e.catalog?(this.cube=e.cube,this.catalog=e.catalog,this.reportDoc.setReportOption("cube",this.cube),this.reportDoc.setReportOption("catalog",this.catalog)):(this.cube=this.reportDoc.getReportOption("cube"),this.catalog=this.reportDoc.getReportOption("catalog")),this.currentSelection=null,this.gemList=new dojox.collections.Dictionary,this.badFields=[],this.badFilters=!1},MIN_REPORT_HEIGHT:100,HISTORY_ACTION_LIST:"",reportBeCanceled:!1,providePluginWithStateInRender:!0,byId:function(e){return e.indexOf(this.id)!=0&&(e=this.id+e),dojo.byId(e)},byClass:function(e){return cv.util.getFirstChildByClass(this.domNode,e)},createNode:function(e,t,n,r){var i=document.createElement(e);return t&&(i.id=this.id+t),n&&(i.className=n),r&&r.appendChild(i),i},init:function(){window.name="cvrpt"+this.id,this._initDom(),this.reportStatus=null,this.timeUnlimited=!0,this.refreshRequestId="",this.progressImgId=0,this.isReportPropsDirty=!1,this.actionLog=[],this.pendingActionLen=0,this.topPaneId="",this.reportHeight=300,this.reportWidth=500,this.refreshTimeStamp=null,this.isInitialized=!1,this.pivotReportLoaded=!1,this.chartLoaded=!1,this.rptDlg=new cv.ReportDialog(this),this.filterDlg=new cv.FilterDialog(this),this.linkDlg=new cv.LinkDialog(this),this.chartOptionsDlg=new cv.ChartOptionsDialog(this),this.pageSetupDlg=new cv.PageSetupDialog(this),this.resizer=new cv.ReportResizer,this.reportHeaders=null,this.isResizing=!1,this.rowFieldWidths=new Array,this.actualRowFieldWidths=null,this.columnDataFieldWidths=new Array,this.actualColumnFieldWidths=null,dojo.dnd.manager.nestedTargets=!0,this.dropTargets={measures:{accept:cvConst.dndAcceptedTypes.measures,dndSuffix:cvConst.dndTypes.measures},columnAttributes:{accept:cvConst.dndAcceptedTypes.columnAttributes,dndSuffix:cvConst.dndTypes.columnAttributes},rowAttributes:{accept:cvConst.dndAcceptedTypes.rowAttributes,dndSuffix:cvConst.dndTypes.rowAttributes},reportArea:new cv.ReportDropTarget(this.byId("ReportArea"),{accept:cvConst.dndAcceptedTypes.reportArea,report:this}),trashcan:new cv.TrashAreaDropTarget(this.byId("Trashcan"),{accept:cvConst.dndAcceptedTypes.trashcan,report:this})},this.mode=="EDIT"?(dojo.addClass(this.byId("filters"),"dojoDndItem"),this.dropTargets.filters=new cv.FilterPaneDropTarget(this.byId("filters").parentNode,{accept:cvConst.dndAcceptedTypes.filters,dndSuffix:cvConst.dndTypes.filters,report:this}),this.dropTargets.filters.sync(),this.dropTargets.filterPaneTitle=new cv.FilterPaneDropTarget(this.byId("FilterPaneTitle"),{accept:cvConst.dndAcceptedTypes.filters,dndSuffix:cvConst.dndTypes.filters,report:this}),this.handles.push(dojo.connect(this.nodeFilters,"ondblclick",this,"showFilterDlg")),this.setAutoRefresh(this.reportDoc.getReportOption("autoRefresh")=="true"?!0:!1)):(this.mode=="VIEW"||this.mode=="MINI")&&this.handles.push(dojo.connect(this.byId("CmdActions"),"onclick",this,"toggleActionsPopupMenu")),this.handles.push(dojo.connect(this.byId("ReportSummary"),"onclick",this,"onToggleReportPane")),this.handles.push(dojo.connect(this.byId("HideFilterPane"),"onclick",this,"onToggleReportPane")),this.handles.push(dojo.connect(this.nodeFilters,"onmousemove",this,"onMouseOverFilters")),this.handles.push(dojo.connect(dojo.byId("closeRowTruncate"),"onclick",this,"hideTruncateMessage")),this.handles.push(dojo.connect(dojo.byId("closeColTruncate"),"onclick",this,"hideTruncateMessage")),cv.util.setHelpTopics([this.id+"HelpFilterPane","CV/Business_User/working_with_filters.html"]),cv.util.show(this.domNode),typeof analyzerPlugins!="undefined"&&dojo.forEach(analyzerPlugins,function(e){e.init()})},_initDom:function(){this.domNode=this.createNode("DIV","ReportMain","reportMain pentaho-panel-insetglow "+this.mode),this.containerNode.appendChild(this.domNode);var e=this.createNode("DIV","ReportTitle","pentaho-titled-toolbar",this.domNode);this.mode=="EDIT"?e.innerHTML="<div id='"+this.id+"ReportFormatCmdDiv' class='reportFormatShowDiv' style='height:23px;'>"+"</div><div class='titleLink reportName' id='"+this.id+"ReportName'></div>":e.innerHTML="<div id='"+this.id+"ReportFormatCmdDiv' class='reportFormatShowDiv' style='height:23px;'>"+"<div title='Report Actions' id='"+this.id+"CmdActions' class='cmdActionsBtn'><span>"+cvCatalog.reportDashboardActions+"</span></div>"+"</div><div class='titleLink reportName' id='"+this.id+"ReportName'></div>",e=this.createNode("DIV","ReportSummary","reportSummary clearfix pentaho-titled-toolbar",this.domNode),e.innerHTML='<div class="filterSummary" id="'+this.id+'FilterPaneTitle"><div id="'+this.id+'FilterPaneToggle" class="filterPaneToggle" title="'+cvCatalog.ttShowHideFilters+'">&nbsp;</div>'+'<span id="'+this.id+'FilterCountLabel" title="'+cvCatalog.ttShowHideFilters+'" style="padding-top:6px;">No Filter in use</span></div>'+'<div id="refreshSummary"><div id="'+this.id+'StatusBar" class="statusBar"></div><div id="progressPane" class="progressPaneDiv hidden"></div></div>',this.mode=="EDIT"&&(dojo.style("refreshSummary","position","absolute"),dojo.style("refreshSummary","right","0")),this.nodeFilter=this.createNode("DIV","Filter","reportFilter clearfix hidden",this.domNode),this.nodeFilter.innerHTML='<img id="'+this.id+'HideFilterPane" src="images/report/Close_over.png" class="closeBox" style="float:right;" title="Hide filter pane">'+'<img id="'+this.id+'HelpFilterPane" class="helpIcon" title="Help on Filters" style="float:right;" src="images/help_link.png">'+'<div id="'+this.id+'filters" class="filters"><div class="filterPaneHint"></div></div>',this.nodeRowTruncate=this.createNode("DIV","RowTruncateInfo","rowTruncate hidden",this.domNode),this.nodeRowTruncate.innerHTML='<img src="images/report/button_close.gif" id="closeRowTruncate" style="float:right;cursor:pointer;"><br><img src="images/icons/info.gif">&nbsp;Showing <span id="'+this.id+'RowTruncateMsg"></span>&nbsp;rows. Add more filters to reduce the number of rows.<br>To see all rows, download the report to Excel or PDF files.',this.nodeColTruncate=this.createNode("DIV","ColTruncateInfo","colTruncate hidden",this.domNode),this.nodeColTruncate.innerHTML='<img src="images/report/button_close.gif" id="closeColTruncate" style="float:right;cursor:pointer;"><br><img src="images/icons/info.gif">&nbsp;Showing <span id="'+this.id+'ColTruncateMsg"></span>&nbsp;columns. Add more filters to reduce the number of columns.<br>To see all columns, download the report to Excel or PDF files.',this.nodeReportRefresh=this.createNode("DIV","ReportRefresh","reportRefresh",this.domNode),this.nodeReportRefresh.innerHTML='<div style="float: left;"><img src="images/icons/warn.png" style="vertical-align: middle;">'+cvCatalog.warnAutoRefreshPanel+'</div><button id="cmdRefreshBtn" style="float: right; margin-right: 10px;padding: 2px 5px 4px;" class="pentaho-button">'+cvCatalog.refreshButton+"</button>",dojo.connect(dojo.byId("cmdRefreshBtn"),"onclick",function(){cv.getActiveReport().history.isStateRefreshed()||cv.getActiveReport().refreshReport(!0)}),cv.util.hide(this.nodeReportRefresh),this.nodeReportArea=this.createNode("DIV","ReportArea","reportArea",this.domNode),this.nodeTrash=this.createNode("DIV","Trashcan","trashcan hidden",this.domNode),this.nodeFilters=this.byId("filters"),this.statusBar=this.byId("StatusBar"),this.closeTruncateStatus="None"},postCreate:function(){var e="";this.reportDoc.isEmpty()||(e="actionOpenReport"),this.history.add(new cv.ReportState(e)),this.history.setSaved(),this.openReport(null,!1),this.badFields.length>0&&(this.history.current().reportXml=dojox.xml.parser.innerXML(this.reportDoc.getReportNode())),this.history.setRefreshed(!1),this.successState=this.history.current(),this.isInitialized=!0},destroy:function(){dojo.forEach(this.handles,dojo.disconnect),this.rptDlg.destroy(),this.filterDlg.destroy(),this.resizer.destroy(),cv.util.destroyDojoWidgets(),this.rptDlg=null,this.filterDlg=null,this.resizer=null,this.reportDoc=null,this.reportHeaders=null,this.reportStatus=null,this.statusBar=null,this.nodeColTruncate=null,this.nodeRowTruncate=null,this.nodeLayout=null,this.nodeFilter=null,cv.util.TRACE("_EXIT")},setReportPropsDirty:function(e){this.isReportPropsDirty=e},showReportDescription:function(e){var t=e.currentTarget.id,n=dojo.byId(t);n.setAttribute("title",this.getReportProperties().description)},openReport:function(e,t){e&&(this.reportDoc.replaceReportNode(e),this.reportDoc.setReportOption("autoRefresh",cv.prefs.autoRefresh?"true":"false")),this._initDisplay(),this.cube=this.reportDoc.getReportOption("cube");var n=this.reportDoc.getReportProperty("name");if(n)this.setReportName(n),document.title=n,this.reportDoc.getUIAttributes().getAttribute("showFilterPanel")=="true"&&this.onToggleReportPane("cmdFilters");else{this.setReportName(cvCatalog.reportNewName),document.title=cvCatalog.reportNewName,this.setReportPropsDirty(!0);var r=cv.util.getURLQueryValue("autoRefresh");!e&&r=="false"&&this.setAutoRefresh(!1)}t||this.refreshReport(!1,!0)},destroyReport:function(){this.reportHeaders!=null&&(this.reportHeaders.disconnect(),this.reportHeaders=null),dojo.unsubscribe(this.resizeSubscription);var e=this.byClass("pivotTable");if(e){var t=dijit.findWidgets(e);dojo.forEach(t,function(e){e.destroyRecursive(!1)})}e&&(e.innerHTML="",dojo.disconnect(this.rptPopupMenu),dojo.disconnect(this.rptOnKeepAndShow),cv.util.hide(this.nodeColTruncate,this.nodeRowTruncate))},loadReportResizeParams:function(){if(this.rowFieldWidths.length>0||this.columnDataFieldWidths.length>0)return;var e="cv:uiAttributes/cv:rowFieldWidths/cv:labelWidth",t=this.reportDoc.reportRecord.documentElement.selectNodes(e);for(var n=0;n<t.length;++n)this.rowFieldWidths[t[n].attributes[0].value]=dojox.xml.parser.textContent(t[n].selectSingleNode("cv:width"))-0;e="cv:uiAttributes/cv:columnDataFieldWidths/cv:labelWidth";var r=this.reportDoc.reportRecord.documentElement.selectNodes(e);for(var n=0;n<r.length;++n)this.columnDataFieldWidths[r[n].attributes[0].value]=dojox.xml.parser.textContent(r[n].selectSingleNode("cv:width"))-0},updateReportResizeParams:function(e,t,n,r){if(e=="remove")if(r=="measure")for(var i=t;i<this.columnDataFieldWidths.length;++i)this.columnDataFieldWidths[i]=this.columnDataFieldWidths[i+1];else for(var i=t;i<this.rowFieldWidths.length;++i)this.rowFieldWidths[i]=this.rowFieldWidths[i+1];else if(e=="add"&&n=="before")if(r=="measure"){for(var i=this.columnDataFieldWidths.length;i>t;i--)this.columnDataFieldWidths[i]=this.columnDataFieldWidths[i-1];this.columnDataFieldWidths[t]=null}else{for(var i=this.rowFieldWidths.length;i>t;i--)this.rowFieldWidths[i]=this.rowFieldWidths[i-1];this.rowFieldWidths[t]=null}},saveUIAttributes:function(){var e=this.reportDoc.getUIAttributes(),t,n;dojox.xml.parser.removeChildren(e.selectSingleNode("cv:rowFieldWidths")),dojox.xml.parser.removeChildren(e.selectSingleNode("cv:columnDataFieldWidths")),t=e.selectSingleNode("cv:rowFieldWidths"),this.actualRowFieldWidths&&t.setAttribute("actualWidths",this.actualRowFieldWidths.toString()),n=e.selectSingleNode("cv:columnDataFieldWidths"),this.actualColumnFieldWidths&&n.setAttribute("actualWidths",this.actualColumnFieldWidths.toString());for(i=0;i<this.rowFieldWidths.length;++i)if(typeof this.rowFieldWidths[i]!="undefined"&&this.rowFieldWidths[i]!=null){var r=dojox.xml.parser.parse('<labelWidth xmlns="http://www.pentaho.com" index=\''+i+"'><width>"+parseInt(this.rowFieldWidths[i])+"</width></labelWidth>").documentElement;t.appendChild(r.cloneNode(!0))}for(i=0;i<this.columnDataFieldWidths.length;++i)if(typeof this.columnDataFieldWidths[i]!="undefined"&&this.columnDataFieldWidths[i]!=null){var r=dojox.xml.parser.parse('<labelWidth xmlns="http://www.pentaho.com" index=\''+i+"'><width>"+parseInt(this.columnDataFieldWidths[i])+"</width></labelWidth>").documentElement;n.appendChild(r.cloneNode(!0))}this.savePluginDataToXML(this.getPluginDataJSON())},loadReportHTML:function(e){this.refreshRequest=null,this.refreshRequestId=null,this.hideProgressPane(),this._removeAutoRefreshPane();var t=this.handleReportMsg(e);if(t){if(t.type=="success"){this.showReportStatus(null);if(t.id!="successGenerateReport"){var n=cvCatalog[t.id];n||(n=t.id),t.id=="reportNoDataMsg"?e=cv.util.substituteParams(this.mode=="EDIT"?cvCatalog.reportNoDataMsgHTML:cvCatalog.reportSuccessMsgHTML,n):this.getReportFormat()=="CHART"?e=cv.util.substituteParams(cvCatalog.reportSuccessMsgChartHTML,n):e=cv.util.substituteParams(cvCatalog.reportSuccessMsgHTML,n)}}else this.showReportStatus(t.details?t.details:t.id,t.type);if(t.id=="reportNoDataMsg"){this.displayReport(e,t);return}this.isClientSideViz()?this.displayClientSideReport(e):(this.visualization=null,this.loadReportResizeParams(),this.displayReport(e,t))}},log:function(e,t){if(e){this.manager.cmdUndo&&(e=="UNDO"&&this?e=this.manager.cmdUndo.title:e=="REDO"&&(e=this.manager.cmdRedo.title));var n=e.indexOf(" (Ctrl+");n>0&&(e=e.substring(0,n)),this.actionLog.push(e)}t&&(this.pendingActionLen=this.actionLog.length)},handleReportMsg:function(e){if(!e)return null;var t=dojo.isObject(e)?e:cv.util.parseAjaxMsg(e);if(!t)return{type:"success",id:"successGenerateReport",text:e};switch(t.type){case"exception":if(t.message!=undefined&&(t.message.indexOf("Component returned failure code: 0x80040111")>=0||t.message.indexOf("XMLHttpTransport Error: 0")>=0)||t.initId!=undefined&&t.initId==null)return null;this.showReportStatus("exceptionGenerateReport");var n="<img class='reportMsgIcon' src='images/icons/exception_l.gif'><div class='reportMsgText'>"+(t.ticket?cv.util.substituteParams(cvCatalog.reportErrorTicket,t.ticket+"",t.id):cvCatalog.reportErrorMsg)+"</div>";return t.details&&(n+=t.details),this.hideProgressPane(),this.displayReport(n,null,"exception"),null;case"error":return this.showReportStatus(this.successState?"errorGenerateReport":"errorLoadReport"),this.rptDlg.showError(t.details),this._revertToLastSuccessState(),this.hideProgressPane(),null;case"confirm":var r=this;return this.refreshRequestId=t.text,t.id=="Incompatible.fields"?this.rptDlg.showConfirm(t.details,"CV/Business_User/working_with_fields.html#incompatible_fields",{srcFunc:function(){cv.io.getReportHTML(r)}},{srcObj:this,srcFunc:"cancelReport"}):this.rptDlg.showConfirm(t.details,null,{srcFunc:function(){cv.io.getReportHTML(r)}},{srcObj:this,srcFunc:"cancelReport"}),null;case"warn":return t.id=="Incompatible.fields"?this.rptDlg.showWarning(t.details,"CV/Business_User/working_with_fields.html#incompatible_fields",!1,!1,null):cv.prefs.suppressMsg[t.id]||this.rptDlg.showWarning(t.details,null,!1,!1,t.id),t;case"sessionExpired":return null;default:return t}},displayReport:function(e,t,n){cv.util.TRACE("_START");var r=this.getReportFormat();if(!e)return;this.destroyReport(),cv.util.TRACE("set report HTML"),this.nodeReportArea.innerHTML=e;if(t&&t.id=="reportNoDataMsg"&&this.mode=="EDIT")cv.util.setHelpTopics([cv.util.getFirstChildByClass(this.nodeReportArea,"helpLinkReportNoData"),"CV/Business_User/working_with_filters.html#when_the_report_returns_no_data"]);else if(r=="PIVOT"){var i=this.byClass("pivotTable");if(i){var s=i.getAttribute("rowcount"),o=i.getAttribute("columncount");if(t){t.truncate&&(i.truncateType=t.truncate);switch(t.truncate){case"ROW":s=cv.util.substituteParams(cvCatalog.reportTableCountValue,s,t.rows),i.rowMsg=s;break;case"COL":o=cv.util.substituteParams(cvCatalog.reportTableCountValue,o,t.cols),i.colMsg=o;break;case"BOTH":s=cv.util.substituteParams(cvCatalog.reportTableCountValue,s,t.rows),i.rowMsg=s,o=cv.util.substituteParams(cvCatalog.reportTableCountValue,o,t.cols),i.colMsg=o;break;case"NONE":default:}}this.statusBar.innerHTML=cv.util.substituteParams(cvCatalog.reportTableCount,s,o),cv.util.TRACE("Update layout"),this.reportHeaders=new cv.ReportHeaders(this,i);var u=0,a=dojo.query(".resize",this.reportHeaders.rowLabelHeaderContainer);for(var f=0;f<a.length;++f)f!=0&&this.reportHeaders.attachResizeNode(a[f],"Label","before",u++),this.reportHeaders.attachResizeNode(a[f],"Label","after",u++),dojo.style(a[f],"position","relative");var l=dojo.query(".resize",this.reportHeaders.columnHeaderContainer);for(var f=0;f<l.length;++f)l[f].parentNode.getAttribute("type")=="measure"&&(this.reportHeaders.attachResizeNode(l[f],"Column","before",u++),this.reportHeaders.attachResizeNode(l[f],"Column","after",u++),dojo.style(l[f],"position","relative"));this.reportHeaders.resizeLabels=a,this.reportHeaders.resizeColumns=l,this.closeTruncateStatus="None",this.resizeContainer(),this.reportHeaders.updateLayout(),this.rptOnKeepAndShow=dojo.connect(i,"ondblclick",this,"onKeepAndShow"),this.rptPopupMenu=dojo.connect(i,"oncontextmenu",this,"toggleInReportPopupMenu");var c=cv.util.getDojoWidget("memberPopMenu");c&&c.domNode&&(c.domNode.memberId=null)}}else r=="CHART"&&(dojox.fx.fadeIn({duration:cv.prefs.fadeTime,node:this.nodeReportArea}).play(),this.setupChartInteraction());!t&&this.reportDoc.getReportNode().selectNodes("cv:measures/cv:measure").length==0&&this.showReportStatus("infoAddNumberField"),this.dropTargets.reportArea.init(r),this.successState=this.history.current(),n!="exception"&&(r=="PIVOT"?this.pivotReportLoaded=!0:this.chartLoaded=!0),cv.util.TRACE("_END")},refreshReport:function(e,t,n){t||this.reportDoc.replaceSelectionItems(),dojo.publish("/analyzer/reportDisplayed",[this,n]);if(!e&&!this.autoRefresh())return!0;cv.util.hide(this.nodeReportRefresh),this.history.setRefreshed(!1),this.statusBar.innerHTML="";if(this.reportDoc.isEmpty()||!this.isRequiredGembarsFilled()){this.hideProgressPane(),this.refreshRequest&&this.refreshRequest.cancel(),this.refreshRequestId&&cv.io.cancelAsyncRequest(this.refreshRequestId),this.refreshRequest=this.refreshRequestId=null,this.destroyReport();var r=this.getReportFormat(),i="images/viz/PIVOT",s=cvCatalog.VIZ_PIVOT_DESC,o=null;return this.isClientSideViz()?(i="images/viz/"+this.reportDoc.getChartOption("customChartType").toUpperCase(),s=this.visualization.name,o=cv.pentahoVisualizationHelpers[this.visualization.id].placeholderImageSrc):this.getReportFormat()=="CHART"&&(i="images/viz/"+this.reportDoc.getChartOption("chartType").toUpperCase(),s=cvCatalog["VIZ_"+this.reportDoc.getChartOption("chartType")+"_DESC"]),i+=".png",this.nodeReportArea.innerHTML=cv.util.substituteParams(cvCatalog.emptyReportAreaHTML,this.id,cvCatalog.emptyVizArea,o||i,s),cv.util.setHelpTopics([this.id+"GettingStarted","CV/Business_User/creating_a_new_report.html#start_adding_fields_and_filters"]),this.dropTargets.reportArea.init(r),this.showReportStatus(null),this.successState=this.history.current(),!0}return this.pivotReportLoaded=!1,this.chartLoaded=!1,this.refreshTimeStamp=(new Date).getTime(),cv.io.refreshReport(this)},cancelReport:function(){this.reportBeCanceled=!0,this.hideProgressPane();if(!this.refreshRequestId)return;this.refreshRequest&&this.refreshRequest.cancel(),cv.io.cancelAsyncRequest(this.refreshRequestId),this.refreshRequest=this.refreshRequestId=null,this.showReportStatus("infoCancelReportRefresh"),this._revertToLastSuccessState()},getReportXml:function(){return this.reportDoc.getXml()},getReportFormat:function(){return this.reportDoc.getReportOption("reportTypeEnum")},isVisualizationPrintable:function(e){if(!this.visualization)return!0;var t=cv.io.ajaxLoad("checkPrintAvailable",{vizId:this.visualization.id},!0);return t=="true"?!0:(setTimeout(function(){cv.getActiveReport().rptDlg.showConfirm("CANNOT_PRINT_VIZ",null,{srcFunc:function(){e=="PDF"?cv.getActiveReport().getReportPDF():cv.getActiveReport().getReportExcel()}})},500),!1)},getReportPDF:function(e){if(e&&!this.isVisualizationPrintable("PDF"))return;this.saveUIAttributes(),cv.io.getReportInFormat(this.getReportXml(),"PDF",null,null,this.isDirty())},getReportExcel:function(e){if(e&&!this.isVisualizationPrintable("EXCEL"))return;this.saveUIAttributes(),cv.io.getReportInFormat(this.getReportXml(),"EXCEL",null,null,this.isDirty())},getReportDrillCSV:function(e,t){cv.io.getReportDrillCSV(this.getReportXml(),e,t,this.isDirty())},showReportStatus:function(e,t){this.reportStatus=e,this.manager.showStatus(e,t)},showProgressPane:function(e){this.reportBeCanceled=!1;var t=dojo.byId(this.progressPaneId),n="<img src='images/report/refreshing.gif' style='vertical-align:middle;'>&nbsp;&nbsp;Refreshing&nbsp;&nbsp;<img id='progressPaneCancel' src='images/report/button_cancel.png' style='vertical-align:middle;cursor:pointer;'>";t.innerHTML=n,cv.util.show(t);var r=cv.util.getFirstChildByClass(dojo.byId("refreshTooltip"),"progressPaneHeaderLabel");r!=null&&(r.innerHTML="<img src='images/report/refreshing.gif' style='vertical-align:middle;'>&nbsp;&nbsp;<b>Refreshing</b>"),dojo.connect(dojo.byId("progressPaneCancel"),"onclick",this,"cancelReport");if(cv.isMobile())return;dojo.addClass(dojo.byId("refreshHeader"),"progressPaneUp"),dojo.addClass(dojo.byId("refreshAction"),"progressPaneContent"),dojo.addClass(dojo.byId("refreshFooter"),"progressPaneDown");var i=dojo.position(t,!0),s=cv.util.getDojoWidget("refreshTooltip"),o=null;s.addConnectNode(t,i.x+88,i.y-8),o=cv.util.getFirstChildByClass(s.domNode,"progressPaneContent");var u=dojo.window.getBox();if(this.mode=="VIEW"||this.mode=="MINI")dojo.style(s.domNode,"top","25px"),dojo.style(s.domNode,"left",u.w-320+"px");s._thisShow(),this.HISTORY_ACTION_LIST="";for(var a=this.pendingActionLen;a<this.actionLog.length;++a)this.HISTORY_ACTION_LIST+="<div style='font-size:11px;width:210px;'>"+this.actionLog[a]+"</div>";o&&(o.innerHTML=this.HISTORY_ACTION_LIST)},_fadeInRefreshReport:function(){dojox.fx.fadeIn({duration:3*cv.prefs.fadeTime,node:this.nodeReportArea}).play()},hideProgressPane:function(){this.log(null,!0);var e="",t=dojo.byId(this.progressPaneId),n=cv.util.getDojoWidget("refreshTooltip");n.close(),n.removeConnectNode(t),this.reportBeCanceled&&(e=cv.util.substituteParams(cvCatalog.refreshPanelCancel,cvCatalog.refreshPanelCancelMsg)),t.innerHTML=e},getReportProperties:function(){var e={};for(var t=0;t<this.reportDoc.reportProps.length;++t){var n=this.reportDoc.reportProps[t];e[n]=this.reportDoc.getReportProperty(n),e[n]==null&&(e[n]="")}return e},setReportProperties:function(e){for(var t in e)this.reportDoc.setReportProperty(t,e[t]);this.setReportPropsDirty(!0)},toggleActionsPopupMenu:function(e){if(!cv.util.getDojoWidget("reportFormatMenu"))return;var t=cv.util.getDojoWidget("actionsMenu");if(!t)return;this.getReportFormat()=="PIVOT"?(cv.util.setMenuItem("PIVOT","checked"),cv.util.setMenuItem(this.chartMenuItem,"none")):(cv.util.setMenuItem(this.chartMenuItem,"checked"),cv.util.setMenuItem("PIVOT","none")),cv.util.setMenuItem("cmdGrandTotalRow",this.reportDoc.getReportOption("showRowGrandTotal")=="true"?"checked":"none"),cv.util.setMenuItem("cmdGrandTotalCol",this.reportDoc.getReportOption("showColumnGrandTotal")=="true"?"checked":"none");var n=this.byId("CmdActions"),r=dojo.position(n,!0);cv.util.showPopupMenu(t,r.x+60,r.y+13),dojo.stopEvent(e)},toggleGrandTotalRow:function(){this.reportDoc.setReportOption("showRowGrandTotal",this.reportDoc.getReportOption("showRowGrandTotal")=="true"?"false":"true"),this.history.add(new cv.ReportState("actionReportOptions")),this.refreshReport()},toggleGrandTotalCol:function(){this.reportDoc.setReportOption("showColumnGrandTotal",this.reportDoc.getReportOption("showColumnGrandTotal")=="true"?"false":"true"),this.history.add(new cv.ReportState("actionReportOptions")),this.refreshReport()},toggleChartTypePopupMenu:function(e){var t=cv.util.getDojoWidget("chartTypeMenu");if(!t)return;cv.util.setMenuItem(this.chartMenuItem,"checked");var n=dojo.byId("cmdSelectChartType"),r=dojo.position(n,!0);cv.util.showPopupMenu(t,r.x+5,r.y+13),dojo.stopEvent(e)},toggleReportFormat:function(e){var t,n=this.getReportFormat(),r=null;if(e&&e.target){r=e.target;while(!r.id)r=r.parentNode}if(n=="PIVOT"){if(r&&r.id.indexOf("CmdShowPivot")>=0)return;var i=this.reportDoc.getChartOption("chartType")||cv.prefs.chartOption;this._initDisplay(i=="CUSTOM"?"JSON":"CHART",i),t="actionShowChart"}else{if(r&&r.id.indexOf("CmdShowChart")>=0)return;this._initDisplay("PIVOT"),t="actionShowPivot"}this.history.add(new cv.ReportState(t)),this.refreshReport()},toggleMultiChart:function(e){var t=this.reportDoc.getChartOption("showMultiChart")=="true"?!0:!1;if(e.target.id=="CmdToggleMultiChart"&&t)return;if(e.target.id=="CmdToggleSingleChart"&&!t)return;this.setShowMultiChart(!t),t?this.history.add(new cv.ReportState("Switch to single chart")):this.history.add(new cv.ReportState("Switch to multi-charts")),this.refreshReport()},setShowMultiChart:function(e){this.reportDoc.setChartOption("showMultiChart",e?"true":"false"),e?(dojo.byId("CmdToggleSingleChart").src="images/report/single_chart_off.png",dojo.byId("CmdToggleSingleChart").title="Switch to single chart",dojo.byId("CmdToggleMultiChart").src="images/report/multi_chart_on.png",dojo.byId("CmdToggleMultiChart").title="Switch to multi-chart"):(dojo.byId("CmdToggleSingleChart").src="images/report/single_chart_on.png",dojo.byId("CmdToggleSingleChart").title="Switch to single charts",dojo.byId("CmdToggleMultiChart").src="images/report/multi_chart_off.png",dojo.byId("CmdToggleMultiChart").title="Switch to multi-charts")},setAutoRefresh:function(e){cv.prefs.autoRefresh=e,this.reportDoc.setReportOption("autoRefresh",e?"true":"false"),!e&&this.isInitialized&&this.showLayoutPanel()},showLayoutPanel:function(){this.manager&&!this.manager.isShowing("layoutPanelWrapper")&&this.onToggleReportPane("cmdLayout")},populateDropZone:function(e){var t=this.reportDoc.getChildMembers(e);for(var n=0;t&&n<t.length;++n)this.createGemDomNode(t[n],e)},populateFilters:function(){var e=this.reportDoc.getChildMembers("filters"),t=this.reportDoc.getSelectionFilters(),n=0;this.timeUnlimited=!0;if(e.length==0&&t.length==0)this.nodeFilters.innerHTML=cvCatalog[this.mode=="EDIT"?"filterSummZoneHint":"filterSummZoneNone"];else{dojox.xml.parser.removeChildren(this.nodeFilters);var r,i,s=[],o=[];for(r=0;r<e.length;++r)e[r].selectSingleNode("cv:predicates/cv:predicate")?(i=this.createGemDomNode(e[r],"filters"),i&&(cv.getFieldHelp().isTimeAttribute(i.getFormula(),!0)?s.push(i):o.push(i))):this.reportDoc.removeEmptyFilter(e[r]);if(s.length>0){this.timeUnlimited=!1;for(r=0;r<s.length;++r)this.nodeFilters.appendChild(s[r].domNode),n+=s[r].itemCount}if(o.length>0)for(r=0;r<o.length;++r)this.nodeFilters.appendChild(o[r].domNode),n+=o[r].itemCount;if(t.length>0){var u=dojo.create("div",{innerHTML:cvCatalog.filterTemplateSelection}).firstChild;this.nodeFilters.appendChild(u),++n}i=this.createMetricFilterGem(),i&&(this.nodeFilters.appendChild(i.domNode),++n)}this.byId("FilterCountLabel").innerHTML=n==0?cvCatalog.filterTitleNone:cv.util.substituteParams(n>1?cvCatalog.filterTitlePlural:cvCatalog.filterTitleSingular,n+""),this.dropTargets.filters&&this.dropTargets.filters.sync()},showEditDialogOnColumnHeader:function(e){if(this.mode!="EDIT")return;if(e.target.parentNode.getAttribute("type")=="member")return;this.currentSelection=this.getGem(e.target.parentNode.getAttribute("formula"));if(!this.currentSelection)return;var t="attribute";this.currentSelection.type==cvConst.TYPE_METRIC&&(t=this.currentSelection.metricType),t=="EXPRESSION"?this.rptDlg.showEditArithMeasure():t=="PCTOF"||t=="RANK"||t=="RSUM"||t=="PCTRSUM"?this.rptDlg.showEditSummaryMeasure():t=="VALUE"?this.rptDlg.showEditColumn():t=="attribute"?this.rptDlg.showEditColumn():t=="TREND"&&this.rptDlg.showEditTrendMeasure()},showHelpDlg:function(){var e=!this.currentSelection.metricType||this.currentSelection.metricType=="VALUE"?this.currentSelection.getFormula():this.currentSelection.getBaseFieldFormula();e&&e.indexOf("[MEASURE:")!=0&&cv.getFieldHelp().showDlg(e)},showPropHelpDlg:function(){this.rptDlg.show("show","propHelp")},resize:function(e,t){e=parseInt(this.domNode.parentNode.style.width),t=parseInt(this.domNode.parentNode.style.height),e=isNaN(e)?0:e,t=isNaN(t)?0:t,this.domNode.style.width=e+"px",this.domNode.style.height=t+"px";var n=t-dojo.position(this.byId("ReportTitle")).h-dojo.position(this.byId("ReportSummary")).h-(this.topPaneId=="filterPane"?dojo.position(this.nodeFilter).h:0);if(n<=0)return!1;if(this.reportWidth==e&&this.reportHeight==n)return!1;this.reportWidth=e,this.reportHeight=n,this.nodeReportArea.style.width=e+"px",this.nodeReportArea.style.height=n+"px";var r=this.byId("ReportEmpty");r&&(r.style.height=n+"px"),this.reportHeaders&&this.reportHeaders.updateLayout();var i=this.byId("Trashcan");return i&&setTimeout(function(){i.style.top=t-140+"px",i.style.left=e-130+"px"},200),this.vizDiv&&(this.vizDiv.style.height=this.reportHeight+"px",this.vizDiv.style.width=this.reportWidth+"px",dojo.publish("/Analyzer/resize",[this.reportHeight,this.reportWidth])),this.setReportName(),!0},setReportName:function(e){if(window.parent&&window.parent.PentahoMobile)return;if(window.parent&&window.parent.mantle_initialized)return;e&&(this.byId("ReportName").innerHTML=cv.util.escapeHtml(e));var t=(dojo.position(this.byId("ReportTitle")).w-dojo.position(this.byId("ReportName")).w)/2;this.byId("ReportName").style.left=t+"px"},resizeContainer:function(){return this.manager.resize()},addOptionsForAllMeasures:function(e,t,n,r){function v(e,t){return f[t]?f[t]:d[e]?v(e+"_"+ ++d[e],t):(d[e]=1,e)}function b(e,t){return f[e]>f[t]?1:f[e]<f[t]?-1:0}var i=[],s=[],o,u,a,f={},l=this.reportDoc.getMetrics(),c=0,h={};for(o=0;o<l.length;++o){var p=l[o].getAttribute("measureTypeEnum");if(p=="VALUE")u=l[o].getAttribute("formula"),h[u]=r?!1:!0;else{u=l[o].getAttribute("id");if(n&&u==n){++c;continue}}i.push(u)}var d={},m=l.length-c,g=cv.getFieldHelp();l=g.getMeasureList();for(o=0;o<l.length;++o)a=l[o].getAttribute("formula"),!g.isHidden(l[o])&&!h[a]&&(s.push(a),f[a]=v(this.getFieldLabel(a,!0),a));if(i.length==0&&s.length==0)return!1;var y=this;s.sort(b),i=i.concat(s),e.innerHTML="";for(o=0;o<i.length;++o){if(o==m&&r){var w=new Option("------------------------------------------------------------","");cv.addOption(e,w)}var E=o<m?v(this.getFieldLabel(i[o],!0),i[o]):f[i[o]];t&&(E=E.replace(/\]/g,"\\]"));var w=new Option(E,i[o]);w.setAttribute("title",E),cv.addOption(e,w)}return!0},addOptionsForAttributes:function(e,t){var n=[],r,i=t?1:0,s=this.reportDoc.getChildMembers("columnAttributes");for(r=0;r<s.length-i;++r)n.push(s[r]);s=this.reportDoc.getChildMembers("rowAttributes");for(r=0;r<s.length-i;++r)n.push(s[r]);if(n.length==0)return!1;e.innerHTML="";var o=!1;for(r=n.length-1;r>=0;--r){var u=n[r].getAttribute("formula"),a=this.getFieldLabel(u,!0),f=new Option(a,u);f.setAttribute("title",a),cv.addOption(e,f),o||(o=!0)}return o},showFilterDlg:function(){var e=this.currentSelection;if(!e)return;var t=e.id,n;e.getAttribute?n=e.getAttribute("formula"):e.getFormula&&(n=e.getFormula()),!t&&!n?(n=e.parentNode.getAttribute("formula"),n&&this.rptDlg.showFilterList(n)):t&&t.indexOf("filter_")==0?this.filterDlg.show(t):n&&this.rptDlg.showFilterList(n)},showNewFilterDlg:function(){var e=this.currentSelection;if(!e)return;var t=this.getGem(e.parentNode.id);if(!t)return;this.filterDlg.show(t.getFormula())},showFilterDlgCondition:function(){var e=this.currentSelection;e&&this.filterDlg.showMetricFilter(e.getFormula(),"CONDITIONS")},showFilterDlgRank:function(){var e=this.currentSelection;e&&this.filterDlg.showMetricFilter(e.getFormula(),"RANK")},isDirty:function(){return this.isReportPropsDirty||this.history.isStateDirty()},isEmpty:function(){return this.reportDoc.isEmpty()},_revertToLastSuccessState:function(){this.history.setTo(this.successState),this.successState&&this.successState.exec(!0),cv.prefs.autoRefresh&&this.history.setRefreshed(!1),this.history.isStateRefreshed()||cv.util.show(this.nodeReportRefresh),dojo.publish("/analyzer/reportDisplayed",[this,!1]),this.log(cvCatalog.actionCancel,!0)},_initDisplay:function(rptType,chartType,customChartType){var reportDoc=this.reportDoc;rptType||(rptType=this.getReportFormat()),rptType=="PIVOT"&&this.visualization&&this.savePluginDataToXML(this.getPluginDataJSON()),reportDoc.setReportOption("reportTypeEnum",rptType),chartType=chartType?chartType:reportDoc.getChartOption("chartType"),reportDoc.setChartOption("chartType",chartType);var oldCustomChartType=reportDoc.getChartOption("customChartType");customChartType=customChartType?customChartType:oldCustomChartType,customChartType&&(reportDoc.setChartOption("customChartType",customChartType),customChartType!=oldCustomChartType&&this.savePluginDataToXML("[]")),this.visualization&&this.history.current().setPluginDataJSON(this.getPluginDataJSON());if(this.isClientSideViz()){this.visualization=null;var pluginState=[],vizJSON=dojox.xml.parser.textContent(this.reportDoc.getPluginData());vizJSON?pluginState=eval("("+vizJSON+")"):pluginState=[];var vizMetadata=pentaho.visualizations.getById(customChartType);vizMetadata?(this.visualization=dojo.clone(vizMetadata),this.applyAnalyzerProperties(this.visualization),pluginState.length>0&&(dojo.mixin(this.visualization.options,pluginState[0].options),dojo.mixin(this.visualization.args,pluginState[0].args)),cv.util.setMenuItem(this.chartMenuItem,"none"),this.chartMenuItem=customChartType):(alert("Unable to load visualization: "+customChartType),rptType="PIVOT",reportDoc.setReportOption("reportTypeEnum",rptType))}else rptType=="CHART"?(cv.util.setMenuItem(this.chartMenuItem,"none"),this.chartMenuItem=chartType):rptType=="PIVOT";this.mode=="EDIT"&&(rptType=="PIVOT"?(dojo.addClass(dojo.byId("cmdShowPivot"),"reportDisplayFormatPressed"),dojo.removeClass(dojo.byId("cmdShowChart"),"reportDisplayFormatPressed"),dojo.byId("cmdSelectChartType").title=cvCatalog.titleShowChartTypeTT):(dojo.addClass(dojo.byId("cmdShowChart"),"reportDisplayFormatPressed"),dojo.removeClass(dojo.byId("cmdShowPivot"),"reportDisplayFormatPressed"),dojo.byId("cmdSelectChartType").title=cvCatalog.titleSwitchChartTypeTT)),this.clearGemList(),this.populateDropZone("measures"),this.populateDropZone("rowAttributes"),this.populateDropZone("columnAttributes"),this.populateFilters();if(this.badFields.length>0){var badFieldsStr="";for(var x=0,len=this.badFields.length;x<len;++x)badFieldsStr+="	"+this.badFields[x]+"\n";alert(cv.util.substituteParams(cvCatalog.warnMissingFields,badFieldsStr)),this.setReportPropsDirty(!0)}if(rptType!="PIVOT"){var currentMaxValues=this.reportDoc.getChartOption("maxValues"),maxValues=this.getVizDefiniton().maxValues,found=!1;for(var x=0;x<maxValues.length;x++)if(maxValues[x]==currentMaxValues){found=!0;break}found||this.reportDoc.setChartOption("maxValues",maxValues[0])}this.validateLayoutState()},onGemToggleInChart:function(){var e=this.currentSelection;if(!e)return;var t=e.isHideInChart()?"false":"true";e.xmlNode.setAttribute("hideInChart",t);var n=this.getReportFormat()=="CHART"||this.getReportFormat()=="JSON";e.disable(t=="true"&&n),this.history.add(new cv.ReportState(t=="true"?"actionHide":"actionShow",e.getDisplayLabel(!0))),n&&this.refreshReport()},onGemSortDesc:function(){this.setSortOrder(null,"DESC",!0)},onGemSortAsc:function(){this.setSortOrder(null,"ASC",!0)},onGemConditionalFormatting:function(e){var t=e.target.parentNode.id.substr("PM:condFormat_".length),n=this.currentSelection;if(!n)return;var r=n.getNumberFormat(),i;r.formatShortcut==t?(n.setNumberFormat({formatShortcut:"NONE"}),i="actionRemoveCondFormat"):(n.setNumberFormat({formatShortcut:t}),i="actionAddCondFormat"),this.history.add(new cv.ReportState(i,n.getDisplayLabel(!0))),this.refreshReport()},onGemToggleSubtotal:function(){var e=this.currentSelection;if(!e)return;var t=e.xmlNode.getAttribute("showSubtotal")=="true"?"false":"true";e.xmlNode.setAttribute("showSubtotal",t),this.history.add(new cv.ReportState(t=="true"?"actionShowSubtotal":"actionHideSubtotal",e.getDisplayLabel(!0))),this.refreshReport()},onRptExclude:function(){this.updateInTableFilter("EXCLUDE"),this.setReportPropsDirty(!0)},onRptKeep:function(){this.updateInTableFilter("KEEP"),this.setReportPropsDirty(!0)},onRptDrillDown:function(){this.updateInTableFilter("KEEP_AND_DRILL"),this.setReportPropsDirty(!0)},onRptShowAll:function(){this.updateInTableFilter("SHOW_ALL"),this.setReportPropsDirty(!0)},onRptNonVisualTotal:function(){this.reportDoc.setReportOption("useNonVisualTotals",this.reportDoc.getReportOption("useNonVisualTotals")=="true"?"false":"true"),this.history.add(new cv.ReportState("actionNonVisual")),this.refreshReport()},onRptHideGrandTotal:function(){var e=this.currentSelection;dojo.hasClass(cv.util.getAncestorByTag(e,"TABLE"),"ZONE_columnAttributes")?this.reportDoc.setReportOption("showRowGrandTotal","false"):this.reportDoc.setReportOption("showColumnGrandTotal","false"),this.history.add(new cv.ReportState("actionHideGrandTotal")),this.refreshReport()},onResetReport:function(){cv.util.goToURL(window.location)},onResetColumnSize:function(){this.columnDataFieldWidths=new Array,this.rowFieldWidths=new Array,this.reportHeaders.updateLayout(),this.isReportPropsDirty=!0;var e=new cv.ReportState("Reset Column Sizes");e.resizeData={rowFieldWidths:this.rowFieldWidths.slice(0,this.rowFieldWidths.length),columnDataFieldWidths:this.columnDataFieldWidths.slice(0,this.columnDataFieldWidths.length)};var t=this.history.isStateRefreshed();this.history.add(e),t&&this.history.setRefreshed(!0)},onToggleReportPane:function(e){var t;if(dojo.isObject(e)){t=e.target;while(!t.id)t=t.parentNode;t=t.id.substring(this.id.length)}else t=e;return this.manager.onToggleReportPane(t)},hideTruncateMessage:function(e){e.target.id=="closeRowTruncate"?(cv.util.hide(this.nodeRowTruncate),this.closeTruncateStatus=="None"?this.closeTruncateStatus="RowClose":this.closeTruncateStatus="BothClose"):e.target.id=="closeColTruncate"&&(cv.util.hide(this.nodeColTruncate),this.closeTruncateStatus=="None"?this.closeTruncateStatus="ColClose":this.closeTruncateStatus="BothClose")}}),dojo.declare("cv.ReportState",null,{constructor:function(e,t){this.action=e,this.label=e&&t?cv.util.substituteParams(cvCatalog[e],t):cvCatalog[e],this.label||(this.label=e)},pluginDataJSON:"",resizeData:{},init:function(e){this.report=e,this.reportXml||(this.reportXml=dojox.xml.parser.innerXML(e.reportDoc.getReportNode())),this.resizeData.rowFieldWidths=this.report.rowFieldWidths.slice(0,this.report.rowFieldWidths.length),this.resizeData.columnDataFieldWidths=this.report.columnDataFieldWidths.slice(0,this.report.columnDataFieldWidths.length),this.action!="Column Resize"&&e.log(this.label)},checkRefresh:function(){cv.prefs.autoRefresh?this.report.history.setRefreshed():this.report.refreshReport()},exec:function(e,t){var n=dojox.xml.parser.parse(this.reportXml);n&&n.documentElement&&(this.report.manager.cmdUndo!=null&&this.report.manager.cmdUndo.title.indexOf("Column Resize")>-1&&t=="UNDO"?(this.report.reportHeaders.updateLayout(this.resizeData.index,-this.resizeData.dx,this.resizeData.colspan),this.checkRefresh()):this.report.manager.cmdUndo!=null&&this.report.manager.cmdRedo.title.indexOf("Column Resize")>-1&&t=="REDO"?(this.report.reportHeaders.updateLayout(this.resizeData.index,this.resizeData.dx,this.resizeData.colspan),this.checkRefresh()):this.report.manager.cmdUndo!=null&&(this.report.manager.cmdUndo.title.indexOf("Reset Column")>-1||this.report.manager.cmdRedo.title.indexOf("Reset Column")>-1)?(this.report.columnDataFieldWidths=this.resizeData.columnDataFieldWidths.slice(0,this.resizeData.columnDataFieldWidths.length),this.report.rowFieldWidths=this.resizeData.rowFieldWidths.slice(0,this.resizeData.rowFieldWidths.length),this.checkRefresh()):(this.report.columnDataFieldWidths=this.resizeData.columnDataFieldWidths.slice(0,this.resizeData.columnDataFieldWidths.length),this.report.rowFieldWidths=this.resizeData.rowFieldWidths.slice(0,this.resizeData.rowFieldWidths.length),this.report.savePluginDataToXML(this.pluginDataJSON),this.report.visualization=null,this.report.openReport(n.documentElement,e)))},back:function(e){this.report.manager.cmdUndo.title.indexOf("Column")<0&&this.report.log("UNDO"),this.exec(e,"UNDO")},forward:function(e){this.report.manager.cmdRedo.title.indexOf("Column")<0&&this.report.log("REDO"),this.exec(e,"REDO")},copy:function(e){this.reportXml=e.reportXml},setPluginDataJSON:function(e){this.pluginDataJSON=e}})}),dojo.require("dijit.Menu"),dojo.require("dojox.collections.Dictionary"),dojo.require("dojox.xml.parser"),dojo.require("dijit.Declaration"),pen.define("analyzer/report/cv_rptReport2",["analyzer/report/cv_rptReport"],function(){dojo.extend(cv.Report,{appendGem:function(e,t){return this.checkDuplicateGem(e)?this._getGemsInHierarchy(e)?this.insertGemInHierarchy(e,t):this.insertGem(e,cv.getFieldHelp().getDndType(e)=="V"?"measures":"rowAttributes","append",t):!1},checkColumns:function(e){if(this.reportDoc.getChildMembers("columnAttributes").length+e<=cv.prefs.maxColumnFields)return!0;var t=this.getReportFormat()=="PIVOT"?"PIVOT_FULL":this.reportDoc.getChartOption("chartType");return setTimeout(dojo.hitch(this.rptDlg,"showError",500,["errorTooManyFields",cv.prefs.maxColumnFields,cvCatalog["dropZoneLabels_"+t+"_COL"]])),!1},checkDuplicateGem:function(e,t){var n,r=this.gemList.getKeyList();if(!r||r.length==0)return!0;for(var i=0;i<r.length;++i){var s=this.gemList.item(r[i]);if(r[i]==e||s.type==cvConst.TYPE_METRIC&&s.metricType=="VALUE"&&s.getFormula()==e){n=s;break}}return n?(t||this.rptDlg.showError(["errorDuplicateItemInReport",n.getDisplayLabel()],"CV/Business_User/working_with_fields.html"),!1):!0},checkGemHierarchy:function(e,t,n,r,i){if(e=="rowAttributes"||e=="columnAttributes"){var s=this._getGemsInHierarchy(t);if(!s||s[0].getZone()==e)return!0;if(r){var o="",u=[];for(var a=0;a<s.length;++a)a>0&&(o+=", "),o+=s[a].getDisplayLabel(),u.push(s[a]);u.push(this.getGem(t)),this.pendingAction={func:"moveHierarchy",params:{list:u,zoneId:e,refId:r.refId,pos:r.pos}},this.rptDlg.showConfirm(["promptMoveFieldHierarchy",n,o],"CV/Business_User/working_with_fields.html#about_field_hierarchies",{srcObj:this,srcFunc:"moveHierarchy"})}else i||this.rptDlg.showError(["errorBreakFieldHierarchy",n,s[0].getDisplayLabel()],"CV/Business_User/working_with_fields.html#about_field_hierarchies");return!1}return!0},checkColumnSelectionFilters:function(e,t){if(e=="columnAttributes"){var n=this.reportDoc.getSelectionFilters();if(n.length>0)return t||this.rptDlg.showError(["errorColumnSelectionFilters"]),!1}return!0},clearGemList:function(){this.currentSelection=null,this.gemList.clear(),this.badFields=[],this.badFilters=!1},createGem:function(e){if(e.gemType==cvConst.TYPE_METRIC&&e.metricType!="VALUE"&&e.metricType!="EXPRESSION"){var t=this.getGem(e.formula);if(t){var n=t.xmlNode.selectSingleNode("cv:displayLabels/cv:displayLabel");n&&n.getAttribute("label")&&(e.label=cv.util.substituteParams(cvCatalog["metric"+e.metricType],n.getAttribute("label")),e.locale=n.getAttribute("locale"))}}else e.zoneId=="measures"&&!e.metricType&&(e.metricType="VALUE");var r=this.reportDoc.createNode(e);return this.createGemDomNode(r,e.zoneId)},createGemDomNode:function(e,t){var n;switch(cvConst.defaultGemTypes[t]){case cvConst.TYPE_ATTRIBUTE:n=new cv.AttributeGem(e,this);break;case cvConst.TYPE_METRIC:n=new cv.MetricGem(e,this);break;case cvConst.TYPE_FILTER:n=new cv.FilterGem(e,this,!1),n.bad||n.createDomNode();break;default:return null}return n.bad?null:(t&&n.setZone(t),this.gemList.add(n.getId(),n),n)},createMetricFilterGem:function(){var e=this.reportDoc.getMetricFilterNode();if(!e)return null;var t=new cv.FilterGem(e,this,!0);return t.bad?null:(t.setZone("filters"),t.createDomNode(),this.gemList.add(t.getId(),t),t)},createSpecialMetricGem:function(e){e.gemType=cvConst.TYPE_METRIC;var t=this.createGem(e);return this.insertGem(t,e.refGem,"after",!0),t},getFieldLabel:function(e,t){if(!e)return"";var n=null,r=null;dojo.isString(e)?n=e:dojo.isObject(e)&&(e.id&&this.gemList.item(e.id)?r=this.gemList.item(e.id).getDisplayLabel(!0):n=e.getAttribute("formula"));if(!r){if(!n)return"";var i=this.getGem(n);r=i?i.getDisplayLabel(!0):cv.getFieldHelp().get(n,"displayLabel")}return r||(r=cv.util.parseMDXExpression(n,!1)),t?r:cv.util.escapeHtml(r)},getFieldLabelPlural:function(e,t){if(!e)return"";var n=null,r=null;dojo.isString(e)?n=e:dojo.isObject(e)&&(e.id&&this.gemList.item(e.id)?r=this.gemList.item(e.id).getDisplayLabelPlural(!0):n=e.getAttribute("formula"));if(!r){if(!n)return"";var i=this.getGem(n);r=i?i.getDisplayLabelPlural(!0):cv.getFieldHelp().get(n,"displayLabelPlural")}return!r||t?r:cv.util.escapeHtml(r)},getGem:function(e,t){if(!e)return null;if(dojo.isString(e)){if(this.gemList.contains(e))return this.gemList.item(e);t||(t="VALUE")}else if(!e.xmlNode)return null;var n=this.gemList.getKeyList();if(!n||n.length==0)return null;for(var r=0;r<n.length;++r){var i=this.gemList.item(n[r]);if(i&&(e.xmlNode&&i.xmlNode==e.xmlNode||i.getFormula()==e&&i.metricType==t))return i}return null},getGemFromDomNode:function(e){if(!e)return null;if(e.id){var t=this.getGem(e.id);if(t)return t}var n=cv.util.getAttribute(e,"formula");return e.getAttribute("type")=="measure"?this.getGem(n,e.getAttribute("metrictype")):this.getGem(n)},_getGemsInHierarchy:function(e){var t=cv.getFieldHelp().getHierarchy(e),n=[];for(var r=0;t&&r<t.length;++r){var i=t[r],s;i!=e&&(s=this.getGem(i),s&&n.push(s))}return n.length==0?null:n},getSummaryFacet:function(e,t){var n=this.getGem(e,t);return n?n.getMetricFacet():null},getTrendNumberOnAncestors:function(e){var t=cv.getFieldHelp().getHierarchy(e);if(!t)return null;for(var n=0;n<t.length;++n){var r=t[n];if(r==e)break;var i=this.reportDoc.getNode('cv:report/cv:measures/cv:measure/cv:trendFacet[@trendAttributeFormula="'+r+'"]');if(i)return{ancestor:r,trend:this.getGem({xmlNode:i.parentNode})}}return null},insertGem:function(e,t,n,r){var i,s,o,u=dojo.isObject(t)?t:this.getGem(t);u?s=u.getZone():(s=t,s.indexOf(this.id)==0&&(s=s.substring(this.id.length)),u=this.reportDoc.getReportZoneNode(s)),i=dojo.isObject(e)?e:this.getGem(e);if((!i||i.getZone()!=s)&&s=="columnAttributes"&&!this.checkColumns(1))return null;var a="actionMove";i?i.setZone(s):(i=this.createGem({zoneId:s,formula:e}),a="actionAdd");if(this.getReportFormat()!="PIVOT"&&i.getGembarId()==null){var f;if(n!="append"&&s!="measures")f=u.getGembarId();else{var l=s=="measures"?"number":"string";f=this.getNextAvailableGembarByType(l)}i.setGembarId(f),i.setGembarOrdinal(this.getNextOrdinal(f))}var c;n!="append"?(c=this.reportDoc.getReportZoneNode(s).childNodes.length,u,i.metricType=="VALUE"?this.updateReportResizeParams("add",c,n,"measure"):this.updateReportResizeParams("add",c,n)):i.metricType=="VALUE"&&this.reportHeaders!=null&&this.reportHeaders.columnHeaderContainer.getElementsByTagName("COL").length>u.childNodes.length&&this.updateReportResizeParams("add",u.childNodes.length,"before","measure");var h=!0;return n=="before"?u.xmlNode.parentNode.insertBefore(i.xmlNode,u.xmlNode):n=="after"?u.xmlNode.parentNode.insertBefore(i.xmlNode,u.xmlNode.nextSibling):n=="append"&&u.appendChild(i.xmlNode),r||this.history.add(new cv.ReportState(a,i.getDisplayLabel(!0))),this.resizeContainer(),r||this.refreshReport(),i},insertGemInHierarchy:function(e,t,n){var r=cv.getFieldHelp().getHierarchy(e);if(!r)return null;var i=null,s=null;for(var o=0;o<r.length;++o){var u=r[o];if(u==e){if(i){s="after";break}s="before"}else{var a=this.getGem(u);if(a){if(n&&a.zone!=n)continue;i=a;if(i&&s)break}}}return!i||!s?null:this.insertGem(e,i,s,t)},moveHierarchy:function(){if(!this.pendingAction||this.pendingAction.func!="moveHierarchy")return;var e=this.pendingAction.params;if(e.zoneId=="columnAttributes"&&!this.checkColumns(e.list.length))return;for(var t=0;t<e.list.length;++t){var n=e.list[t],r=n.getFormula(),i=n.getSortOrder();this.removeGem(n,!0,null,!0),t==0?n=this.insertGem(r,e.refId,e.pos,!0):n=this.insertGemInHierarchy(r,!0,e.zoneId),n&&n.setSortOrder(i)}this.history.add(new cv.ReportState("actionMoveHierarchy")),this.refreshReport()},onMouseOverFilters:function(e){var t=cv.util.getAncestorByClass(e.target,"filterItem");(!t||t!=this.currentSelection)&&this.currentSelection&&(this._setFilterSelected(this.currentSelection,!1),this.currentSelection=t);if(!t)return;this._setFilterSelected(t,!0),this.currentSelection=t},removeFilter:function(e){var t=/^(filter_.+)_(\d)$/,n=t.exec(e);if(!n)return!1;var r=this.getGem(n[1]);if(!r)return!1;r.isNumeric?(cv.util.removeNode(this.reportDoc.getNode("cv:report/cv:filters/cv:filter/cv:conditions")),cv.util.removeNode(this.reportDoc.getNode("cv:report/cv:filters/cv:filter/cv:topBottom")),this.reportDoc.removeEmptyFilter(r.xmlNode),this.gemList.remove(r.getId())):this.reportDoc.removeFilterPredicate(r.xmlNode,n[2])||this.gemList.remove(r.getId());if(cv.dlgWidget&&cv.dlgWidget.open){var i=n[1],s=this.getGem(i);if(!s)cv.dlgWidget.hide();else{this.rptDlg.load(this.getFieldLabel(i.substring(7)),cv.util.escapeHtml(i.substring(7)))||cv.dlgWidget.hide();var o=this.rptDlg.byId("predicateList");dojo.addClass(o,"unlocked"),dojo.addClass(o,"filterGroup"),dojox.xml.parser.removeChildren(o),o.innerHTML=s.createSummary(!0)}}this.populateFilters(),this.currentSelection=null,r.isNumeric?this.history.add(new cv.ReportState("actionRemoveNumericFilter")):this.history.add(new cv.ReportState("actionRemoveFilter",r.getDisplayLabel(!0))),this.resizeContainer(),this.refreshReport()},removeCurrentGem:function(e){e&&!e.tagName&&(e=e.target),e&&(this.currentSelection=this.getGemFromDomNode(e));var t=this.currentSelection;t||(t=this.currentSelection=this.getGemFromDomNode(cv.util.popupSourceNode));if(!t)return;if(!(t instanceof cv.BaseGem)){var n=t.id;n&&n.indexOf("filter_")==0&&this.removeFilter(n);return}var r=t.getZone();if(r=="rowAttributes"||r=="columnAttributes"){var i=t.getFormula(),s=t.getDisplayLabel(),o=this.reportDoc.getNode("cv:report/cv:measures/cv:measure/cv:summaryFacet[@breakAttributeFormula='"+i+"']");if(o){o=this.getGem({xmlNode:o.parentNode});if(o)return this.rptDlg.showError(["errorUsedByMetric",s,o.getDisplayLabel()])}if(this.reportDoc.isUsedByMetricFilter(i))return this.rptDlg.showConfirm(["promptUsedByFilter",s],"CV/Business_User/working_with_filters.html#numeric_filters_larger_than",{srcObj:this,srcFunc:"removeGem"});var u=this.reportDoc.getNode('cv:report/cv:measures/cv:measure/cv:trendFacet[@trendAttributeFormula="'+i+'"]');u&&(u=this.getGem({xmlNode:u.parentNode}));var a=cv.getFieldHelp().getHierarchy(i,!1);if(a){var f=!1;for(var l=0,c=!1;l<a.length;++l)if(a[l]==i)c=!0;else if(c&&this.getGem(a[l])){f=!0;break}if(f)u=null;else if(!u){var h=this.reportDoc.getMetrics("TREND");if(h.length>0){var p=dojo.indexOf(a,i);for(var l=0;!u&&l<h.length;++l){var d=h[l].selectSingleNode("cv:trendFacet").getAttribute("trendAttributeFormula"),n=dojo.indexOf(a,d);if(n<0||n>p)continue;u=h[l];if(this.getGem("filter_"+i))return this.rptDlg.showError(["errorRemoveWithTrendOnAncestor",s,this.getFieldLabel(d),this.getGem({xmlNode:u}).getDisplayLabel()]);for(var v=n;v<p;++v)if(this.getGem(a[v])){u=null;break}}}if(u)return this.rptDlg.showError(["errorUsedByTrendMetric",s,this.getGem({xmlNode:u}).getDisplayLabel()])}}if(u)return this.rptDlg.showError(["errorUsedByTrendMetric",s,u.getDisplayLabel()])}else if(r=="measures"&&t.metricType!="VALUE"){var n=t.getFormula(),o=this.reportDoc.getFirstMetricDependent(n);if(o){o=this.getGem({xmlNode:o});if(o)return this.rptDlg.showError(["errorUsedByMetric",t.getDisplayLabel(),o.getDisplayLabel()])}if(this.reportDoc.isUsedByMetricFilter(n))return this.rptDlg.showConfirm(["promptUsedByFilter",t.getDisplayLabel()],"CV/Business_User/working_with_filters.html#numeric_filters_larger_than",{srcObj:this,srcFunc:"removeGem"})}this.removeGem(t,!0,"actionRemove"),cv.util.popupSourceNode=null},removeGem:function(e,t,n,r){e&&typeof e["getFormula"]=="undefined"&&(e=this.currentSelection,n="actionRemove");if(!e)return;var i=dojo.query(".gemLabel",e.zone);for(var s=0;s<i.length;++s)if(dojox.xml.parser.textContent(e.domNode)==dojox.xml.parser.textContent(i[s])){e.metricType=="VALUE"?this.updateReportResizeParams("remove",s,"","measure"):this.updateReportResizeParams("remove",s);break}t||this.reportDoc.removeFromMetricFilter(e.getFormula())&&this.populateFilters(),this.gemList.remove(e.getId()),cv.util.removeNode(e.xmlNode),this.currentSelection=null,n&&this.history.add(new cv.ReportState(n,e.getDisplayLabel(!0))),e.type==cvConst.TYPE_FILTER&&this.populateFilters(),this.resizeContainer(),r||this.refreshReport()},removeCurrentProp:function(){var e=this.currentSelection.getAttribute("name"),t=this.currentSelection.getAttribute("formula"),n=this.getGem(t);n.removeProperty(e)},_setFilterSelected:function(e,t){t?(dojo.addClass(e,"filterItemMouseOver"),this.selectedFilterHandle=dojo.connect(e,"onMouseOut",this,"deselectFilter")):(dojo.removeClass(e,"filterItemMouseOver"),dojo.disconnect(this.selectedFilterHandle))},deselectFilter:function(){this._setFilterSelected(this.currentSelection,!1)},setSortOrder:function(e,t,n,r){e&&dojo.isString(e)?e=this.getGem(e):e||(e=this.currentSelection);if(!e)return;if(this.getReportFormat()=="PIVOT"){var i=e.getZone()=="rowAttributes"&&e.isLast();if(t==e.getSortOrder()&&(!i||!this.reportDoc.getSortedMetric()))return;e.setSortOrder(t);if(e.metricType||i){var s=this.gemList.getKeyList();for(var o=0;s&&o<s.length;++o){var u=this.gemList.item(s[o]);u&&u.metricType&&u.getId()!=e.getId()&&u.setSortOrder("NONE")}}if(n)if(e.metricType){var a=this.reportDoc.getChildMembers("rowAttributes");this.history.add(new cv.ReportState("actionSort",e.getDisplayLabel(!0))),a.length>=2?this.rptDlg.showWarning(["warnSortMetric",this.getFieldLabel(a[a.length-1]),e.getDisplayLabel(),this.getFieldLabel(a[a.length-2])],null,null,null,null,this):this.refreshReport()}else this.history.add(new cv.ReportState("actionSort",e.getDisplayLabel(!0))),this.refreshReport()}else{e.setSortOrder(t);if(e.getGembarId()=="rows"||e.metricType){var s=this.gemList.getKeyList();for(var o=0;s&&o<s.length;++o){var u=this.gemList.item(s[o]);u&&u.metricType&&u.getId()!=e.getId()&&u.setSortOrder("NONE")}}this.history.add(new cv.ReportState("actionSort",e.getDisplayLabel(!0))),this.refreshReport()}},sortMembers:function(e,t){if(e==t)return 0;var n=e.caption,r=t.caption;return n==r?e>t?1:-1:n>r?1:-1},onKeepAndShow:function(e){var t=e.target;t.className=="resize"&&(t=t.parentNode);while(t&&t.tagName!="TD")t=t.parentNode;if(!t)return;var n=t.getAttribute("type");if(n!="member")return;this.currentSelection=t;var r=this.currentSelection.getAttribute("member"),i=this.currentSelection.getAttribute("formula"),s=cv.getFieldHelp().getDirectChild(i);if(!s||this.getGem(s))return;this.updateInTableFilter("KEEP_AND_DRILL")},toggleInReportPopupMenu:function(e){var t=e.target;t.className=="resize"&&(t=t.parentNode);while(t&&t.tagName!="TD")t=t.parentNode;if(!t)return;cv.util.popupSourceNode=t;var n=t.getAttribute("type"),r=cv.util.getDojoWidget(n+"PopMenu"),i=!1;this.currentSelection=null;switch(n){case"measure":case"attribute":var s=cv.util.getAttribute(t,"formula");this.currentSelection=this.getGem(s),this.currentSelection!=null&&this.currentSelection.updatePopupMenu();break;case"prop":this.currentSelection=t;break;case"member":this.currentSelection=t;var o=this.currentSelection.getAttribute("member"),s=this.currentSelection.getAttribute("formula"),u=this.getGem("filter_"+s),a=cv.getFieldHelp().getDirectChild(s),r=cv.util.getDojoWidget(n+"PopMenu");if(r.domNode&&r.domNode.memberId==o)break;cv.util.disconnectPopupMenu(this,[{id:"PM:membEXCLUDE",handler:"onRptExclude"},{id:"PM:membKEEP",handler:"onRptKeep"},{id:"PM:membKEEP_AND_DRILL",handler:"onRptDrillDown"},{id:"PM:membSHOW_ALL",handler:"onRptShowAll"}]),r.destroyDescendants(),r.domNode.memberId=o,o=dojox.xml.parser.textContent(t.firstChild);var f=new dijit.MenuItem({id:"PM:membEXCLUDE",label:cv.util.substituteParams(cvCatalog.menuMembEXCLUDE,o)});r.addChild(f),dojo.connect(f,"onClick",this,"onRptExclude"),f=new dijit.MenuItem({id:"PM:membKEEP",label:cv.util.substituteParams(cvCatalog.menuMembKEEP,o)}),r.addChild(f),dojo.connect(f,"onClick",this,"onRptKeep"),a&&(f=new dijit.MenuItem({id:"PM:membKEEP_AND_DRILL",label:cv.util.substituteParams(cvCatalog.menuMembKEEP_AND_DRILL,o,this.getFieldLabel(a))}),r.addChild(f),dojo.connect(f,"onClick",this,"onRptDrillDown")),u&&(f=new dijit.MenuItem({id:"PM:membSHOW_ALL",label:cv.util.substituteParams(cvCatalog.menuMembSHOW_ALL,this.getFieldLabel(s))}),r.addChild(f),dojo.connect(f,"onClick",this,"onRptShowAll")),i=!0;break;case"grandTotal":this.currentSelection=t,cv.util.setMenuItem("PM:totalNonVisual",this.reportDoc.getReportOption("useNonVisualTotals")=="true"?"checked":"none","enabled"),cv.util.updateMenuItemCaption("PM:totalHide",dojo.hasClass(cv.util.getAncestorByTag(t,"TABLE"),"ZONE_columnAttributes")?"menuHideGrandTotalRow":"menuHideGrandTotalCol");break;default:return}this.currentSelection!=null&&cv.util.showPopupMenu(r,e.clientX,e.clientY),dojo.stopEvent(e)},updateFilterProps:function(e,t,n){var r=e.predicates,i=null;t.members&&t.members.sort(this.sortMembers);var s=r.getKeyList();if(t.op=="CONTAIN"||t.op=="NOT_CONTAIN"||(t.op=="EQUAL"||t.op=="NOT_EQUAL")&&!t.preset)for(var o=0;o<s.length;++o){var u=r.item(s[o]);for(var a=0;a<u.length;a++){var f=u[a];if(f.op!=t.op||f.preset)continue;if(f.ordinal==t.ordinal)break;n||alert(cv.util.substituteParams(cvCatalog.infoMergeFilter,cvCatalog["filterOpString_"+t.op],this.getFieldLabel(e.formula)));if(t.op=="CONTAIN"||t.op=="NOT_CONTAIN"){var l=f.exp,c=t.exp,h=l.length,p=c.length;for(var d=0;d<p;++d){for(var v=0;v<h;++v)if(c[d]==l[v])break;v>=h&&l.push(c[d])}}else{f.members.sort(this.sortMembers);var m=f.members,g=t.members,v=0,d=0,h=m.length,p=g.length,y=[],b;while(v<h||d<p)if(v>=h)while(d<p)y.push(g[d++]);else if(d>=p)while(v<h)y.push(m[v++]);else b=this.sortMembers(m[v],g[d]),b==0?(y.push(m[v++]),++d):b>0?y.push(g[d++]):y.push(m[v++]);f.members=y}i=f,i.ordinal=o+1;break}if(i){r.contains(t.ordinal)&&r.remove(t.ordinal);break}}if(!i){i=t;var w=i.ordinal;if(!w){for(var v=0;v<r.getKeyList().length;v++)r.getKeyList()[v]>w&&(w=r.getKeyList()[v]);w+=1}var E=[];E.push(i),r.add(w,E)}return i},updateRelativeFilterProps:function(e,t){var n=t[0].ordinal,r=e.predicates,i=r.getKeyList();if(!n)for(var s=0;s<i.length;s++)parseInt(i[s])>=n&&(n=parseInt(i[s])+1);for(var s=0;s<t.length;s++){if(!!t[s].ordinal)break;t[s].ordinal=n}var o={EQUAL:0,TIME_YAGO:1,TIME_RANGE_PREV:2,TIME_RANGE_NEXT:3,TIME_AGO:4,TIME_AHEAD:5};t.sort(function(e,t){return e.op==t.op?0:o[e.op]>o[t.op]?1:-1}),r.add(n,t)},updateInTableFilter:function(e,t,n,r){var i,s;r?i=t.formula:t?(i=t.formula,s={formula:t.member,caption:t.caption},r=[s]):(i=this.currentSelection.getAttribute("formula"),s={formula:this.currentSelection.getAttribute("member"),caption:dojox.xml.parser.textContent(this.currentSelection.firstChild)},r=[s]);var o=this.getGem("filter_"+i),u=null;if(e=="SHOW_ALL"){if(!o)return;cv.util.removeNode(o.xmlNode.selectSingleNode("cv:predicates")),o.xmlNode.childNodes.length==0&&this.removeGem(o,!0),u=cv.util.substituteParams(cvCatalog.actionSHOW_ALL,this.getFieldLabel(i,!0))}else{var a="";for(var f=0;f<r.length;f++)f&&(a+=", "),a+=r[f].caption;var l,c=this.reportDoc.getFilter(i);c?l=this.reportDoc.getFilterProps(c):l={formula:i,viewFilterEnum:"MULTIPLE"};switch(e){case"EXCLUDE":case"ADD":var h=e=="ADD"?"EQUAL":"NOT_EQUAL";if(!l.predicates){var p=new dojox.collections.Dictionary,d=[];d.push({ordinal:1,op:h,members:r}),p.add(1,d),l.predicates=p}else{var v=l.predicates.getKeyList(),m=!1,g,y;for(var b=0;b<v.length;b++){var w=l.predicates.item(v[b]);for(var E=0;E<w.length;E++){g=w[E],g.ordinal>y&&(y=g.ordinal+1);if(g.op==h){for(var S=0;S<r.length;S++)g.members.push(r[S]);m=!0;break}}if(m)break}if(!m){var d=[];p=l.predicates;var x=l.predicates.getKeyList().length+1;d.push({ordinal:y,op:h,members:r}),p.add(y,d)}else if(g.members.length>cvConst.MAX_FILTER_MEMBERS){this.rptDlg.showError(["errprFilterMaxMembers",cvConst.MAX_FILTER_MEMBERS]);return}}u=cv.util.substituteParams(cvCatalog.actionEXCLUDE,a);break;case"KEEP":var p=new dojox.collections.Dictionary,d=[];d.push({ordinal:1,op:"EQUAL",members:r}),p.add(1,d),l.predicates=p,u=cv.util.substituteParams(cvCatalog.actionKEEP,a);break;case"KEEP_AND_DRILL":var T=cv.getFieldHelp().getDirectChild(i);if(T){var p=new dojox.collections.Dictionary,d=[];d.push({ordinal:1,op:"EQUAL",members:r}),p.add(1,d),l.predicates=p,this.insertGemInHierarchy(T,!0),u=cv.util.substituteParams(cvCatalog.actionKEEP_AND_DRILL,a,this.getFieldLabel(T,!0))}break;default:return}this.reportDoc.updateFilter(l)}return n||(this.history.add(new cv.ReportState(u)),this.openReport()),u},validateField:function(e){if(e.indexOf("[MEASURE:")==0)return!0;var t=cv.getFieldHelp().get(e);if(!t||cv.getFieldHelp().isHidden(t)){var n,r=this.getFieldLabel(e);for(n=0;n<this.badFields.length;++n)if(this.badFields[n]==r)break;return n==this.badFields.length&&this.badFields.push(r),!1}return!0},autoRefresh:function(){if(this.mode=="VIEW"||this.mode=="MINI")return!0;if(this.history.isEmpty())return!0;if(!cv.prefs.autoRefresh){if(this.nodeReportArea.lastChild.className!="autoRefreshDirtyPane"){cv.util.show(this.nodeReportRefresh);var e=document.createElement("div");e.className="autoRefreshDirtyPane",e.id="autoRefreshDirtyPaneId",this.nodeReportArea.appendChild(e);var t=dojo.byId(this.progressPaneId);cv.util.hide(t),this.statusBar.innerHTML=""}this.history.isStateRefreshed()&&(this._removeAutoRefreshPane(),cv.util.hide(this.nodeReportRefresh))}return cv.prefs.autoRefresh},_removeAutoRefreshPane:function(){var e=dojo.byId("autoRefreshDirtyPaneId");e&&e.parentNode.removeChild(e)},clickChart:function(e,t){for(var n=0;n<e.length;n++){var r=e[n];r.action=="KEEP"?this.updateInTableFilter("KEEP",r,!0):(this.updateInTableFilter("KEEP_AND_DRILL",r,!0),t||this.removeGem(this.getGem(r.formula),null,null,!0))}this.history.add(new cv.ReportState("actionDrillIntoChart")),this.reportDoc.replaceSelectionItems(),this.openReport()}})}),pen.define("analyzer/report/cv_rptReport2",[],function(){}),pen.define("analyzer/report/cv_rptReport3",["analyzer/report/cv_rptReport2"],function(){dojo.extend(cv.Report,{isChartSelectionsDisabled:function(){return this.reportDoc.getChildMembers("columnAttributes").length>1},showWaitCursor:function(e){document.body.style.cursor=e?"wait":"default"},setupChartInteraction:function(){if(this.isChartSelectionsDisabled())return;var e=this.nodeReportArea.getElementsByTagName("IMG");if(!e)return;var t=dojo.byId("rubberBand");t||(t=document.createElement("div"),t.id="rubberBand",dojo.addClass(t,"rubberBand"),document.body.appendChild(t));for(var n=0;n<e.length;n++){dojo.connect(e[n],"onmousedown",this,"startDragOnChart");var r=e[n].parentNode.firstChild;if(r.nodeType==1&&r.tagName.toLowerCase()=="map"){var i=cv.util.getDojoWidget("chartTooltip"),s=r.getElementsByTagName("AREA");for(var o=0;o<s.length;o++){var u=s[o];dojo.connect(u,"onmousedown",this,"startDragOnChart"),dojo.connect(u,"ondblclick",this,"dblClickOnChart"),i.addConnectNode(u)}}}},dblClickOnChart:function(e){var node=e.target;dojo.stopEvent(e);if(this.chartLoaded&&node.tagName.toLowerCase()=="area"){var action=node.getAttribute("cvhref");action&&(document.all||(this.cancelStopDragOnChart=!0),eval(action))}},startDragOnChart:function(e){if(this.mousedown)return;var node=e.target;if(this.chartLoaded&&this.lastStartDragOnChartMS&&(new Date).getTime()-this.lastStartDragOnChartMS<250){if(node.tagName.toLowerCase()=="area"){var action=node.getAttribute("cvhref");action&&(this.cancelStopDragOnChart=!0,eval(action))}this.lastStartDragOnChartMS=null,dojo.stopEvent(e),this.mousedown=!1;return}this.lastStartDragOnChartMS=(new Date).getTime(),this.startPageX=e.pageX,this.startPageY=e.pageY,this.mousedown=!0,node.tagName.toLowerCase()!="img"&&(node=node.parentNode.parentNode.lastChild),this.chartImageNode=node;var rb=dojo.byId("rubberBand");rb.style.width=0,rb.style.height=0,rb.style.left=this.startPageX+"px",rb.style.top=this.startPageY+"px",rb.style.visibility="visible",this.events=[dojo.connect(document,"onmousemove",this,"dragOnChart"),dojo.connect(document,"onmouseup",this,"stopDragOnChartPre")]},stopDragOnChartPre:function(e){dojo.stopEvent(e),dojo.forEach(this.events,dojo.disconnect);var t=dojo.byId("rubberBand");t.style.visibility="hidden",this.mousedown=!1;var n={};for(var r in e)n[r]=e[r];this._stopDragOnChartTimeout=setTimeout(dojo.hitch(this,"stopDragOnChart",n),100)},stopDragOnChart:function(e){if(this.cancelStopDragOnChart){this.cancelStopDragOnChart=!1;return}dojo.forEach(this.events,dojo.disconnect);var t=dojo.byId("rubberBand");t.style.visibility="hidden";var n=this.getRubberBandBox(e),r=dojo.position(this.chartImageNode,!0);n.left=n.left-r.x,n.top=n.top-r.y,n.left<0&&(n.width+=n.left,n.left=0),n.top<0&&(n.height+=n.top,n.top=0);var i=this.chartImageNode.parentNode.getAttribute("pageMember"),s=this.chartImageNode.getAttribute("width"),o=this.chartImageNode.getAttribute("height");this.showWaitCursor(!0),cv.io.selectChart(this,n,s,o,i)},getRubberBandBox:function(e){var t=e.pageX-this.startPageX,n=e.pageY-this.startPageY,r={};return t<0?r.left=e.pageX:r.left=this.startPageX,r.width=Math.abs(t),n<0?r.top=e.pageY:r.top=this.startPageY,r.height=Math.abs(n),r},dragOnChart:function(e){var t=dojo.byId("rubberBand"),n=this.getRubberBandBox(e);return t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.top=n.top+"px",t.style.height=n.height+"px",!1},onClearSelectionItems:function(e){this.reportDoc.replaceSelectionItems();if(!this.isClientSideViz()){var t=this.nodeReportArea.getElementsByTagName("IMG");this.chartImageNode=t[0];var n=this.chartImageNode.parentNode.getAttribute("pageMember"),r=this.chartImageNode.getAttribute("width"),i=this.chartImageNode.getAttribute("height");cv.io.selectChart(this,{top:-1,left:-1,width:0,height:0},r,i,n)}else this.visualizationController.highlights=[],this.visualizationController.updateHighlights();this.hideSelectionFilterButtons()},onApplySelectionItems:function(e){var t=this.reportDoc.getSelectionItems();if(t.length==0)return;var n=this.reportDoc.getChildMembers("columnAttributes").length;if(n>1){this.rptDlg.showError(["actionSelectionFilterDisabledTooltip"]);return}var r="INCLUDE";if(e.target.id=="cmdSelectionExclude"||e.target.parentNode.id=="cmdSelectionExclude")r="EXCLUDE";var t=this.reportDoc.getSelectionItems();if(n==1){var i={};for(var s=0;s<t.length;++s){var o=t[s].selectNodes("cv:selectionMember");for(var u=0;u<o.length;++u){var a=o[u],f={formula:a.getAttribute("formula"),member:a.getAttribute("member")};f.caption=cv.util.parseMDXExpression(f.member,!1),r=="INCLUDE"&&!i[f.formula]&&(i[f.formula]=!0,this.updateInTableFilter("SHOW_ALL",f,!0)),this.updateInTableFilter(r=="INCLUDE"?"ADD":"EXCLUDE",f,!0)}}}else this.reportDoc.addSelectionFilters(t,r);this.reportDoc.replaceSelectionItems(),r=="INCLUDE"?this.history.add(new cv.ReportState("actionKeepSelectedItems")):this.history.add(new cv.ReportState("actionExcludeSelectedItems")),this.populateFilters(),this.refreshReport(),this.hideSelectionFilterButtons()},loadSelectedChart:function(e){this.refreshRequest=null,this.refreshRequestId=null;var t=this.handleReportMsg(e);if(!t)return;var n=[],r=0;for(;;){var i=e.indexOf("<img src='",r);if(i==-1)break;var r=e.indexOf("'",i+10);n[n.length]=e.substring(i+10,r)}var s=this.nodeReportArea.getElementsByTagName("IMG");for(var r=0;r<s.length;r++)s[r].src=n[r];this.chartLoaded=!0,this.manager&&this.uiController&&this.manager[this.uiController](),this.showWaitCursor(!1);var o=this.reportDoc.getSelectionItems();o.length!=0&&this.showSelectionFilterButtons()},removeSelectionFilters:function(){this.reportDoc.removeSelectionFilters(),this.populateFilters(),this.history.add(new cv.ReportState("actionRemoveSelectionFilters")),this.resizeContainer(),this.refreshReport()},isClientSideViz:function(){return this.getReportFormat()=="JSON"&&this.reportDoc.getChartOption("chartType")=="CUSTOM"?!0:!1},displayClientSideReport:function(resultJson){try{var selectionItems=this.reportDoc.getSelectionItems();selectionItems.length==0&&(this.highlights=[]),this.localData=resultJson;var measures=this.reportDoc.getChildMembers(["measures"]),down=this.reportDoc.getChildMembers(["rowAttributes"]),across=this.reportDoc.getChildMembers(["columnAttributes"]),data=eval("("+resultJson+")"),gDataTable=new pentaho.DataTable(data);for(var colNo=0;colNo<gDataTable.getNumberOfColumns();colNo++){var fieldH=this.manager.fieldHelp.get(gDataTable.getColumnId(colNo));if(!fieldH)continue;var role=fieldH.getAttribute("geoRole");role&&(role=="country"?role="Country":role=="state"?role="CountrySubdivision":role=="city"?role="Municipality":role=="postal_code"?role="PostalCode":role=="latitude"?role="Latitude":role=="longitude"&&(role="Longitude"),gDataTable.setColumnProperty(colNo,"geoRole",role))}if(this.nodeReportArea.firstChild&&this.nodeReportArea.firstChild.id=="VIZFRAME"&&this.visualizationController.currentViz==this.visualization)this.visualizationController.setDataTable(gDataTable),this.visualizationController.highlights=this.highlights,this.visualizationController.updateVisualization(this.generateVizOptions());else{this.destroyReport();var h=this.nodeReportArea.offsetHeight,w=this.nodeReportArea.offsetWidth;this.vizDiv=document.createElement("DIV"),this.vizDiv.id="VIZFRAME",this.vizDiv.setAttribute("style","position:absolute; top:0px; left:0px; width:"+w+"px; height:"+h+"px; overflow: auto");while(this.nodeReportArea.firstChild)this.nodeReportArea.removeChild(this.nodeReportArea.firstChild);this.nodeReportArea.appendChild(this.vizDiv);var minHeight=200;this.visualizationController=null;var internalThis=this,div=document.createElement("DIV");div.setAttribute("style","position:absolute; top:0px; left:0px; width:"+w+"px; height:"+h+"px"),div.setAttribute("id","vizdiv0"),this.vizDiv.appendChild(div);var controller=new pentaho.VizController(0);this.visualizationController=controller,pentaho.events.addListener(controller,"select",function(){return internalThis.selectTriggered.apply(internalThis,arguments)}),pentaho.events.addListener(controller,"doubleclick",function(){return internalThis.selectDoubleClick.apply(internalThis,arguments)}),controller.setDomNode(div),controller.setDataTable(gDataTable),controller.highlights=this.highlights,controller.setVisualization(this.visualization,this.generateVizOptions()),this.resizeSubscription&&dojo.unsubscribe(this.resizeSubscription),this.resizeSubscription=dojo.subscribe("/Analyzer/resize",function(e,t){div.style.height=e+"px",div.style.width=t+"px",controller.resize(t,e)})}}catch(e){alert(e.message)}},generateVizOptions:function(){var e=cv.pentahoVisualizationHelpers[this.visualization.id];return e?e.generateOptionsFromAnalyzerState(this):{}},selectDoubleClick:function(e){var t=e.selections[0],n="",r="",i=[],s=[];t.columnId&&t.columnId.length>0&&(i.push(t.columnId[0]),s.push(t.columnItem[0]),n=t.columnId[0],r=t.columnItem[0]),t.rowId&&t.rowId.length>0&&(i.push(t.rowId[0]),s.push(t.rowItem[0]),n=t.rowId[0],r=t.rowItem[0]);var o=!1;for(var u=0;u<i.length;u++){var a=this.getGem(i[u]),f=a.getLink();if(f){o=!0;var l=[{formula:i[u],member:s[u],clickLevel:!0}];this.linkDlg.performAction(l)}}if(o)return;if(this.visualization.type=="heatgrid")return;var c=cv.getFieldHelp().getDirectChild(n);if(c){var l=[{formula:n,member:r,action:"KEEP_AND_DRILL",caption:cv.util.parseMDXExpression(r,!1)}];this.clickChart(l,!0);return}},selectTriggered:function(e){this.highlights=e.source.controller.highlights,this.visualizationController.highlights=this.highlights,this.visualizationController.updateHighlights();var t='<selectionItems xmlns="http://www.pentaho.com" >';for(var n=0;n<this.highlights.length;n++){var r=this.highlights[n],i=r.colItem,s=r.colId,o=r.rowItem,u=r.rowId;if(i||o)t+='<selectionItem op="SELECT" type="CategoryItem">';if(typeof i!="undefined")for(var a=0;a<i.length&&a<s.length;a++)t+='<selectionMember member="'+cv.util.escapeHtml(i[a])+'" formula="'+cv.util.escapeHtml(s[a])+'"/>';if(typeof o!="undefined")for(var a=0;a<o.length&&a<u.length;a++)t+='<selectionMember member="'+cv.util.escapeHtml(o[a])+'" formula="'+cv.util.escapeHtml(u[a])+'"/>';if(i||o)t+="</selectionItem>"}t+="</selectionItems>";var f=dojox.xml.parser.parse(t).documentElement;this.reportDoc.replaceSelectionItems(f.cloneNode(!0)),this.showSelectionFilterButtons()},getVizDataReq:function(){return this.getVizDefiniton().dataReqs[0].reqs},getVizDefiniton:function(){var e;if(this.isClientSideViz()&&this.visualization!=null)return this.visualization;if(this.isClientSideViz()&&this.visualization==null)this.reportDoc.setReportOption("reportTypeEnum","PIVOT"),e=this._createVizDataReq(cvCatalog.dropZoneLabels_PIVOT_ROW,cvCatalog.dropZoneLabels_PIVOT_COL,cvCatalog.dropZoneLabels_PIVOT_NUM,!1);else if(this.getReportFormat()=="PIVOT")e=this._createVizDataReq(cvCatalog.dropZoneLabels_PIVOT_ROW,cvCatalog.dropZoneLabels_PIVOT_COL,cvCatalog.dropZoneLabels_PIVOT_NUM,!1);else if(this.getReportFormat()=="CHART"&&this.reportDoc.getChartOption("chartType")=="SCATTER")e=[{id:"x",dataType:"number",dataStructure:"column",caption:cvCatalog.dropZoneLabels_SCATTER_X,required:!0,allowMultiple:!1},{id:"y",dataType:"number",dataStructure:"column",caption:cvCatalog.dropZoneLabels_SCATTER_Y,required:!0,allowMultiple:!1},{id:"rows",dataType:"string",dataStructure:"column",caption:cvCatalog.dropZoneLabels_SCATTER_ROW,required:!0},{id:"color",dataType:"number, string",dataStructure:"column",caption:cvCatalog.dropZoneLabels_SCATTER_COL,required:!1,allowMultiple:!1},{id:"size",dataType:"number",dataStructure:"column",caption:cvCatalog.dropZoneLabels_SCATTER_Z,required:!1,allowMultiple:!1},{id:"multi",dataType:"string",dataStructure:"column",caption:cvCatalog.dropZoneLabels_MULTI_CHART,required:!1},{id:"scatterPattern",dataType:"string",values:["GRADIENT","THREE-COLOR","FIVE-COLOR"],value:this.reportDoc.getChartOptions().getAttribute("scatterPattern"),ui:{labels:["gradient","step_3","step_5"],group:"options",type:"combo",caption:"Pattern",visible:!1}},{id:"scatterColorSet",dataType:"string",values:["RYG","RYB","BLUE","GRAY"],value:this.reportDoc.getChartOptions().getAttribute("scatterColorSet"),ui:{labels:["RYG","RYB","blue_scale","gray_scale"],group:"options",type:"combo",caption:"Color",visible:!1}},{id:"scatterReverseColors",dataType:"boolean",value:this.reportDoc.getChartOptions().getAttribute("scatterReverseColors")=="true",ui:{label:"reverse_colors",group:"options",type:"checkbox",visible:!1}}];else if(this.getReportFormat()=="CHART"&&this.reportDoc.getChartOption("chartType")=="LINE"){var t=this.reportDoc.getChartOption("chartType"),n=cvCatalog["dropZoneLabels_"+t+"_ROW"],r=cvCatalog["dropZoneLabels_"+t+"_COL"],i=cvCatalog["dropZoneLabels_"+t+"_NUM"];e=this._createVizDataReq(n,r,i,t!="MULTIPLE_PIE"),e[2].required=!0,e.push({id:"bulletStyle",dataType:"string",values:["NONE","CIRCLE","SQUARE","DIAMOND","TRIANGLE"],value:this.reportDoc.getChartOptions().getAttribute("lineShape"),ui:{labels:[cvCatalog.dropZoneLabels_NONE,cvCatalog.dropZoneLabels_CIRCLE,cvCatalog.dropZoneLabels_SQUARE,cvCatalog.dropZoneLabels_DIAMOND,cvCatalog.dropZoneLabels_TRIANGLE],group:"options",type:"combo",caption:cvCatalog.dropZoneLabels_BULLET_STYLE}}),e.push({id:"lineWidth",dataType:"number",value:this.reportDoc.getChartOptions().getAttribute("lineWidth"),values:["1","2","3","4","5","6","7","8"],ui:{group:"options",type:"combo",caption:"Line Width"}})}else if(this.getReportFormat()=="CHART"){var t=this.reportDoc.getChartOption("chartType"),n=cvCatalog["dropZoneLabels_"+t+"_ROW"],r=cvCatalog["dropZoneLabels_"+t+"_COL"],i=cvCatalog["dropZoneLabels_"+t+"_NUM"];e=this._createVizDataReq(n,r,i,t!="MULTIPLE_PIE"),e[2].required=!0}this.getReportFormat()=="PIVOT"?e.push({id:"optionsBtn",dataType:"none",ui:{group:"options",type:"button",label:cvCatalog.dropZoneLabels_REPORT_OPTIONS}}):this.getReportFormat()=="CHART"&&e.push({id:"optionsBtn",dataType:"none",ui:{group:"options",type:"button",label:cvCatalog.dropZoneLabels_CHART_OPTIONS}});var s="analyzer_";this.getReportFormat()=="PIVOT"?s+="PIVOT":s+=this.reportDoc.getChartOption("chartType");var o={id:s,maxValues:[100,150,200,250],dataReqs:[{reqs:e}]};return this.reportDoc.getChartOption("chartType")=="SCATTER"&&(o.maxValues=[1e3,5e3,1e4,2e4]),this.applyAnalyzerProperties(o)},applyAnalyzerProperties:function(e){var t=cv.analyzerProperties["viz."+e.id+".maxValues"];if(t){var n=t.split(","),r=[];for(var i=0;i<n.length;i++)r.push(parseInt(n[i]));e.maxValues=r}e.maxValues||(e.maxValues=[100,150,200,250]);var s="viz."+e.id+".args.";for(key in cv.analyzerProperties)if(key.indexOf(s)!=-1){var o=key.substr(s.length);e.args||(e.args={}),e.args[o]=cv.analyzerProperties[key]}return e},_createVizDataReq:function(e,t,n,r){var i=[{id:"rows",dataType:"string",dataStructure:"column",caption:e,required:!1,allowMultiple:!0,defaultAppend:!0},{id:"columns",dataType:"string",dataStructure:"column",caption:t,required:!1,allowMultiple:!0},{id:"measures",dataType:"number",dataStructure:"column",caption:n,required:!1,allowMultiple:!0,defaultAppend:!0}];return r&&i.push({id:"multi",dataType:"string",dataStructure:"column",caption:cvCatalog.dropZoneLabels_MULTI_CHART,allowMultiple:!1,required:!1}),i},getNextAvailableGembarByType:function(e){var t=this.getVizDataReq(),n=[],r;for(var i=0;i<t.length;i++)(e=="string"&&t[i].dataType.match(/string/)||e=="number"&&t[i].dataType.match(/number/))&&n.push(t[i]);for(var i=0;i<n.length;i++){var s=n[i];if(s.allowMultiple==undefined||s.allowMultiple==1)return s.id;if(s.allowMultiple==0&&this.findGemsByGembarId(s.id).length==0)return s.id}},findGemsByGembarId:function(e){var t=[],n=this.reportDoc.getChildMembers("rowAttributes");for(var r=0;r<n.length;r++){var i=this.getGem(n[r].getAttribute("formula"));i||(i=this.createGemDomNode(n[r],"rowAttributes")),this.getReportFormat()=="PIVOT"?e=="rows"&&t.push(i):i.getGembarId()==e&&t.push(i)}var n=this.reportDoc.getChildMembers("columnAttributes");for(var r=0;r<n.length;r++){var i=this.getGem(n[r].getAttribute("formula"));i||(i=this.createGemDomNode(n[r],"columnAttributes")),this.getReportFormat()=="PIVOT"?e=="columns"&&t.push(i):i.getGembarId()==e&&t.push(i)}var n=this.reportDoc.getChildMembers("measures");for(var r=0;r<n.length;r++){var i=this.getGem(n[r].getAttribute("id"));i||(i=this.createGemDomNode(n[r],"measures")),this.getReportFormat()=="PIVOT"?e=="measures"&&t.push(i):i.getGembarId()==e&&!i.isHideInChart()&&t.push(i)}return this.getReportFormat()!="PIVOT"&&t.sort(function(e,t){var n=e.getGembarOrdinal(),r=t.getGembarOrdinal();return n<r?-1:n>r?1:0}),t},validateLayoutState:function(){if(this.getReportFormat()=="PIVOT")return;var e={};dojo.forEach(this.getVizDataReq(),function(t){var n;t.allowMultiple==undefined||t.allowMultiple==1?n=!0:n=!1,t.dataType.match(/string/)&&(e[t.id+"string"]=n),t.dataType.match(/number/)&&(e[t.id+"number"]=n)},this);var t=this.getNextAvailableGembarByType("string"),n=this.reportDoc.getChildMembers("columnAttributes");for(var r=0;r<n.length;r++){var i=n[r].getAttribute("gembarId");e[i+"string"]!=undefined?n[r].getAttribute("gembarOrdinal")==undefined&&n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(i)):e["columns"+"string"]!=undefined?(n[r].setAttribute("gembarOrdinal",this.getNextOrdinal("columns")),n[r].setAttribute("gembarId","columns")):e["color"+"string"]!=undefined?(n[r].setAttribute("gembarOrdinal",this.getNextOrdinal("color")),n[r].setAttribute("gembarId","color")):(n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(t)),n[r].setAttribute("gembarId",t))}n=this.reportDoc.getChildMembers("rowAttributes");for(var r=0;r<n.length;r++){var i=n[r].getAttribute("gembarId");e[i+"string"]!=undefined?n[r].getAttribute("gembarOrdinal")==undefined&&n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(i)):(n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(t)),n[r].setAttribute("gembarId",t))}n=this.reportDoc.getChildMembers("measures");for(var r=0;r<n.length;r++){var i=n[r].getAttribute("gembarId");if(e[i+"number"]!=undefined)n[r].getAttribute("gembarOrdinal")==undefined&&n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(i));else{var s=this.getNextAvailableGembarByType("number");n[r].setAttribute("gembarOrdinal",this.getNextOrdinal(s)),n[r].setAttribute("gembarId",s)}}},getNextOrdinal:function(e){var t=-1,n=this.reportDoc.getChildMembers("rowAttributes");for(var r=0;r<n.length;r++)if(n[r].getAttribute("gembarId")==e){var i=parseInt(n[r].getAttribute("gembarOrdinal"));i>t&&(t=i)}n=this.reportDoc.getChildMembers("columnAttributes");for(var r=0;r<n.length;r++)if(n[r].getAttribute("gembarId")==e){var i=parseInt(n[r].getAttribute("gembarOrdinal"));i>t&&(t=i)}n=this.reportDoc.getChildMembers("measures");for(var r=0;r<n.length;r++)if(n[r].getAttribute("gembarId")==e){var i=parseInt(n[r].getAttribute("gembarOrdinal"));i>t&&(t=i)}return t+1},isRequiredGembarsFilled:function(e){if(this.isClientSideViz()){var t=cv.pentahoVisualizationHelpers[this.visualization.id];if(t&&t.canRefreshReport)return t.canRefreshReport(this)}var n=this.getVizDataReq();for(var r=0;r<n.length;r++)if(n[r].required==1&&this.findGemsByGembarId(n[r].id).length==0)return!1;return!0},getPluginDataJSON:function(){if(!this.isClientSideViz())return"[]";var e=[],t={};this.visualization.args&&(t.args=this.visualization.args),this.visualization.options&&(t.options=this.visualization.options),t.visualizationId=this.visualization.id,e.push(t);var n=dojo.toJson(e);return n},savePluginDataToXML:function(e){var t=this.reportDoc.getUIAttributes();cv.util.removeNode(t.selectSingleNode("cv:pluginData"));var n=dojox.xml.parser.parse('<pluginData xmlns="http://www.pentaho.com"><![CDATA['+e+"]]></pluginData>").documentElement;t.appendChild(n.cloneNode(!0))},hideSelectionFilterButtons:function(){var e=dojo.byId("selectionFilterPanel");e&&cv.util.hide(e)},showSelectionFilterButtons:function(){var e=dojo.byId("selectionFilterPanel");if(e){cv.util.isHidden(e)&&(e.style.height="0px",cv.util.show(e),dojox.fx.wipeTo({node:e,duration:150,height:cv.isMobile()?35:27}).play());return}var t=document.createElement("div");t.id="selectionFilterPanel",t.innerHTML='<div class="btnContainer"><button style="border-top-right-radius:0px; border-bottom-right-radius:0px;" type="button" class="pentaho-button" id="cmdSelectionKeepOnly" title="Keep only selected items">'+cvCatalog.btnSelectionKeepOnly+"</button></div>"+'<div class="btnContainer" style="margin-left: -5px;"><button style="border-top-right-radius:0px; border-bottom-right-radius:0px; border-top-left-radius:0px; border-bottom-left-radius:0px;" type="button" class="pentaho-button" id="cmdSelectionExclude" title="Exclude selected items">'+cvCatalog.btnSelectionExclude+"</button></div>"+'<div class="btnContainer" style="margin-left: -5px;"><button style="border-top-left-radius:0px; border-bottom-left-radius:0px;" type="button" class="pentaho-button" id="cmdClearSelections" title="Clear all selected items">'+cvCatalog.btnClearSelections+"</button></div>",this.nodeReportArea.appendChild(t),e=dojo.byId("selectionFilterPanel"),e.style.marginLeft=(dojo.position(dojo.byId(this.nodeReportArea)).w-dojo.position(e).w)/2+"px",e.style.height="0px";var n=dojo.byId("cmdSelectionKeepOnly"),r=dojo.byId("cmdSelectionExclude"),i=dojo.byId("cmdClearSelections");dojo.connect(n,"onclick",this,"onApplySelectionItems"),dojo.connect(r,"onclick",this,"onApplySelectionItems"),dojo.connect(i,"onclick",this,"onClearSelectionItems"),dojox.fx.wipeTo({node:e,duration:150,height:cv.isMobile()?35:27}).play()}})}),dojo.require("dijit.Menu"),dojo.require("dojox.collections.Dictionary"),dojo.require("dojo.dnd.Source"),dojo.require("dijit._base.popup"),dojo.require("dijit.Declaration"),pen.define("analyzer/report/cv_rptGem",["analyzer/report/cv_rptReport3"],function(){dojo.declare("cv.BaseGem",null,{constructor:function(e,t){this.report=t,this.handles=[]},type:null,htmlTemplate:null,commonCssClass:"dropZoneItem",cssClass:null,cssClassHover:null,popMenu:null,label:null,xmlNode:null,domNode:null,zone:null,getFormula:function(){return this.xmlNode.getAttribute("formula")},getUniqueId:function(){return this.getFormula()},getId:function(){return this.getUniqueId()},getXmlAttributes:function(){return this.xmlNode.attributes},getTagName:function(){return this.xmlNode.tagName},getZone:function(){return this.zone},getName:function(e){var t=cv.getFieldHelp().get(this.getFormula(),"displayLabel");return t?e?t:cv.util.escapeHtml(t):""},getNamePlural:function(e){var t=cv.getFieldHelp().get(this.getFormula(),"displayLabelPlural");return t?e?t:cv.util.escapeHtml(t):""},getDisplayLabel:function(e,t){var n=t?this.xmlNode.selectSingleNode("cv:displayLabels/cv:displayLabel[locale='"+t+"']"):this.xmlNode.selectSingleNode("cv:displayLabels/cv:displayLabel"),r=n&&n.getAttribute("label")?n.getAttribute("label"):this.getName(!0);return r?e?r:cv.util.escapeHtml(r):""},getDisplayLabelPlural:function(e,t){var n=t?this.xmlNode.selectSingleNode("cv:displayLabels/cv:displayLabel[locale='"+t+"']"):this.xmlNode.selectSingleNode("cv:displayLabels/cv:displayLabel"),r=n&&n.getAttribute("labelPlural")?n.getAttribute("labelPlural"):this.getNamePlural(!0);return r?e?r:cv.util.escapeHtml(r):""},getGembarId:function(){return this.xmlNode.getAttribute("gembarId")},setGembarId:function(e){this.xmlNode.setAttribute("gembarId",e)},getGembarOrdinal:function(){return this.xmlNode.getAttribute("gembarOrdinal")},setGembarOrdinal:function(e){this.xmlNode.setAttribute("gembarOrdinal",e)},setDisplayLabel:function(e,t,n){this.report.reportDoc.updateDisplayLabel(this.xmlNode,e,t,n),this.updateDomNode()},getCalculateSubtotalsUsingFormula:function(){return this.xmlNode.getAttribute("calculateSubtotalsUsingFormula")},setCalculateSubtotalsUsingFormula:function(e){this.report.reportDoc.updateCalculateSubtotalsUsingFormula(e,this.xmlNode)},isLast:function(){var e=this.xmlNode.parentNode.selectNodes("cv:"+this.xmlNode.tagName);return e[e.length-1]==this.xmlNode},setXmlNode:function(e){this.xmlNode=e,this.dndType=cv.getFieldHelp().getDndType(this.getFormula()),this.dndType==null&&this.type==cvConst.TYPE_METRIC&&(this.dndType="V"),e.parentNode&&(this.zone=this.report.byId(e.parentNode.tagName))},setSortOrder:function(e){this.xmlNode.setAttribute("sortOrderEnum",e=="ASC"||e=="DESC"?e:"NONE")},getSortOrder:function(){return this.xmlNode.getAttribute("sortOrderEnum")},setZone:function(e){this.zone=e},createDomNode:function(){},destroy:function(){dojo.forEach(this.handles,dojo.disconnect),this.domNode=null},update:function(){},updateDomNode:function(){},onContextMenu:function(e){this.report.currentSelection=this;var t=cv.util.getDojoWidget(this.popMenu);if(!t)return;this.updatePopupMenu(),cv.util.showPopupMenu(t,e.clientX,e.clientY),dojo.stopEvent(e)},onMouseOver:function(e){this.cssClassHover&&dojo.addClass(this.domNode,this.cssClassHover)},onMouseOut:function(e){this.cssClassHover&&dojo.removeClass(this.domNode,this.cssClassHover)},onClick:function(e){new dijit.popup.close},updatePopupMenu:function(){}}),currentGem=null,dojo.declare("cv.AttributeGem",cv.BaseGem,{constructor:function(e,t){this.bad=!this.report.validateField(e.getAttribute("formula")),this.bad?cv.util.removeNode(e):this.setXmlNode(e)},type:cvConst.TYPE_ATTRIBUTE,htmlTemplate:"<div class='gemLabel'>%{0}</div>",cssClass:"attributeItem",cssClassHover:"attributeItemHover",popMenu:"attributePopMenu",dndType:null,updatePopupMenu:function(){var e=this.getSortOrder(),t=this.getFormula();this.report.getReportFormat()=="PIVOT"?this.report.reportDoc.getSortedMetric()&&this.getZone()=="rowAttributes"&&this.isLast()&&(e="NONE"):this.report.reportDoc.getSortedMetric()&&this.getGembarId()=="rows"&&(e="NONE");var n=this.report.getGem("filter_"+t);cv.util.setMenuItem("PM:attrFilter",n?"checked":"none","enabled"),cv.util.setMenuItem("PM:attrFilterRank",this.report.reportDoc.isUsedByMetricFilter(t,"RANK")?"checked":"none"),cv.util.setMenuItem("PM:attrSortAZ",e=="ASC"?"checked":"none"),cv.util.setMenuItem("PM:attrSortZA",e=="DESC"?"checked":"none");var r=!this.isLast();cv.util.setMenuItem("PM:attrShowSub",r&&this.xmlNode.getAttribute("showSubtotal")=="true"?"checked":"none",r?"enabled":"disabled"),this._createHierarchyMenu(),this._createPropertiesMenu()},_createHierarchyMenu:function(){var e=this.getFormula(),t=cv.getFieldHelp().getHierarchy(e),n=cv.util.getDojoWidget("PM:addHier");if(!t||t.length<=1){n.setDisabled(!0);return}n.setDisabled(!1);var r=this.getZone(),i=cv.util.getDojoWidget("hierarchyPopMenu");i&&i.destroyDescendants();for(var s=0;s<t.length;++s){var o=t[s],u=this.report.getFieldLabel(o);if(!o||!u)continue;var a=o==e,f;o==e?f=new dijit.MenuItem({id:"HierPop:"+o,label:u,disabled:!0}):this.report.getGem(o)?(f=new dijit.MenuItem({id:"HierPop:"+o,label:u}),f.iconNode.src=cv.contextPath+"images/checkmark.png"):(f=new dijit.MenuItem({id:"HierPop:"+o,label:u}),dojo.connect(f,"onClick",{form:o,execute:function(){cv.getActiveReport().insertGemInHierarchy(this.form),dijit.popup.close()}},"execute")),i.addChild(f)}},_createPropertiesMenu:function(){var e=this.getFormula(),t=cv.getFieldHelp().getProperties(e);if(!t||t.length<1){cv.util.getDojoWidget("PM:addProp").setDisabled(!0);return}cv.util.getDojoWidget("PM:addProp").setDisabled(!1);var n=dijit.byId("propertiesPopMenu");n&&n.destroyDescendants(),currentGem=this;var r=new dijit.MenuItem({id:"PropPop:AllMemberProps",label:cvCatalog.memberPropertiesAddProps});dojo.connect(r,"onClick",function(){currentGem.addAllProperties(),dijit.popup.close()}),n.addChild(r),r=new dijit.MenuSeparator,n.addChild(r);var i=Math.floor((this.report.reportHeight-125)/25),s=this.getProperties();for(var o=0;o<t.length;++o){if(o%i==i-1){var u=new dijit.Menu;dojo.addClass(u.domNode,"pentaho-menu-outer pentaho-menu");var a=new dijit.PopupMenuItem({label:cvCatalog.memberPropertiesMoreProps,popup:u});n.addChild(new dijit.MenuSeparator),n.addChild(a),n=u}var f=t[o];s[f]?(r=new dijit.MenuItem({id:"PropPop:"+f,label:f}),r.iconNode.src=cv.contextPath+"images/checkmark.png",dojo.connect(r,"onClick",{prop:f,execute:function(){currentGem.removeProperty(this.prop),dijit.popup.close()}},"execute")):(r=new dijit.MenuItem({id:"PropPop:"+f,label:f}),dojo.connect(r,"onClick",{prop:f,execute:function(){currentGem.addProperty(this.prop),dijit.popup.close()}},"execute")),n.addChild(r)}},getProperties:function(){var e=this.xmlNode.selectNodes("cv:property"),t={};for(var n=0;n<e.length;++n){var r=e[n].getAttribute("name");t[r]=r}return t},addProperty:function(e){var t=this.getProperties();if(t[e])return;this.report.reportDoc.addMemberProperty(this.xmlNode,e),this.report.history.add(new cv.ReportState("actionAdd",e)),this.report.refreshReport()},addAllProperties:function(){var e=cv.getFieldHelp().getProperties(this.getFormula()),t=this.getProperties(),n=!1;for(var r=0;r<e.length;++r){var i=e[r];if(t[i])continue;n=!0,this.report.reportDoc.addMemberProperty(this.xmlNode,i)}n&&(this.report.history.add(new cv.ReportState("actionAdd",cvCatalog.memberPropertiesAddProps)),this.report.refreshReport())},removeProperty:function(e){var t=this.xmlNode.selectSingleNode("cv:property[@name='"+e+"']");if(!t)return;cv.util.removeNode(t),this.report.history.add(new cv.ReportState("actionRemove",e)),this.report.refreshReport()},getLink:function(){return this.xmlNode.selectSingleNode("cv:link")},setLink:function(e,t){var n=this.xmlNode.selectSingleNode("cv:link");n&&cv.util.removeNode(n),this.report.reportDoc.addLink(this.xmlNode,e,t)},removeLink:function(){var e=this.xmlNode.selectSingleNode("cv:link");e&&cv.util.removeNode(e)}}),dojo.declare("cv.MetricGem",cv.BaseGem,{constructor:function(e,t){var n=e.getAttribute("formula");this.bad=n?!this.report.validateField(n):!1,this.popMenu="measurePopMenu";if(!this.bad){this.metricType=e.getAttribute("measureTypeEnum");if(this.isSummaryMetric()){var r=e.selectSingleNode("cv:summaryFacet");if(!r||r.getAttribute("summaryAcrossEnum")=="LABEL"&&!this.report.validateField(r.getAttribute("breakAttributeFormula")))this.bad=!0}else if(this.metricType=="EXPRESSION"){var i=e.selectSingleNode("cv:expression");if(!i)this.bad=!0;else{var s=cv.textContent(i).match(/\[Measures\]\.\[[^\]]+\]/g);if(s)for(var o=0;o<s.length;++o)if(!this.report.validateField(s[o])){this.bad=!0;break}}}else if(this.metricType=="TREND"){var u=e.selectSingleNode("cv:trendFacet");if(!u||!this.report.validateField(u.getAttribute("trendAttributeFormula")))this.bad=!0}}this.bad?cv.util.removeNode(e):(this.id=e.getAttribute("id"),this.id||(this.id=this.report.reportDoc.getNextMetricId(),e.setAttribute("id",this.id)),this.setXmlNode(e))},type:cvConst.TYPE_METRIC,htmlTemplate:"<div class='gemLabel'>%{0}</div>",cssClass:"metricItem",cssClassHover:"metricItemHover",popMenuOrigin:"measurePopMenu",id:null,metricType:null,getFormula:function(){return this.metricType=="VALUE"?this.xmlNode.getAttribute("formula"):this.id},getBaseFieldFormula:function(){return this.metricType=="EXPRESSION"?null:this.xmlNode.getAttribute("formula")},getId:function(){return this.id},getUniqueId:function(){return this.id},getDisplayLabel:function(e,t){if(this.metricType=="VALUE")return cv.BaseGem.prototype.getDisplayLabel.call(this,e,t);var n=this.xmlNode.selectSingleNode(t?"cv:displayLabels/cv:displayLabel[locale='"+t+"']":"cv:displayLabels/cv:displayLabel");if(n&&n.getAttribute("label"))return n.getAttribute("label");var r;return this.metricType=="EXPRESSION"?r=this.id:(r=cv.getFieldHelp().get(this.xmlNode.getAttribute("formula"),"displayLabel",!e),r||(r=cvCatalog.missingFieldLabel)),cv.util.substituteParams(cvCatalog["metric"+this.metricType],r)},update:function(e){if(this.isSummaryMetric()){var t=this.xmlNode.selectSingleNode("cv:summaryFacet");if(!t)return!1;t.setAttribute("summaryAcrossEnum",e.sumAcross),t.setAttribute("useNonVisualTotals",e.sumTotal),e.sumAcross=="LABEL"?t.setAttribute("breakAttributeFormula",e.sumBreakBy):t.removeAttribute("breakAttributeFormula")}else if(this.metricType=="EXPRESSION")cv.textContent(this.getMetricFacet(),e.expression);else if(this.metricType=="TREND"){var n=this.getMetricFacet();n.setAttribute("trendTypeEnum",e.trendType),n.setAttribute("amount",e.trendAmount),n.setAttribute("trendDirectionEnum",e.trendDir),n.setAttribute("trendAttributeFormula",e.trendField)}e.label&&this.report.reportDoc.updateDisplayLabel(this.xmlNode,e.label),e.numberFormat&&this.setNumberFormat(e.numberFormat),this.updateDomNode()},updatePopupMenu:function(){var e=this.getSortOrder(),t=this.getFormula();cv.util.setMenuItem("PM:measSortLowHi",e=="ASC"?"checked":"none"),cv.util.setMenuItem("PM:measSortHiLow",e=="DESC"?"checked":"none"),cv.util.setMenuItem("PM:measFilterCond",this.report.reportDoc.isUsedByMetricFilter(t,"CONDITIONS")?"checked":"none"),cv.util.setMenuItem("PM:measFilterRank",this.report.reportDoc.isUsedByMetricFilter(t,"RANK")?"checked":"none"),cv.util.setMenuItem("PM:helpMetric",null,this.metricType=="VALUE"?"enabled":"disabled"),cv.util.updateMenuItemCaption("PM:inChartHideMetric",this.isHideInChart()?"menuShowOnChart":"menuHideFromChart"),cv.util.getDojoWidget("newNumberMenu"),cv.util.displayWidget("PM:editMeasureSummary",this.isSummaryMetric()),cv.util.displayWidget("PM:editMeasureArith",this.metricType=="EXPRESSION"),cv.util.displayWidget("PM:editMeasureTrend",this.metricType=="TREND"),cv.util.displayWidget("menuSeparator",this.isSummaryMetric()||this.metricType=="TREND"||this.metricType=="EXPRESSION"),cv.util.getDojoWidget("condFormatMenu");var n=this.getNumberFormat(),r=["COLOR_SCALE_G_Y_R","COLOR_SCALE_R_Y_G","COLOR_SCALE_B_Y_R","COLOR_SCALE_R_Y_B","DATA_BAR_RED","DATA_BAR_GREEN","DATA_BAR_BLUE","TREND_ARROW_GR","TREND_ARROW_RG"];for(var i in r)cv.util.setMenuItem("PM:condFormat_"+r[i],n.formatShortcut==r[i]?"checked":"none")},getNumberFormat:function(){var e=this.report.reportDoc.getNumberFormat(this.xmlNode);return e||(this.metricType=="VALUE"?e=cv.getFieldHelp().get(this.xmlNode.getAttribute("formula"),"format"):this.metricType=="PCTOF"||this.metricType=="PCTRSUM"?e={formatCategory:"Percentage (%)",formatScale:"2"}:e={formatCategory:"General Number",formatScale:"0"},e.formatExpression="",e.formatShortcut="NONE"),e},setNumberFormat:function(e){this.report.reportDoc.setNumberFormat(this.xmlNode,e)},isSummaryMetric:function(){return dojo.indexOf(["PCTOF","RSUM","PCTRSUM","RANK"],this.metricType)>-1},getMetricFacet:function(){return this.isSummaryMetric()?this.xmlNode.selectSingleNode("cv:summaryFacet"):this.metricType=="TREND"?this.xmlNode.selectSingleNode("cv:trendFacet"):this.metricType=="EXPRESSION"?this.xmlNode.selectSingleNode("cv:expression"):null},isHideInChart:function(){return this.xmlNode.getAttribute("hideInChart")=="true"},disable:function(e){e?this.popMenu="measureDisabledPopMenu":this.popMenu=this.popMenuOrigin}}),dojo.declare("cv.FilterGem",cv.BaseGem,{constructor:function(e,t,n){this.isNumeric=n,this.bad=!t.validateField(e.getAttribute("formula"));if(!this.bad)if(this.isNumeric){var r,i=e.selectNodes("cv:conditions/cv:condition"),s=i.length;for(var o=0;i&&o<i.length;++o)r=i[o],t.validateField(r.getAttribute("formula"))||(cv.util.removeNode(r),--s);s==0&&i.length>0&&e.removeChild(e.selectSingleNode("cv:conditions")),r=e.selectSingleNode("cv:topBottom"),r&&!t.validateField(r.getAttribute("formula"))&&(e.removeChild(r),r=null),!r&&s==0&&(this.bad=!0)}else{var i=e.selectNodes("cv:predicates/cv:predicate");if(!i||i.length==0)this.bad=!0;var u=cv.getFieldHelp().isTimeAttribute(e.getAttribute("formula"));for(var a=0;a<i.length;++a){var f=i[a].getAttribute("operatorEnum"),l=i[a].getAttribute("preset");if(u&&(f=="CONTAIN"||f=="NOT_CONTAIN")||!u&&(l||f=="BETWEEN"||f=="BEFORE"||f=="AFTER"))this.bad=!0}this.bad&&(t.badFilters=!0)}this.bad?cv.util.removeNode(e):this.setXmlNode(e)},type:cvConst.TYPE_FILTER,htmlTemplate:cvCatalog.filterTemplate,cssClass:"filterItem",cssClassHover:null,popMenu:"filterPopMenu",itemCount:0,getUniqueId:function(){return"filter_"+(this.isNumeric?"metric":this.getFormula())},createDomNode:function(){this.domNode=dojo.create("div",{innerHTML:this.htmlTemplate}).firstChild,this.domNode.id=this.getUniqueId(),this.domNode.setAttribute("formula",this.getFormula()),this.updateDomNode(),dojo.connect(this.domNode,"oncontextmenu",this,"onContextMenu")},updateDomNode:function(){var e=dojo.create("div",{innerHTML:this.createSummary()}).childNodes;if(e&&e.length>0){var t=cvConst.dndTypes.filters;this.domNode.setAttribute("dndType",t);while(e.length>0)this.domNode.appendChild(e[0])}dojo.addClass(this.domNode,"unlocked")},onContextMenu:function(e){if(!this.report.currentSelection)return;cv.util.popupSourceNode=this.domNode;var t=cv.util.getDojoWidget(this.popMenu);if(!t)return;this.updatePopupMenu(),dijit.popup.open({popup:t,x:e.clientX,y:e.clientY});var n=dojo.connect(t,"onBlur",function(){dijit.popup.close(),dojo.disconnect(n)});e.preventDefault(),e.stopPropagation()},updatePopupMenu:function(){var e=this.report.getFieldLabel(this.getFormula());cv.util.updateMenuItemCaption("PM:addFilter","menuAddFilter",e),cv.util.setMenuItem("PM:editFilter",null,"enabled"),cv.util.setMenuItem("PM:removeFilter",null,"enabled"),cv.util.setMenuItem("PM:addFilter",null,"enabled"),cv.util.setMenuItem("PM:removeFilter",null,this.report.currentSelection.id?"enabled":"disabled")},getViewType:function(){return this.xmlNode.getAttribute("viewFilterEnum")},setViewType:function(e){this.xmlNode.setAttribute("viewFilterEnum",e),e!="NONE"?dojo.addClass(this.domNode,"unlocked"):dojo.removeClass(this.domNode,"unlocked")},createSummary:function(e){var t="",n=this.report.getFieldLabel(this.getFormula());if(this.isNumeric){this.itemCount=1;var r,i=this.xmlNode.selectNodes("cv:conditions/cv:condition");for(var s=0;i&&s<i.length;++s)r=i[s],t+="<div class='filterItemList'>"+cv.util.substituteParams(cvCatalog["filterSummMetric"+r.getAttribute("operator")],{METRIC:this.report.getFieldLabel(r.getAttribute("formula")),OP1:r.getAttribute("op1"),OP2:r.getAttribute("op2"),ATTR:n})+"</div>";r=this.xmlNode.selectSingleNode("cv:topBottom"),r&&(t+="<div class='filterItemList'>"+cv.util.substituteParams(cvCatalog["filterSummMetric"+r.getAttribute("type")],{METRIC:this.report.getFieldLabel(r.getAttribute("formula")),COUNT:r.getAttribute("count"),ATTR:n})+"</div>"),this.isNumeric&&(t=cv.util.substituteParams(cvCatalog.filterTemplateMetric,this.getFormula(),t))}else{var i=this.xmlNode.selectNodes("cv:predicates/cv:predicate"),o=new dojox.collections.Dictionary,u;for(var a=0;a<i.length;++a){var f=this._createPredicateSummary(i[a]).split("`");u=i[a].getAttribute("ordinal");if(o.contains(u))for(var s=0;s<f.length;++s)o.item(u).labels.push(f[s]);else o.add(u,{operatorEnum:i[a].getAttribute("operatorEnum"),labels:f})}var l=o.getKeyList(),c=l.length;this.itemCount=c;if(i.length==0)return cvCatalog.filterTemplateNone;!e&&c>1&&(t+=cv.util.substituteParams(cvCatalog.filterTemplateMultiLine,n));for(var a=0;a<l.length;a++){var h="",p=o.item(l[a]).labels;for(var d=0;d<p.length;d++)if(d>0)if(d==p.length-1)if(h.indexOf("<a")>-1)h+=", "+p[d].replace("includes","");else{var v=o.item(l[a]).operatorEnum,m=" and ";if(v=="NOT_CONTAIN"||v=="CONTAIN")m=" or ";h+=m+p[d].replace("includes","")}else h+=", "+p[d].replace("includes","");else h=p[d];!e&&c==1?t+=cv.util.substituteParams(cvCatalog.filterTemplateSingleLine,this.getFormula(),"filter_"+this.getFormula()+"_"+l[a],n,h):t+=cv.util.substituteParams(cvCatalog.filterTemplateAttr,this.getFormula(),"filter_"+this.getFormula()+"_"+l[a],h)}}return t},_createPredicateSummary:function(e){var t="",n="",r=e.getAttribute("operatorEnum"),i=e.selectNodes("cv:member"),s=cv.getFieldHelp().get(this.getFormula()),o;for(var u=0;i.length>0&&u<i.length;++u){var a=i[u].getAttribute("formula");a||(u>0?o+=","+i[u].getAttribute("pos"):o=i[u].getAttribute("pos"))}switch(r){case"EQUAL":case"NOT_EQUAL":if(o){if(!s)return"ERROR";var f=cv.getFieldHelp().get(s,"type"),l=o.split(",");for(var c=0;c<l.length;++c)c>0&&(t+="`"),f=="TIME_DATE"?t+=cvCatalog["filterPreset"+cv.getFieldHelp().get(s,"type")+"_"+l[c].replace(",","a").replace("-","n")]:t+=cvCatalog["filterSummR_3_"+l[c].replace("-","n")];t=cv.util.substituteParams(t,this.report.getFieldLabel(this.getFormula()))}else{if(i.length==0)return cvCatalog.filterTemplateNone;if(i.length<5)for(var c=0;c<i.length;++c)t+=(c>0?"` ":"")+cv.util.escapeHtml(i[c].getAttribute("caption"));else t=cv.util.substituteParams(cvCatalog.filterSummSimple,cv.util.escapeJavaScript(this.getFormula()),e.getAttribute("ordinal"),i.length)}break;case"CONTAIN":case"NOT_CONTAIN":var h=e.selectNodes("cv:containsExpression");if(!h||h.length==0)return cvCatalog.filterTemplateNone;for(var c=0;c<h.length;++c)t+=(c>0?"` ":"")+cv.util.escapeHtml(cv.textContent(h[c]));break;case"BETWEEN":n=cv.util.escapeHtml(i[1].getAttribute("caption"));case"BEFORE":case"AFTER":t=cv.util.escapeHtml(i[0].getAttribute("caption"));break;case"TIME_AHEAD":case"TIME_AGO":case"TIME_RANGE_NEXT":case"TIME_RANGE_PREV":t=o,n=this.report.getFieldLabel(this.getFormula());break;case"TIME_YAGO":return n=this.report.getFieldLabel(this.getFormula()),cv.util.substituteParams(cvCatalog["filterSumm"+r],n);default:t=cv.util.escapeHtml(i[0].getAttribute("caption"))}return cv.util.substituteParams(cvCatalog["filterSumm"+r],t,n)}})}),dojo.require("dojox.xml.parser"),pen.define("analyzer/report/cv_rptDlg",["analyzer/report/cv_rptGem"],function(){dojo.declare("cv.ReportDialog",cv.Dialog,{constructor:function(e){this.report=e,this.dlgTemplates={reportOpt_edit:"reportOptionsDlg.html",report_rename:"saveReportDlg.html",report_props:"reportPropsDlg.html",report_xml:"reportDefDlg.html",measures_subtotal:"measureDlg.html",measures_summaries:"summaryMetricsDlg.html",summary_new:"singleSummaryDlg.html",summary_edit:"singleSummaryDlg.html",measures_arith:"arithNumberDlg.html",measures_trend:"trendNumberDlg.html",arith_edit:"arithNumberDlg.html",trend_edit:"trendNumberDlg.html",gem_edit:"editGemDlg.html",filter_list:"filterListDlg.html",fieldHelp_show:"fieldHelpDlg.html",propHelp_show:"fieldHelpDlg.html",report_csv_download:"reportCSVDownloadDlg.html"},this.prefixes={reportOpt_edit:"RO_",report_props:"RP_",report_xml:"RD_",measures_subtotal:"VF_",measures_summaries:"SM_",summary_edit:"SM_",summary_new:"SM_",measures_arith:"MA_",measures_trend:"MT_",arith_edit:"MA_",trend_edit:"MT_",gem_edit:"ED_",filter_list:"FT_",fieldHelp_show:"FH_",propHelp_show:"FH_",gadget_displaying:"GD_"},this.helpTopics={reportOpt_edit:"CV/Business_User/setting_report_preferences.html",report_props:"",report_xml:"",measures_subtotal:"CV/Business_User/working_with_calculations.html#displaying_totals_as_averages_max",measures_summaries:"CV/Business_User/working_with_calculations.html#displaying_percent_rank_etc",summary_edit:"CV/Business_User/working_with_calculations.html#",summary_new:"CV/Business_User/working_with_calculations.html#",measures_arith:"CV/Business_User/working_with_calculations.html#",measures_trend:"CV/Business_User/working_with_calculations.html#",arith_edit:"CV/Business_User/working_with_calculations.html#",trend_edit:"CV/Business_User/working_with_calculations.html#",gem_edit:"CV/Business_User/working_with_fields.html#renaming_a_field",filter_list:"CV/Business_User/working_with_filters.html#filters_on_text_fields",fieldHelp_show:"CV/Business_User/working_with_fields.html#viewing_the_definition_of_a_field",gadget_displaying:""},this.src=null,this.dataSource=null},destroy:function(){this.src=null,this.dataSource=null},show:function(e,t,n){this.dataSource=this.report.currentSelection;var r=this.report.reportDoc;t?this.src=t:this.dataSource&&this.dataSource.getZone()&&(this.src=this.dataSource.getZone()),this.type=this.src+"_"+e,this.param=n,this.prefix=this.prefixes[this.type],this.dlgTemplate=this.dlgTemplates[this.type],this.helpTopic=this.helpTopics[this.type],this.defaultFocus=null;var i=this;switch(this.type){case"reportOpt_edit":if(!this.load())break;var s=r.getReportOptions();for(var o=0,u=s.length;s!=null&&o<u;++o)this.updateHtml(s[o].name,s[o].value);this.report.manager.disableDrillLinks&&cv.util.hide("RO_drillLinkTable"),cv.util.setHelpTopics(["RO_helpNonVisualTotal","CV/Business_User/working_with_calculations.html#non_visual_totals"]),this.defaultFocus=this.byId("showEmptyCells");break;case"report_props":if(!this.loadRptProps())break;var a=this.report.getReportProperties();for(var o in a){var f=this.byId(o);if(!f)continue;f.tagName=="INPUT"||f.tagName=="TEXTAREA"?f.value=a[o]:f.innerHTML=cv.util.escapeHtml(a[o]),o=="description"&&a[o]==""&&(f.tagName=="INPUT"||f.tagName=="TEXTAREA"?f.value="No Description":f.innerHTML=cv.util.escapeHtml("No Description"));if(o=="created"||o=="update")if(a[o]!=null&&a[o]!=""){var l=cv.util.formatDateString(a[o]);f.innerHTML=cv.util.escapeHtml(l)}o=="folder"&&a[o].substring(0,1)=="/"&&(f.innerHTML=a[o].substring(1))}break;case"report_xml":if(!this.load())break;this.byId("reportDef").value=dojox.xml.parser.innerXML(r.getReportNode()),this.byId("pluginData").value=this.report.getPluginDataJSON();break;case"measures_subtotal":if(!this.dataSource)return;if(!this.load(this.dataSource.getDisplayLabel()))break;var s=this.dataSource.getXmlAttributes();for(var o=0,u=s.length;s!=null&&o<u;++o)this.updateHtml(s[o].name,s[o].value);this.defaultFocus=this.byId("showSum"),dojo.connect(this.byId("showSumTD"),"onclick",function(){dojo.byId("VF_showSum").checked=!dojo.byId("VF_showSum").checked}),dojo.connect(this.byId("showAggregateTD"),"onclick",function(){dojo.byId("VF_showAggregate").checked=!dojo.byId("VF_showAggregate").checked}),dojo.connect(this.byId("showAverageTD"),"onclick",function(){dojo.byId("VF_showAverage").checked=!dojo.byId("VF_showAverage").checked}),dojo.connect(this.byId("showMaxTD"),"onclick",function(){dojo.byId("VF_showMax").checked=!dojo.byId("VF_showMax").checked}),dojo.connect(this.byId("showMinTD"),"onclick",function(){dojo.byId("VF_showMin").checked=!dojo.byId("VF_showMin").checked});break;case"measures_summaries":if(!this.dataSource||!this.load(this.dataSource.getDisplayLabel()))break;this.param?this.defaultFocus=this.byId(this.param):this.defaultFocus=this.byId("PCTOF"),this.defaultFocus.checked=!0;break;case"summary_new":if(!this.dataSource)return;var c=this.dataSource.getDisplayLabel();if(!this.load(cvCatalog.summaryMetricTitle,c))break;var h=this.byId("formatCategory"),p=this.byId("formatScale");this.byId("name").value=this._getUniqueLabel(cv.util.substituteParams(cvCatalog["metric"+n],c));if(n=="PCTOF"||n=="PCTRSUM"||n=="RSUM")n=="RSUM"?h.value=this.dataSource.getNumberFormat().formatCategory:h.value="Percentage (%)",p.value="2";this.byId(n).className="summaryOption";var d=this.byId("field_"+n);this.report.addOptionsForAttributes(d,!0)||(d.disabled=!0,this.byId("LABEL_"+n).disabled=!0),dojo.connect(dojo.byId("dlgBtnPrev"),"onclick",function(){i.show("summaries",null,i.param)}),r.getReportOption("useNonVisualTotals")=="true"&&this.displayMsg(cvCatalog.dlgInfoNonvisualTotal),this.helpTopic+=n,this.defaultFocus=this.byId("ROWS_"+n);break;case"summary_edit":if(!this.dataSource)return;var v=this.dataSource.metricType,m=this.dataSource.getDisplayLabel();if(!this.load(cvCatalog.summaryMetricEditTitle,this.report.getFieldLabel(this.dataSource.getBaseFieldFormula())))break;this.byId("name").value=m,this._updateNumberFormat(this.dataSource,!0),this.byId(v).className="summaryOption";var d=this.byId("field_"+v);this.report.addOptionsForAttributes(d,!0)||(d.disabled=!0,this.byId("LABEL_"+v).disabled=!0);var g=this.dataSource.getMetricFacet(),y=g.getAttribute("summaryAcrossEnum");this.updateHtml("RD_"+v,y),y=="LABEL"&&this.updateHtml(d,g.getAttribute("breakAttributeFormula")),r.getReportOption("useNonVisualTotals")=="true"&&this.displayMsg(cvCatalog.dlgInfoNonvisualTotal),this.helpTopic+=v,this.defaultFocus=this.byId("ROWS_"+v);var b=dojo.byId("dlgBtnPrev");b&&dojo.style(b,"display","none"),b=dojo.byId("dlgBtnSave"),b&&(b.innerHTML="OK");break;case"measures_arith":case"arith_edit":if(!this.load())break;var w=this.byId("measures");w.selectedIndex=-1;var E=this.byId("ops").childNodes,S=this.byId("content"),x=!1;function T(e,t){var n=0,r=0;if(typeof e.selectionStart=="number")n=e.selectionStart,r=e.selectionEnd,e.value=e.value.slice(0,n)+t+e.value.slice(r);else if(document.selection){if(!x){var i=event.srcElement,s=e.createTextRange();s.moveStart("character",e.value.length),s.collapse(!0),s.select()}e.focus();var o=document.selection.createRange();o.text=t}}function N(e){var t=e.target;return t?(t.tagName=="INPUT"&&t.type=="button"?(t.value.length==1?T(S,t.value):t.id==i.prefix+"clear"&&(S.value=""),e.preventDefault()):t.id==i.prefix+"measures"||t.id==i.prefix+"addField"||t.tagName=="OPTION"?w.options[w.selectedIndex].value!=""&&T(S,"["+w.options[w.selectedIndex].text+"]"):t.id==i.prefix+"content"&&(x=!0),S.focus(),!1):!0}for(var o=0;o<E.length;++o)E[o].tagName=="INPUT"&&E[o].type=="button"&&dojo.connect(E[o],"onclick",N);dojo.connect(this.byId("addField"),"onclick",N),dojo.connect(w,"ondblclick",N),dojo.connect(this.byId("clear"),"onclick",N),dojo.connect(this.byId("content"),"onclick",N),cv.util.setHelpTopics(["helpCalculateSubtotals","CV/Business_User/working_with_calculations.html#subtotal_calculation"]),this.helpTopic+="creating_new_numbers",this.type=="arith_edit"?(this.dataSourceOrigin={},this.report.addOptionsForAllMeasures(w,!0,this.dataSource.getId(),!0),this.dataSourceOrigin.label=this.byId("name").value=this.dataSource.getDisplayLabel(!0),this.dataSourceOrigin.numberFormat=this._updateNumberFormat(this.dataSource,!0),this.dataSourceOrigin.expression=cv.textContent(this.dataSource.getMetricFacet()),S.value=this._transformArithExpression(this.dataSourceOrigin.expression,!1),this.byId("calculateSubtotalsUsingFormula").checked=this.dataSource.getCalculateSubtotalsUsingFormula()=="true",dojo.byId("dialogTitleText").innerHTML=cvCatalog.calculatedEditTitle):(this._updateNumberFormatAndDecimalPlacesDropdown(),dojo.byId("MA_name").value="",this.report.addOptionsForAllMeasures(w,!0,null,!0),w.value=this.dataSource.getFormula(),S.value+="["+w.options[w.selectedIndex].text+"]",this.refGem=this.dataSource,this.dataSource=null);break;case"measures_trend":case"trend_edit":if(!this.dataSource)return;var C=this.report.reportDoc.getChildMembers("columnAttributes","rowAttributes"),k=[];if(C)for(var o=0;o<C.length;++o){var s=C[o].getAttribute("formula"),L=cv.getFieldHelp().getHierarchy(s,!1,!0);if(L)for(var u=0;u<L.length;++u)dojo.indexOf(k,L[u])==-1&&k.push(L[u]);else dojo.indexOf(k,s)==-1&&k.push(s)}if(k.length==0){this.showError("errorNoFieldForTrend");return}if(this.type=="trend_edit"){if(!this.load(this.report.getFieldLabel(this.dataSource.getBaseFieldFormula())))break}else if(!this.load(this.dataSource.getDisplayLabel()))break;var A=this.byId("trendFields");A.innerHTML="";for(var o=0;o<k.length;++o){var O=k[o];cv.addOption(A,new Option(this.report.getFieldLabel(O,!0),O))}this._updateNumberFormat(this.dataSource,!0);if(this.type=="trend_edit"){dojo.byId("dialogTitleText").innerHTML=cvCatalog.trendNumberEditTitle,this.byId("name").value=this.dataSource.getDisplayLabel(!0);var M=this.dataSource.getMetricFacet();this.updateHtml("trendType",M.getAttribute("trendTypeEnum")),this.updateHtml("amount",M.getAttribute("amount")),this.updateHtml("trendFields",M.getAttribute("trendAttributeFormula"))}else this.baseGemFormat=this.dataSource.getNumberFormat().formatCategory,this.byId("formatScale").value="2";function _(e){var t=i.dataSource;i.type=="trend_edit"&&(t=i.report.getGem(i.dataSource.xmlNode.getAttribute("formula"))),i.byId("formatCategory").value=e.target.value=="PCT_CHANGE"?"Percentage (%)":t.getNumberFormat().formatCategory}dojo.connect(this.byId("trendType"),"onchange",_);break;case"gem_edit":if(!this.dataSource)return;var m=this.dataSource.getDisplayLabel();if(this.dataSource.metricType){if(!this.load(cvCatalog.editColumn))break}else if(!this.load(m))break;this.byId("name").innerHTML=this.dataSource.getName();var D=this.byId("displayLabel");D.value=this.dataSource.getDisplayLabel(!0);if(this.dataSource.metricType){cv.util.hide("ED_pluralNameRow"),cv.util.hide("ED_pluralLabelRow"),this.dataSourceOrigin={},this.dataSourceOrigin.numberFormat=this._updateNumberFormat(this.dataSource,!0),this.byId("nameTD").style.width="150px",this.dataSource.metricType!="VALUE"&&(cv.util.hide("ED_nameRow"),cv.util.hide("blankRow"));function P(e){var t=i.byId("formatCategory");if(t.value=="Expression"){i.byId("formatScale").disabled=!0;var n=i.byId("formatExpression");n.disabled=!1,n.value==""&&(n.value=cvConst.defaultFormatExp)}else t.value=="Default"?(i.byId("formatScale").disabled=!0,i.byId("formatExpression").disabled=!0):(i.byId("formatScale").disabled=!1,i.byId("formatExpression").disabled=!0)}dojo.connect(this.byId("formatCategory"),"onchange",P),P()}else this.byId("namePlural").innerHTML=this.dataSource.getNamePlural(),this.byId("displayLabelPlural").value=this.dataSource.getDisplayLabelPlural(!0),cv.util.hide("ED_formatRow","ED_formatExpRow");this.defaultFocus=D;break;case"filter_list":var H=this.report.getGem("filter_"+n);if(!H)return this.report.filterDlg.show(n);if(H.itemCount==1)return this.report.filterDlg.show(n,1);if(!this.load(this.report.getFieldLabel(n),cv.util.escapeHtml(n)))break;var B=this.byId("predicateList");B.innerHTML=H.createSummary(!0);break;case"fieldHelp_show":var j=cv.getFieldHelp(),f=j.get(n),F=j.get(f,"displayLabelOriginal",!0);F||(F="&nbsp;");var I=this.report.getFieldLabel(n),m=j.get(f,"displayLabel",!0);if(!this.load(I,m,F))break;I!=m&&cv.util.show("FH_customLabel"),F!="nbsp;"&&F!=m&&cv.prefs.isAdmin&&cv.util.show("FH_name");var q=j.get(f,"displayDescription",!0);q&&this.updateHtml("displayDescription",q),this.updateHtml("formula",n),this.updateHtml("type",cvCatalog["fieldTypes_"+j.get(f,"type")]);var a=cv.getFieldHelp().getProperties(n);if(a&&a.length>1){var q="";cv.util.show("FH_memberProperties");for(var o=0;o<a.length;++o){var R=a[o];o!=0&&(q+=", "),q+=R}this.updateHtml("memberPropertiesDescription",q)}break;case"propHelp_show":var U=this.dataSource.getAttribute("formula"),z=this.dataSource.getAttribute("name"),j=cv.getFieldHelp(),f=j.get(U),m=this.report.getFieldLabel(U);m||(m=j.get(f,"displayLabel",!0));if(!this.load(z,z,z))break;this.updateHtml("displayDescription",cv.util.substituteParams(cvCatalog.memberPropertyHelp,z,m)),this.updateHtml("type",cvCatalog.fieldTypes_PROPERTY);break;case"report_csv_download":if(!this.load())break;break;default:return}if(this.status){this.report.showReportStatus(this.status);return}this.showDialog(),this.lastSaveTime=null},save:function(){var e=this.report.reportDoc,t=this.theForm.elements,n=!0;switch(this.type){case"reportOpt_edit":for(var r=0;r<t.length;++r)t[r].tagName=="INPUT"&&this.updateXml(e.getReportNode(),t[r]);this.report.history.add(new cv.ReportState("actionReportOptions"));break;case"report_props":this.report.setReportProperties({description:this.byId("description").value}),n=!1;break;case"report_xml":var i=dojox.xml.parser.parse(this.byId("reportDef").value);if(!i||!i.documentElement||i.documentElement.tagName!="report")return this.displayError(cvCatalog.errorReportDefinition);try{dojo.fromJson(this.byId("pluginData").value)}catch(s){return this.displayError("Invalid visualization state JSON")}this.report.savePluginDataToXML(this.byId("pluginData").value);try{this.report.visualization=null,this.report.openReport(i.documentElement,!0)}catch(s){return this.report.history.current().exec(!0),this.displayError(cvCatalog.errorReportDefinition)}this.report.history.add(new cv.ReportState("actionImport"));break;case"measures_subtotal":for(var r=0;this.dataSource!=null&&r<t.length;++r)t[r].tagName=="INPUT"&&this.updateXml(this.dataSource.xmlNode,t[r]);this.report.history.add(new cv.ReportState("actionEdit",this.dataSource.getDisplayLabel(!0)));break;case"measures_summaries":var o=this.getRadioGroupValue(this.prefix+"Group");if(!o){n=!1;break}return this.show("new","summary",o);case"summary_new":var u=dojo.string.trim(this.byId("name").value),a=this.report.createSpecialMetricGem({zoneId:"measures",formula:this.dataSource.getFormula(),metricType:this.param,sumAcross:this.getRadioGroupValue(this.prefix+"RD_"+this.param),sumTotal:"false",sumBreakBy:this.byId("field_"+this.param).value,refGem:this.dataSource});this._updateNumberFormat(a),a.setDisplayLabel(u),this.report.history.add(new cv.ReportState("actionAdd",u));break;case"summary_edit":var u=dojo.string.trim(this.byId("name").value),o=this.dataSource.metricType,f=this.getRadioGroupValue(this.prefix+"RD_"+o),l={sumAcross:f,sumBreakBy:this.byId("field_"+o).value,sumTotal:"false"};this.dataSource.update(l),this._updateNumberFormat(this.dataSource),this.dataSource.setDisplayLabel(u),e.isUsedByMetricFilter(this.dataSource.getFormula())&&this.report.populateFilters(),this.report.history.add(new cv.ReportState("actionEdit",u));break;case"measures_arith":case"arith_edit":u=dojo.string.trim(this.byId("name").value);if(!this._validateName())return!1;if(!this._validateNumberFormatAndDecimalPlaces())return!1;var c=this._transformArithExpression(this.byId("content").value,!0);this.dataSource?this.dataSource.update({expression:c}):this.dataSource=this.report.createSpecialMetricGem({zoneId:"measures",metricType:"EXPRESSION",formula:null,expression:c,refGem:this.refGem}),this.dataSource.setDisplayLabel(u),this._updateNumberFormat(this.dataSource),this.dataSource.setCalculateSubtotalsUsingFormula(this.byId("calculateSubtotalsUsingFormula").checked?"true":"false");var h=cv.util.parseAjaxMsg(cv.io.ajaxLoad("ajax/validateCalculatedMeasure",{reportXML:this.report.getReportXml(),measureId:this.dataSource.getId()},!0));if(h&&h.type=="error")return this.displayError(h.details?h.details:cvCatalog.dlgErrGeneric);this.report.history.add(new cv.ReportState(this.type=="arith_edit"?"actionEdit":"actionAdd",u)),this.type=="arith_edit"&&e.isUsedByMetricFilter(this.dataSource.getFormula())&&this.report.populateFilters();break;case"measures_trend":case"trend_edit":var l={zoneId:"measures",metricType:"TREND",formula:this.dataSource.getFormula(),trendType:this.byId("trendType").value,trendDir:this.byId("direction").value,trendAmount:this.byId("amount").value,trendField:this.byId("trendFields").value,refGem:this.dataSource},p=cv.getFieldHelp().getHierarchy(l.trendField);if(p)for(var r=dojo.indexOf(p,l.trendField)+1;r<p.length;++r)if(!this.report.getGem(p[r])&&this.report.getGem("filter_"+p[r]))return this.showError(["errorAddTrendWithFilterOnChild",this.report.getFieldLabel(p[r]),this.report.getFieldLabel(l.trendField)]),!1;if(!this._validateName())return this.byId("name").focus(),!1;var d=this._validateAmountField(l.trendAmount);if(d)return this.displayMsg(cvCatalog[d]),this.byId("amount").focus(),!1;var v;this.type=="trend_edit"?(this.dataSource.update(l),v="actionEdit"):(this.dataSource=this.report.createSpecialMetricGem(l),v="actionAdd");var u=dojo.string.trim(this.byId("name").value);this.dataSource.setDisplayLabel(u),this._updateNumberFormat(this.dataSource),this.report.history.add(new cv.ReportState(v,u)),this.type=="trend_edit"&&e.isUsedByMetricFilter(this.dataSource.getFormula())&&this.report.populateFilters();break;case"gem_edit":if(this.dataSource.metricType){this._updateNumberFormat(this.dataSource);if(this.byId("formatCategory").value=="Expression"){if(this.byId("formatExpression").value=="")return this.displayError("Format expression cannot be empty.");var h=cv.util.parseAjaxMsg(cv.io.ajaxLoad("ajax/parseReport",{reportXML:this.report.getReportXml()},!0));if(h&&h.type=="error")return this.displayError(h.details?h.details:cvCatalog.dlgErrGeneric)}}this.dataSource.setDisplayLabel(dojo.string.trim(this.byId("displayLabel").value),dojo.string.trim(this.byId("displayLabelPlural").value)),this.report.populateFilters(),this.report.history.add(new cv.ReportState("actionRename"));break;case"report_csv_download":cv.io.getReportInFormat(this.report.getReportXml(),"CSV",dojo.byId("CSV_includeSubtotals").checked,dojo.byId("CSV_keepNumberFormatting").checked,this.report.isDirty()),n=!1;break;default:n=!1}cv.dlgWidget.hide(),n&&this.report.reportStatus!="errorReportDefinition"&&this.report.refreshReport()},cancel:function(){switch(this.type){case"measures_arith":this.dataSource&&(this.report.gemList.remove(this.dataSource.getId()),cv.util.removeNode(this.dataSource.xmlNode));break;case"arith_edit":this.dataSource.update(this.dataSourceOrigin);break;case"gem_edit":this.dataSource.metricType&&this.dataSource.setNumberFormat(this.dataSourceOrigin.numberFormat)}cv.Dialog.prototype.cancel.call(this)},showEditColumn:function(){this.show("edit","gem")},showEditSummaryMeasure:function(){this.show("edit","summary")},showEditArithMeasure:function(){this.show("edit","arith")},showEditTrendMeasure:function(){this.show("edit","trend")},showReplaceAttribute:function(){this.show("replace","attribute")},showSaveReport:function(){this.show("save","report")},showReportOptions:function(){this.show("edit","reportOpt")},showReportProps:function(){this.show("props","report")},loadRptProps:function(){this.status=null;if(!this.cache[this.type]){var e=this;dojo.xhrPost({url:cv.contextPath+"templates/"+this.dlgTemplate,handleAs:"text",sync:!0,load:function(t,n){if(cv.util.parseAjaxMsg(t)){this.status="errorDlgLoad";return}e.cache[e.type]=t},error:function(t,n){e.status="errorDlgLoad"}})}if(this.status!=null)return!1;var t=this.loadRptProps.arguments.length>0?cv.util.substituteParams(this.cache[this.type],this.loadRptProps.arguments):this.cache[this.type];cv.dlgWidget==undefined&&(cv.dlgWidget=cv.util.getDojoWidget("theDialog")),cv.dlgWidget.setContent('<form id="theDialogForm" action="" onsubmit="return false">'+t+"</form>"),this.defaultMsg=null,this.theForm=dojo.byId("theDialogForm");var n=this.byId("editDescButton");return n&&dojo.connect(n,"onclick",this,"showEditDesc"),this.byId("descBtnCancel")&&dojo.connect(this.byId("descBtnCancel"),"onclick",this,"hideEditDesc"),this.byId("descBtnSave")&&dojo.connect(this.byId("descBtnSave"),"onclick",this,"saveRptDesc"),this.byId("closeButton")&&dojo.connect(this.byId("closeButton"),"onclick",this,"cancel"),!0},showReportDefinition:function(){this.show("xml","report")},showSubtotals:function(){this.show("subtotal")},showNewSummaryOptions:function(){this.show("summaries")},showNewArithBuilder:function(){this.show("arith")},showNewTrendNumber:function(){this.show("trend")},showFilterList:function(e){this.show("list","filter",e)},showCSVDownload:function(e){this.show("csv_download","report",e)},remove:function(){switch(this.type){case"attribute_replace":this.report.reportDoc.setReplaced(this.dataSource.getFormula(),null);return;default:}},_transformArithExpression:function(e,t){var n=this.byId("measures").options,r={},i={};for(var s=0;s<n.length;++s)t?(r["["+n[s].text+"]"]=n[s].value,i[n[s].value]="["+n[s].text+"]"):r[n[s].value]="["+n[s].text+"]";return e.replace(t?/((\[Measures\]\.\[[^\]]+\])|(\[MEASURE[^\]]+\]))|(\[(\\\]|[^\]])+\])/g:/(\[Measures\]\.\[[^\]]+\])|(\[MEASURE[^\]]+\])/g,function(e,t){return typeof r[e]!="undefined"&&r[e]!=null?r[e]:typeof i[e]!="undefined"&&i[e]!=null&&e.indexOf("[Measures].")>=0?e:typeof i[e]!="undefined"&&i[e]!=null||!(e.indexOf("[Measures].")>=0||e.indexOf("[MEASURES].")>=0)?e:e.replace("[Measures].","")})},_updateNumberFormat:function(e,t){var n=this.byId("formatCategory"),r=this.byId("formatScale"),i=this.byId("formatExpression"),s;return t?e?(s=e.getNumberFormat(),s.formatCategory&&(n.value=s.formatCategory),s.formatScale&&(r.value=s.formatScale),i&&(i.value=s.formatExpression)):(n.selectedIndex=-1,r.selectedIndex=-1):(s={formatCategory:n.value,formatScale:r.value},i&&(s.formatExpression=i.value),e.setNumberFormat(s)),s},_selectFolderInList:function(e){CookieLib.setCookieAttrib("cookie","report_selected_folder",this.byId("folder").value),!e||!dojo.isString(e)||e.length<=1?e=this.byId("folder").value:this.byId("folder").value=e;var t=this;dojo.xhrPost({url:cv.contextPath+"ajax/getFolderContent",content:{path:e,stok:cv.securityToken},load:function(e){if(e){var n=cv.util.parseAjaxMsg(e);if(n)return t.displayMsg(n.details?n.details:cvCatalog.dlgErrGeneric);t.byId("folderContent").innerHTML='<select id="SR_filesInFolder" size=9 class="folderContent">'+e+"</select>",dojo.connect(t.byId("filesInFolder"),"onchange",t,"_selectReportInFolder")}else t.byId("folderContent").innerHTML='<select size=9 class="folderContent"><option>&nbsp;</option></select>'},error:function(e){t.report.showReportStatus("errorReportDefinition")},sync:!1})},_selectReportInFolder:function(){this.byId("name").value=this.byId("filesInFolder").value},_validateAmountField:function(e){return dojo.removeClass(dojo.byId("MT_amount"),"invalid"),!cv.util.checkNumber(e)||parseInt(e)<=0||parseInt(e)!=parseFloat(e)?(this.report.filterDlg.setInvalidInputField("MT_amount"),"dlgErrTrendNumberAmountNumberExpected"):null},_getUniqueLabel:function(e){function r(e){for(var r=0;r<n.length;++r){var i=t.item(n[r]);if(i.getDisplayLabel()==e)return!0}return!1}var t=this.report.gemList,n=t.getKeyList();if(!n||n.length==0)return e;if(!r(e))return e;var i=2,s=e+"_"+i;while(r(s))s=e+"_"+ ++i;return s},_validateNumberFormatAndDecimalPlaces:function(){dojo.removeClass(this.byId("formatCategory"),"invalid"),dojo.removeClass(this.byId("formatScale"),"invalid");var e=!0;return this.byId("formatCategory").value==cvCatalog["dlgNullSelection"]&&(this.byId("formatCategory").focus(),dojo.addClass(this.byId("formatCategory"),"invalid"),e=!1),this.byId("formatScale").value==cvCatalog["dlgNullSelection"]&&(this.byId("formatScale").focus(),dojo.addClass(this.byId("formatScale"),"invalid"),e=!1),e||this.displayMsg(cvCatalog.dlgErrNumberFormatOrDecimalRequired),e},_updateNumberFormatAndDecimalPlacesDropdown:function(){var e=document.createElement("option");e.setAttribute("value",cvCatalog.dlgNullSelection),e.innerHTML=cvCatalog.dlgNullSelection,this.byId("formatCategory").insertBefore(e,this.byId("formatCategory").getElementsByTagName("option")[0]),this.byId("formatCategory").value=cvCatalog.dlgNullSelection,this.byId("formatScale").value="2"},_validateName:function(){return dojo.removeClass(this.byId("name"),"invalid"),this.byId("name").value==""?(dojo.addClass(this.byId("name"),"invalid"),this.displayMsg(cvCatalog.dlgErrNameRequired),!1):!0},showEditDesc:function(){var e=this.byId("editDescTextArea");dojo.removeClass(this.byId("editDescTextAreaTR"),"hidden"),dojo.addClass(this.byId("descDivTR"),"hidden"),cv.getActiveReport().reportDoc.getReportProperty("description")?e.innerHTML='<input id="RP_hiddenDesc" type="hidden" value="'+this.byId("description").innerHTML.replace(/(["])/gm,"&quot;")+'"><textarea id="RP_description" style="width:430px;" rows=3>'+this.byId("description").innerHTML.replace(/(["])/gm,"&quot;")+"</textarea>":e.innerHTML='<input id="RP_hiddenDesc" type="hidden" value="'+this.byId("description").innerHTML.replace(/(["])/gm,"&quot;")+'"><textarea id="RP_description" style="width:430px;" rows=3></textarea>',dojo.removeClass(this.byId("descBtn"),"hidden"),this.byId("editDescDiv").innerHTML="",this.byId("description").focus(),this.isEditDescHidden=!1,this.isShowingNow=this.isEditDescHidden&&this.isRenamingHidden},hideEditDesc:function(){var e=this.byId("editDescDiv");dojo.addClass(this.byId("editDescTextAreaTR"),"hidden"),dojo.removeClass(this.byId("descDivTR"),"hidden");var t=this.byId("hiddenDesc").value;e.innerHTML="<div id='RP_description' style='word-break:break-all;overflow:auto;padding-left: 10px;'>"+this.byId("hiddenDesc").value+"</div>",dojo.addClass(this.byId("descBtn"),"hidden"),this.byId("editDescTextArea").innerHTML="",this.isEditDescHidden=!0,this.isShowingNow=this.isEditDescHidden&&this.isRenamingHidden},saveRptDesc:function(){this.report.setReportProperties({description:this.byId("description").value});var e=this.byId("description").value;this.byId("description").innerHTML=e,this.byId("hiddenDesc").value=this.byId("description").value,this.hideEditDesc()}})}),pen.define("analyzer/report/cv_rptLinkDlg",["analyzer/report/cv_rptDlg"],function(){dojo.declare("cv.LinkDialog",cv.Dialog,{constructor:function(e){this.report=e,this.dlgTemplate="linkDlg.html",this.prefix="AL_",this.dataSource=null,this.linkTypes=["FILE","URL"]},performAction:function(e){var t;for(var n=0;n<e.length;n++)if(e[n].clickLevel){t=e[n];break}var r=cv.util.parseMDXExpression(t.formula,!1),i=cv.util.parseMDXExpression(t.member,!1),s=this.report.getGem(t.formula),o=s.getLink(),u=o.getAttribute("target"),a=o.getAttribute("type");if(a=="URL"){var f=o.getAttribute("url");f=f.replace("{"+r+"}",encodeURIComponent(i)),this._openUrl(u,f,i)}else if(a=="FILE"){var l=o.getAttribute("fileSolution"),c=o.getAttribute("filePath"),h=o.getAttribute("fileName"),p=this._getSolutionFileXML(l,c,h);if(p==null){alert(cvCatalog.linkFileOpenError);return}var f=p.getAttribute("url"),d=o.selectNodes("cv:linkParam"),v=p.getAttribute("param-service-url"),m=null;if(d.length>0&&v){var v=p.getAttribute("param-service-url");m=this._getSolutionDocParams(v)}for(var n=0;n<d.length;++n){var g=d[n].getAttribute("name");f=f+"&"+encodeURIComponent(g)+"=";var y=d[n].getAttribute("value");y=this._substituteParam(y,e);if(m){var b=m.selectSingleNode('parameter[@name="'+g+'"]/values/value[@label="'+y+'"]');b&&(y=b.getAttribute("value"))}f+=encodeURIComponent(y)}this._openUrl(u,f,i)}else if(a=="DASHBOARD")for(var n=0;n<e.length;++n){t=e[n],i=cv.util.parseMDXExpression(t.member,!1);if(!(parent&&parent.Dashboards&&parent.encode_prepare)){alert("Unable to call Dashbords.fireChange on param "+t.formula+" with value "+i);return}parent.Dashboards.fireOutputParam(window,t.formula,parent.encode_prepare(i))}},_substituteParam:function(e,t){for(var n=0;n<t.length;++n){var r=t[n],i=cv.util.parseMDXExpression(r.formula,!1),s=cv.util.parseMDXExpression(r.member,!1);if(e=="{"+i+"}")return s}return e},_openUrl:function(e,t,n){if(e=="NEW_TAB"){if(console_enabled&&window.parent.mantle_openTab){window.parent.mantle_openTab(n,n,t);return}if(window.parent&&window.parent.parent&&window.parent.parent.mantle_openTab){window.parent.parent.mantle_openTab(n,n,t);return}}e=="CURRENT"?window.location=t:window.open(t)},show:function(){this.dataSource=this.report.currentSelection;if(!this.dataSource)return;var e=this.dataSource.getName();if(!this.load(e))return;dojo.connect(this.byId("enableCheckbox"),"onclick",cv.util,"onToggleSectionCheckbox"),dojo.connect(this.byId("linkType"),"onchange",this,"_changeType"),dojo.connect(this.byId("filePicker"),"onclick",this,"_openGwtRepositoryBrowser");var t=this.dataSource.getLink();if(t){var n=this.byId("linkType"),r=t.getAttribute("type");r=="URL"?(this.byId("urlInput").value=t.getAttribute("url"),this.byId("urlToolTip").value=t.getAttribute("toolTip"),cv.util.selectByValue(this.byId("urlTarget"),t.getAttribute("target"))):r=="FILE"&&(this.byId("fileLabel").value=t.getAttribute("fileLabel"),this.byId("fileName").value=t.getAttribute("fileName"),this.byId("filePath").value=t.getAttribute("filePath"),this.byId("fileSolution").value=t.getAttribute("fileSolution"),this.byId("fileToolTip").value=t.getAttribute("toolTip"),cv.util.selectByValue(this.byId("fileTarget"),t.getAttribute("target")),this._populateParameters(t.getAttribute("fileSolution"),t.getAttribute("filePath"),t.getAttribute("fileName"),t.selectNodes("cv:linkParam"))),cv.util.selectByValue(this.byId("linkType"),t.getAttribute("type"))}else cv.util.setSectionCollapsed("AL_enableCheckbox");this._changeType(),this.showDialog()},save:function(){if(dojo.byId("dlgBtnSave").disabled)return;if(this.byId("enableCheckbox").checked){var e=this.byId("linkType").value;if(!this._validateParameter(e))return;if(e=="URL"){var t={type:e,url:this.byId("urlInput").value,toolTip:this.byId("urlToolTip").value,target:this.byId("urlTarget").value};this.dataSource.setLink(t),this.report.history.add(new cv.ReportState("actionAdd","hyperlink"))}else if(e=="FILE"){var t={type:e,fileLabel:this.byId("fileLabel").value,fileName:this.byId("fileName").value,filePath:this.byId("filePath").value,fileSolution:this.byId("fileSolution").value,toolTip:this.byId("fileToolTip").value,target:this.byId("fileTarget").value},n=this.byId("linkParamsTable").rows,r={};for(var i=0;i<n.length;++i){if(!n[i].lastChild.firstChild.checked)continue;var s=n[i].lastChild.lastChild;r[s.name]=s.value}this.dataSource.setLink(t,r),this.report.history.add(new cv.ReportState("actionAdd","hyperlink"))}}else this.dataSource.removeLink(),this.report.history.add(new cv.ReportState("actionRemove","hyperlink"));cv.dlgWidget.hide(),this.report.reportStatus!="errorReportDefinition"&&this.report.refreshReport()},_openGwtRepositoryBrowser:function(e){zindex=dojo.style(dojo.byId("theDialog"),"z-index"),dojo.style(dojo.byId("theDialog"),"z-index","100");var t=this;openFileChooserDialog({fileSelected:function(e,n,r,i){t.byId("fileLabel").value=i,t.byId("fileSolution").value=e,t.byId("filePath").value=n,t.byId("fileName").value=r,t._populateParameters(e,n,r,null),dojo.style(dojo.byId("theDialog"),"z-index",zindex)},dialogCanceled:function(){dojo.style(dojo.byId("theDialog"),"z-index",zindex)}})},_changeType:function(e){var t=this.byId("linkType");for(var n=0;n<this.linkTypes.length;++n)this.linkTypes[n]==t.value?cv.util.show(this.prefix+this.linkTypes[n]):cv.util.hide(this.prefix+this.linkTypes[n])},_validateParameter:function(e){if(e=="URL"){if(!this.byId("urlInput").value)return this.displayError(cvCatalog.linkRequiredURL),this.setInvalidInputField("AL_urlInput"),!1}else if(e=="FILE"&&!this.byId("fileName").value)return this.displayError(cvCatalog.linkRequiredFile),this.setInvalidInputField("AL_fileLabel"),!1;return!0},_getSolutionDocParams:function(e){var t=null;return dojo.xhrPost({url:e,load:function(e){t=e},handleAs:"xml",sync:!0}),t.documentElement},_populateParameters:function(e,t,n,r){this.byId("fileLabelSpan").title=e+t+"/"+n;var i=this.byId("linkParamsTable");cv.util.hide("AL_linkParamsDiv");while(i.rows.length>0)i.deleteRow(0);var s=this._getSolutionFileXML(e,t,n);if(s==null){alert(cvCatalog.linkFileRemoved),this.byId("fileLabel").value="",this.byId("fileName").value="";return}var o=s.getAttribute("param-service-url");if(!o)return;var u=this._getSolutionDocParams(o).selectNodes("parameter"),a=!1;for(var f=0;f<u.length;++f){var l=u[f].selectSingleNode("attribute[@name='parameter-group']");if(!(!l||l.getAttribute("value")!="system"&&l.getAttribute("value")!="subscription"))continue;a=!0;var c=u[f].getAttribute("name"),h=null;l=u[f].selectSingleNode("attribute[@name='label']"),l?h=l.getAttribute("value"):h=c;var p=i.insertRow(i.rows.length),d=null,v=!1;if(r)for(var m=0;m<r.length;++m)if(r[m].getAttribute("name")==c){d=r[m].getAttribute("value"),v=!0;break}d||(h==this.dataSource.getName()?(d="{"+h+"}",v=!0):d="");var g=document.createElement("td");g.className="paramCell",p.appendChild(g),g.innerHTML=h,g=document.createElement("td"),g.className="valueCell",p.appendChild(g);var y=document.createElement("input");y.type="checkbox",g.appendChild(y),y=document.createElement("input"),y.name=c,y.type="text",y.size=40,y.value=d,g.appendChild(y),v?p.lastChild.firstChild.checked=!0:p.lastChild.lastChild.disabled=!0,dojo.connect(p.lastChild.firstChild,"onclick",this,"_toggleLinkParam")}a&&cv.util.show("AL_linkParamsDiv")},_toggleLinkParam:function(e){var t=e.target.checked,n=e.target.parentNode.lastChild;t?(n.disabled=!1,n.focus()):(n.value="",n.disabled=!0)},_getSolutionFileXML:function(e,t,n){var r=null;dojo.xhrPost({url:"../../SolutionRepositoryService?component=getSolutionRepositoryDoc",load:function(e){r=e},handleAs:"xml",sync:!0});var i=r.documentElement.selectSingleNode('file[@name="'+e+'"]');if(i==null)return;var s=t.split("/");for(var o=0;o<s.length;++o){if(s[o]=="")continue;i=i.selectSingleNode('file[@name="'+s[o]+'"]');if(i==null)return}return i=i.selectSingleNode('file[@name="'+n+'"]'),i}})}),dojo.require("dijit.Declaration"),dojo.require("dijit.ColorPalette"),pen.define("analyzer/report/cv_rptChartOptionsDlg",["analyzer/report/cv_rptLinkDlg"],function(){dojo.declare("cv.ChartOptionsDialog",cv.Dialog,{constructor:function(e){this.report=e,this.dlgTemplate="chartPropsDlg.html",this.prefix="CP_",this.originalOptions={},this.applied=!1,this.lastScale=0,this.lastScaleSecondary=0},show:function(){if(!this.load())return;var e=this.report.getVizDefiniton().maxValues,t=dojo.byId("CP_maxValues");t.options.length=0;for(var n=0;n<e.length;n++){var r=new Option(e[n],e[n]);t.add(r,null)}var i=this.report.reportDoc,s=i.getChartOptions().attributes;for(var n=0,o=s.length;s!=null&&n<o;++n)this.updateHtml(s[n].name,s[n].value),this.originalOptions[s[n].name]=s[n].value;this.toggleAutoRange({target:{id:"CP_autoRange"}}),this.toggleAutoRange({target:{id:"CP_autoRangeSecondary"}}),dojo.connect(this.byId("autoRange"),"onclick",this,"toggleAutoRange"),dojo.connect(this.byId("autoRangeSecondary"),"onclick",this,"toggleAutoRange"),dojo.connect(this.byId("labelColorDiv"),"onclick",this,"toggleColorPalette");var u=new dijit.ColorPalette({palette:"7x10"},dojo.byId("CP_labelColorPaletteWidget"));u.startup(),dojo.connect(u,"onChange",this,"selectColor"),dojo.style(this.byId("labelColorDiv"),"background-color",i.getChartOption("labelColor")),dojo.connect(this.byId("backgroundColorDiv"),"onclick",this,"toggleColorPalette"),u=new dijit.ColorPalette({palette:"7x10"},dojo.byId("CP_backgroundColorPaletteWidget")),u.startup(),dojo.connect(u,"onChange",this,"selectColor"),dojo.style(this.byId("backgroundColorDiv"),"background-color",i.getChartOption("backgroundColor")),dojo.connect(this.byId("backgroundColorEndDiv"),"onclick",this,"toggleColorPalette"),u=new dijit.ColorPalette({palette:"7x10"},dojo.byId("CP_backgroundColorEndPaletteWidget")),u.startup(),dojo.connect(u,"onChange",this,"selectColor"),dojo.style(this.byId("backgroundColorEndDiv"),"background-color",i.getChartOption("backgroundColorEnd")),dojo.connect(this.byId("legendColorDiv"),"onclick",this,"toggleColorPalette"),u=new dijit.ColorPalette({palette:"7x10"},dojo.byId("CP_legendColorPaletteWidget")),u.startup(),dojo.connect(u,"onChange",this,"selectColor"),dojo.style(this.byId("legendColorDiv"),"background-color",i.getChartOption("legendColor")),dojo.connect(this.byId("legendBackgroundColorDiv"),"onclick",this,"toggleColorPalette"),u=new dijit.ColorPalette({palette:"7x10"},dojo.byId("CP_legendBackgroundColorPaletteWidget")),u.startup(),dojo.connect(u,"onChange",this,"selectColor"),dojo.style(this.byId("legendBackgroundColorDiv"),"background-color",i.getChartOption("legendBackgroundColor")),dojo.connect(dojo.byId("dlgBtnApply"),"onclick",this,"apply"),dojo.connect(this.byId("backgroundFill"),"onchange",this,"toggleFillType"),this.toggleFillType(),this.lastScale=this.report.reportDoc.getChartOption("displayUnits"),this.lastScale=this.lastScale.substring(6),this.lastScaleSecondary=this.report.reportDoc.getChartOption("displayUnitsSecondary"),this.lastScaleSecondary=this.lastScaleSecondary.substring(6),dojo.connect(this.byId("displayUnits"),"onchange",this,"toggleDisplayUnits"),dojo.connect(this.byId("displayUnitsSecondary"),"onchange",this,"toggleDisplayUnits"),dojo.connect(dojo.byId("standardDialog"),"onclick",this,"hideColorPalettes"),this.showDialog()},save:function(e){var t=this.report.reportDoc,n=this.theForm.elements;if(!dojo.byId("CP_autoRange").checked&&!cv.util.checkNumber(dojo.byId("CP_valueAxisLowerLimit").value))return this.displayError(cvCatalog.dlgChartPropsAxisLimitError),this.setInvalidInputField("CP_valueAxisLowerLimit"),dojo.byId("CP_valueAxisLowerLimit").focus(),!1;if(!dojo.byId("CP_autoRange").checked&&!cv.util.checkNumber(dojo.byId("CP_valueAxisUpperLimit").value))return this.displayError(cvCatalog.dlgChartPropsAxisLimitError),this.setInvalidInputField("CP_valueAxisUpperLimit"),dojo.byId("CP_valueAxisUpperLimit").focus(),!1;if(!dojo.byId("CP_autoRangeSecondary").checked&&!cv.util.checkNumber(dojo.byId("CP_valueAxisLowerLimitSecondary").value))return this.displayError(cvCatalog.dlgChartPropsAxisLimitError),this.setInvalidInputField("CP_valueAxisLowerLimitSecondary"),dojo.byId("CP_valueAxisLowerLimitSecondary").focus(),!1;if(!dojo.byId("CP_autoRangeSecondary").checked&&!cv.util.checkNumber(dojo.byId("CP_valueAxisUpperLimitSecondary").value))return this.displayError(cvCatalog.dlgChartPropsAxisLimitError),this.setInvalidInputField("CP_valueAxisUpperLimitSecondary"),dojo.byId("CP_valueAxisUpperLimitSecondary").focus(),!1;for(var r=0;r<n.length;++r)if(n[r].tagName=="INPUT"||n[r].tagName=="SELECT"){if((n[r].id=="CP_valueAxisLowerLimit"||n[r].id=="CP_valueAxisUpperLimit")&&n[r].value=="")continue;if((n[r].id=="CP_valueAxisLowerLimitSecondary"||n[r].id=="CP_valueAxisUpperLimitSecondary")&&n[r].value=="")continue;this.updateXml(t.getChartOptions(),n[r])}e||(this.report.history.add(new cv.ReportState("actionChartProps")),cv.dlgWidget.hide()),this.report.reportStatus!="errorReportDefinition"&&this.report.refreshReport()},toggleAutoRange:function(e){var t="";e.target.id=="CP_autoRangeSecondary"&&(t="Secondary"),dojo.byId("CP_valueAxisLowerLimit"+t).disabled=dojo.byId("CP_autoRange"+t).checked,dojo.byId("CP_valueAxisUpperLimit"+t).disabled=dojo.byId("CP_autoRange"+t).checked},toggleColorPalette:function(e){var t=e.target.id.replace("Div","Palette");this.hideColorPalettes(),cv.util.show(t),e.preventDefault(),e.stopPropagation()},toggleFillType:function(){var e=dojo.byId("CP_backgroundFill").value;e=="NONE"?(cv.util.hide("CP_backgroundColorWrapper"),cv.util.hide("CP_backgroundColorEndWrapper")):e=="SOLID"?(cv.util.show("CP_backgroundColorWrapper"),cv.util.hide("CP_backgroundColorEndWrapper")):e=="GRADIENT"&&(cv.util.show("CP_backgroundColorWrapper"),cv.util.show("CP_backgroundColorEndWrapper"))},toggleDisplayUnits:function(e){if(e.target.id=="CP_displayUnits"){var t=dojo.byId("CP_displayUnits").value;t=t.substring(6);var n=this.lastScale-t;this.lastScale=t,dojo.byId("CP_valueAxisLowerLimit").value&&(dojo.byId("CP_valueAxisLowerLimit").value=dojo.byId("CP_valueAxisLowerLimit").value*Math.pow(10,n)),dojo.byId("CP_valueAxisUpperLimit").value&&(dojo.byId("CP_valueAxisUpperLimit").value=dojo.byId("CP_valueAxisUpperLimit").value*Math.pow(10,n))}else if(e.target.id=="CP_displayUnitsSecondary"){var t=dojo.byId("CP_displayUnitsSecondary").value;t=t.substring(6);var n=this.lastScaleSecondary-t;this.lastScaleSecondary=t,dojo.byId("CP_valueAxisLowerLimitSecondary").value&&(dojo.byId("CP_valueAxisLowerLimitSecondary").value=dojo.byId("CP_valueAxisLowerLimitSecondary").value*Math.pow(10,n)),dojo.byId("CP_valueAxisUpperLimitSecondary").value&&(dojo.byId("CP_valueAxisUpperLimitSecondary").value=dojo.byId("CP_valueAxisUpperLimitSecondary").value*Math.pow(10,n))}},selectColor:function(e){var t;cv.util.isHidden("CP_labelColorPalette")?cv.util.isHidden("CP_backgroundColorPalette")?cv.util.isHidden("CP_backgroundColorEndPalette")?cv.util.isHidden("CP_legendColorPalette")?cv.util.isHidden("CP_legendBackgroundColorPalette")||(t="CP_legendBackgroundColor"):t="CP_legendColor":t="CP_backgroundColorEnd":t="CP_backgroundColor":t="CP_labelColor",dojo.byId(t).value=e,dojo.style(dojo.byId(t+"Div"),"backgroundColor",e),cv.util.hide(t+"Palette")},hideColorPalettes:function(e){cv.util.hide("CP_labelColorPalette"),cv.util.hide("CP_backgroundColorPalette"),cv.util.hide("CP_backgroundColorEndPalette"),cv.util.hide("CP_legendBackgroundColorPalette"),cv.util.hide("CP_legendColorPalette")},apply:function(){this.save(!0),this.applied=!0},cancel:function(){if(this.applied){var e=this.report.reportDoc;for(var t in this.originalOptions)e.setChartOption(t,this.originalOptions[t]);this.report.refreshReport()}cv.Dialog.prototype.cancel.call(this)}})}),dojo.require("dijit.Declaration"),pen.define("analyzer/report/cv_rptPageSetupDlg",["analyzer/report/cv_rptLinkDlg"],function(){dojo.declare("cv.PageSetupDialog",cv.Dialog,{constructor:function(e){this.report=e,this.dlgTemplate="pageSetupDlg.html",this.prefix="",this.originalOptions={},this.isPDF=!1},showExcel:function(){if(!this.load())return;this.isPDF=!1,cv.util.hide("pdfPageSize"),cv.util.show("excelPageSize"),cv.util.show("excelScalingRow"),dojo.byId("pageSetupTitle").innerHTML=cvCatalog.dlgPageSetupExcelTitle,this._show()},showPDF:function(){if(!this.load())return;this.isPDF=!0,cv.util.show("pdfPageSize"),cv.util.hide("excelPageSize"),cv.util.hide("excelScalingRow"),dojo.byId("pageSetupTitle").innerHTML=cvCatalog.dlgPageSetupPDFTitle,this._show()},_show:function(){var e=this.report.reportDoc,t=e.getPageSetup().attributes;for(var n=0;n<t.length;++n)this.updateHtml(t[n].name,t[n].value),this.originalOptions[t[n].name]=t[n].value,this.isPDF&&t[n].name=="pdfOrientation"?this.setPortraitOrientation(t[n].value=="PORTRAIT"):!this.isPDF&&t[n].name=="excelOrientation"&&this.setPortraitOrientation(t[n].value=="PORTRAIT");dojo.byId("dlgBtnSave").disabled=!0;var r=this;dojo.connect(this.byId("orientationPortrait"),"onclick",this,function(){r.setPortraitOrientation(!0)}),dojo.connect(this.byId("orientationLandscape"),"onclick",this,function(){r.setPortraitOrientation(!1)}),dojo.connect(dojo.byId("dlgBtnDownload"),"onclick",this,"download"),dojo.connect(dojo.byId("excelPageSize"),"onchange",this,"enableDoneButton"),dojo.connect(dojo.byId("pdfPageSize"),"onchange",this,"enableDoneButton"),dojo.connect(dojo.byId("excelScalingPercent"),"onclick",this,"enableDoneButton"),dojo.connect(dojo.byId("excelScalingPageWide"),"onclick",this,"enableDoneButton"),dojo.connect(dojo.byId("excelScalingPageTall"),"onclick",this,"enableDoneButton");var i=this.theForm.excelScalingType;dojo.connect(i[0],"onclick",this,"enableDoneButton"),dojo.connect(i[1],"onclick",this,"enableDoneButton"),this.showDialog()},download:function(){if(!this._updatePageSetupXML())return;cv.dlgWidget.hide(),this.isPDF?this.report.getReportPDF(!0):this.report.getReportExcel(!0)},save:function(){if(!this._updatePageSetupXML())return;cv.dlgWidget.hide()},_updatePageSetupXML:function(){if(!cv.util.checkPositiveInteger(dojo.byId("excelScalingPercent").value))return this.displayError(cvCatalog.dlgSharedErrorPositiveInteger),this.setInvalidInputField("excelScalingPercent"),dojo.byId("excelScalingPercent").focus(),!1;if(!cv.util.checkPositiveInteger(dojo.byId("excelScalingPageWide").value))return this.displayError(cvCatalog.dlgSharedErrorPositiveInteger),this.setInvalidInputField("excelScalingPageWide"),dojo.byId("excelScalingPageWide").focus(),!1;if(!cv.util.checkPositiveInteger(dojo.byId("excelScalingPageTall").value))return this.displayError(cvCatalog.dlgSharedErrorPositiveInteger),this.setInvalidInputField("excelScalingPageTall"),dojo.byId("excelScalingPageTall").focus(),!1;var e=this.report.reportDoc,t=this.theForm.elements;for(var n=0;n<t.length;++n)(t[n].tagName=="INPUT"||t[n].tagName=="SELECT")&&this.updateXml(e.getPageSetup(),t[n]);var r=dojo.byId("orientationPortrait"),i=this.isPDF?"pdf":"excel";i+="Orientation",dojo.hasClass(r,"pageSetupDialogPortraitSelected")?e.setPageSetup(i,"PORTRAIT"):e.setPageSetup(i,"LANDSCAPE");var s=this.getRadioGroupValue("excelScalingType");return e.setPageSetup("excelScalingType",s),!0},setPortraitOrientation:function(e){var t=this.byId("orientationPortrait"),n=this.byId("orientationLandscape");e?(dojo.addClass(t,"pageSetupDialogPortraitSelected"),dojo.removeClass(n,"pageSetupDialogLandscapeSelected")):(dojo.addClass(n,"pageSetupDialogLandscapeSelected"),dojo.removeClass(t,"pageSetupDialogPortraitSelected")),this.enableDoneButton()},enableDoneButton:function(){dojo.byId("dlgBtnSave").disabled=!1},cancel:function(){var e=this.report.reportDoc;for(var t in this.originalOptions)e.setPageSetup(t,this.originalOptions[t]);cv.Dialog.prototype.cancel.call(this)}})}),dojo.require("dojox.collections.Dictionary"),dojo.require("dojox.collections.ArrayList"),pen.define("analyzer/report/cv_rptFilterDlg",["analyzer/report/cv_rptDlg"],function(){dojo.declare("cv.FilterDialog",cv.Dialog,{constructor:function(e){this.report=e,this.dlgTemplate=null,this.prefix="FT_",this.filterTypes=["FILTER_METRIC","FILTER_PICKLIST","FILTER_MATCH","FILTER_PRESET","FILTER_RANGE"]},destroy:function(){this.clear()},clear:function(){this.gem=null,this.type=null,this.attribute=null,this.attributeType=null,this.isTimeAttribute=!1,this.metric=null,this.ordinal=0,this.filterProps=null,this.parentFilterMsg=null,this.asyncRequestId=null,this.asyncMode=!1,this.searchCache=new Array(30),this.searchCacheTopIndex=-1,this.searchRequestId=null,this.valueListNode=null,this.search=null},show:function(e,t){if(dojo.isString(e)&&e.indexOf("filter_metric")==0)return this.showMetricFilter();if(cv.getFieldHelp().get(e,"type")=="NUMBER"||dojo.isString(e)&&e.indexOf("[MEASURE:")==0)return this.showMetricFilter(e);this.clear();if(e.indexOf("filter_")==0){var n=/^filter_(.+)_(\d)$/,r=n.exec(e);if(!r)return!1;this.attribute=r[1],this.ordinal=r[2]}else this.attribute=e,t=parseInt(t),!isNaN(t)&&t>0&&(this.ordinal=t);this.attributeType=cv.getFieldHelp().get(this.attribute,"type");if(!this.attributeType)return;this.isTimeAttribute=cv.getFieldHelp().isTimeAttribute(this.attribute),this.gem=this.report.getGem("filter_"+this.attribute);if(this.gem)this.filterProps=this.report.reportDoc.getFilterProps(this.gem.xmlNode);else{if(!this.report.getGem(this.attribute)){var i=this.report.getTrendNumberOnAncestors(this.attribute);if(i)return this.showError(["errorAddFilterWithTrendOnAncestor",this.report.getFieldLabel(this.attribute),this.report.getFieldLabel(i.ancestor),i.trend.getDisplayLabel()]),!1}this.filterProps={type:this.type,formula:this.attribute,predicates:new dojox.collections.Dictionary}}if(this.ordinal==0)this.type=this.isTimeAttribute?"FILTER_PRESET":"FILTER_PICKLIST";else{var s=this.filterProps.predicates.item(this.ordinal)[0];switch(s.op){case"CONTAIN":case"NOT_CONTAIN":this.type="FILTER_MATCH";break;case"BEFORE":case"AFTER":case"BETWEEN":this.type="FILTER_RANGE";break;case"EQUAL":case"NOT_EQUAL":this.type=this.isTimeAttribute&&s.preset?"FILTER_PRESET":"FILTER_PICKLIST";break;case"TIME_YAGO":case"TIME_AHEAD":case"TIME_AGO":case"TIME_RANGE_NEXT":case"TIME_RANGE_PREV":this.type="FILTER_PRESET";break;default:return}}this.dlgTemplate="filterPredicateDlg.html",this.helpTopic="CV/Business_User/working_with_filters.html#filters_on_text_fields";var o=this.report.getFieldLabel(this.attribute)?this.report.getFieldLabel(this.attribute):this.report.getFieldLabelPlural(this.attribute),u=cv.getFieldHelp().get(this.attribute,"type"),a;u=="TIME_DATE"?a=this.load(o,"Today","Yesterday","Tomorrow"):a=this.load(o,"Current "+o,"Previous "+o,"Next "+o);if(!a){this.report.showReportStatus(this.status);return}var f=dojo.byId(this.isTimeAttribute?"FT_filterTypeText":"FT_filterTypeTime");cv.util.removeNode(f),f=dojo.byId(this.isTimeAttribute?"FT_filterTypeTime":"FT_filterTypeText"),dojo.connect(f,"onclick",this,"_setFilterType"),this.valueListNode=dojo.byId("FT_valueList"),cv.util.disableTextSelection(this.valueListNode);if(!this.report.manager.applyReportContextInFilterDialog){var l=cv.getFieldHelp().getHierarchy(this.attribute);if(l){var c=null;for(var h=0;l&&h<l.length;++h){var p=l[h];if(p==this.attribute)break;this.report.getGem("filter_"+p)&&(c=p)}this.parentFilterMsg=c?cv.util.substituteParams(cvCatalog.dlgInfoFilterOnParent,this.report.getFieldLabel(c)):null}}if(!this._setFilterType(this.type))return;this.showDialog()},save:function(){if(dojo.byId("dlgBtnSave").disabled)return;if(!this._validateParameter())return;var e=!1;switch(this.type){case"FILTER_METRIC":e=this._saveMetricFilter();break;case"FILTER_PICKLIST":e=this._savePicklistFilter(!0);break;case"FILTER_MATCH":e=this._saveMatchFilter(!0);break;case"FILTER_PRESET":e=this._savePresetFilter(!0);break;case"FILTER_RANGE":e=this._saveRangeFilter(!0);break;default:return}if(!e)return;cv.dlgWidget.hide(),this.filterProps&&(this.report.reportDoc.updateFilter(this.filterProps),this.report.populateFilters(),this.report.resizeContainer(),this.report.history.add(new cv.ReportState("actionEditFilter")),this.report.reportStatus!="errorReportDefinition"&&this.report.refreshReport(),this.valueListNode=null)},showAttrSelection:function(e,t,n){var r=this.report.getGem("filter_"+e);if(!r)return;if(this.report.mode=="EDIT")return this.show(e,t);this.type="filter_selection",this.attribute=e,this.dlgTemplate="filterAttrViewDlg.html",this.helpTopic=null;if(!this.load(this.report.getFieldLabel(e),n))return;var i=dojo.byId("FT_memberList"),s=this.report.reportDoc.getFilterProps(r.xmlNode);i.innerHTML=this._formatValueList(s.predicates.item(t)[0].members,"SELECTED"),this.showDialog()},showSelectionFilter:function(e){this.type="filter_selection",this.attribute="foo",this.dlgTemplate="filterSelectionViewDlg.html",this.helpTopic=null;var t="",n=this.report.reportDoc.getSelectionFilters(),r=0;for(var i=0;i<n.length;i++){var s=n[i];if(s.getAttribute("op")!=e)continue;var o=s.selectNodes("cv:selectionMember"),u="";for(var a=0;a<o.length;a++){var f=o[a].getAttribute("member");a!=0&&(u+=" and "),u+=cv.util.parseMDXExpression(f,!0)}t+="<div>"+u+"</div>",r++}if(!this.load(cvCatalog["dlgSelectionFilterTitle"+e],r))return;var l=dojo.byId("FT_memberList");l.innerHTML=t,this.showDialog()},_setFilterType:function(e){var t=!0,n=null;if(dojo.isString(e)&&e.indexOf("FILTER_")==0)this.type=e,this.updateHtml("filterType",e);else{if(!e.target)return;if(e.target.tagName=="INPUT")this.type=this.getRadioGroupValue("FT_filterType");else if(e.target.tagName=="A"){switch(e.target.id){case"FT_filterOp_PRESET_EQUAL":case"FT_filterOp_PRESET_NOT_EQUAL":this.type="FILTER_PRESET",n=e.target.id.substr(19);break;case"FT_filterOp_EQUAL":case"FT_filterOp_NOT_EQUAL":this.type="FILTER_PICKLIST",n=e.target.id.substr(12);break;case"FT_filterOp_CONTAIN":case"FT_filterOp_NOT_CONTAIN":this.type="FILTER_MATCH",n=e.target.id.substr(12);break;case"FT_filterOp_AFTER":case"FT_filterOp_BEFORE":case"FT_filterOp_BETWEEN":this.type="FILTER_RANGE",this.type="FILTER_RANGE",n=e.target.id.substr(12);break;default:return t}this.updateHtml("filterType",this.type)}}this._showFilterTab();switch(this.type){case"FILTER_PICKLIST":t=this._initPicklistFilter(n);break;case"FILTER_MATCH":t=this._initMatchFilter(n);break;case"FILTER_PRESET":t=this._initPresetFilter(n);break;case"FILTER_RANGE":t=this._initRangeFilter(n);break;default:}return t},_showFilterTab:function(){for(var e=1;e<this.filterTypes.length;++e)this.filterTypes[e]==this.type?cv.util.show(this.prefix+this.filterTypes[e]):cv.util.hide(this.prefix+this.filterTypes[e])},_initPresetFilter:function(e){this.defaultMsg=null,this.displayMsg();var t,n,r,i,s;if(this.ordinal>0){var o=this.filterProps.predicates.item(this.ordinal);for(var u=0;u<o.length;u++){t=o[u],n=t.op,r=t.preset,t.parameterName&&this._setParameterName(t.parameterName);if(!r&&n!="TIME_YAGO")continue;switch(n){case"EQUAL":var a=r.split(",");for(var f=0;f<a.length;++f)a[f]=="-1"?i=dojo.byId("FT_PREVIOUS_TIME"):a[f]=="0"?i=dojo.byId("FT_CURRENT_TIME"):a[f]=="-4"||a[f]=="-12"?i=dojo.byId("FT_TIME_YAGO"):i=dojo.byId("FT_NEXT_TIME"),i.checked=!0;break;case"TIME_YAGO":dojo.byId("FT_TIME_YAGO").checked=!0;break;case"TIME_RANGE_PREV":dojo.byId("FT_TIME_RANGE_PREV").checked=!0,dojo.byId("FT_TIME_RANGE_PREV_NUM").value=r;break;case"TIME_AGO":dojo.byId("FT_TIME_AGO").checked=!0,dojo.byId("FT_TIME_AGO_NUM").value=r;break;case"TIME_RANGE_NEXT":dojo.byId("FT_TIME_RANGE_NEXT").checked=!0,dojo.byId("FT_TIME_RANGE_NEXT_NUM").value=r;break;case"TIME_AHEAD":dojo.byId("FT_TIME_AHEAD").checked=!0,dojo.byId("FT_TIME_AHEAD_NUM").value=r;break;default:}}}return i=dojo.byId("FT_TIME_RANGE_PREV"),dojo.byId("FT_TIME_RANGE_PREV_NUM").disabled=!i.checked,dojo.connect(i,"onclick",this,"_switchPreset"),i=dojo.byId("FT_TIME_AGO"),dojo.byId("FT_TIME_AGO_NUM").disabled=!i.checked,dojo.connect(i,"onclick",this,"_switchPreset"),i=dojo.byId("FT_TIME_RANGE_NEXT"),dojo.byId("FT_TIME_RANGE_NEXT_NUM").disabled=!i.checked,dojo.connect(i,"onclick",this,"_switchPreset"),i=dojo.byId("FT_TIME_AHEAD"),dojo.byId("FT_TIME_AHEAD_NUM").disabled=!i.checked,dojo.connect(i,"onclick",this,"_switchPreset"),cv.util.show("FT_PARAMETER"),dojo.connect(dojo.byId("FT_PARAMETER_ENABLE"),"onclick",this,"_toggleParameterCheckbox"),this.attributeType=="TIME_YEAR"?dojo.addClass(dojo.byId("TD_FT_TIME_YAGO"),"hidden"):dojo.removeClass(dojo.byId("TD_FT_TIME_YAGO"),"hidden"),!0},_switchPreset:function(e){var t=e.target.id,n=e.target.checked,r;switch(t){case"FT_TIME_RANGE_PREV":r=dojo.byId("FT_TIME_RANGE_PREV_NUM");break;case"FT_TIME_AGO":r=dojo.byId("FT_TIME_AGO_NUM");break;case"FT_TIME_RANGE_NEXT":r=dojo.byId("FT_TIME_RANGE_NEXT_NUM");break;case"FT_TIME_AHEAD":r=dojo.byId("FT_TIME_AHEAD_NUM")}n?(r.disabled=!1,r.focus()):(r.value="",r.disabled=!0,dojo.removeClass(r,"inputNum invalid"))},_savePresetFilter:function(){if(dojo.byId("FT_TIME_RANGE_PREV").checked&&!this._validatePreset(dojo.byId("FT_TIME_RANGE_PREV_NUM").value))return dojo.byId("FT_TIME_RANGE_PREV_NUM").focus(),dojo.addClass(dojo.byId("FT_TIME_RANGE_PREV_NUM"),"inputNum invalid"),!1;if(dojo.byId("FT_TIME_AGO").checked&&!this._validatePreset(dojo.byId("FT_TIME_AGO_NUM").value))return dojo.byId("FT_TIME_AGO_NUM").focus(),dojo.addClass(dojo.byId("FT_TIME_AGO_NUM"),"inputNum invalid"),!1;if(dojo.byId("FT_TIME_RANGE_NEXT").checked&&!this._validatePreset(dojo.byId("FT_TIME_RANGE_NEXT_NUM").value))return dojo.byId("FT_TIME_RANGE_NEXT_NUM").focus(),dojo.addClass(dojo.byId("FT_TIME_RANGE_NEXT_NUM"),"inputNum invalid"),!1;if(dojo.byId("FT_TIME_AHEAD").checked&&!this._validatePreset(dojo.byId("FT_TIME_AHEAD_NUM").value))return dojo.byId("FT_TIME_AHEAD_NUM").focus(),dojo.addClass(dojo.byId("FT_TIME_AHEAD_NUM"),"inputNum invalid"),!1;if(!dojo.byId("FT_TIME_RANGE_PREV").checked&&!dojo.byId("FT_TIME_AGO").checked&&!dojo.byId("FT_TIME_RANGE_NEXT").checked&&!dojo.byId("FT_CURRENT_TIME").checked&&!dojo.byId("FT_PREVIOUS_TIME").checked&&!dojo.byId("FT_NEXT_TIME").checked&&!dojo.byId("FT_TIME_AHEAD").checked&&(dojo.byId("TD_FT_TIME_YAGO").className=="hidden"||dojo.byId("TD_FT_TIME_YAGO").className!="hidden"&&!dojo.byId("FT_TIME_YAGO").checked))return this.report.removeFilter("filter_"+this.filterProps.formula+"_"+this.ordinal),!1;var e;dojo.byId("FT_PREVIOUS_TIME").checked&&(e="-1"),dojo.byId("FT_CURRENT_TIME").checked&&(e=e?e+",0":"0"),dojo.byId("FT_NEXT_TIME").checked&&(e=e?e+",1":"1");var t=[];return e&&t.push({ordinal:this.ordinal,op:"EQUAL",preset:e,rela_filter:1}),dojo.byId("FT_TIME_YAGO").checked&&t.push({ordinal:this.ordinal,op:dojo.byId("FT_TIME_YAGO").value,rela_filter:1}),dojo.byId("FT_TIME_RANGE_PREV").checked&&t.push({ordinal:this.ordinal,op:dojo.byId("FT_TIME_RANGE_PREV").value,preset:dojo.byId("FT_TIME_RANGE_PREV_NUM").value,rela_filter:1}),dojo.byId("FT_TIME_RANGE_NEXT").checked&&t.push({ordinal:this.ordinal,op:dojo.byId("FT_TIME_RANGE_NEXT").value,preset:dojo.byId("FT_TIME_RANGE_NEXT_NUM").value,rela_filter:1}),dojo.byId("FT_TIME_AGO").checked&&t.push({ordinal:this.ordinal,op:dojo.byId("FT_TIME_AGO").value,preset:dojo.byId("FT_TIME_AGO_NUM").value,rela_filter:1}),dojo.byId("FT_TIME_AHEAD").checked&&t.push({ordinal:this.ordinal,op:dojo.byId("FT_TIME_AHEAD").value,preset:dojo.byId("FT_TIME_AHEAD_NUM").value,rela_filter:1}),t.length>0&&(t[0].parameterName=dojo.byId("FT_PARAMETER_NAME").value,this.report.updateRelativeFilterProps(this.filterProps,t)),!0},_validatePreset:function(e){return!cv.util.checkNumber(e)||parseInt(e)<=0||parseInt(e)>180?(this.displayError("Please input a number between 1 and 180"),!1):!0},_setPresetMenu:function(e){if(e.childNodes.length>1)return;e.innerHTML="";var t=cvCatalog["filterPreset"+this.attributeType];for(var n in t)cv.addOption(e,new Option(t[n],n));e.childNodes[0].selected=!0},_initRangeFilter:function(e){return cv.util.hide("FT_PARAMETER"),this.defaultMsg=this.parentFilterMsg,this.displayMsg(),setTimeout(dojo.hitch(this,"_loadRangeFilter"),0,e),!0},_loadRangeFilter:function(e){this.asyncMode=!0,this._loadAttributeMembers();var t=dojo.byId("FT_rangeOp");if(t.disabled)return;var n=dojo.byId("FT_range1"),r=dojo.byId("FT_range2");dojo.connect(t,"onchange",this,"_onChangeRangeOp");var i=this.ordinal>0?this.filterProps.predicates.item(this.ordinal)[0]:null;!i||i.op!="BETWEEN"&&i.op!="AFTER"&&i.op!="BEFORE"?(n.options[0].selected=!0,r.options[r.options.length-1].selected=!0):(t.value=i.op,n.value=i.members[0].formula,i.op=="BETWEEN"?r.value=i.members[1].formula:r.options[r.options.length-1].selected=!0),e&&(t.value=e),this._onChangeRangeOp()},_saveRangeFilter:function(){var e=dojo.byId("FT_rangeOp").value,t=dojo.byId("FT_range1").options[dojo.byId("FT_range1").selectedIndex],n=[{formula:t.value,caption:t.text}];return n[0]?(e=="BETWEEN"&&(t=dojo.byId("FT_range2").options[dojo.byId("FT_range2").selectedIndex],n.push({formula:t.value,caption:t.text})),this.report.updateFilterProps(this.filterProps,{ordinal:this.ordinal,op:e,preset:null,members:n}),!0):(this.displayMsg(cvCatalog.dlgErrFilterInvalidValue),!1)},_onChangeRangeOp:function(){!cv.util.isHidden("FT_range1_row")&&dojo.byId("FT_rangeOp").value=="BETWEEN"?cv.util.show("FT_range2_row"):cv.util.hide("FT_range2_row")},_initPicklistFilter:function(e){this.defaultMsg=this.parentFilterMsg,this.displayMsg(),this.memberListNode=dojo.byId("FT_memberList"),cv.util.disableTextSelection(this.memberListNode),this.search=dojo.byId("FT_searchText"),this.asyncMode=!1,this._loadAttributeMembers();var t=dojo.byId("FT_picklistOp");dojo.connect(t,"onchange",this,"_onChangePicklistOp"),dojo.connect(this.valueListNode,"onclick",this,"_onClickList"),dojo.connect(this.valueListNode,"ondblclick",this,"_addMembers"),dojo.connect(this.memberListNode,"onclick",this,"_onClickList"),dojo.connect(this.memberListNode,"ondblclick",this,"_removeMembers"),dojo.connect(dojo.byId("FT_searchBy"),"onclick",this,"_searchValueList"),dojo.connect(dojo.byId("FT_select_add"),"onclick",this,"_addMembers"),dojo.connect(dojo.byId("FT_select_addAll"),"onclick",this,"_addMembers"),dojo.connect(dojo.byId("FT_select_remove"),"onclick",this,"_removeMembers"),dojo.connect(dojo.byId("FT_select_removeAll"),"onclick",this,"_removeMembers"),dojo.connect(dojo.byId("FT_PARAMETER_ENABLE"),"onclick",this,"_toggleParameterCheckbox"),cv.util.show("FT_PARAMETER");var n=this.ordinal>0?this.filterProps.predicates.item(this.ordinal)[0]:null;return n&&(n.op=="EQUAL"||n.op=="NOT_EQUAL")&&!n.preset&&(t.value=n.op,this.memberListNode.innerHTML=this._formatValueList(n.members,"SELECTED"),n.parameterName&&this._setParameterName(n.parameterName)),e&&(t.value=e),t.value||(t.options[0].selected=!0),this._onChangePicklistOp(),!0},_savePicklistFilter:function(){var e=this._getSelectionList();if(e.count==0)return this.displayMsg(cvCatalog.dlgErrFilterNoSelection),!1;var t=this.report.updateFilterProps(this.filterProps,{ordinal:this.ordinal,op:dojo.byId("FT_picklistOp").value,members:e.toArray()});return t.parameterName=dojo.byId("FT_PARAMETER_NAME").value,t.members.length>cvConst.MAX_FILTER_MEMBERS?(this.displayMsg(cvCatalog.dlgErrFilterMaxMembers,cvConst.MAX_FILTER_MEMBERS),t.ordinal>0&&t.ordinal!=this.ordinal&&(this.memberListNode.innerHTML=this._formatValueList(t.members,"SELECTED"),this.ordinal=t.ordinal),!1):!0},_onChangePicklistOp:function(){dojo.removeClass(this.memberListNode,"excluded"),dojo.removeClass(this.memberListNode,"included");var e=dojo.byId("FT_picklistOp").value=="EQUAL"?"included":"excluded";dojo.addClass(this.memberListNode,e)},_addMembers:function(e){if(!dojo.isObject(this.searchCache[0]))return;var t;switch(e.target.id){case"FT_select_add":if(!this.valueListNode.selection)return;t=this.valueListNode.selection.toArray();break;case"FT_select_addAll":t=this.valueListNode.getElementsByTagName("DIV");break;default:if(e.target.id.indexOf("FT_AVA_")!=0)return;t=[e.target]}if(t.length==0)return;var n=this._getSelectionList(),r=n.count,i={};for(var s=0;s<r;++s)i[n.item(s).formula]=!0;for(var s=0;s<t.length;++s){var o=t[s];if(!o.id)continue;var u=o.id.substring(7);while(u&&u.indexOf('"')>-1)u=u.replace('"',"&quot;");if(i[u])continue;var a=dojo.create("div",{id:"FT_SEL_"+u,title:u,innerHTML:o.innerHTML});this.memberListNode.appendChild(a),++r}r>cvConst.MAX_FILTER_MEMBERS&&this.displayMsg(cvCatalog.dlgErrFilterMaxMembers,cvConst.MAX_FILTER_MEMBERS),dojo.byId("FT_memberListStat").innerHTML=cv.util.substituteParams(cvCatalog[r<=1?"filterSelectionSummarySingle":"filterSelectionSummaryAll"],r)},_removeMembers:function(e){var t=this.memberListNode.getElementsByTagName("DIV"),n=t.length;switch(e.target.id){case"FT_select_remove":if(!this.memberListNode.selection)return;var t=this.memberListNode.selection.toArray();n-=t.length;break;case"FT_select_removeAll":n=0;break;default:if(e.target.id.indexOf("FT_SEL_")!=0)return;t=[e.target],--n}if(t.length==0)return!1;for(var r=t.length-1;r>=0;--r)this.memberListNode.removeChild(t[r]),this.memberListNode.selection&&this.memberListNode.selection.clear();return dojo.byId("FT_memberListStat").innerHTML=cv.util.substituteParams(cvCatalog[n<=1?"filterSelectionSummarySingle":"filterSelectionSummaryAll"],n),!1},_onClickList:function(e){var t=e.target;t.id=="FT_valueList"&&t.focus();var n=cv.util.getAncestorByClass(t,"selectableList");if(!n||n==t)return;if(n.selection)for(var r=0,i=n.selection.count;r<i;++r)dojo.removeClass(n.selection.item(r),"selected");if(!n.selection||!(e.ctrlKey||e.shiftKey||e.metaKey))n.selection?n.selection.clear():n.selection=new dojox.collections.ArrayList,n.selection.add(t);else if(e.ctrlKey||e.metaKey)n.selection.contains(t)?n.selection.remove(t):n.selection.add(t);else if(e.shiftKey){var s=n.selection.item(0),o,u;dojo.position(s,!0).y>dojo.position(t,!0).y?(o=t,u=s):(o=s,u=t);var a=n.getElementsByTagName("DIV"),f=!1;n.selection.clear(),n.selection.add(s);for(var r=0,i=a.length;r<i;++r){a[r]==o&&(f=!0),f&&a[r]!=s&&(n.selection.add(a[r]),dojo.addClass(t,"selected"));if(a[r]==u)break}}for(var r=0,i=n.selection.count;r<i;++r)dojo.addClass(n.selection.item(r),"selected")},_loadAttributeMembers:function(){if(dojo.isObject(this.searchCache[0]))return;this.valueListNode.innerHTML="<span style='margin-left:5px'><img src='images/indicator_circle_ball.gif'>&nbsp;"+cvCatalog.progressLoading+"</span>",this.searchRequestId=this.asyncRequestId=this._initGetMembersRequest(""),this.asyncRequestId&&this._getMembers({requestId:this.asyncRequestId,timeout:1,search:""})},_searchValueList:function(e){var t=this.search.value,n=t?t.length:0;t&&(t=t.toLowerCase());var r=this.searchCache[n];this.valueListNode.selection&&this.valueListNode.selection.clear();if(!r||n!=0&&r.key!=t)if(this.searchCacheTopIndex==0||this.searchCacheTopIndex>0&&t&&t.indexOf(this.searchCache[this.searchCacheTopIndex].key)>=0){var i=this.searchCache[this.searchCacheTopIndex].data,s=[];for(var o=0,u=i.length;o<u;++o)cv.util.escapeHtml(i[o].caption).toLowerCase().indexOf(t)>=0&&s.push(i[o]);this.searchCache[t.length]={key:t,data:s},this.valueListNode.innerHTML=this._formatValueList(s,"AVAILABLE")}else this.searchRequestId&&cv.io.cancelAsyncRequest(this.searchRequestId),this.valueListNode.innerHTML="<span style='margin-left:5px'><img src='images/indicator_circle_ball.gif'>&nbsp;"+cvCatalog.progressLoading+"</span>",this.searchRequestId=this._initGetMembersRequest(t),this.searchRequestId&&this._getMembers({requestId:this.searchRequestId,timeout:1,search:t});else this.valueListNode.innerHTML=this._formatValueList(r.data,"AVAILABLE",r.count);return e.preventDefault(),e.stopPropagation(),!1},_initGetMembersRequest:function(e){return cv.io.initAsyncRequest({reportXML:this.report.getReportXml(),action:"MEMBERS",attribute:this.attribute,search:e})},_getMembers:function(e){var t=this;e.time=(new Date).getTime(),this.asyncRequest=dojo.xhrPost({url:cv.contextPath+"ajax/getMembers",content:e,load:function(n){if(!cv.dlgWidget.open)return;t.status=null;if(t.searchRequestId&&t.searchRequestId!=e.requestId)return;if(n){t.asyncRequestId=t.asyncRequest=t.searchRequestId=null,t.searchCacheTopIndex=!n.count||n.values.length==n.count?e.search.length:-1;if(e.search.length>0)t.searchCache[e.search.length]={key:e.search,data:n.values,count:n.count};else{t.searchCache[0]={key:null,data:n.values,count:n.count};if(t.isTimeAttribute){var r=dojo.byId("FT_range1"),i=dojo.byId("FT_range2");r.innerHTML=i.innerHTML="",cv.util.hide("FT_rangeLoading"),cv.util.show("FT_range1_row","FT_range2_row");for(var s=0,o=n.values.length;s<o;++s){var u=cv.util.escapeHtml(n.values[s].caption),a=n.values[s].formula;cv.addOption(r,new Option(u,a)),cv.addOption(i,new Option(u,a))}n.values.length<n.count&&(cv.util.show("FT_rangeWarning"),dojo.byId("FT_rangeWarningText").innerHTML=cv.util.substituteParams(cvCatalog.dlgAttributeFilterTooManyValues,n.values.length))}}t.valueListNode.innerHTML=t._formatValueList(n.values,"AVAILABLE",n.count)}else e.timeout=1,t.asyncRequest=null,setTimeout(dojo.hitch(t,"_getMembers",e),3e3);t.status&&t.displayMsg(cvCatalog[t.status])},error:function(e){t.asyncRequestId=t.asyncRequest=t.searchRequestId=null,t.status="dlgErrGeneric",t.displayMsg(cvCatalog[t.status])},handleAs:"json",sync:this.asyncMode,headers:{"Content-Encoding":"utf8"}})},_formatValueList:function(e,t,n){var r=e?e.length:0,i,s="",o;t=="SELECTED"?(i=dojo.byId("FT_memberListStat"),o="filterSelectionSummary"):(i=dojo.byId("FT_valueListStat"),o=this.search&&this.search.value?"filterMatchesSummary":"filterValuesSummary"),i&&(!n||n>=0&&n<=r?i.innerHTML=cv.util.substituteParams(cvCatalog[o+(r<=1?"Single":"All")],r):i.innerHTML=cv.util.substituteParams(cvCatalog[o+(n==-1?"PartialFirst":"Partial")],r,n));for(var u=0;u<r;++u){var a=cv.util.escapeHtml(e[u].formula),f=cv.util.escapeHtml(e[u].caption);t=="SELECTED"?s+='<div id="FT_SEL_':t=="AVAILABLE"&&(s+='<div id="FT_AVA_'),s+=a+'" title="'+a+'">'+f+"</div>"}return n>r&&(s+="<div style='font-size:92%'>"+cvCatalog.filterHintForFind+"</div>"),s},_getSelectionList:function(){var e=this.memberListNode.getElementsByTagName("DIV"),t=new dojox.collections.ArrayList;for(var n=0,r=e.length;n<r;++n)t.add({formula:e[n].id.substring(7),caption:dojox.xml.parser.textContent(e[n])});return t},_initMatchFilter:function(e){this.defaultMsg=null,this.displayMsg();var t=dojo.byId("FT_matchOp"),n=dojo.byId("FT_FILTER_MATCH");dojo.connect(n,"onclick",this,"_onClickMatchTbl"),dojo.connect(dojo.byId("FT_exp_add"),"onclick",this,"_addExpressionItem"),dojo.connect(dojo.byId("FT_PARAMETER_ENABLE"),"onclick",this,"_toggleParameterCheckbox"),cv.util.show("FT_PARAMETER"),this.defaultFocus=dojo.byId("FT_expression_0");var r=this.ordinal>0?this.filterProps.predicates.item(this.ordinal)[0]:null;if(r&&(r.op=="CONTAIN"||r.op=="NOT_CONTAIN")){t.value=r.op;if(r.exp)for(var i=0;i<r.exp.length;++i)this._createExpressionItem(r.exp[i],i+"");r.parameterName&&this._setParameterName(r.parameterName)}return e&&(t.value=e),t.value||(t.options[0].selected=!0),!0},_saveMatchFilter:function(){var e=this._getExpressionList();if(e.length==0)return this.displayMsg(cvCatalog.dlgErrFilterRequiredExpression),!1;var t=this.report.updateFilterProps(this.filterProps,{ordinal:this.ordinal,op:dojo.byId("FT_matchOp").value,exp:e});t.parameterName=dojo.byId("FT_PARAMETER_NAME").value;if(t.exp.length>cvConst.MAX_FILTER_EXPRESSIONS){this.displayMsg(cvCatalog.dlgErrFilterMaxExpressions,cvConst.MAX_FILTER_EXPRESSIONS);if(t.ordinal>0&&t.ordinal!=this.ordinal){for(var n=0;n<cvConst.MAX_FILTER_EXPRESSIONS;++n)this._createExpressionItem(t.exp[n],n+"");this.ordinal=t.ordinal}return!1}return!0},_addExpressionItem:function(){var e=dojo.byId("FT_FILTER_MATCH");if(e.rows.length==cvConst.MAX_FILTER_EXPRESSIONS+1){this.displayMsg(cvCatalog.dlgErrFilterMaxExpressions,cvConst.MAX_FILTER_EXPRESSIONS);return}this._createExpressionItem()},_onClickMatchTbl:function(e){if(!e.target||!e.target.id)return;var t=e.target.id;if(t.indexOf("FT_exp_remove_")==0){var n=dojo.byId("FT_FILTER_MATCH"),r=n.rows.length;if(r==2)return;t=parseInt(t.substr(14));for(var i=t;i<r-2;++i)dojo.byId("FT_expression_"+i).value=dojo.byId("FT_expression_"+(i+1)).value;r==3&&dojo.removeClass(n,"FT_multiExp"),n.deleteRow(r-2)}},_getExpressionList:function(){var e=[];for(var t=0,n=dojo.byId("FT_FILTER_MATCH").rows.length-1;t<n;++t){var r=dojo.byId("FT_expression_"+t).value;r&&e.push(r)}return e},_createExpressionItem:function(e,t){var n=dojo.byId("FT_FILTER_MATCH");t&&(t=dojo.byId("FT_expression_"+t));if(!t){t=n.rows.length-1;var r=n.insertRow(t),i=r.insertCell(0);i.innerHTML=cvCatalog.filterTemplateExpressionOR,i.className="FT_expressionOR",i=r.insertCell(1),i.innerHTML='<input type="text" id="FT_expression_'+t+'">',i.className="FT_expression",i=r.insertCell(2),i.innerHTML="&nbsp;",i.id="FT_exp_remove_"+t,i.className="FT_removeExp",n.rows.length==3&&dojo.addClass(n,"FT_multiExp"),t=dojo.byId("FT_expression_"+t)}e&&(t.value=e)},_setParameterName:function(e){dojo.byId("FT_PARAMETER_ENABLE").checked=!0,dojo.byId("FT_PARAMETER_NAME").disabled=!1,dojo.byId("FT_PARAMETER_NAME").value=e},_toggleParameterCheckbox:function(e){var t=e.target.checked,n=dojo.byId("FT_PARAMETER_NAME");t?(n.disabled=!1,n.focus()):(n.value="",n.disabled=!0,dojo.removeClass(n,"invalid"))},_validateParameter:function(e){if(this.type=="FILTER_METRIC")return!0;if(!dojo.byId("FT_PARAMETER_ENABLE").checked)return!0;var t=dojo.byId("FT_PARAMETER_NAME");return t.value==""?(this.displayError("Please input a parameter name."),t.focus(),dojo.addClass(t,"invalid"),!1):!0}})}),pen.define("analyzer/report/cv_rptFilterMetricDlg",["analyzer/report/cv_rptFilterDlg"],function(){dojo.extend(cv.FilterDialog,{showMetricFilter:function(e,t){this.clear(),this.attributeType=this.type="FILTER_METRIC",e&&(e.indexOf("[MEASURE:")==0||cv.getFieldHelp().get(e,"type")=="NUMBER"?this.metric=e:this.attribute=e),t||(t="CONDITIONS"),this._initMetricFilter(t)&&this.showDialog()},_initMetricFilter:function(e){this.helpTopic="CV/Business_User/working_with_filters.html#filters_on_number_fields";if(!this.report.reportDoc.getNode("//cv:attribute"))return this.report.rptDlg.showError("errorNoAttributeInReport","CV/Business_User/working_with_filters.html#filters_on_number_fields"),!1;this.type="FILTER_METRIC",this.gem=this.report.getGem("filter_metric"),this.gem&&(this.attribute&&!this.report.reportDoc.isUsedByMetricFilter(this.attribute)||this.metric&&!this.report.reportDoc.isUsedByMetricFilter(this.metric))&&(this.attribute=this.metric=null),this.dlgTemplate="filterMetricDlg.html";if(!this.load())return this.report.showReportStatus(this.status),!1;this.filterProps=this.report.reportDoc.getMetricFilter(),this.rankCtrl=dojo.byId("FT_rank"),dojo.connect(this.rankCtrl,"onclick",cv.util,"onToggleSectionCheckbox");var t=dojo.byId("FT_rankMetric");this.report.addOptionsForAllMeasures(t),this.filterProps?(this.attribute=this.filterProps.formula,this.filterProps.rank?(t.value=this.filterProps.rank.formula,dojo.byId("FT_rankType").value=this.filterProps.rank.type,dojo.byId("FT_rankCount").value=this.filterProps.rank.count):e!="RANK"&&cv.util.setSectionCollapsed("FT_rank")):(this.metric&&(t.value=this.metric),e!="RANK"&&cv.util.setSectionCollapsed("FT_rank")),this.conditionsCtrl=dojo.byId("FT_conditions"),dojo.connect(this.conditionsCtrl,"onclick",cv.util,"onToggleSectionCheckbox"),dojo.connect(dojo.byId("FT_addCondition"),"onclick",this,"_editCondition"),dojo.connect(dojo.byId("FT_conditionsList"),"onclick",this,"_onClickConditionsList");if(this.filterProps&&this.filterProps.conditions){this.numConditions=this.filterProps.conditions.length;for(var n=0;n<this.numConditions;++n)this._updateCondition("FT_condition_"+n,!0)}else this.numConditions=1,this._editCondition("FT_condition_0"),(this.filterProps||e=="RANK")&&cv.util.setSectionCollapsed("FT_conditions");var r=dojo.byId("FT_attribute");return this.report.addOptionsForAttributes(r),r.options.length==1?(this.attribute=r.options[0].value,r.parentNode.innerHTML=cv.util.substituteParams(cvCatalog.filterMetricSubtitle,r.options[0].innerHTML)):(this.attribute&&(r.value=this.attribute),dojo.connect(r,"onchange",this,"_selectMetricFilterAttribute")),this._selectMetricFilterAttribute(),this.filterProps||(this.filterProps={}),this.filterProps.type=this.type,this.filterProps.old=this.attribute,this.defaultFocus=dojo.byId(e=="RANK"?"FT_rank":"FT_conditions"),!0},_saveMetricFilter:function(){var e=dojo.byId("FT_attribute");this.filterProps.formula=e?e.value:this.attribute;if(this.conditionsCtrl.checked){if(this.selectedItem&&!this._updateCondition())return!1}else this.filterProps.conditions=null;if(this.rankCtrl.checked){var t={formula:dojo.byId("FT_rankMetric").value,type:dojo.byId("FT_rankType").value,count:dojo.byId("FT_rankCount").value},n=this._validateRank(t);if(n)return this.displayMsg(cvCatalog[n]),!1;t.count=parseInt(t.count),this.filterProps.rank=t,this.report.setSortOrder(t.formula,t.type=="BOTTOM"?"ASC":"DESC",!1,!0)}else this.filterProps.rank=null;return!this.filterProps.conditions&&!this.filterProps.rank&&(this.report.removeFilter("filter_metric_0"),this.filterProps=null),!0},_editCondition:function(e){if(!this._updateCondition())return;var t;dojo.isString(e)?t=parseInt(this._getListItemIndex(e)):(t=this.filterProps.conditions.length,++this.numConditions,e="FT_condition_"+t);var n=dojo.byId(e);n||(n=document.createElement("div"),dojo.byId("FT_conditionsList").appendChild(n),dojo.addClass(n,"filterCondition"),n.id=e),dojo.addClass(n,"filterConditionSelected"),n.innerHTML=cv.util.substituteParams(cvCatalog.filterConditionEdit,{GT:cvCatalog.filterConditionOperators_GREATER_THAN,GTE:cvCatalog.filterConditionOperators_GREATER_THAN_EQUAL,LT:cvCatalog.filterConditionOperators_LESS_THAN,LTE:cvCatalog.filterConditionOperators_LESS_THAN_EQUAL,E:cvCatalog.filterConditionOperators_EQUAL,NE:cvCatalog.filterConditionOperators_NOT_EQUAL,B:cvCatalog.filterConditionOperators_BETWEEN,NE:cvCatalog.filterConditionOperators_NOT_EQUAL});var r=dojo.byId("FT_condMetric");this.report.addOptionsForAllMeasures(r);var i=dojo.byId("FT_condOp");dojo.connect(i,"onchange",this,"_setConditionOperands");if(this.filterProps&&this.filterProps.conditions&&this.filterProps.conditions[t]){var s=this.filterProps.conditions[t];r.value=s.formula,i.value=s.operator,dojo.byId("FT_condOp1").value=s.op1,dojo.byId("FT_condOp2").value=s.op2?s.op2:""}else this.metric&&(r.value=this.metric);this._setConditionOperands(),this.selectedItem=e},_updateCondition:function(e,t){if(!e){if(!this.selectedItem)return!0;e=this.selectedItem}var n=parseInt(this._getListItemIndex(e)),r=dojo.byId(e),i;if(!r){if(!t)return!0;r=document.createElement("div"),dojo.byId("FT_conditionsList").appendChild(r),dojo.addClass(r,"filterCondition"),r.id=e,i=this.filterProps.conditions[n]}else this.filterProps.conditions||(this.filterProps.conditions=[]),n==this.filterProps.conditions.length&&this.filterProps.conditions.push({}),i=this.filterProps.conditions[n],i.formula=dojo.byId("FT_condMetric").value,i.operator=dojo.byId("FT_condOp").value,i.op1=dojo.byId("FT_condOp1").value,i.op2=i.operator!="BETWEEN"?null:dojo.byId("FT_condOp2").value;var s=this._validateCondition(i);return s?(this.displayMsg(cvCatalog[s]),!1):(r.innerHTML=cv.util.substituteParams(cvCatalog.filterConditionStatic,{metric:this.report.getFieldLabel(i.formula),op:cvCatalog["filterConditionOperators_"+i.operator],op1:i.op1?i.op1:" ",op2:i.op2?i.op2:" ",op2Css:i.op2?" ":"hidden"}),dojo.removeClass(r,"filterConditionSelected"),this.selectedItem=null,this.displayMsg(),!0)},_onClickConditionsList:function(e){var t=e.target,n=cv.util.getAncestorByClass(t,"filterCondition");if(!n)return this._updateCondition();if(dojo.hasClass(t,"filterConditionDelete")){if(this.numConditions==1)return this.displayMsg(cvCatalog.dlgErrFilterLastCondition);var r=this._getListItemIndex(n.id);this.filterProps.conditions[r]=null,this.selectedItem==n.id&&(this.selectedItem=null),cv.util.removeNode(n),--this.numConditions;return}if(n.id==this.selectedItem)return;this._updateCondition()&&this._editCondition(n.id)},_selectMetricFilterAttribute:function(){var e=dojo.byId("FT_attribute");dojo.byId("FT_rankAttribute").innerHTML=this.report.getFieldLabel(e?e.value:this.attribute)},_setConditionOperands:function(){var e=dojo.byId("FT_condOp").value,t=dojo.byId("FT_condOp1"),n=dojo.byId("FT_condOp2").parentNode;e=="IS_NOT_EMPTY"?(cv.util.hide(t,n),t.value=n.value=""):e=="BETWEEN"?cv.util.show(t,n):(cv.util.show(t),cv.util.hide(n),n.value="")},_validateCondition:function(e){var t=parseFloat(e.op1),n=parseFloat(e.op2);return!e.formula||!e.operator?"dlgErrFilterConditionRequiredFields":e.operator!="IS_NOT_EMPTY"&&!cv.util.checkNumber(e.op1)?(this.setInvalidInputField("FT_condOp1"),"dlgErrFilterConditionNumberExpected"):e.operator=="BETWEEN"&&!cv.util.checkNumber(e.op2)?(this.setInvalidInputField("FT_condOp2"),"dlgErrFilterConditionNumberExpected"):t>=n?(this.setInvalidInputField("FT_condOp1"),"dlgErrFilterConditionOp2LTOp1"):null},_validateRank:function(e){if(!cv.util.checkPositiveInteger(e.count))return this.setInvalidInputField("FT_rankCount"),"dlgErrFilterRankNumberExpected";if(!e.formula||!e.type)return"dlgErrFilterRankRequiredFields"},_getListItemIndex:function(e){return e.substr(13)}})}),dojo.require("dojox.collections.Dictionary"),dojo.require("dojox.xml.parser"),pen.define("analyzer/report/cv_rptDoc",["analyzer/report/cv_rptLinkDlg"],function(){cv.ReportDocument=function(){this.reportRecord=null,this.status=null,this.childTags={measures:"measure",columnAttributes:"attribute",rowAttributes:"attribute",filters:"filter"},this.attributes={measure:{showAggregate:"true",showSum:"false",showAverage:"false",showCount:"false",showMin:"false",showMax:"false",measureTypeEnum:"VALUE",sortOrderEnum:"NONE"},attribute:{showSubtotal:"false",sortOrderEnum:"ASC"},filter:{viewFilterEnum:"NONE"}},this.reportProps=["name","folder","description","cube","reportTypeEnum","update","updatedBy","created","createdBy","title","subtitle"]},cv.ReportDocument.prototype={initialize:function(e){this.reportRecord=dojox.xml.parser.parse(e),cv.setDomDefaultNamespace(this.reportRecord),this.status="reportOpenOK"},getReportNode:function(){return this.getNode("cv:report")},getStorageNode:function(){return this.getNode("cv:commonStorageAttributes")},getXml:function(){return dojox.xml.parser.innerXML(this.reportRecord)},replaceReportNode:function(e){this.reportRecord.documentElement.replaceChild(e.cloneNode(!0),this.getReportNode())},replaceStorageNode:function(e){this.reportRecord.documentElement.replaceChild(e.cloneNode(!0),this.getStorageNode())},getReportProperty:function(e){var t=null;switch(e){case"catalog":case"cube":case"reportTypeEnum":t=this.getReportNode().getAttribute(e);break;case"title":t=this.getReportTitle();break;case"subtitle":t=this.getReportSubtitle();break;case"name":case"folder":t=this.getStoragePathNode().getAttribute(e);break;default:t=this.getStorageNode().getAttribute(e)}return t},setReportProperty:function(e,t){switch(e){case"catalog":case"cube":case"reportTypeEnum":this.getReportNode().setAttribute(e,t);break;case"title":this.setReportTitle(t);break;case"subtitle":this.setReportSubtitle(t);break;case"name":case"folder":this.getStoragePathNode().setAttribute(e,t);break;default:this.getStorageNode().setAttribute(e,t)}},getReportOptions:function(){return this.getReportNode().attributes},getReportOption:function(e){return this.getReportNode().getAttribute(e)},setReportOption:function(e,t){this.getReportNode().setAttribute(e,t)},getStoragePathNode:function(){return this.getNode("cv:commonStorageAttributes/cv:path")},getReportTitle:function(){var e=this.getNode("cv:report/cv:title");return e?dojox.xml.parser.textContent(e):null},setReportTitle:function(e){var t=this.getNode("cv:report/cv:title");t||(t=this.reportRecord.createElement("title"),this.getReportNode().appendChild(t)),cv.textContent(t,e)},getReportSubtitle:function(){var e=this.getNode("cv:report/cv:subtitle");return e?dojox.xml.parser.textContent(e):null},setReportSubtitle:function(e){var t=this.getNode("cv:report/cv:subtitle");t||(t=this.reportRecord.createElement("subtitle"),this.getReportNode().appendChild(t)),cv.textContent(t,e)},setChartOption:function(e,t){var n=this.getChartOptions();n.setAttribute(e,t)},getChartOption:function(e){var t=this.getChartOptions();return t.getAttribute(e)},getChartOptions:function(){var e=this.getNode("cv:report/cv:chartOptions");return e},setPageSetup:function(e,t){var n=this.getPageSetup();n.setAttribute(e,t)},getPageSetup:function(e){var t=this.getPageSetup();return t.getAttribute(e)},getPageSetup:function(){var e=this.getNode("cv:report/cv:pageSetup");return e},getReplaced:function(){return this.getNode("cv:report/cv:attributeReplacement")},setReplaced:function(e,t){var n=this.getReplaced();if(n){if(!t){cv.util.removeNode(n);return}dojox.xml.parser.removeChildren(n)}else n=this._createXmlNode("attributeReplacement"),this.getReportNode().appendChild(n);n.setAttribute("formula",e);for(var r=0;r<t.length;++r){var i=this._createXmlNode("replacementOption");cv.textContent(i,t[r]),n.appendChild(i)}},replaceAttribute:function(e){try{var t=this.getReplaced();if(!t)return;var n=t.getAttribute("formula");if(n==e)return;t.setAttribute("formula",e);var r=t.selectNodes("cv:replacementOption");for(var i=0;i<r.length;++i)if(cv.textContent(r[i])==e){cv.textContent(r[i],n);break}}catch(s){console.log(s)}},isNew:function(){return!this.getStorageNode().getAttribute("created")},isEmpty:function(){var e=this.getReportNode().selectNodes("cv:measures/cv:measure|*/cv:attribute");return!e||e.length==0},getSortedMetric:function(){return this.getNode("cv:report/cv:measures/cv:measure[@sortOrderEnum!='NONE']")},createNode:function(e){var t,n=this._createXmlNode(this.childTags[e.zoneId]);return e.formula&&n.setAttribute("formula",e.formula),e.metricType&&(dojo.indexOf(["PCTOF","RSUM","PCTRSUM","RANK"],e.metricType)>-1?(t=this._createXmlNode("summaryFacet",{summaryAcrossEnum:e.sumAcross,useNonVisualTotals:e.sumTotal}),e.sumAcross=="LABEL"&&t.setAttribute("breakAttributeFormula",e.sumBreakBy)):e.metricType=="EXPRESSION"?(t=this._createXmlNode("expression"),cv.textContent(t,e.expression)):e.metricType=="TREND"&&(t=this._createXmlNode("trendFacet",{trendTypeEnum:e.trendType,trendDirectionEnum:e.trendDir,amount:e.trendAmount,trendAttributeFormula:e.trendField})),n.setAttribute("measureTypeEnum",e.metricType),t&&n.appendChild(t)),e.label&&(t=this._createXmlNode("displayLabels"),n.appendChild(t),t.appendChild(this._createXmlNode("displayLabel",{label:e.label,locale:e.locale}))),e.gembarId&&n.setAttribute("gembarId",e.gembarId),n},getNode:function(e,t){return t||(t=this.reportRecord.documentElement),t.selectSingleNode(e)},getChildMembers:function(){var e="";for(var t=0;t<this.getChildMembers.arguments.length;++t)t>0&&(e+=" | "),e+="cv:"+this.getChildMembers.arguments[t]+"/cv:"+this.childTags[this.getChildMembers.arguments[t]];return this.getReportNode().selectNodes(e)},getTimeAttributes:function(){var e=this.getReportNode().selectNodes("*/cv:attribute"),t=null;if(e&&e.length>0)for(var n=0;n<e.length;++n){var r=e[n].getAttribute("formula");cv.getFieldHelp().isTimeAttribute(r,!0)&&(t?t.push(r):t=[r])}return t},getReportZoneNode:function(e){return this.reportRecord.documentElement.selectSingleNode("cv:report/cv:"+e)},getFirstMetricDependent:function(e){var t=this.getReportNode().selectNodes("cv:measures/cv:measure[@measureTypeEnum!='VALUE' and @id!='"+e+"']");for(var n=0;t&&n<t.length;++n){var r=t[n];if(r.getAttribute("measureTypeEnum")=="EXPRESSION"&&cv.textContent(r.selectSingleNode("cv:expression")).indexOf(e)>=0||r.getAttribute("formula")==e)return r}return null},getMetrics:function(e){return this.getReportNode().selectNodes("cv:measures/cv:measure"+(e?"[@measureTypeEnum='"+e+"']":""))},getNextMetricId:function(){var e=0,t=this.getNode("cv:report/cv:measures");while(this.getNode("cv:measure[@id='[MEASURE:"+e+"]']",t))++e;return"[MEASURE:"+e+"]"},getNumberFormat:function(e){var t;dojo.isString(e)?t=this.getNode('cv:report/cv:measures/cv:measure[@formula="'+e+'"]/cv:numberFormat'):t=e.selectSingleNode("cv:numberFormat");var n="";if(t){var r=t.selectSingleNode("cv:formatExpression");r&&(n=cv.textContent(r))}return t?{formatCategory:t.getAttribute("formatCategory"),formatScale:t.getAttribute("formatScale"),formatExpression:n,formatShortcut:t.getAttribute("formatShortcut")}:null},setNumberFormat:function(e,t){dojo.isString(e)&&(n=this.getNode('cv:report/cv:measures/cv:measure[@formula="'+e+'"]/cv:numberFormat'));if(!e)return!1;var n=e.selectSingleNode("cv:numberFormat");n||(n=this._createXmlNode("numberFormat"),e.appendChild(n),n.setAttribute("formatShortcut","NONE"),n.setAttribute("formatCategory","Default"),n.setAttribute("formatScale","0")),t.formatCategory&&n.setAttribute("formatCategory",t.formatCategory),t.formatScale&&n.setAttribute("formatScale",t.formatScale),t.formatShortcut&&n.setAttribute("formatShortcut",t.formatShortcut);var r=n.selectSingleNode("cv:formatExpression");r||(r=this._createXmlNode("formatExpression"),n.appendChild(r)),t.formatExpression&&cv.textContent(r,t.formatExpression)},updateDisplayLabel:function(e,t,n,r){var i=!t&&!n,s=null,o=e.selectSingleNode("cv:displayLabels");if(!o){if(i)return;o=this._createXmlNode("displayLabels"),e.appendChild(o)}else s=o.selectSingleNode(r?"cv:displayLabel[locale='"+r+"']":"cv:displayLabel");if(!s){if(i)return;s=this._createXmlNode("displayLabel"),o.appendChild(s)}return i?(o.removeChild(s),o.selectSingleNode("cv:displayLabel")||e.removeChild(o),null):(s.setAttribute("label",t?t:""),s.setAttribute("labelPlural",n?n:""),s.setAttribute("locale",r?r:""),s)},getFilter:function(e){return this.getNode('cv:report/cv:filters/cv:filter[@formula="'+e+'"]')},getFilterProps:function(e){var t={formula:e.getAttribute("formula"),viewFilterEnum:e.getAttribute("viewFilterEnum"),predicates:null},n=e.selectNodes("cv:predicates/cv:predicate");if(!n||n.length==0)return t;t.predicates=new dojox.collections.Dictionary;var r,i;for(var s=0;s<n.length;++s){i=n[s].getAttribute("ordinal");var o={ordinal:i,op:n[s].getAttribute("operatorEnum"),preset:n[s].getAttribute("preset"),parameterName:n[s].getAttribute("parameterName")};if(o.op=="CONTAIN"||o.op=="NOT_CONTAIN"){var u=n[s].selectNodes("cv:containsExpression");o.exp=[];for(var a=0,f=u.length;f>0&&a<f;++a)o.exp.push(cv.textContent(u[a]))}else{var l=n[s].selectNodes("cv:member"),f=l.length;o.members=[];for(var a=0;f>0&&a<f;++a){var c=l[a].getAttribute("formula");c?o.members.push({formula:c,caption:l[a].getAttribute("caption")}):(o.members.push(parseInt(l[a].getAttribute("pos"))),a>0?r+=","+l[a].getAttribute("pos"):r=l[a].getAttribute("pos"))}r&&(o.preset=r),r=null}if(t.predicates.contains(i))t.predicates.item(i).push(o);else{var h=[];h.push(o),t.predicates.add(i,h)}}return t},removeFilterPredicate:function(e,t){var n=this.getFilterProps(e);if(!n)return e;n.predicates.remove(t);var r=this.updateFilter(n);return r&&r.selectSingleNode("cv:predicates/cv:predicate")?r:null},updateFilter:function(e){if(!e.conditions&&!e.rank&&!e.predicates)return null;var t=null,n=this.getReportZoneNode("filters");if(e.type=="FILTER_METRIC"){if(e.old){t=this.getFilter(e.old);if(t){var r=this.getNode("cv:conditions",t);r&&t.removeChild(r),r=this.getNode("cv:topBottom",t),r&&t.removeChild(r),e.old!=e.formula&&t.childNodes.length==0&&n.removeChild(t)}}if(!e.old||e.old!=e.formula)t=this.getFilter(e.formula)}else t=this.getFilter(e.formula),t&&cv.util.removeNode(this.getNode("cv:predicates",t));t||(t=this._createXmlNode("filter",{formula:e.formula,viewFilterEnum:"MULTIPLE"}),this.getReportZoneNode("filters").appendChild(t));if(e.conditions){var i=this._createXmlNode("conditions");for(var s=0;s<e.conditions.length;++s){if(!e.conditions[s])continue;var o=this._createXmlNode("condition");for(var u in e.conditions[s])e.conditions[s][u]&&o.setAttribute(u,e.conditions[s][u]);i.appendChild(o)}t.appendChild(i)}if(e.rank){var a=this._createXmlNode("topBottom");for(var u in e.rank)e.rank[u]&&a.setAttribute(u,e.rank[u]);t.appendChild(a)}if(e.predicates&&e.predicates.getKeyList()&&e.predicates.getKeyList().length>0){var f=e.predicates.getKeyList(),l=[];for(var u=0;u<f.length;u++){var c=[],h=e.predicates.item(f[u]);if(h.length>0){var p=this.getOrderKey(h);if(l.length>0){var d=l.length-1;for(;d>=0;d--){if(!(this.getOrderKey(l[d])>p))break;c.push(l.pop())}l.push(h),c.length>0&&(l=l.concat(c.reverse()))}else l.push(h)}}var v,m=this.getNode("cv:predicates",t);m||(m=this._createXmlNode("predicates"));for(var s=0;s<l.length;s++){v=l[s];if(!v)continue;for(var g=0;g<v.length;g++){var y=v[g];if(!y)continue;var b=this._createXmlNode("predicate",{ordinal:s+1,operatorEnum:y.op});if(y.preset){y.members=[];var w=y.preset.split(",");for(var u=0;u<w.length;++u)y.members.push(parseInt(w[u]))}var E=y.members;for(var u=0;E&&u<E.length;++u){var S=this._createXmlNode("member");cv.util.checkNumber(E[u])?S.setAttribute("pos",E[u]):(S.setAttribute("pos","0"),S.setAttribute("formula",E[u].formula),S.setAttribute("caption",E[u].caption)),b.appendChild(S)}if(y.exp)for(var u=0;u<y.exp.length;++u){var x=this._createXmlNode("containsExpression");x.appendChild(this.reportRecord.createTextNode(y.exp[u])),b.appendChild(x)}y.parameterName&&b.setAttribute("parameterName",y.parameterName),m.appendChild(b)}}t.appendChild(m)}return this.removeEmptyFilter(t)?null:(e.viewFilterEnum&&t.setAttribute("viewFilterEnum",e.viewFilterEnum),t)},getOrderKey:function(e){var t=new dojox.collections.Dictionary;t.add("EQUAL",2),t.add("TIME_YAGO",2),t.add("TIME_RANGE_PREV",2),t.add("TIME_RANGE_NEXT",2),t.add("TIME_AGO",2),t.add("TIME_AHEAD",2),t.add("CONTAIN",3),t.add("BETWEEN",4),t.add("AFTER",5),t.add("BEFORE",6),t.add("NOT_EQUAL",7),t.add("NOT_CONTAIN",8);var n;if(e[0].op=="EQUAL"){var r=e[0].members;e[0].preset||cv.util.checkNumber(r[0])?n=2:n=1}else n=t.item(e[0].op);return n},getMetricFilter:function(){var e=null,t=null,n=this.getNode("cv:report/cv:filters/cv:filter/cv:topBottom");n?(e=n.parentNode,t=this.getNode("cv:conditions",e)):(t=this.getNode("cv:report/cv:filters/cv:filter/cv:conditions"),t&&(e=t.parentNode));if(!e)return null;var r={node:e,formula:e.getAttribute("formula"),conditions:null,rank:null};if(n){r.rank={};var i=n.attributes;for(var s=0;s<i.length;++s)r.rank[i[s].name]=i[s].value}if(t){conds=t.getElementsByTagName("condition"),r.conditions=new Array(conds.length);for(var o=0;o<conds.length;++o){var i=conds[o].attributes;r.conditions[o]={};for(var s=0;s<i.length;++s)r.conditions[o][i[s].name]=i[s].value}}return r},getMetricFilterNode:function(){var e=this.getNode("cv:report/cv:filters/cv:filter/cv:conditions | cv:report/cv:filters/cv:filter/cv:topBottom");return e?e.parentNode:null},isUsedByMetricFilter:function(e,t){var n=this.getMetricFilter();if(!n)return null;if(n.formula==e)return!t||t=="RANK"&&n.rank||t=="CONDITIONS"&&n.conditions?n.node:null;if(n.rank&&n.rank["formula"]==e&&(!t||t=="RANK"))return n.node;if(n.conditions&&(!t||t=="CONDITIONS"))for(var r=0;r<n.conditions.length;++r)if(n.conditions[r]["formula"]==e)return n.node;return null},removeFromMetricFilter:function(e){var t=this.isUsedByMetricFilter(e);if(!t)return!1;var n=this.getNode("cv:conditions",t),r=this.getNode("cv:topBottom",t);if(t.getAttribute("formula")==e)n&&t.removeChild(n),r&&t.removeChild(r);else{if(n){conds=n.getElementsByTagName("condition");var i=conds.length;for(var s=0;s<conds.length;++s)conds[s].getAttribute("formula")==e&&(n.removeChild(conds[s]),--i);i==0&&t.removeChild(n)}r&&r.getAttribute("formula")==e&&t.removeChild(r)}return this.removeEmptyFilter(t),!0},removeEmptyFilter:function(e){return e&&e.selectSingleNode("cv:conditions|cv:topBottom|cv:predicates/cv:predicate")?!1:(cv.util.removeNode(e),!0)},updateCalculateSubtotalsUsingFormula:function(e,t){return t.setAttribute("calculateSubtotalsUsingFormula",e)},addMemberProperty:function(e,t){var n=this._createXmlNode("property",{name:t});e.appendChild(n)},addLink:function(e,t,n){var r=this._createXmlNode("link",t);if(n)for(var i in n){var s=this._createXmlNode("linkParam",{name:i,value:n[i]});r.appendChild(s)}e.appendChild(r)},addSelectionFilters:function(e,t){t=="INCLUDE"&&this.removeSelectionFilters();var n=this.getNode("cv:report/cv:selectionFilters");n||(n=this._createXmlNode("selectionFilters"),this.getReportNode().appendChild(n));for(var r=0;r<e.length;++r)e[r].setAttribute("op",t),n.appendChild(e[r])},getSelectionFilters:function(){return this.getReportNode().selectNodes("cv:selectionFilters/cv:selectionItem")},removeSelectionFilters:function(){var e=this.getNode("cv:report/cv:selectionFilters");e&&cv.util.removeNode(e)},replaceSelectionItems:function(e){var t=this.getNode("cv:report/cv:selectionItems");t&&cv.util.removeNode(t),e&&this.getReportNode().appendChild(e)},getSelectionItems:function(){return this.getReportNode().selectNodes("cv:selectionItems/cv:selectionItem")},_createXmlNode:function(e,t){var n=cv.createNode(this.reportRecord,e),r,i=this.attributes[e];for(r in i)n.setAttribute(r,i[r]);for(r in t)n.setAttribute(r,t[r]);return n},getPluginData:function(){return this.getUIAttributes().selectSingleNode("cv:pluginData")},getUIAttributes:function(){var e=this.reportRecord.documentElement.selectSingleNode("cv:uiAttributes");e||(e=this._createXmlNode("uiAttributes",{showFieldList:"true",showFieldLayout:"true",showFilterPanel:"false"}),this.reportRecord.documentElement.appendChild(e)),e.selectSingleNode("cv:rowFieldWidths")||e.appendChild(this._createXmlNode("rowFieldWidths")),e.selectSingleNode("cv:columnDataFieldWidths")||e.appendChild(this._createXmlNode("columnDataFieldWidths"));if(!e.selectSingleNode("cv:pluginData")){var t=this._createXmlNode("pluginData");cv.textContent(t,"[]"),e.appendChild(t)}return e}}}),dojo.require("dijit._base.popup"),dojo.require("dojo.dnd.Source"),pen.define("analyzer/report/cv_rptDnd",["analyzer/report/cv_rptDoc"],function(){dojo.declare("cv.ReportDropTarget",dojo.dnd.Target,{copyOnly:!0,selfAccept:!0,constructor:function(e,t){this.curItem=null,this.dropIndicator=dojo.create("div",{"class":"dndDropIndicator"}),dojo.connect(this.dropIndicator,"onmouseover",this,"_redirectMouseOver"),dojo.connect(this.dropIndicator,"onmouseup",this,"_redirectMouseUp"),dojo.subscribe("/dnd/start",dojo.hitch(this,"dndStart")),this._drop=this.dropIndicator,this.dropIndicator.parentNode||document.body.appendChild(this.dropIndicator),cv.util.hide(this.dropIndicator)},onDndStart:function(e,t,n){this.inherited(arguments);var r=dojo.coords(e.node),i=dojo.coords(this.node);r.x<=i.x+i.w&&r.x>=i.x&&r.y<i.y+i.h&&r.y>i.y&&this.fireSyntheticOverEvent()},fireSyntheticOverEvent:function(){if(document.createEvent){var e=document.createEvent("MouseEvent");e.initMouseEvent("mouseover",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.node.dispatchEvent(e)}else if(document.createEventObject){var e=document.createEventObject(window.event);this.node.fireEvent("onmouseover",e)}},_redirectMouseOver:function(e){this.fireSyntheticOverEvent(),this._getZoneIdForPivot(dojo.dnd.manager().nodes[0]);var t=this._getNodeUnderMouse(e);this.lastItemOver=t,this.position=this._getNodeUnderMouse();var n=this.childBoxes[this.zoneId];if(t>-1)if(document.createEvent){var r=document.createEvent("MouseEvent");r.initMouseEvent("mouseover",!0,!0,window,0,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),this.node.dispatchEvent(r),n[t].node.dispatchEvent(r),r=document.createEvent("MouseEvent"),r.initMouseEvent("mousemove",!0,!0,window,0,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),this.node.dispatchEvent(r),n[t].node.dispatchEvent(r)}else if(document.createEventObject){var r=document.createEventObject(window.event);r.button=1,n[t].node.fireEvent("onmouseover",r),n[t].node.fireEvent("onmousemove",r)}},_redirectMouseUp:function(e){this._getZoneIdForPivot(dojo.dnd.manager().nodes[0]);var t=this._getNodeUnderMouse(e);this.position=this._getNodeUnderMouse();var n=this.childBoxes[this.zoneId];if(t>-1)if(document.createEvent){var r=document.createEvent("MouseEvent");r.initMouseEvent("mouseup",!0,!0,window,0,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),n[t].node.dispatchEvent(r)}else if(document.createEventObject){var r=document.createEventObject(window.event);this.node.children[t].fireEvent("onmouseup",r),n[t].node.fireEvent("onmouseup",r)}},onMouseOut:function(e){if(this.dropIndicator&&cv.util.overElement(this.dropIndicator,e)){dojo.stopEvent(e);return}this.inherited(arguments)},init:function(e){this.reportFormat=e,e=="PIVOT"?(this.zones={measures:this.report.byClass("ZONE_measures"),rowAttributes:this.report.byClass("ZONE_rowAttributes"),columnAttributes:this.report.byClass("ZONE_columnAttributes")},this.zones.rowAttributes&&this.zones.rowAttributes.getElementsByTagName("TD").length==0&&(this.zones.rowAttributes=this.report.byClass("pivotTableRowLabelHeaderContainer")),this.zones.columnAttributes&&this.zones.columnAttributes.getElementsByTagName("TR").length==0&&(this.zones.columnAttributes=this.report.byClass("pivotTableColumnHeaderSection"))):(this.zones=null,this.childBoxes=[],this.zoneId=null),dojo.subscribe("/dnd/cancel",dojo.hitch(this,"onDraggingOut")),dojo.subscribe("/dnd/drop",dojo.hitch(this,"onDraggingOut"))},dndCancel:function(){this.onDraggingOut()},checkAcceptance:function(e,t){return this.report.isResizing||!this.report.history.isStateRefreshed()?!1:this.inherited(arguments)?!0:!1},accepted:!1,dndStart:function(){this.childBoxes=null,this.accepted=this.checkAcceptance(dojo.dnd.manager().source,dojo.dnd.manager().nodes)},onMouseOver:function(){dojo.dnd.manager().source&&this.childBoxes==null&&this.calculateBoxes(),this.inherited(arguments)},calculateBoxes:function(e){if(this.reportFormat!="PIVOT")return!0;if(this.report.isResizing){this.onDraggingOut(),cv.util.stopDrag();return}this.childBoxes={measures:[],rowAttributes:[],columnAttributes:[]};var t,n=this.zones.measures?this.zones.measures.getElementsByTagName("TD"):null,r=this.report.byClass("pivotTable");if(r){var i=dojo.position(r,!0);i.x=i.y+dojo.position(r).y;var s=n?n.length:0;s>20&&(s=20);for(t=0;t<s;++t){if(n[t].getAttribute("type")!="measure")continue;var o=dojo.position(n[t],!0);this.childBoxes.measures.push({top:i.y,bottom:i.x,left:o.x,right:o.x+dojo.position(n[t]).w,node:n[t]})}n=this.zones.rowAttributes?this.zones.rowAttributes.getElementsByTagName("TD"):null;var u=null;for(t=0;n&&t<n.length;++t){var o=dojo.position(n[t],!0);n[t].getAttribute("formula")==u?this.childBoxes.rowAttributes[this.childBoxes.rowAttributes.length-1].right=o.x+dojo.position(n[t]).w:this.childBoxes.rowAttributes.push({top:i.y,bottom:i.x,left:o.x,right:o.x+dojo.position(n[t]).w,node:n[t]}),u=n[t].getAttribute("formula")}n=this.zones.columnAttributes?this.zones.columnAttributes.getElementsByTagName("TR"):null,u=null;for(t=0;n&&t<n.length;++t){var a=n[t].firstChild;if(!a||a.getAttribute("type")!="attribute"&&a.getAttribute("type")!="prop")break;var o=dojo.position(n[t],!0);a.getAttribute("formula")==u?this.childBoxes.columnAttributes[this.childBoxes.columnAttributes.length-1].bottom=o.y+o.h:this.childBoxes.columnAttributes.push({top:o.y,bottom:o.y+o.h,left:o.x,right:o.x+o.w,node:a}),u=a.getAttribute("formula")}}return this.reportFormat=="PIVOT"&&cv.util.show(this.dropIndicator),!0},onMouseMove:function(e){this.lastDragEvent=e;if(dojo.dnd.manager().nodes.length<1||!this.accepted)return;if(this.reportFormat!="PIVOT")return;if(this.report.isResizing){this.onDraggingOut(),cv.util.stopDrag();return}this.childBoxes==null&&this.calculateBoxes(e),this._getZoneIdForPivot(dojo.dnd.manager().nodes[0]),this.position=this._getNodeUnderMouse();var t=this.childBoxes[this.zoneId],n=!0;this.position<0?t.length&&(n=cv.util.gravity(t[0].node,e)&this.gravity):n=cv.util.gravity(t[this.position].node,e)&this.gravity,this.reportFormat=="PIVOT"&&cv.util.show(this.dropIndicator),this.placeIndicator(e,dojo.dnd.manager().nodes,this.position,n)},onDraggingOut:function(){this.reportFormat=="PIVOT"&&this.dropIndicator&&cv.util.hide(this.dropIndicator),this.hoverMetric&&(dojo.removeClass(this.hoverMetric,"metricHover"),this.hoverMetric=null)},onMouseUp:function(){this.inherited(arguments)},onDrop:function(e,t,n){try{this.onDraggingOut();var r;for(var i in e.accept){r=i;break}var s=t[0],o=cv.util.getAttribute(s,"formula");if(r.length==1&&this.reportFormat!="PIVOT")return this.report.appendGem(o);var u,a,f,l,c=!0;this._getZoneIdForPivot(t[0]),this.position=this._getNodeUnderMouse();var h=this.childBoxes[this.zoneId];if(!h)return!1;var p=this.lastDragEvent;if(this.position<0)h.length?cv.util.gravity(h[0].node,p)&this.gravity?(u=this.report.getGemFromDomNode(h[0].node),u&&(a=u,f="before")):(u=this.report.getGemFromDomNode(h[h.length-1].node),u&&(a=u,f="after")):(a=this.zoneId,f="append");else{var d=h[this.position].node;u=this.report.getGemFromDomNode(d),u&&(a=u,f=cv.util.gravity(d,p)&this.gravity?"before":"after")}if(!f)return!1;this.actionStr="";if(r.length==1){c=this.report.checkDuplicateGem(o),c&&(c=this.report.checkGemHierarchy(this.zoneId,o,this.report.getFieldLabel(s))),c&&(c=this.report.checkColumnSelectionFilters(this.zoneId));if(!c)return!1;l=this.report.createGem({zoneId:this.zoneId,formula:o}),this.curItem=l,this.actionStr="actionAdd"}else{if(r.length!=2)return!1;l=this.report.getGemFromDomNode(s);if(!this.report.checkGemHierarchy(this.zoneId,o,this.report.getFieldLabel(s),{refId:f=="append"?a:a.getId(),pos:f}))return!0;if(!this.report.checkColumnSelectionFilters(this.zoneId))return!1;l.setZone(u?u.zone:a),this.curItem=l,this.actionStr="actionMove"}return c=this.insert(a,f),this.curItem=null,c}catch(p){alert(p)}},_getNodeUnderMouse:function(){var children=this.childBoxes[this.zoneId];for(var i=0,child;children&&i<children.length;++i)with(children[i])if(this.lastDragEvent.clientX>=left&&this.lastDragEvent.clientX<=right&&this.lastDragEvent.clientY>=top&&this.lastDragEvent.clientY<=bottom)return i;return-1},_getZoneIdForPivot:function(e){if(this.reportFormat!="PIVOT")return;this.gravity=cv.util.gravity.WEST;var t=e.getAttribute("dndType");t=="V"||t=="VM"?this.zoneId="measures":this.zones.rowAttributes&&cv.util.overElement(this.zones.rowAttributes,this.lastDragEvent)?this.zoneId="rowAttributes":this.zones.columnAttributes&&cv.util.overElement(this.zones.columnAttributes,this.lastDragEvent)?(this.zoneId="columnAttributes",this.gravity=cv.util.gravity.NORTH):this.zoneId="rowAttributes"},placeIndicator:function(e,t,n,r){if(!this.zoneId)return;var i=this.dropIndicator.style,s=this.childBoxes[this.zoneId],o=s.length,u=this.zones[this.zoneId];u||(u=this.node);if(this.gravity==cv.util.gravity.NORTH){var a,f=dojo.contentBox(this.node).w;n<0?o?a=r?s[0].top:s[o-1].bottom:a=dojo.position(u,!0).y:a=r?s[n].top:s[n].bottom,i.width=f+15+"px",i.height="28px",i.left=dojo.position(this.node,!0).x-14+"px",i.top=a-14+"px",i.position="absolute",i.zIndex=2e3,this.dropIndicator.innerHTML="<div style='position:relative;top:6px;height:16px;width:14px;float:left;overflow:hidden;background:url(images/dnd_left_arrow.png) no-repeat;'></div><div style='position:relative;top:10px;height:12px;width:"+(f-18)+"px;float:left;background:url(images/dnd_horz_line.png) repeat-x;'></div>"+"<div style='position:relative;top:6px;height:16px;width:14px;float:left;overflow:hidden;background:url(images/dnd_right_arrow.png) no-repeat;'></div>"}else{var l,c=dojo.contentBox(this.node).h;if(this.zoneId=="measures"&&o){if(n<0||n>=o)n=r?0:o-1;this.hoverMetric&&this.hoverMetric!=s[n].node&&dojo.removeClass(this.hoverMetric,"metricHover"),this.hoverMetric=s[n].node,dojo.addClass(this.hoverMetric,"metricHover")}n<0?o?l=r?s[0].left:s[o-1].right:(this.zoneId=="measures"&&this.zones.columnAttributes&&(u=this.zones.columnAttributes),l=dojo.position(u,!0).x):l=r?s[n].left:s[n].right,i.left=l-14+"px",i.height=c+10+"px",i.width="28px",i.position="absolute",i.zIndex=2e3,i.top=dojo.position(this.node,!0).y-7+"px",this.dropIndicator.innerHTML="<div style='position:relative;left:6px;width:16px;height:14px;overflow:hidden;background:url(images/dnd_top_arrow.png);'></div><div style='position:relative;left:11px;width:7px;height:"+(c-22)+"px;background:url(images/dnd_vert_line.png) repeat-y;'></div>"+"<div style='position:relative;left:6px;width:16px;height:14px;overflow:hidden;background:url(images/dnd_bottom_arrow.png);'></div>"}},insert:function(e,t){return e==this.curItem?!1:this.report.insertGem(this.curItem.getId(),dojo.isString(e)?e:e.getId(),t)}}),dojo.declare("cv.FilterPaneDropTarget",[dojo.dnd.Target],{constructor:function(e,t){this.curItem=null,this.filterPane=e,this.autoSync=!0,dojo.connect(this,"onDrop",this,"afterDrop")},onDraggingOver:function(e){if(this.report.isResizing)return;if(dojo.dnd.manager().nodes.length<1||!this.checkAcceptance(dojo.dnd.manager().source,dojo.dnd.manager().nodes))return;return cv.util.setDivActive(this.filterPane,!0),this.inherited(arguments)},onDragMove:function(e){},onDraggingOut:function(e){return cv.util.setDivActive(this.filterPane,!1),this.inherited(arguments)},onDrop:function(e){this.curItem=dojo.dnd.manager().nodes[0],cv.util.setDivActive(this.filterPane,!1)},createDropIndicator:function(){return},afterDrop:function(){this.curItem&&this.report.filterDlg.show(this.curItem.getAttribute("formula")),this.curItem=null},insert:function(e,t,n){return!0}}),dojo.declare("cv.TrashAreaDropTarget",[dojo.dnd.Target],{constructor:function(e,t){this.node=e,dojo.hasClass(this.node,"trashcan")&&(dojo.connect(dojo.dnd.manager(),"onMouseMove",this,"_onMouseMove"),dojo.connect(dojo.dnd.manager(),"onMouseUp",this,"_onMouseUp"))},onDraggingOver:function(e){if(this.report.isResizing)return;if(dojo.dnd.manager().nodes.length<1||!this.checkAcceptance(dojo.dnd.manager().source,dojo.dnd.manager().nodes))return;return this.childBoxes=[],dojo.addClass(this.node,"trashActive"),!0},onDragMove:function(e){},onDraggingOut:function(){return dojo.removeClass(this.node,"trashActive"),!0},createDropIndicator:function(){return},onDrop:function(e){var t=dojo.dnd.manager().nodes[0].id;return t.indexOf("filter_")==0?this.report.removeFilter(t):this.report.removeCurrentGem(dojo.dnd.manager().nodes[0]),dojo.removeClass(this.node,"trashActive"),this.node.focus(),!0},_onMouseMove:function(e){if(this.report.isResizing)return;dijit.popup.close();if(dojo.dnd.manager().nodes.length<1||!this.checkAcceptance(dojo.dnd.manager().source,dojo.dnd.manager().nodes))return;cv.util.show(this.node)},_onMouseUp:function(e){cv.util.isHidden(this.node)||cv.util.hide(this.node)}})}),dojo.require("dojox.xml.parser"),dojo.require("dojo.dnd.Source"),dojo.require("dijit._base.popup"),pen.define("analyzer/report/cv_rptFieldHelp",["analyzer/report/cv_rptDnd"],function(){dojo.declare("cv.FieldHelp",null,{constructor:function(e,t){this.doc=dojox.xml.parser.parse(e),cv.setDomDefaultNamespace(this.doc),this.manager=t,this.fieldListItems=null,this.fieldListTree=null,this.fieldListNodes=null,this.selectedField=null,this.searchField=null,this.viewOptions={cmdViewCategory:"businessGroup",cmdViewName:"displayLabel",cmdViewType:"type",cmdViewSchema:"schema"},this.currentView=null,this.handles=[]},destroy:function(){this.fieldListItems=null;if(!this.fieldListTree)return;if(this.fieldListNodes)for(var e=0,t=this.fieldListNodes.length;e<t;++e)this.fieldListNodes[e].dndObj&&(this.fieldListNodes[e].dndObj=null);dojo.forEach(this.handles,dojo.disconnect),this.doc=null,this.fieldListTree=null,this.fieldListNodes=null,this.selectedField=null,this.searchField=null},_getFieldListItems:function(){var e=this.doc.documentElement.selectNodes("cv:attributeHelp|cv:measureHelp"),t=[];for(x=0,len=e.length;x<len;++x)this.isHidden(e[x])||t.push(e[x]);return t},init:function(){var e,t,n=this.doc.documentElement.selectNodes("cv:attributeHelp|cv:measureHelp");this.fieldListItems=this._getFieldListItems(),this.fieldCount=this.fieldListItems.length,this.fieldListTree=dojo.byId("fieldListTree"),this.fieldListTree&&(this.fieldListTreeContent=dojo.byId("fieldListTreeContent"),this.searchField=dojo.byId("searchField"),this.searchField.value="",this.clearSearchField=dojo.byId("clearSearchField"),cv.util.getDojoWidget("fieldViewMenu"),this.sortFields(cv.prefs.fieldListView),dojo.byId("fieldCount").innerHTML=this.fieldListItems.length,this.updateFieldCount(),this.handles.push(dojo.connect(this.searchField,"onkeyup",this,"searchFields")),this.handles.push(dojo.connect(this.fieldListTree,"onmouseover",this,"onMouseOver")),this.handles.push(dojo.connect(this.fieldListTree,"onmousedown",this,"onMouseDown")),this.handles.push(dojo.connect(this.fieldListTree,"ondblclick",this,"onDblClick")),this.handles.push(dojo.connect(this.fieldListTree,"oncontextmenu",this,"onContextMenu")),this.handles.push(dojo.connect(this.clearSearchField,"onclick",this,"onClearSearch")),this.handles.push(dojo.connect(dojo.byId("viewFieldOptions"),"onclick",this,"onViewFieldOptions")));var r=this;cv.formatTooltip=function(e,t){r.formatTooltip(e,t)}},formatTooltip:function(e,t){var n=cvCatalog.fieldTooltipNone;if(dojo.hasClass(t,"folder")){var r=t.getAttribute("businessGroup"),i=this.doc.documentElement.selectSingleNode('cv:businessGroupInfo[@businessGroup="'+r+'"]');i&&(n=i.getAttribute("description"))}else if(dojo.hasClass(t,"field")){var s=this.get(t.getAttribute("formula")),o=this.get(s,"displayDescription",!0);n=(o?o:cvCatalog.fieldTooltipNone)+"<div class='fieldTooltipFooter'><a id='showFieldHelpDlg' class='appCmdLink' style='float:right;text-decoration:none;' "+"href='#' onclick='cv.getFieldHelp().onFieldHelp();return false'>Tell me more...</a></div>"}e.innerHTML=n},get:function(e,t,n){dojo.isString(e)&&(e=this.doc.documentElement.selectSingleNode('*[@formula="'+e+'"]'));if(!e||!t)return e;var r=e.selectSingleNode("cv:presentationFieldHelp"),i=null;switch(t){case"formula":case"hierarchy":i=e.getAttribute(t);break;case"type":i=e.tagName=="measureHelp"?"NUMBER":r.getAttribute("type");break;case"displayLabel":i=r?r.getAttribute(t):null,i||(i="");break;case"displayLabelOriginal":if(r){var s=r.selectSingleNode("cv:originalPresentationFieldHelp");if(s){i=s.getAttribute("displayLabel");break}}i||(i="");break;case"format":i={formatCategory:"Default",formatScale:"0",formatExpression:"",formatShortcut:"NONE"};break;default:i=r?r.getAttribute(t):null}return i?n?cv.util.escapeHtml(i):i:i},getAttributeList:function(){return this.doc.documentElement.selectNodes("cv:attributeHelp")},getMeasureList:function(){return this.doc.documentElement.selectNodes("cv:measureHelp")},getDndType:function(e){if(dojo.isString(e)){e=this.get(e);if(!e)return null}return e.tagName=="measureHelp"?"V":this.isTimeAttribute(e)?"T":"L"},getDirectChild:function(e){var t=this.getHierarchy(e);for(var n=0;t&&n<t.length;++n)if(t[n]==e)return n<t.length-1?t[n+1]:null;return null},getHierarchy:function(e,t,n){var r=this.get(e);if(!r)return null;r=r.getAttribute("hierarchy");if(!r)return null;var i=this.doc.documentElement.selectNodes('cv:hierarchyInfo[@formula="'+r+'"]/cv:levelInfo'),s=[];for(var o=0;o<i.length;++o){var u=i[o].getAttribute("formula");(t||!this.isHidden(u))&&s.push(u);if(n&&u==e)break}return s},getProperties:function(e){var t=this.doc.documentElement.selectNodes('cv:attributeHelp[@formula="'+e+'"]/cv:presentationFieldHelp/cv:property'),n=[];for(var r=0;r<t.length;++r)n.push(t[r].getAttribute("name"));return n},isHidden:function(e){return this.get(e,"hidden")=="true"},isTimeAttribute:function(e,t){if(dojo.isString(e)){e=this.get(e);if(!e)return!1}var n=this.get(e,"type");return e.tagName=="attributeHelp"&&(n=="TIME_YEAR"||n=="TIME_QUARTER"||n=="TIME_MONTH"||n=="TIME_WEEK"||n=="TIME_DATE"||t&&n=="TIME_CYCLICAL")},searchFields:function(e){if(e&&e.keyCode==13){this.fieldCount==1&&this.selectedField&&this.manager.report.appendGem(this.selectedField.getAttribute("formula"));return}if(!e||!dojo.isString(e))e=this.searchField.value;var t=this.fieldListNodes.length;this.fieldCount=0;var n=null;e?(n=new RegExp(dojo.regexp.escapeString(e),"i"),cv.util.isHidden(this.clearSearchField)&&cv.util.show(this.clearSearchField)):cv.util.hide(this.clearSearchField);var r=!1,i=null,s=null;for(var o=0;o<t;++o){var u=this.fieldListNodes[o];i!=u.groupHeader&&(i=u.groupHeader,r=!1,i&&cv.util.hide(i)),!n||u.innerHTML.search(n)>=0?(cv.util.show(u),dojo.hasClass(u,"hidden")||(++this.fieldCount,s||(s=u),!r&&i&&(cv.util.show(i),r=!0))):cv.util.isHidden(u)||cv.util.hide(u)}n?dojo.byId("fieldListCount").innerHTML=cv.util.substituteParams(cvCatalog.fieldListCount,this.fieldCount):dojo.byId("fieldListCount").innerHTML=cvCatalog.fieldListAll,this.fieldCount==1&&(this.selectedField&&dojo.style(this.selectedField,"background-color","#ffffff"),this.selectedField=s,dojo.style(this.selectedField,"background-color","#dfdfdf"))},showDlg:function(e){this.manager.report.rptDlg.show("show","fieldHelp",e)},sortFields:function(e){this.currentView&&cv.util.setMenuItem(this.currentView,"none"),this.currentView=e,cv.util.setMenuItem(this.currentView,"checked");var t,n=!0,r=this;e=this.viewOptions[e];switch(e){case"displayLabel":n=!1,t=function(e,t){return r._sortByName(e,t)};break;case"schema":t=null,this.fieldListItems=this._getFieldListItems(),e="businessGroup";break;case"type":t=function(e,t){if(r.isTimeAttribute(e,!0)&&r.isTimeAttribute(t,!0))return r._sortByName(e,t);var n=r.get(e,"type"),i=r.get(t,"type");return n==i?r._sortByName(e,t):n=="NUMBER"?-1:i=="NUMBER"?1:n=="ATTRIBUTE"?-1:1};break;case"businessGroup":t=function(e,t){var n=r.get(e,"businessGroup"),i=r.get(t,"businessGroup");return!n&&!i?r._sortByHierarchy(e,t):n?i?n>i?1:n<i?-1:r._sortByHierarchy(e,t):-1:1};break;default:return}t&&this.fieldListItems.sort(t);if(this.fieldListNodes)for(var i=0,s=this.fieldListNodes.length;i<s;++i)this.fieldListNodes[i].dndObj&&(this.fieldListNodes[i].dndObj=null);this.fieldListNodes=[],this.fieldListTreeContent.innerHTML="";var o=cv.util.getDojoWidget("theTooltip"),s=this.fieldListItems.length,u="!@#$",a=null,f=null,l=!1,c=0,h=[];for(var i=0;i<s;++i){var p=this.fieldListItems[i],d=p.getAttribute("formula"),v;if(n){var m;e=="type"&&this.isTimeAttribute(p,!0)?m="TIME":m=this.get(p,e);if(m!=u){u=m;var g;switch(e){case"schema":g=u?u:cvCatalog.fieldGroupNoValue;break;case"type":g=cvCatalog["fieldTypeLabels_"+(u?u:"NUMBER")];break;case"businessGroup":g=u?u:cvCatalog.fieldGroupNoValue;break;default:g=cvCatalog.fieldGroupNoValue}a=document.createElement("DIV"),a.innerHTML=cv.util.escapeHtml(g),a.id="GROUP"+c,dojo.addClass(a,"folder hidden uncommon"),l=!1,this.fieldListTreeContent.appendChild(a),f=document.createElement("DIV"),f.id="GROUP"+c+"DIV",dojo.addClass(f,"folderContent uncommon"),this.fieldListTreeContent.appendChild(f),new cv.Collapsible(a,f,!0),++c,v=new dojo.dnd.Source(f,{accept:[this.getDndType(d)]}),dojo.mixin(v,{onDrop:function(){}}),cv.isMobile()||(a.setAttribute("businessGroup",g),o.addConnectNode(a))}}var y=document.createElement("DIV"),d=p.getAttribute("formula"),b=this.get(p,"displayLabel",!0),w=this.getProperties(d);w&&w.length>0&&(b+=" ("+w.length+")"),y.innerHTML=b?b:"&nbsp;",y.setAttribute("formula",d),y.groupHeader=a,dojo.addClass(y,this.get(p,"type")=="NUMBER"?"field measure":"field attribute"),dojo.addClass(y,"dojoDndItem"),this.get(p,"isDefaultFavorite")!="true"?dojo.addClass(y,"uncommon"):a&&dojo.hasClass(a,"uncommon")&&(dojo.removeClass(a,"uncommon"),dojo.removeClass(f,"uncommon")),this.fieldListNodes.push(y),f?f.appendChild(y):(this.fieldListTreeContent.appendChild(y),h.push(this.getDndType(d))),a&&!l&&(cv.isMobile()&&y.style.display!="none"||dojo.style(y,"display")!="none")&&(cv.util.show(a),l=!0),cv.isMobile()||o.addConnectNode(y);var d=y.getAttribute("formula"),E=this.get(d);E&&(cv.util.disableTextSelection(y),y.setAttribute("dndType",this.getDndType(E))),y.setAttribute("dndType",this.getDndType(E)),f&&v.sync()}l||(this.fieldListDnDSource||(this.fieldListDnDSource=new dojo.dnd.Source(this.fieldListTreeContent,{accept:h}),dojo.mixin(this.fieldListDnDSource,{onDrop:function(){}})),this.fieldListDnDSource.sync()),this.searchField.value&&this.searchFields()},_sortByName:function(e,t){var n=this.get(e,"displayLabel"),r=this.get(t,"displayLabel");return n>r?1:n<r?-1:0},_sortByHierarchy:function(e,t){var n=this.get(e,"hierarchy"),r=this.get(t,"hierarchy");if(!n&&!r)return this._sortByName(e,t);if(!n)return-1;if(!r)return 1;if(n!=r)return n<r?-1:1;var i=this.doc.documentElement.selectNodes('cv:hierarchyInfo[@formula="'+n+'"]/cv:levelInfo');n=this.get(e,"formula"),r=this.get(t,"formula");for(var s=0;s<i.length;++s){var o=i[s].getAttribute("formula");if(o==n)return-1;if(o==r)return 1}return this._sortByName(e,t)},updateFieldCount:function(){},onClearSearch:function(){this.searchField.value&&(this.searchField.value="",this.searchFields(),this.searchField.focus()),cv.util.hide(this.clearSearchField)},onMouseOver:function(e){var t=e.target;if(!t||!dojo.hasClass(t,"field")||this.selectedField==t)return;this.selectedField&&dojo.removeClass(this.selectedField,"fieldListItem-selected"),this.selectedField=t,dojo.addClass(this.selectedField,"fieldListItem-selected")},onMouseDown:function(e){var t=e.target;if(!t||!dojo.hasClass(t,"field"))return;var n=t.getAttribute("formula"),r=this.get(n);if(!r)return},onDblClick:function(e){e.target==this.selectedField&&this.manager.report.appendGem(this.selectedField.getAttribute("formula"))},onContextMenu:function(e){var t=cv.util.getAncestorByClass(e.target,"field");if(!t)return;cv.util.popupSourceNode=t,cv.util.getDojoWidget("theTooltip").cancelShowing=!0;var n=cv.util.getDojoWidget("fieldListMenu");cv.util.showPopupMenu(n,e.clientX,e.clientY),dojo.stopEvent(e)},onFieldAdd:function(){this.selectedField&&(this.manager.report.appendGem(this.selectedField.getAttribute("formula")),dijit.popup.close())},onFieldFilter:function(){this.selectedField&&(this.manager.report.rptDlg.showFilterList(this.selectedField.getAttribute("formula")),dijit.popup.close())},onFieldHelp:function(){this.selectedField&&(this.showDlg(this.selectedField.getAttribute("formula")),dijit.popup.close())},onViewCategory:function(){this.sortFields("cmdViewCategory")},onViewName:function(){this.sortFields("cmdViewName")},onViewSchema:function(){this.sortFields("cmdViewSchema")},onViewType:function(){this.sortFields("cmdViewType")},onViewFieldOptions:function(e){var t=cv.util.getDojoWidget("fieldViewMenu");if(!t)return;cv.util.showPopupMenu(t,e.pageX,e.pageY),dojo.stopEvent(e)}})}),pen.define("analyzer/report/cv_rptResize",["analyzer/report/cv_rptFieldHelp"],function(){cv.ReportResizer=function(e){this.report=e,this.previousPageX=-1,this.resizeObj=null,this.resizeData=null,this.page=null,this.handles=[]},cv.ReportResizer.prototype={destroy:function(){this.page=null,this.resizeData=null,this.resizeobj=null},gainedFocus:function(e){var t=e.target;if(!t)return;this._updateCursorLook(e);while(t.tagName!="DIV")t=t.childNodes[0];this.handles.push(dojo.connect(t,"onmousemove",this,"_updateCursorLook")),this.handles.push(dojo.connect(t,"onclick",this,"_showMenu")),this.handles.push(dojo.connect(t,"onmousedown",this,"_beginResize")),this.handles.push(dojo.connect(t,"onmouseout",this,"_lostFocus"))},_lostFocus:function(e){var t=e.target;while(t.tagName!="DIV")t=t.childNodes[0];dojo.forEach(this.handles,dojo.disconnect)},_beginResize:function(e){if(!this._isInResizeZone(e))return;this.report.resizing=!0,this.previousPageX=e.pageX;var t=e.target;while(t.tagName!="DIV")t=t.childNodes[0];this.resizeObj=t,this.resizeData=this.report.reportHeaders.getDataColumn(this.resizeObj.offsetParent),this.page=this.resizeObj;while(this.page.offsetParent)this.page=this.page.offsetParent;this.resizeHandles=[dojo.connect(this.page,"onmousemove",this,"_resize"),dojo.connect(this.page,"onmouseup",this,"_endResize")]},_endResize:function(e){this.report.reportHeaders.updateLayout(),dojo.forEach(this.resizeHandles,dojo.disconnect);var t=this._getWidth(this.resizeObj);for(var n=0;n<this.resizeData.length;n++)this.resizeData[n].childNodes[0].style.width=t+1+"px";this.report.resizing=!1},_resize:function(e){var t=this._getParentHeaders(this.resizeObj);for(var n=0;n<t.length;n++)this._resizeObj(t[n],e);this.previousPageX=e.pageX},_resizeObj:function(e,t){var n=this._getWidth(e);n+=t.pageX-this.previousPageX;var r=e.offsetParent.getAttribute("colspan")*1;n<10*r&&(n=10*r),e.style.width=n+"px"},_getParentHeaders:function(e){var t=e.parentNode,n=t.parentNode,r=n.parentNode,i=r.getElementsByTagName("TR"),s=t.getAttribute("colindex")*1;return this.getParentHeaders(i,s)},getParentHeaders:function(e,t){var n=new Array;for(var r=0;r<e.length;r++){var i=e[r].childNodes;for(var s=0;s<i.length;s++){var o=i[s],u=o.getAttribute("colspan")*1,a=o.getAttribute("rowspan")*1,f=o.getAttribute("colindex")*1;if(f<=t&&f+u>t){n.push(o.childNodes[0]),r+=a-1;break}}}return n},_updateCursorLook:function(e){var t=e.target;while(t.tagName!="DIV")t=t.childNodes[0];e.target.style&&e.target.style.cursor&&(this._isInResizeZone(e)?t.offsetParent.style.cursor="e-resize":t.offsetParent.style.cursor="")},_showMenu:function(e){this._isInResizeZone(e)||this.report.toggleInReportPopupMenu(e)},_isInResizeZone:function(e){var t=e.target;while(t.tagName!="DIV")t=t.childNodes[0];var n=e.pageX,r=this._findLeft(t),i=t.offsetWidth,s=r+i;return n>s-10&&n<s?!0:!1},_findLeft:function(e){var t=0;if(e.offsetParent)while(e.offsetParent)t+=e.offsetLeft-e.scrollLeft,e=e.offsetParent;else e.x&&(t+=e.x);return dojo.isIE||(t-=this.report.reportHeaders.getHorzScrollAmount()),t},_getWidth:function(e){var t=1*e.style.width.substring(0,e.style.width.length-2);return t}}}),dojo.require("dojo.dnd.Source"),dojo.require("analyzer.ResizeHandle"),dojo.require("analyzer.BeforeResizeHandle"),pen.define("analyzer/report/cv_rptHeaders",["analyzer/report/cv_rptFieldHelp"],function(){cv.ReportHeaders=function(e,t){this.report=e,this.tableArea=e.nodeReportArea,this.pivotTable=dojo.query(" > div:first-of-type",e.nodeReportArea)[0],this.rowLabelHeaderSection=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableRowLabelHeaderSection"),this.rowLabelHeaderContainer=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableRowLabelHeaderContainer"),this.rowLabelSection=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableRowLabelSection"),this.rowLabelContainer=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableRowLabelContainer"),this.columnHeaderSection=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableColumnHeaderSection"),this.columnHeaderContainer=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableColumnHeaderContainer"),this.columnHeaderTable=cv.util.getFirstChildByClass(this.columnHeaderContainer,"ZONE_columnAttributes"),this.rowHeaderTable=cv.util.getFirstChildByClass(this.rowLabelHeaderSection,"ZONE_rowAttributes"),this.measureHeaderTable=cv.util.getFirstChildByClass(this.columnHeaderTable,"ZONE_measures"),this.dataSection=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableDataSection"),this.dataContainer=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableDataContainer"),this.content=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableContent"),this.scrollbarArea=cv.util.getFirstChildByClass(this.pivotTable,"pivotTableScrollbars"),this.scrollbarAreaDiv=dojo.query(" > div:first-of-type",this.scrollbarArea)[0],this.truncateType=this.pivotTable.truncateType,this.dragNodes=[],this.handles=[],this.tempDragHandles=[];var n=this.rowLabelContainer.firstChild;while(n.tagName!="TABLE")n=n.nextSibling;this.rowLabelTable=n;var n=this.dataContainer.firstChild;while(n.tagName!="TABLE")n=n.nextSibling;this.colLabelTable=n;var n=this.content.firstChild;while(n.tagName!="TABLE")n=n.nextSibling;this.contentTable=n;if(this.truncateType=="ROW"||this.truncateType=="BOTH")e.byId("RowTruncateMsg").innerHTML=this.pivotTable.rowMsg;if(this.truncateType=="COL"||this.truncateType=="BOTH")e.byId("ColTruncateMsg").innerHTML=this.pivotTable.colMsg;cv.util.hide(this.report.nodeColTruncate,this.report.nodeRowTruncate),this.rowLabelHeaders=this.rowLabelHeaderContainer.getElementsByTagName("TD");var r=this.rowLabelSection.getElementsByTagName("TR"),i=null;this.rowLabels=null,r.length>0&&(i=r[0].childNodes,this.rowLabels=this.rowLabelSection.getElementsByTagName("COLGROUP")[0].childNodes);var s=this.columnHeaderSection.getElementsByTagName("TR");this.columnHeaders=s.length?s[s.length-1].childNodes:null;if(this.columnHeaders!=null&&dojo.isIE&&s.length==1){var o=this.columnHeaderSection.getElementsByTagName("COLGROUP")[0].childNodes;for(var u=0;u<o.length;u++)o[u].width=o[u].width*1-1}this.dataColumns=this.dataSection.getElementsByTagName("TR"),this.connectScrollbar(),this.previousPageX=-1,this.previousPageY=-1,this._setUpDrag(),dojo.isMozilla?this.pivotTable.addEventListener&&this.pivotTable.addEventListener("DOMMouseScroll",dojo.hitch(this,"_mouseScroll"),!1):(this.mouseWheelHandle=dojo.connect(this.pivotTable,"onmousewheel",this,"_mouseScroll"),this.handles.push(this.mouseWheelHandle),this.handles.push(dojo.connect(this.pivotTable,"onmousemove",this,"_clearSelection"))),this.handles.push(dojo.connect(this.pivotTable,"onmousedown",this,"_mouseDown")),this.handles.push(dojo.connect(this.columnHeaderContainer,"ondblclick",this.report,"showEditDialogOnColumnHeader")),this.handles.push(dojo.connect(this.rowLabelHeaderContainer,"ondblclick",this.report,"showEditDialogOnColumnHeader")),this.widths=new Array,this.initialWidths=new Array,this.columnWidths=new Array,this.initialColumnWidths=new Array,this.DEFAULT_COLUMN_WIDTH=120,this.MINIMAL_WIDTH=10,this.resizeLabels=new Array,this.resizeColumns=new Array;for(var u=0;u<this.rowLabelHeaders.length;u++){var a=0;this.rowLabels!=null&&(a=dojo.marginBox(i[u]).w);var f=dojo.marginBox(this.rowLabelHeaders[u]).w;this.isTooLongOrHasSpace(this.rowLabelHeaders[u].title)&&(f=f*1.1/2),this.widths[u]=Math.min(a,210),this.widths[u]=Math.max(this.widths[u],80),this.widths[u]=Math.max(this.widths[u],f),this.initialWidths[u]=this.widths[u]}if(dojo.isIE){var l=this.dataContainer.childNodes[0].childNodes[0].childNodes;if(this.columnHeaders!=null&&this.columnHeaders.length>0&&l.length>0){var c=l[0];c.width=c.width*1+1,c=l[l.length-1],c.width=c.width*1-(s.length==1?2:1)}}},cv.ReportHeaders.prototype={disconnect:function(){this._tearDownDrag();for(var e=0;e<this.dragNodes.length;++e)this.dragNodes[e].dndObj=null;dojo.forEach(this.handles,dojo.disconnect),this.pivotTable=null,this.rowLabelHeaderSection=null,this.rowLabelHeaderContainer=null,this.rowLabelSection=null,this.rowLabelContainer=null,this.columnHeaderSection=null,this.columnHeaderContainer=null,this.dataSection=null,this.dataContainer=null,this.tableArea=null,this.content=null,this.scrollbarArea=null,this.rowLabelHeaders=null,this.rowLabels=null,this.columnHeaders=null,this.dataColumns=null,this.dragNodes=null},connectScrollbar:function(){this.scrollHandle=dojo.connect(this.scrollbarArea,"onscroll",this,"_scroll"),this.handles.push(this.scrollHandle)},isTooLongOrHasSpace:function(e){return e.length>30||e.indexOf(" ")>-1},attachResizeNode:function(e,t,n,r){if(e==null)return;var i=document.createElement("div");if("after"==n){var s=new analyzer.ResizeHandle({resizeNodeId:r,reportHeader:this,targetType:t,targetDomNode:e},i);e.appendChild(s.domNode)}else{var s=new analyzer.BeforeResizeHandle({resizeNodeId:r,reportHeader:this,targetType:t,targetDomNode:e},i);e.insertBefore(s.domNode,e.firstChild)}},_sumOf:function(e){var t=0;for(var n=0;n<e.length;n++)t+=e[n];return t},_computeRowLabelWidths:function(){var e=new Array;for(var t=0;t<this.widths.length;t++)e[t]=this.widths[t];var n=this._sumOf(e),r=.67*this.pivotTableWidth;while(n>r){var i=new Array,s=0,o=0;for(var t=0;t<e.length;t++)e[t]==s?i[i.length]=t:e[t]>s&&(i=new Array,i[0]=t,s=e[t]);for(var t=0;t<e.length;t++)e[t]>o&&e[t]<s&&(o=e[t]);var u=Math.max(1,Math.min(Math.ceil((n-r)/i.length),s-o));for(var t=0;t<i.length;t++)e[i[t]]-=u;n=this._sumOf(e)}return e},_adjustRowLabelWidths:function(e,t,n){var r=[],i=Math.max(dojo.style(this.rowLabelContainer,"padding"),dojo.style(this.rowLabelHeaderContainer,"padding")),s=i;this.rowLabelContainer.childNodes[0].style.tableLayout="fixed",this.rowLabelContainer.childNodes[0].style.width="0px";var o=this.rowLabelHeaderContainer.getElementsByTagName("COL");this.rowLabelHeaderContainer.childNodes[0].style.tableLayout="fixed",this.rowLabelHeaderContainer.childNodes[0].style.width="0px";for(var u=0;u<e.length;u++){var a=this.widths[u];this.report.rowFieldWidths[u]!=null&&(a-=this.report.rowFieldWidths[u]),a<this.MINIMAL_WIDTH&&(a=this.MINIMAL_WIDTH),typeof t!="undefined"&&u==t&&(this.report.isReportPropsDirty=!0,a-=n,typeof this.report.rowFieldWidths[u]=="undefined"?this.report.rowFieldWidths[u]=n:this.report.rowFieldWidths[u]+=n),this.rowLabelHeaders[u].childNodes[0].style.whiteSpace="normal",o[u].width=a+"px",r.push(a),this.rowLabels!=null&&(this.rowLabels[u].width=a+"px"),i+=a}return i-=s,this.rowLabelHeaderSection.setAttribute("width",i),this.rowLabelSection.setAttribute("width",i),i>0&&(this.rowLabelHeaderContainer.style.width=i+"px",this.rowLabelContainer.style.width=i+"px"),this.report.actualRowFieldWidths=r,i},_adjustColumnWidths:function(e,t,n){var r=[],i=new Array,s=this.columnHeaderContainer.getElementsByTagName("COL");for(var o=0;o<s.length;o++)typeof this.report.columnDataFieldWidths[o]!="undefined"?i[o]=this.DEFAULT_COLUMN_WIDTH-this.report.columnDataFieldWidths[o]:i[o]=this.DEFAULT_COLUMN_WIDTH;for(var o=0;o<i.length;o++)typeof e!="undefined"&&typeof n!="undefined"&&o>=e&&o<e+n&&(this.report.isReportPropsDirty=!0,i[o]-=t/n);var u=0;for(var o=0;o<i.length;++o)u+=i[o];dojo.isIE&&(u+=1),this.columnHeaderSection.style.width=u+"px",this.columnHeaderContainer.style.width=u+"px",this.columnHeaderSection.setAttribute("width",u),this.columnHeaderContainer.setAttribute("width",u);var a=this.dataContainer.getElementsByTagName("COL");for(var o=0;o<i.length;o++){var f=i[o]<this.MINIMAL_WIDTH?this.MINIMAL_WIDTH:i[o];a[o].width=f,s[o].width=f,r.push(f)}for(var o=0;o<i.length;o++)this.report.columnDataFieldWidths[o]=this.DEFAULT_COLUMN_WIDTH-i[o];cv.util.getFirstChildByClass(this.columnHeaderContainer,"ZONE_columnAttributes").style.width=u+"px",this.dataContainer.setAttribute("width",u),this.dataContainer.style.width=u+"px";var l=this.dataContainer.getElementsByTagName("table");l[0].setAttribute("width",u),this.report.actualColumnFieldWidths=r},_adjustHeadersHeight:function(){if(this.rowLabelHeaders!=null&&this.rowLabelHeaders.length>0&&this.columnHeaders!=null&&this.columnHeaders.length>0){var e=dojo.contentBox(this.columnHeaders[0]).h,t=dojo.contentBox(this.rowLabelHeaders[0]).h,n=Math.max(e,t);for(var r=0;r<this.rowLabelHeaders.length;r++)this.rowLabelHeaders[r].style.height=n+"px";for(var r=0;r<this.columnHeaders.length;r++)this.columnHeaders[r].style.height=n+"px"}},_hideEmptyContainers:function(){dojo.marginBox(this.columnHeaderTable).h<=1&&(this.columnHeaderTable.style.display="none")},_adjustContainer:function(e){var t=Math.max(dojo.position(this.columnHeaderContainer.childNodes[0]).h,dojo.position(this.rowLabelHeaderContainer.childNodes[0]).h);this.rowLabelHeaderSection.setAttribute("height",t),this.rowLabelHeaderContainer.style.height=t+"px",this.columnHeaderSection.setAttribute("height",t),this.dataAreaWidth=this.scrollbarArea.clientWidth-e-2;var n=this.scrollbarArea.clientHeight-t;this.content.style.width=this.scrollbarArea.clientWidth+"px",this.content.style.height=this.scrollbarArea.clientHeight+"px",this.dataContainer.scrollLeft=0,this.dataContainer.scrollTop=0;var r=this.rowLabelContainer.childNodes[0].offsetHeight*this.scrollbarArea.clientHeight/n,i=this.columnHeaderSection.getAttribute("width")-0,s=e+i;this.scrollbarAreaDiv.style.height=Math.max(n,r)+"px",this.scrollbarAreaDiv.style.width=Math.max(this.dataAreaWidth,s)+"px"},_clearHeaderHeightStyle:function(){if(this.rowLabelHeaders!=null)for(var e=0;e<this.rowLabelHeaders.length;e++)this.rowLabelHeaders[e].style.height="";if(this.columnHeaders!=null)for(var e=0;e<this.columnHeaders.length;e++)this.columnHeaders[e].style.height=""},updateLayout:function(e,t,n){this.pivotTableHeight=this.report.reportHeight-10,this.pivotTableWidth=this.report.reportWidth-10,this.scrollbarArea.style.height=this.pivotTableHeight+"px",this.scrollbarArea.style.width=this.pivotTableWidth+"px",this.pivotTable.style.height=this.pivotTableHeight+"px",this.pivotTable.style.width=this.pivotTableWidth+"px",this.content.style.marginTop="-"+this.pivotTableHeight+"px";var r=this._computeRowLabelWidths();this._clearHeaderHeightStyle();var i=0;typeof n!="undefined"?i=this._adjustRowLabelWidths(r):i=this._adjustRowLabelWidths(r,e,t),this._adjustColumnWidths(e,t,n),this._adjustHeadersHeight(),this._adjustContainer(i),this._hideEmptyContainers();if(dojo.isIE){var s=dojo.query(".resize",this.columnHeaderContainer);for(var o=0;o<s.length;++o)dojo.style(s[o],"top","0px"),dojo.style(s[o],"position","static"),dojo.style(s[o],"position","relative");for(var o=0;o<this.resizeLabels.length;++o)dojo.style(this.resizeLabels[o],"top","0px"),dojo.style(this.resizeLabels[o],"position","static"),dojo.style(this.resizeLabels[o],"position","relative")}this._scroll(null)},getDataColumn:function(e){for(var t=0;t<this.columnHeaders.length;t++)if(this.columnHeaders[t]==e){var n=new Array;for(var r=0;r<this.dataColumns.length;r++)n[r]=this.dataColumns[r].childNodes[t];return n}return null},_scroll:function(e){var t=cv.getActiveReport().reportDoc,n;t.getReportOption("freezeColumns")=="true"&&t.getReportOption("freezeRows")=="true"?n=this.XYLockedScrollStrategy:t.getReportOption("freezeColumns")=="true"?n=this.YLockedScrollStrategy:t.getReportOption("freezeRows")=="true"?n=this.XLockedScrollStrategy:n=this.UnlockedScrollStrategy;try{var r=-this.scrollbarArea.scrollLeft/(this.scrollbarArea.clientWidth-parseInt(this.scrollbarAreaDiv.clientWidth)),i=-this.scrollbarArea.scrollTop/(this.scrollbarArea.clientHeight-parseInt(this.scrollbarAreaDiv.clientHeight));r||(r=0),i||(i=0);var s=Math.round(n.getMaxXOffset(this)*r),o=Math.round(n.getMaxYOffset(this)*i);n.scroll(this,s,o),this._checkTruncate(r,i)}catch(e){throw alert(e),e}},_clearSelection:function(e){},_mouseScroll:function(e){this.mouseWheelHandle&&dojo.disconnect(this.mouseWheelHandle);var t=0;typeof e.wheelDelta=="number"?t=e.wheelDelta:typeof e.detail=="number"&&(t=-e.detail*40),this._scrollByAmount(0,t),this.mouseWheelHandle=dojo.connect(this.pivotTable,dojo.isMozilla?"DOMMouseScroll":"onmousewheel",this,"_mouseScroll")},_mouseDown:function(e){var t=cv.util.getAncestorByTag(e.target,"td");if(!t)return;var n=t.getAttribute("type");if(n!="measure"&&n!="attribute")return;if(!t.dndObj){if(n=="measure")n="VM";else{var r=this.report.getGem(t.getAttribute("formula"));if(!r)return;n=r.dndType+this.report.dropTargets[r.getZone()].dndSuffix}dojo.addClass(t,"dojoDndItem"),t.setAttribute("dndType",n),t.dndObj=new dojo.dnd.Source(t.parentNode,{accept:[n]}),t.dndObj.onMouseOver(e),t.dndObj.onMouseDown(e),this.dragNodes.push(t)}},keyPress:function(e){e==33?this._scrollByAmount(0,250):e==34?this._scrollByAmount(0,-250):e==38?this._scrollByAmount(0,10):e==40?this._scrollByAmount(0,-10):e==37?this._scrollByAmount(10,0):e==39&&this._scrollByAmount(-10,0)},_setUpDrag:function(){this.dragHandle=dojo.connect(this.dataContainer,"onmousedown",this,"_startDrag")},_tearDownDrag:function(){dojo.disconnect(this.dragHandle)},_startDrag:function(e){dojo.disconnect(this.scrollHandle),this.previousPageX=e.pageX,this.previousPageY=e.pageY,this.changeIndex=0,this.previousXChanges=new Array,this.previousYChanges=new Array;for(var t=0;t<9;t++)this.previousXChanges[t]=0,this.previousYChanges[t]=0;var n=e.target;while(n.offsetParent)n=n.offsetParent;this.tempDragHandles.push(dojo.connect(n,"onmouseup",this,"_stopDrag")),this.tempDragHandles.push(dojo.connect(document,"onmouseup",this,"_stopDrag")),this.tempDragHandles.push(dojo.connect(n,"onmousemove",this,"_drag")),this.tempDragHandles.push(dojo.connect(document,"onmousemove",this,"_drag"))},_stopDrag:function(e){var t=e.target;while(t.offsetParent)t=t.offsetParent;dojo.forEach(this.tempDragHandles,dojo.disconnect),this.connectScrollbar()},_drag:function(e){if(e.button<0||e.button>2){this._stopDrag();return}var t=!0,n=!0,r=e.pageX-this.previousPageX,i=e.pageY-this.previousPageY;this.previousXChanges[this.changeIndex]=r,this.previousYChanges[this.changeIndex]=i;var s=0,o=0;for(var u=0;u<9;u++)s+=this.previousXChanges[u],o+=this.previousYChanges[u];Math.abs(s)*2<Math.abs(o),Math.abs(o)*2<Math.abs(s),this.changeIndex=(this.changeIndex+1)%9,this.previousPageY=e.pageY,this.previousPageX=e.pageX,t||(r=0),n||(i=0),this._scrollByAmount(r,i)},_scrollByAmount:function(e,t){if(e==0&&t==0)return;var n=cv.getActiveReport().reportDoc,r;n.getReportOption("freezeColumns")=="true"&&n.getReportOption("freezeRows")=="true"?r=this.XYLockedScrollStrategy:n.getReportOption("freezeColumns")=="true"?r=this.YLockedScrollStrategy:n.getReportOption("freezeRows")=="true"?r=this.XLockedScrollStrategy:r=this.UnlockedScrollStrategy;var i=r.getXOffset(this,e),s=r.getYOffset(this,t),o=r.getMaxXOffset(this),u=r.getMaxYOffset(this);r.scroll(this,i,s),this.updateScrollbars(Math.min(1,i/o),Math.min(1,s/u)),this._checkTruncate(i/o,s/u)},updateScrollbars:function(e,t){this.scrollbarArea.scrollLeft=-Math.round((this.scrollbarArea.clientWidth-this.scrollbarAreaDiv.clientWidth)*e),this.scrollbarArea.scrollTop=-Math.round((this.scrollbarArea.clientHeight-this.scrollbarAreaDiv.clientHeight)*t)},UnlockedScrollStrategy:{getXOffset:function(e,t){return e.contentTable.style.marginLeft?parseInt(e.contentTable.style.marginLeft)+t:t},getMaxXOffset:function(e){return e.content.clientWidth-e.contentTable.scrollWidth},getYOffset:function(e,t){return e.contentTable.style.marginTop?parseInt(e.contentTable.style.marginTop)+t:t},getMaxYOffset:function(e){return e.content.clientHeight-e.contentTable.scrollHeight},scroll:function(e,t,n){var r=Math.min(Math.max(t,this.getMaxXOffset(e)),0),i=Math.min(Math.max(n,this.getMaxYOffset(e)),0);e.contentTable.style.marginLeft=r+"px",e.contentTable.style.marginTop=i+"px"}},XLockedScrollStrategy:{getXOffset:function(e,t){return e.columnHeaderTable.style.left?parseInt(e.columnHeaderTable.style.left)+t:t},getMaxXOffset:function(e){return e.content.clientWidth-e.contentTable.scrollWidth},getYOffset:function(e,t){return e.contentTable.style.marginTop?parseInt(e.contentTable.style.marginTop)+t:t},getMaxYOffset:function(e){return e.content.clientHeight-e.contentTable.scrollHeight},scroll:function(e,t,n){var r=Math.min(Math.max(t,this.getMaxXOffset(e)),0),i=Math.min(Math.max(n,this.getMaxYOffset(e)),0);e.colLabelTable.style.left=r+"px",e.columnHeaderTable.style.left=r+"px",e.contentTable.style.marginTop=i+"px"}},YLockedScrollStrategy:{getXOffset:function(e,t){return e.contentTable.style.marginLeft?parseInt(e.contentTable.style.marginLeft)+t:t},getMaxXOffset:function(e){return e.content.clientWidth-e.contentTable.scrollWidth},getYOffset:function(e,t){return e.rowLabelTable.style.top?parseInt(e.rowLabelTable.style.top)+t:t},getMaxYOffset:function(e){return e.content.clientHeight-e.contentTable.scrollHeight},scroll:function(e,t,n){var r=Math.min(Math.max(t,this.getMaxXOffset(e)),0),i=Math.min(Math.max(n,this.getMaxYOffset(e)),0);e.contentTable.style.marginLeft=r+"px",e.colLabelTable.style.top=i+"px",e.rowLabelTable.style.top=i+"px"}},XYLockedScrollStrategy:{getXOffset:function(e,t){return e.columnHeaderTable.style.left?parseInt(e.columnHeaderTable.style.left)+t:t},getMaxXOffset:function(e){return e.content.clientWidth-e.contentTable.scrollWidth},getYOffset:function(e,t){return e.rowLabelTable.style.top?parseInt(e.rowLabelTable.style.top)+t:t},getMaxYOffset:function(e){return e.content.clientHeight-e.contentTable.scrollHeight},scroll:function(e,t,n){var r=Math.min(Math.max(t,this.getMaxXOffset(e)),0),i=Math.min(Math.max(n,this.getMaxYOffset(e)),0);e.colLabelTable.style.left=r+"px",e.columnHeaderTable.style.left=r+"px",e.rowLabelTable.style.top=i+"px",e.colLabelTable.style.top=i+"px"}},_checkTruncate:function(e,t){if(this.report.closeTruncateStatus=="BothClose")return;(this.truncateType=="COL"||this.truncateType=="BOTH")&&this.report.closeTruncateStatus!="ColClose"&&(e>=1||this.scrollbarArea.clientWidth>=this.scrollbarAreaDiv.clientWidth?(cv.util.show(this.report.nodeColTruncate),this.report.nodeColTruncate.style.left=this.tableArea.clientWidth-dojo.marginBox(this.report.nodeColTruncate).w-35+"px",this.report.nodeColTruncate.style.top=this.tableArea.offsetTop+10+"px"):cv.util.hide(this.report.nodeColTruncate));if(this.truncateType=="ROW"||this.truncateType=="BOTH"&&this.report.closeTruncateStatus!="RowClose")t>=1||this.scrollbarArea.clientHeight>=this.scrollbarAreaDiv.clientHeight?(cv.util.show(this.report.nodeRowTruncate),this.report.nodeRowTruncate.style.top=this.tableArea.offsetTop+this.tableArea.clientHeight-dojo.position(this.report.nodeRowTruncate).h-28+"px"):cv.util.hide(this.report.nodeRowTruncate)}}}),pen.define("analyzer/report/cv_pentaho",["analyzer/common"],function(){});var gCtrlr=new WaqrProxy;pen.define("analyzer/report/report",["analyzer/common","analyzer/report/cv_rptConst","analyzer/report/cv_rptIO","analyzer/report/cv_rptReport","analyzer/report/cv_rptReport2","analyzer/report/cv_rptReport3","analyzer/report/cv_rptGem","analyzer/report/cv_rptDlg","analyzer/report/cv_rptLinkDlg","analyzer/report/cv_rptChartOptionsDlg","analyzer/report/cv_rptPageSetupDlg","analyzer/report/cv_rptFilterDlg","analyzer/report/cv_rptFilterMetricDlg","analyzer/report/cv_rptDoc","analyzer/report/cv_rptDnd","analyzer/report/cv_rptFieldHelp","analyzer/report/cv_rptResize","analyzer/report/cv_rptHeaders","analyzer/report/cv_pentaho"],function(){}),pen.define("analyzer/main",["analyzer/oss-module","analyzer/common","analyzer/report/report"]),dojo.require("dijit.Menu"),dojo.require("dojox.fx"),dojo.require("pentaho.common.propertiesPanel.Configuration"),dojo.require("analyzer.LayoutPanel"),dojo.require("dojo.fx.easing"),pen.define("analyzer/report/editor.js.uncompressed",["analyzer/report/report"],function(){dojo.declare("cv.ReportEditor",null,{constructor:function(){this.report=null,this.fieldHelp=null,this.isShowingFieldList=!1},MIN_REPORT_HEIGHT:100,init:function(){this.isAdministrator=dojo.byId("isAdministrator").value=="true",this.applyReportContextInFilterDialog=dojo.byId("applyReportContextInFilterDialog").value=="true",this.disableDrillLinks=dojo.byId("disableDrillLinks").value=="true";var e=window.location.search.indexOf("area=")>=0||window.location.search.indexOf("command=new")>=0,t=dojo.byId("reportXML").value;if(!t){var n=cv.util.getURLQueryValue("path");if(n)return cv.util.alertErrorOnPageOpen(cv.util.substituteParams(cvCatalog.errorBadReport,n),"../")}var r=cv.util.getURLQueryValue("fieldListView");if(r=="cmdViewCategory"||r=="cmdViewName"||r=="cmdViewType"||r=="cmdViewSchema")cv.prefs.fieldListView=r;window.name="cvviewrpt",cv.contentMinWidth=600;var i=dojo.byId("reportContainer");this.report=new cv.Report({id:"RPT001",mode:"EDIT",catalog:dojo.byId("REPORT_catalog").value,cube:dojo.byId("REPORT_cube").value,reportXml:t,containerNode:i,manager:this,uiController:"updateEditCmds",progressPaneId:"progressPane"}),this.fieldHelp=new cv.FieldHelp(dojo.byId("fieldHelpXML").value,this),this.report.init();var s=this.report;this.report.dropTargets.fieldListTree=new cv.TrashAreaDropTarget(dojo.byId("fieldListTree"),{accept:cvConst.dndAcceptedTypes.trashcan,report:s}),cv.popupMenus={fieldViewMenu:[{id:"cmdViewCategory",src:this.fieldHelp,handler:"onViewCategory"},{id:"cmdViewSchema",src:this.fieldHelp,handler:"onViewSchema"},{id:"cmdViewType",src:this.fieldHelp,handler:"onViewType"},{id:"cmdViewName",src:this.fieldHelp,handler:"onViewName"}],fieldListMenu:[{id:"cmdFieldAdd",src:this.fieldHelp,handler:"onFieldAdd"},{id:"cmdFieldFilter",src:this.fieldHelp,handler:"onFieldFilter"},{id:"cmdFieldAbout",src:this.fieldHelp,handler:"onFieldHelp"}],exportMenu:[{id:"cmdPDF",src:this.report.pageSetupDlg,handler:"showPDF"},{id:"cmdExcel",src:this.report.pageSetupDlg,handler:"showExcel"},{id:"cmdCSV",src:this.report.rptDlg,handler:"showCSVDownload"}],adminMenu:[{id:"cmdReportXml",src:this.report.rptDlg,handler:"showReportDefinition"},{id:"cmdAdminLog",src:this,handler:"openQueryLog"},{id:"cmdAdminMDX",src:this,handler:"openMDXEditor"},{id:"cmdClearCache",src:this,handler:"clearCache"}],moreActionsMenu:[{id:"cmdProps",src:this.report.rptDlg,handler:"showReportProps"},{id:"cmdOptions",src:this.report.rptDlg,handler:"showReportOptions"},{id:"cmdChartProps",src:this.report.chartOptionsDlg,handler:"show"},{id:"cmdResetReport",src:this.report,handler:"onResetReport"},{id:"cmdResetColumnSize",handler:"onResetColumnSize"}],attributePopMenu:[{id:"PM:attrEdit",src:this.report.rptDlg,handler:"showEditColumn"},{id:"PM:hyperlink",src:this.report.linkDlg,handler:"show"},{id:"PM:attrSortAZ",handler:"onGemSortAsc"},{id:"PM:attrSortZA",handler:"onGemSortDesc"},{id:"PM:attrShowSub",handler:"onGemToggleSubtotal"},{id:"PM:attrFilter",src:this.report,handler:"showFilterDlg"},{id:"PM:attrFilterRank",src:this.report,handler:"showFilterDlgRank"},{id:"PM:helpAttr",src:this.report,handler:"showHelpDlg"},{id:"PM:removeAttr",src:this.report,handler:"removeCurrentGem"}],propPopMenu:[{id:"PM:helpProp",src:this.report,handler:"showPropHelpDlg"},{id:"PM:removeProp",src:this.report,handler:"removeCurrentProp"}],condFormatMenu:[{id:"PM:condFormat_COLOR_SCALE_G_Y_R",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_COLOR_SCALE_R_Y_G",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_COLOR_SCALE_B_Y_R",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_COLOR_SCALE_R_Y_B",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_DATA_BAR_RED",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_DATA_BAR_GREEN",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_DATA_BAR_BLUE",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_TREND_ARROW_GR",src:this.report,handler:"onGemConditionalFormatting"},{id:"PM:condFormat_TREND_ARROW_RG",src:this.report,handler:"onGemConditionalFormatting"}],newNumberMenu:[{id:"PM:editMeasureSummary",src:this.report.rptDlg,handler:"showEditSummaryMeasure"},{id:"PM:editMeasureArith",src:this.report.rptDlg,handler:"showEditArithMeasure"},{id:"PM:editMeasureTrend",src:this.report.rptDlg,handler:"showEditTrendMeasure"},{id:"PM:summaryMetrics",src:this.report.rptDlg,handler:"showNewSummaryOptions"},{id:"PM:arithNumber",src:this.report.rptDlg,handler:"showNewArithBuilder"},{id:"PM:trendNumber",src:this.report.rptDlg,handler:"showNewTrendNumber"}],measurePopMenu:[{id:"PM:measEdit",src:this.report.rptDlg,handler:"showEditColumn"},{id:"PM:measSortHiLow",handler:"onGemSortDesc"},{id:"PM:measSortLowHi",handler:"onGemSortAsc"},{id:"PM:measFilterCond",src:this.report,handler:"showFilterDlgCondition"},{id:"PM:measFilterRank",src:this.report,handler:"showFilterDlgRank"},{id:"PM:measSubtotals",src:this.report.rptDlg,handler:"showSubtotals"},{id:"PM:helpMetric",src:this.report,handler:"showHelpDlg"},{id:"PM:inChartHideMetric",handler:"onGemToggleInChart"},{id:"PM:removeMetric",src:this.report,handler:"removeCurrentGem"}],measureDisabledPopMenu:[{id:"PM:inChartShowMetric",handler:"onGemToggleInChart"},{id:"PM:removeDisabledMetric",src:this.report,handler:"removeCurrentGem"}],filterPopMenu:[{id:"PM:editFilter",src:this.report,handler:"showFilterDlg"},{id:"PM:removeFilter",src:this.report,handler:"removeCurrentGem"},{id:"PM:addFilter",src:this.report,handler:"showNewFilterDlg"}],grandTotalPopMenu:[{id:"PM:totalNonVisual",handler:"onRptNonVisualTotal"},{id:"PM:totalHide",handler:"onRptHideGrandTotal"}]},cv.isMobile()&&window.top.PentahoMobile&&dijit.byId("exportMenuItem").setDisabled(!0);var o=this,s=this.report;cv.util.initDojoWidget=function(e){var t=e.id;switch(e.declaredClass){case"dijit.Menu":case"analyzer.LeftSidePopupMenu":if(t=="chartTypeMenu"){var n=cv.util.addChartMenuItems(e);for(var r=0;n&&r<n.length;++r)n[r].onSelectChartType=function(){dijit.popup.close();var e=this.customType?"CUSTOM":this.id,t=this.customType?this.id:null,n=this.customType?"JSON":"CHART";s._initDisplay(n,e,t),s.history.add(new cv.ReportState("actionChartType")),s.refreshReport()},dojo.connect(n[r],"onClick",n[r],"onSelectChartType")}else cv.util.connectPopupMenu(s,cv.popupMenus[t]);break;case"FloatingPane":t=="progressPane"&&dojo.connect(dojo.byId("progressPaneCancel"),"onclick",s,"cancelReport");break;default:}},this.fieldHelp.init(),cv.getFieldHelp=function(e){return o.fieldHelp},cv.getActiveReport=function(){return s};var u=cv.util.getURLQueryValue("showRepositoryButtons");if(u=="false"||!cv.isMobile()&&u!="true"||window.parent&&window.parent.PentahoMobile&&u!="true")dojo.forEach(["cmdNew","cmdOpen","cmdSave","cmdSaveAs"],function(e){dojo.addClass(dojo.byId(e),"hidden")}),cv.util.hide(dojo.byId("cmdRepositorySeparator"));this.cmdNew=dojo.byId("cmdNew"),this.cmdOpen=dojo.byId("cmdOpen"),this.cmdSave=dojo.byId("cmdSave"),this.cmdSaveAs=dojo.byId("cmdSaveAs"),this.cmdBookmark=dojo.byId("cmdBookmark"),this.cmdFields=dojo.byId("cmdFields"),this.cmdFilters=dojo.byId("cmdFilters"),this.cmdLayout=dojo.byId("cmdLayout"),this.cmdShowPivot=dojo.byId("cmdShowPivot"),this.cmdShowChart=dojo.byId("cmdShowChart"),this.cmdSelectChartType=dojo.byId("cmdSelectChartType"),this.cmdToggleRefresh=dojo.byId("cmdToggleRefresh"),this.cmdMoreActions=dojo.byId("cmdMoreActions"),this.cmdUndo=dojo.byId("cmdUndo"),this.cmdRedo=dojo.byId("cmdRedo"),this.fieldList=dojo.byId("fieldList"),this.fieldListContent=dojo.byId("fieldListContent"),this.fieldListWrapper=dojo.byId("fieldListWrapper"),this.mainBorderContainer=dijit.byId("borderContainer"),this.reportBorderContainer=dijit.byId("reportContainerWrapper");if(cv.isMobile()){var a=dijit.byId("reportContainerWrapper"),f=dijit.byId("borderContainer"),l=dijit.byId("reportBtns");a.removeChild(l),f.addChild(l),dojo.forEach(["cmdBack","cmdNew","cmdOpen","cmdSave","cmdSaveAs","cmdUndo","cmdRedo","cmdFields","cmdFilters","cmdLayout","cmdToggleRefresh","cmdMoreActions","cmdShowChart","cmdShowPivot","cmdSelectChartType"],function(e){var t=dojo.byId(e);t.tagName!="IMG"&&(t=t.firstChild),t.src=t.src.replace("images/toolbar","images/toolbar/mobile")})}this.prevShowFieldList=null,cv.util.initDivButton(this.cmdFields,this,"onToggleReportPane"),cv.util.initDivButton(this.cmdFilters,this,"onToggleReportPane"),cv.util.initDivButton(this.cmdLayout,this,"onToggleReportPane"),cv.util.initDivButton(this.cmdMoreActions,this,"_toggleMoreActionsMenu"),cv.util.initDivButton(this.cmdUndo,this.report.history,"undo"),cv.util.initDivButton(this.cmdRedo,this.report.history,"redo"),cv.util.initDivButton(this.cmdToggleRefresh,this,"onToggleAutoRefresh"),dojo.connect(this.cmdShowPivot,"onclick",this.report,"toggleReportFormat"),dojo.connect(this.cmdShowChart,"onclick",this.report,"toggleReportFormat"),dojo.connect(this.cmdSelectChartType,"onclick",this.report,"toggleChartTypePopupMenu");var c=cv.util.getURLQueryValue("showBackButton");if(c){var h=dojo.byId("cmdBack");cv.util.show(h),cv.util.initDivButton(h),cv.util.show(dojo.byId("cmdBackSeparator"))}dojo.hasClass(this.cmdNew,"hidden")||(cv.util.initDivButton(this.cmdNew,this,"newReport"),cv.util.initDivButton(this.cmdOpen,this,"openReport"),cv.util.initDivButton(this.cmdSave,this,"gwtSaveReport"),cv.util.initDivButton(this.cmdSaveAs,this,"gwtSaveAsReport")),dojo.connect(window,"onresize",this,"onWindowResize"),dojo.connect(document,"onkeydown",this,"onKey"),this._updateCmdButtons(),window.onbeforeunload=function(){if(s.isDirty()&&window.top==window.self&&!cv.prefs.skipDirtyAlert)return cvCatalog.promptDirtyReport},window.onunload=function(){s.destroyReport(),s.destroy()};var p=dojo.byId("pageLoading");p&&p.parentNode.removeChild(p),this.reportHeight=-1,this.reportWidth=-1,e?this._updateCmdButtons():this.resize(),this.report.postCreate(),this.initReportPane(),this.editorDashboardPath="new",this.editorGadgetPath="new",pentahoLoad(),this.layoutPanel=new analyzer.LayoutPanel,this.layoutPanel.updatePanel(this.report);if(cv.isMobile()){var d=this;window.addEventListener("orientationchange",function(){d.onWindowResize(),dijit.popup.close()})}dojo.connect(this.reportBorderContainer,"layout",this,"onResize"),this.onWindowResize(),this.onResize();if(window.inMobile){var v=this.mainBorderContainer;setInterval(function(){try{var e=window.parent.document.getElementsByTagName("IFRAME");for(var t=0;t<e.length;t++)if(e[t].contentWindow==window){var n=e[t],r=parseInt(n.getAttribute("width"));r=r||n.clientWidth;var i=parseInt(n.getAttribute("height"));i=i||n.clientHeight,Math.abs(parseInt(v.domNode.style.width)-r)>5&&(v.domNode.setAttribute("style","width:"+r+"px !important; height : "+i+"px !important"),v.layout());break}}catch(s){alert(s)}},400)}},onWindowResize:function(){if(cv.isMobile()&&window.inMobile)try{var e=window.parent.document.getElementsByTagName("IFRAME");for(var t=0;t<e.length;t++)if(e[t].contentWindow==window){var n=e[t],r=parseInt(n.getAttribute("width"));r=r||n.clientWidth;var i=parseInt(n.getAttribute("height"));i=i||n.clientHeight,this.mainBorderContainer.domNode.setAttribute("style","width:"+r+"px !important; height : "+i+"px !important"),this.mainBorderContainer.layout()}}catch(s){}},destroy:function(){},saveReport:function(e,t,n){var r={action:e},i=!0;t&&n&&(r.name=dojo.string.trim(t),r.path=n);var s=this;this.report.saveUIAttributes();var o=this.report.reportDoc.getUIAttributes();o.setAttribute("showFieldList",this.isShowing("fieldListWrapper")?"true":"false"),o.setAttribute("showFieldLayout",this.isShowing("layoutPanelWrapper")?"true":"false"),o.setAttribute("showFilterPanel",this.report.topPaneId=="filterPane"?"true":"false");var u=this.report;return r.reportXML=u.getReportXml(),r.time=(new Date).getTime(),dojo.xhrPost({url:cv.contextPath+"ajax/saveReport",content:r,load:function(e){var t=cv.util.parseAjaxMsg(e);if(t){if(t.id.indexOf("Exception")>=0||t.id.indexOf("err")==0)i=!1,console_enabled&&window.parent.mantle_showMessage?window.parent.mantle_showMessage("Error",t.details?t.details:cvCatalog.errorSaveReport):alert(t.details?t.details:cvCatalog.errorSaveReport);s.showStatus("errorSaveReport")}else{u.reportDoc.replaceStorageNode(e.documentElement);var n=u.reportDoc.getReportProperty("name");u.setReportName(n),document.title=n,s.showStatus("successSaveReport")}},error:function(e){s.showStatus("errorSaveReport")},handleAs:"xml",sync:!0,headers:{"Content-Encoding":"utf8"}}),this.report.reportStatus=="successSaveReport"&&this.report.reportStatus=="successSaveReport"&&(u.setReportPropsDirty(!1),u.history.setSaved()),i},clearCache:function(){var e=this;dojo.xhrPost({url:cv.contextPath+"ajax/clearCache",content:{catalog:dojo.byId("REPORT_catalog").value,time:(new Date).getTime()},load:function(t){t=="true"&&e.showStatus("infoCacheCleared")},error:function(t){e.showStatus("errorClearCache")},method:"POST",mimetype:"text/plain",sync:!0})},showStatus:function(e,t){this.report.reportStatus=e;if(!e)return;var n=cvCatalog[e];n||(n=e),cv.isMobile()&&this.report.rptDlg.showConfirm(n)},resize:function(){return this.report.resize()},updateEditCmds:function(){var e=this.report.history;e.hasUndo()?(cv.util.setButtonDisabled(this.cmdUndo,!1),this.cmdUndo.title=cv.util.substituteParams(cvCatalog.actionUndo,e.current().label)):(cv.util.setButtonDisabled(this.cmdUndo,!0),this.cmdUndo.title=cv.util.substituteParams(cvCatalog.actionUndo," ")),e.hasRedo()?(cv.util.setButtonDisabled(this.cmdRedo,!1),this.cmdRedo.title=cv.util.substituteParams(cvCatalog.actionRedo,e.next().label)):(cv.util.setButtonDisabled(this.cmdRedo,!0),this.cmdRedo.title=cv.util.substituteParams(cvCatalog.actionRedo," "))},_toggleButtonMenu:function(e,t){var n=cv.util.getDojoWidget(t);if(!n||!e.target)return;var r=cv.util.getAncestorByClass(e.target,"reportBtn"),i=dojo.position(r,!0);cv.util.showPopupMenu(n,e.pageX,i.y+i.h),dojo.stopEvent(e)},_toggleMoreActionsMenu:function(e){if(!cv.util.getDojoWidget("exportMenu"))return;if(this.isAdministrator){var t=cv.util.getDojoWidget("adminMenu"),n=cv.util.getDojoWidget("moreActionsMenu");if(n.getChildren().length<9){var r=new dijit.PopupMenuItem({label:cvCatalog.popupMenuActionAdmin,popup:t});n.addChild(new dijit.MenuSeparator),n.addChild(r)}}this._toggleButtonMenu(e,"moreActionsMenu"),this.report.getReportFormat()!="PIVOT"?cv.util.setMenuItem("cmdResetColumnSize","none","disabled"):cv.util.setMenuItem("cmdResetColumnSize","none","enabled")},_togglePanel:function(e){var t=dijit.byId(e);t.domNode.style.display==""?(t.domNode.style.display="none",t._splitterWidget&&(t._splitterWidget.domNode.style.display="none")):(t.domNode.style.display="",t._splitterWidget&&(t._splitterWidget.domNode.style.display="")),dijit.byId("borderContainer").layout(),this._updateCmdButtons()},_toggleReportPane:function(e,t,n,r){if(t)cv.util.show(e),n&&dojox.fx.fadeIn({duration:cv.prefs.fadeTime,node:e}).play(),r&&this.onResize();else if(n){var i=this,s=dojox.fx.fadeOut({duration:cv.prefs.fadeTime,node:e});dojo.connect(s,"onEnd",function(e){cv.util.hide(e),r&&i.onResize()}),s.play()}else cv.util.hide(e),r&&this.onResize()},isShowing:function(e){var t=dojo.byId(e);return t?parseInt(t.style.width)==0||t.style.display=="none"?!1:!0:!1},_updateCmdButtons:function(){var e=this.report.topPaneId;this.isShowing("fieldListWrapper")?(this.cmdFields.title=cvCatalog.btnTitleHideFields,dojo.addClass(this.cmdFields,"btnPressed")):(this.cmdFields.title=cvCatalog.btnTitleShowFields,dojo.removeClass(this.cmdFields,"btnPressed")),e=="filterPane"?(this.cmdFilters.title=cvCatalog.btnTitleHideFilters,dojo.addClass(this.cmdFilters,"btnPressed")):(this.cmdFilters.title=cvCatalog.btnTitleShowFilters,dojo.removeClass(this.cmdFilters,"btnPressed")),this.isShowing("layoutPanelWrapper")?(this.cmdLayout.title=cvCatalog.btnTitleHideLayout,dojo.addClass(this.cmdLayout,"btnPressed")):(this.cmdLayout.title=cvCatalog.btnTitleShowLayout,dojo.removeClass(this.cmdLayout,"btnPressed")),cv.prefs.autoRefresh?(this.cmdToggleRefresh.firstChild.title=cvCatalog.disableAutoRefresh,dojo.removeClass(this.cmdToggleRefresh,"btnPressed")):(this.cmdToggleRefresh.firstChild.title=cvCatalog.enableAutoRefresh,dojo.addClass(this.cmdToggleRefresh,"btnPressed"))},onKey:function(e){var t=this.report;if(cv.dlgWidget&&cv.dlgWidget.open){switch(e.keyCode){case 13:if(e.target&&e.target.tagName=="TEXTAREA")return;if(t.filterDlg.isShowing)e.target.id=="FT_searchText"?t.filterDlg._searchValueList(e):t.filterDlg.save();else if(t.rptDlg.isShowing){var n=dojo.byId("dlgBtnSave");if(!n||dojo.hasClass(n,"hidden")){n=dojo.byId("dlgBtnNext");if(!n||dojo.hasClass(n,"hidden"))n=dojo.byId("dlgBtnCancel")}n&&!dojo.hasClass(n,"hidden")&&n.onclick()}break;case 27:cv.dlgWidget.hide();break;default:return}dojo.stopEvent(e)}else if(!e.target||e.target.tagName!="INPUT"&&e.target.tagName!="TEXTAREA"){if(!e.ctrlKey&&!e.altKey)switch(e.keyCode){case 33:case 34:case 38:case 40:case 37:case 39:if(t.reportHeaders!=null){t.reportHeaders.keyPress(e.key);break};default:return}else if(e.ctrlKey&&!e.altKey)switch(e.keyCode){case 90:t.history.undo();break;case 89:t.history.redo();break;case 81:t.onResetReport();break;default:return}else if(e.ctrlKey&&e.altKey)switch(e.keyCode){case 67:t.toggleReportFormat();break;case 70:this.onToggleReportPane("cmdFields");break;case 84:t.onToggleReportPane("cmdFilters");break;case 89:t.onToggleReportPane("cmdLayout");break;default:return}else if(!e.ctrlKey&&e.altKey)return;dojo.stopEvent(e)}},onResize:function(){if(!this.resize())return;this.report.getReportFormat()=="CHART"&&this.report.isInitialized&&(this.report.history.isStateRefreshed()||cv.prefs.autoRefresh)&&(this.report.log(cvCatalog.actionChartResize),this.report.refreshReport(!0,!0,!0))},onSaveReport:function(){if(!this.report.isEmpty()&&!this.report.isDirty())return;this.report.reportDoc.isNew()?this.report.rptDlg.showSaveReport():this.saveReport("save")},initReportPane:function(){var e=!0,t=!0,n=this.report.reportDoc.getReportProperty("name");if(n){var r=this.report.reportDoc.getUIAttributes();r.getAttribute("showFieldList")=="false"&&(e=!1),r.getAttribute("showFieldLayout")=="false"&&(t=!1)}cv.util.getURLQueryValue("showFieldList")=="false"?e=!1:cv.util.getURLQueryValue("showFieldList")=="true"&&(e=!0),cv.util.getURLQueryValue("showFieldLayout")=="false"?t=!1:cv.util.getURLQueryValue("showFieldLayout")=="true"&&(t=!0),cv.isMobile()&&(n?(t=!1,e=!1):(t=!0,e=!0)),e||this.onToggleReportPane("cmdFields"),t||this.onToggleReportPane("cmdLayout"),this._updateCmdButtons()},onToggleAutoRefresh:function(e){var t=!cv.prefs.autoRefresh;this.report.setAutoRefresh(t),t&&!this.report.history.isStateRefreshed()&&this.report.refreshReport(!0),this._updateCmdButtons()},onToggleReportPane:function(e){var t;if(dojo.isObject(e)){t=e.target;while(!t.id)t=t.parentNode;t=t.id}else t=e;var n=this.report.byId("FilterPaneToggle");switch(t){case"cmdFields":this._togglePanel("fieldListWrapper");break;case"cmdFilters":case"FilterPaneToggle":case"FilterPaneTitle":case"FilterCountLabel":case"ReportSummary":case"HideFilterPane":this.report.topPaneId=="filterPane"||t=="HideFilterPane"?(this.report.topPaneId="",dojo.removeClass(n,"hide"),this._toggleReportPane(this.report.nodeFilter,!1,!0,!0)):(this.report.topPaneId="filterPane",dojo.addClass(n,"hide"),this._toggleReportPane(this.report.nodeFilter,!0,!0,!0));break;case"cmdLayout":this._togglePanel("layoutPanelWrapper");break;default:return}return this._updateCmdButtons(),!1},openQueryLog:function(){window.open("admin/log")},openMDXEditor:function(){var e="admin/mdx?catalog="+this.report.reportDoc.getReportOption("catalog")+"&cube="+this.report.reportDoc.getReportOption("cube");window.open(e)},newReport:function(){window.location.href="selectSchema"},openReport:function(){openFileChooserDialog({fileSelected:function(e,t,n,r){if(n.indexOf("xanalyzer")<0){alert("You can currently only open Analyzer files");return}var i=window.location.href,s=/showRepositoryButtons=true/.test(i);i=i.substring(0,i.indexOf("editor?"))+"editor?command=open&solution="+e+"&path="+t+"&action="+n+"&showFieldList=true",s&&(i+="&showRepositoryButtons=true"),window.location.href=i},dialogCanceled:function(){}})},gwtSaveAsReport:function(){if(this.saveAsOpen)return;this.saveAsOpen=!0;var e=this;saveFileChooserDialog({fileSelected:function(t,n,r,i){t=t.trim(),n=n.trim(),r=r.trim(),e.saveAsOpen=!1,r.indexOf(".xanalyzer")!=-1&&r.indexOf(".xanalyzer")==r.length-10&&(r=r.substr(0,r.length-10)),cv.getActiveReport().reportDoc.setReportProperty("name",unescape(r.replace("+","%20")));var s=t+n+"/"+r+".xanalyzer";cv.getActiveReport().reportDoc.setReportProperty("folder",unescape(s.replace("+","%20")));var o=cv.getActiveReport().manager.saveReport("saveAs",r,t+n);if(o==1){refreshBrowsePanel();try{window.parent.PentahoMobile.refreshBrowser();if(window.parent.PentahoMobile){window.parent.PentahoMobile.updateTitleOfCurrentItem(r,t+n+"/"+r+".xanalyzer");var u=window.location.href;u=u.substring(0,u.indexOf("editor?"))+"editor?command=open&solution="+encodeURIComponent(t)+"&path="+encodeURIComponent(n)+"&action="+encodeURIComponent(r)+".xanalyzer",window.parent.PentahoMobile.setLocationOfCurrentItem(u),window.parent.PentahoMobile.setPathOfCurrentItem("/"+s),window.parent.PentahoMobile.updateFavoriteofCurrentItem()}}catch(a){}}},dialogCanceled:function(){e.saveAsOpen=!1}})},gwtSaveReport:function(){var e=cv.getActiveReport().reportDoc.getReportProperty("name");if(!e){this.gwtSaveAsReport();return}var t=cv.getActiveReport().reportDoc.getReportProperty("folder"),n=t.substring(0,t.lastIndexOf("/"));cv.getActiveReport().manager.saveReport("saveAs",e,n)}}),cv.rptEditor=new cv.ReportEditor}),pen.define("analyzer/analyzer-editor",["analyzer/main","analyzer/report/editor.js.uncompressed"])