var SaikuOlapQueryTemplate={queryModel:{axes:{FILTER:{mdx:null,filters:[],sortOrder:null,sortEvaluationLiteral:null,hierarchizeMode:null,location:"FILTER",hierarchies:[],nonEmpty:!1},COLUMNS:{mdx:null,filters:[],sortOrder:null,sortEvaluationLiteral:null,hierarchizeMode:null,location:"COLUMNS",hierarchies:[],nonEmpty:!0},ROWS:{mdx:null,filters:[],sortOrder:null,sortEvaluationLiteral:null,hierarchizeMode:null,location:"ROWS",hierarchies:[],nonEmpty:!0}},visualTotals:!1,visualTotalsPattern:null,lowestLevelsOnly:!1, details:{axis:"COLUMNS",location:"BOTTOM",measures:[]},calculatedMeasures:[],calculatedMembers:[]},queryType:"OLAP",type:"QUERYMODEL"},SaikuOlapQueryHelper=function(a){this.query=a};SaikuOlapQueryHelper.prototype.model=function(){return this.query.model};SaikuOlapQueryHelper.prototype.clearAxis=function(a){this.model().queryModel.axes[a].hierarchies=[]}; SaikuOlapQueryHelper.prototype.getHierarchy=function(a){var b=function(b){return b&&b.name==a},c;for(c in this.model().queryModel.axes){var d=this.model().queryModel.axes[c];if(d=_.find(d.hierarchies,b))return d}return null}; SaikuOlapQueryHelper.prototype.moveHierarchy=function(a,b,c,d){c=this.getHierarchy(c);var e=this.model().queryModel.axes[a].hierarchies.indexOf(c);b=this.model().queryModel.axes[b].hierarchies;this.model().queryModel.axes[a].hierarchies.splice(e,1);"undefined"!=typeof d&&-1d?b.splice(d,0,c):b.push(c)}; SaikuOlapQueryHelper.prototype.removeHierarchy=function(a){var b=this.getHierarchy(a);if(!b)return null;if(a=this.findAxisForHierarchy(a)){var c=a.hierarchies.indexOf(b);a.hierarchies.splice(c,1)}return b};SaikuOlapQueryHelper.prototype.findAxisForHierarchy=function(a){for(var b in this.model().queryModel.axes){var c=this.model().queryModel.axes[b];if(c.hierarchies&&0d?b.hierarchies.splice(d,0,e):b.hierarchies.push(e):Saiku.log("Cannot find axis: "+a+" to include Level: "+c)}; SaikuOlapQueryHelper.prototype.includeLevelCalculatedMember=function(a,b,c,d,e){var f=this.getHierarchy(b);f||(f={name:b,levels:{},cmembers:{}});f.cmembers[d]=d;(d=this.findAxisForHierarchy(b))?this.moveHierarchy(d.location,a,b,-1):(b=this.model().queryModel.axes[a])?"undefined"!=typeof e&&-1e?b.hierarchies.splice(e,0,f):b.hierarchies.push(f):Saiku.log("Cannot find axis: "+a+" to include Level: "+c)}; SaikuOlapQueryHelper.prototype.removeLevel=function(a,b){(a=this.getHierarchy(a))&&a.levels.hasOwnProperty(b)&&delete a.levels[b]};SaikuOlapQueryHelper.prototype.removeLevelCalculatedMember=function(a,b){(a=this.getHierarchy(a))&&a.cmembers.hasOwnProperty(b)&&delete a.cmembers[b]};SaikuOlapQueryHelper.prototype.removeAllLevelCalculatedMember=function(a){a=this.getHierarchy(a);a.cmembers={}}; SaikuOlapQueryHelper.prototype.includeMeasure=function(a){var b=this.model().queryModel.details.measures,c=b.length,d,e=!1;if(b&&!_.isEmpty(b)){for(d=0;de&&$(c._options.htmlObject).append($(a));d=!1}b>=k&&$(c._options.htmlObject).parent().parent().unbind("scroll")},a);$(c._options.htmlObject).parent().parent().scroll(function(){l()})}});return a});else return this.internalRender(this._data,c._options)};SaikuTableRenderer.prototype.clear=function(a,b){this._options&&this._options.htmlObject&&this._options.hasOwnProperty("batch")&&$(this._options.htmlObject).parent().parent().unbind("scroll")}; SaikuTableRenderer.prototype.processData=function(a,b){this._hasProcessed=!0};function genTotalDataCells(a,b,c,d,e){var f="";e=e[ROWS];for(var g=c.length-1;0<=g;g--)if(a==c[g]){for(var h=e[g][d[g]],k=0;kk?e[u-1][w+1].value!=e[u-1][w].value||e[u-1][w+1].properties.uniquename!=e[u-1][w].properties.uniquename:!1,D=999this.data.height&&80>this.data.width,e=null!==this.data&&300>this.data.height&&300>this.data.width,e=!d&&!e,f=c.width()-40,g=c.height()-40,c=_.clone(this.cccOptions);a&&a.width&&(f=a.width);a&&a.height&&(g=a.height);0a.data.height&&300>a.data.width,b=!(null!==a.data&&80>a.data.height&&80>a.data.width)&&!b,c=!1;a.chart.options&&a.chart.options.animate&&(c=!0);if(!c||$(a.el).find(".canvas_wrapper").is(":visible"))$(a.el).find(".canvas_wrapper"),$(a.el).find(".canvas_wrapper").hide();try{c&&$(a.el).find(".canvas_wrapper").show(),a.chart.render(),a.hasRendered=!0}catch(d){$("#canvas_"+a.id).text("Could not render chart"+ d)}if(a.chart.options&&a.chart.options.animate)return!1;isIE||b?$(a.el).find(".canvas_wrapper").show():$(a.el).find(".canvas_wrapper").fadeIn(400);return!1}; SaikuChartRenderer.prototype.process_data_tree=function(a,b,c){var d={};b&&(d.resultset=[],d.metadata=[],d.height=0,d.width=0);var e=d;if("undefined"!=typeof a&&"undefined"!=typeof a.data&&!(null!==a.data&&null!==a.data.error||null===a.data||a.data.cellset&&0===a.data.cellset.length)){var f=a.data.cellset;if(f&&0n&&(n=t)}if(f[l]&&"null"!==f[l][n].value){if(0===n)for(t=0;t<=g;t++)k[t]=null;"number"==typeof e&&(h[q]={},e=h[q]);q=f[l][n].value;k[n]=q;e.hasOwnProperty(q)||(e[q]={});h=e;e=e[q]}}n=_.clone(k);e=g+1;for(t=f[l].length;e=isIE?$(this.el).show():$(this.el).fadeTo(500,1);$(this.el).find(".addMeasure, .calculated_measures").show();$(this.el).find(".measure").parent("li").draggable({cancel:".not-draggable",connectToSortable:$(this.workspace.el).find(".fields_list_body.details ul.connectable"),helper:"clone",placeholder:"placeholder",opacity:.6,tolerance:"touch",containment:$(this.workspace.el),cursorAt:{top:10,left:35}});$(this.el).find(".level").parent("li").draggable({cancel:".not-draggable, .hierarchy", connectToSortable:$(this.workspace.el).find(".fields_list_body.columns \x3e ul.connectable, .fields_list_body.rows \x3e ul.connectable, .fields_list_body.filter \x3e ul.connectable"),containment:$(this.workspace.el),helper:function(a,b){var c=$(a.target).hasClass("d_level")?$(a.target):$(a.target).parent(),d=c.find("a").attr("hierarchy"),e=c.find("a").attr("level"),c=c.parent().clone().removeClass("d_hierarchy").addClass("hierarchy");c.find('li a[hierarchy\x3d"'+d+'"]').parent().hide();c.find('li a[level\x3d"'+ e+'"]').parent().show();d=$('\x3cli class\x3d"selection"\x3e\x3c/li\x3e');d.append(c);return d},placeholder:"placeholder",opacity:.6,tolerance:"touch",cursorAt:{top:10,left:85}})},select:function(a){a=$(a.target).hasClass("root")?$(a.target):$(a.target).parent().find("span");a.hasClass("root")&&(a.find("a").toggleClass("folder_collapsed").toggleClass("folder_expand"),a.toggleClass("collapsed").toggleClass("expand"),a.parents("li").find("ul").children("li").toggle(),a.hasClass("expand")&&Saiku.events.trigger("workspace:expandDimension", this,null));return!1},select_dimension:function(a,b){if("QUERYMODEL"==this.workspace.query.model.type)if($(a.target).parent().hasClass("ui-state-disabled"))a.preventDefault(),a.stopPropagation();else{var c=$(a.target).attr("hierarchy");$(a.target).parent().parent().attr("hierarchycaption");var d=$(a.target).attr("level"),e="ROWS",f=$(a.target).parent().hasClass("dimension-level-calcmember"),e=0<$(this.workspace.el).find(".workspace_fields ul.hierarchy[hierarchy\x3d'"+c+"']").length?$(this.workspace.el).find(".workspace_fields ul[hierarchy\x3d'"+ c+"'] a[level\x3d'"+d+"']").parent().show().parents(".fields_list_body").hasClass("rows")?"ROWS":"COLUMNS":(0<$(this.workspace.el).find(".workspace_fields .fields_list[title\x3d'ROWS'] ul.hierarchy").length?$(this.workspace.el).find(".workspace_fields .fields_list[title\x3d'COLUMNS'] ul.connectable"):$(this.workspace.el).find(".workspace_fields .fields_list[title\x3d'ROWS'] ul.connectable")).parents(".fields_list").attr("title");f?(f=$(a.target).attr("uniquename"),this.workspace.toolbar.$el.find(".group_parents").removeClass("on"), this.workspace.toolbar.group_parents(),this.workspace.query.helper.includeLevelCalculatedMember(e,c,d,f)):this.workspace.query.helper.includeLevel(e,c,d);Saiku.session.trigger("dimensionList:select_dimension",{workspace:this.workspace});this.workspace.sync_query();this.workspace.query.run();a.preventDefault();return!1}},select_measure:function(a,b){if(!$(a.target).parent().hasClass("ui-state-disabled")){var c=$(a.target).parent().clone(),c={name:c.find("a").attr("measure"),type:c.find("a").attr("type")}; this.workspace.query.helper.includeMeasure(c);this.workspace.sync_query();this.workspace.query.run();a.preventDefault();return!1}},measure_dialog:function(a,b){(new CalculatedMemberModal({workspace:this.workspace,measure:null})).render().open()}}),Toolbar=Backbone.View.extend({tagName:"div",events:{"click a":"call","click #logo":"site"},template:function(){return _.template($("#template-toolbar").html())({data:this})},initialize:function(){_.extend(this,Backbone.Events);_.bindAll(this,"call");this.logo= Settings.LOGO?"\x3ch1 id\x3d'logo_override'\x3e\x3cimg src\x3d'"+Settings.LOGO+"'/\x3e\x3c/h1\x3e":"\x3ch1 id\x3d'logo'\x3e\x3ca href\x3d'http://www.meteorite.bi/' title\x3d'Saiku - Next Generation Open Source Analytics' target\x3d'_blank' class\x3d'sprite'\x3eSaiku\x3c/a\x3e\x3c/h1\x3e";this.render()},render:function(){$(this.el).attr("id","toolbar").html(this.template());Saiku.events.trigger("toolbar:render",{toolbar:this});return this},call:function(a){var b=$(a.target).attr("href").replace("#", "");if(this[b])this[b](a);a.preventDefault()},new_query:function(){"undefined"!=typeof ga&&ga("send","event","MainToolbar","New Query");var a=new Workspace;Saiku.tabs.add(a);Saiku.events.trigger("toolbar:new_query",this,a);return!1},open_query:function(){var a=_.find(Saiku.tabs._tabs,function(a){return a.content instanceof OpenQuery});a?a.select():Saiku.tabs.add(new OpenQuery);return!1},logout:function(){Saiku.session.logout()},about:function(){(new AboutModal).render().open();return!1},issue_tracker:function(){window.open("http://jira.meteorite.bi/"); return!1},help:function(){window.open("http://wiki.meteorite.bi/display/SAIK/Saiku+Documentation");return!1},site:function(){window.open("http://www.meteorite.bi/");return!1}}),Upgrade=Backbone.View.extend({events:{},initialize:function(a,b){this.workspace=a.workspace;this.workspace.trigger("workspace:toolbar:render",{workspace:this.workspace})},daydiff:function(a,b){return Math.round((b-a)/864E5)},render:function(){new License;if(Settings.BIPLUGIN5){void 0!=Saiku.session.get("notice")&&null!=Saiku.session.get("notice")&& ""!=Saiku.session.get("notice")&&$(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eNotice:"+Saiku.session.get("notice")+"\x3c/div\x3e");if(void 0!=Settings.LICENSE.licenseType&&"trial"!=Settings.LICENSE.licenseType&&"Open Source License"!=Settings.LICENSE.licenseType)return this;if(void 0!=Settings.LICENSE&&"trial"===Settings.LICENSE.licenseType){var a=parseFloat(Settings.LICENSE.expiration),a=new Date(a);this.remainingdays=this.daydiff(new Date,a);$(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eYou are using a Saiku Enterprise Trial license, you have "+ this.remainingdays+" days remaining. \x3ca href\x3d'http://www.meteorite.bi/saiku-pricing'\x3eBuy licenses online.\x3c/a\x3e\x3c/div\x3e")}else $(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eYou are using Saiku Community Edition, please consider upgrading to \x3ca target\x3d'_blank' href\x3d'http://meteorite.bi'\x3eSaiku Enterprise\x3c/a\x3e, or entering a \x3ca href\x3d'http://meteorite.bi/products/saiku/sponsorship'\x3esponsorship agreement with us\x3c/a\x3e to support development. \x3ca href\x3d'http://meteorite.bi/products/saiku/community'\x3eOr contribute by joining our community and helping other users!\x3c/a\x3e\x3c/div\x3e\x3c/div\x3e")}else{void 0!= Saiku.session.get("notice")&&null!=Saiku.session.get("notice")&&""!=Saiku.session.get("notice")&&$(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eNotice:"+Saiku.session.get("notice")+"\x3c/div\x3e");if(void 0!=Settings.LICENSE.licenseType&&"trial"!=Settings.LICENSE.licenseType&&"Open Source License"!=Settings.LICENSE.licenseType)return this;"trial"===Settings.LICENSE.licenseType?(a=parseFloat(Settings.LICENSE.expiration),a=new Date(a),this.remainingdays=this.daydiff(new Date, a),$(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eYou are using a Saiku Enterprise Trial license, you have "+this.remainingdays+" days remaining. \x3ca href\x3d'http://www.meteorite.bi/saiku-pricing'\x3eBuy licenses online.\x3c/a\x3e\x3c/div\x3e")):$(this.el).append("\x3cdiv\x3e\x3cdiv id\x3d'uphead' class\x3d'upgradeheader'\x3eYou are using Saiku Community Edition, please consider upgrading to \x3ca target\x3d'_blank' href\x3d'http://meteorite.bi'\x3eSaiku Enterprise\x3c/a\x3e, or entering a \x3ca href\x3d'http://meteorite.bi/products/saiku/sponsorship'\x3esponsorship agreement with us\x3c/a\x3e to support development. \x3ca href\x3d'http://meteorite.bi/products/saiku/community'\x3eOr contribute by joining our community and helping other users!\x3c/a\x3e\x3c/div\x3e\x3c/div\x3e")}return this}, call:function(a){}}),Modal=Backbone.View.extend({tagName:"div",className:"dialog",type:"modal",message:"Put content here",options:{autoOpen:!1,modal:!0,title:"Modal dialog",resizable:!1,draggable:!0},events:{"click a":"call"},buttons:[{text:"OK",method:"close"}],template:function(){return _.template("\x3cdiv class\x3d'dialog_icon'\x3e\x3c/div\x3e\x3cdiv class\x3d'dialog_body'\x3e\x3c%\x3d message %\x3e\x3c/div\x3e\x3cdiv class\x3d'dialog_footer'\x3e\x3c% _.each(buttons, function(button) { %\x3e\x3ca class\x3d'form_button btn btn-default i18n' href\x3d'#\x3c%\x3d button.method %\x3e'\x3e\x26nbsp;\x3c%\x3d button.text %\x3e\x26nbsp;\x3c/a\x3e\x3c% }); %\x3e\x3cdiv class\x3d'dialog_response'\x3e\x3c/div\x3e\x3c/div\x3e")(this)}, initialize:function(a){_.extend(this,a);_.bindAll(this,"call");_.extend(this,Backbone.Events)},render:function(){$(this.el).html(this.template()).addClass("dialog_"+this.type).dialog(this.options);var a=$(".ui-dialog-title");a.html(this.options.title);a.addClass("i18n");Saiku.i18n.translate();return this},call:function(a){var b=a.target.hash.replace("#","");if(!$(a.target).hasClass("disabled_toolbar")&&this[b])this[b](a);return!1},open:function(){$(this.el).dialog("open");this.trigger("open",{modal:this}); return this},close:function(){$(this.el).dialog("destroy").remove();$(this.el).remove();return!1}});$.ui.dialog.prototype._allowInteraction=function(a){return!!$(a.target).closest(".ui-dialog, .ui-datepicker, .sp-input").length}; var MDXModal=Modal.extend({type:"mdx",initialize:function(a){this.options.title="MDX";this.message=_.template("\x3ctextarea\x3e\x3c%\x3d mdx %\x3e\x3c/textarea\x3e")(a);this.bind("open",function(){$(this.el).parents(".ui-dialog").css({width:"550px"})})}}),SelectionsModal=Modal.extend({type:"selections",paramvalue:null,buttons:[{text:"OK",method:"save"},{text:"Open Date Filter",method:"open_date_filter"},{text:"Cancel",method:"close"}],events:{"click a":"call","click .search_term":"search_members", "click .clear_search":"clear_search","change #show_unique":"show_unique_action","change #use_result":"use_result_action","dblclick .selection_options li.option_value label":"click_move_selection","click li.all_options":"click_all_member_selection","change #show_totals":"show_totals_action"},show_unique_option:!1,use_result_option:Settings.MEMBERS_FROM_RESULT,show_totals_option:"",members_limit:Settings.MEMBERS_LIMIT,members_search_limit:Settings.MEMBERS_SEARCH_LIMIT,members_search_server:!1,selection_type:"INCLUSION", initialize:function(a){_.extend(this,a);this.options.title="\x3cspan class\x3d'i18n'\x3eSelections for\x3c/span\x3e "+this.name;this.message="Fetching members...";this.query=a.workspace.query;this.selected_members=[];this.available_members=[];this.topLevel;_.bindAll(this,"fetch_members","populate","finished","get_members","use_result_action","show_totals_action");this.axis="undefined";a.axis?(this.axis=a.axis,"FILTER"==a.axis&&(this.use_result_option=!1)):(a.target.parents(".fields_list_body").hasClass("rows")&& (this.axis="ROWS"),a.target.parents(".fields_list_body").hasClass("columns")&&(this.axis="COLUMNS"),a.target.parents(".fields_list_body").hasClass("filter")&&(this.axis="FILTER",this.use_result_option=!1));this.bind("open",this.post_render);this.render();$(this.el).parent().find(".ui-dialog-titlebar-close").bind("click",this.finished);this.member=new Member({},{cube:a.workspace.selected_cube,dimension:a.key});$(this.el).find(".dialog_body").html(_.template($("#template-selections").html())(this)); var b=this.member.level;a=this.workspace.query.helper.getHierarchy(this.member.hierarchy);var c=null;a&&a.levels.hasOwnProperty(b)&&(c=a.levels[b]);"DateFilterModal"===this.source&&_.has(c,"selection")&&0===c.selection.members.length||"DateFilterModal"===this.source&&1===_.size(c)&&_.has(c,"name")?this.$el.find(".dialog_footer a:nth-child(2)").show():this.$el.find(".dialog_footer a:nth-child(2)").hide();Settings.ALLOW_PARAMETERS&&(c&&(b=c.selection?c.selection.parameterName:null)&&($(this.el).find("#parameter").val(b), void 0!=this.query.helper.model().parameters[b]&&(this.paramvalue=this.query.helper.model().parameters[b].split(","))),$(this.el).find(".parameter").removeClass("hide"));b=$(this.el).find("#show_totals");b.val("");1<_.size(a.levels)&&c&&c.hasOwnProperty("aggregators")&&c.aggregators?(0=this.members_limit||0==this.available_members.length;c.show_unique_option=!1;$(this.el).find(".options #show_unique").attr("checked",!1);var d=this.workspace.query.helper.getCalculatedMembers();if(0$(window).width()?$(window).width():1040;$(a.modal.el).parents(".ui-dialog").css({width:c,left:"inherit",margin:"0",height:585}).offset({left:b});$("#filter_selections").attr("disabled",!1);$(this.el).find("a[href\x3d#save]").focus(); $(this.el).find("a[href\x3d#save]").blur()},move_selection:function(a){a.preventDefault();a=$(a.target).attr("id");var b=-1!==a.indexOf("add")?$(this.el).find(".used_selections .selection_options ul"):$(this.el).find(".available_selections .selection_options ul"),c=-1!==a.indexOf("add")?$(this.el).find(".available_selections .selection_options ul"):$(this.el).find(".used_selections .selection_options ul");(-1!==a.indexOf("all")?c.find("li.option_value input").parent():c.find("li.option_value input:checked").parent()).detach().appendTo(b); $(this.el).find(".selection_options ul li.option_value input:checked").prop("checked",!1);$(this.el).find(".selection_options li.all_options input").prop("checked",!1)},updown_selection:function(a){a.preventDefault();return!1},click_all_member_selection:function(a,b){$(a.currentTarget).find("input").is(":checked")?$(a.currentTarget).parent().find("li.option_value input").prop("checked",!0):$(a.currentTarget).parent().find("li.option_value input").removeAttr("checked")},click_move_selection:function(a, b){a.preventDefault();var c=$(a.target).parent().parent().parent().parent().hasClass("used_selections")?".available_selections":".used_selections";$(a.target).parent().appendTo($(this.el).find(c+" .selection_options ul"))},show_unique_action:function(){this.show_unique_option=!this.show_unique_option;!0===this.show_unique_option?($(this.el).find(".available_selections, .used_selections").addClass("unique"),$(this.el).find(".available_selections, .used_selections").removeClass("caption")):($(this.el).find(".available_selections, .used_selections").addClass("caption"), $(this.el).find(".available_selections, .used_selections").removeClass("unique"))},use_result_action:function(){this.use_result_option=!this.use_result_option;this.get_members()},save:function(){var a=this,b=$("\x3cdiv\x3eSaving...\x3c/div\x3e");$(this.el).find(".dialog_body").children().hide();$(this.el).find(".dialog_body").prepend(b);var c=decodeURIComponent(a.member.hierarchy),d=decodeURIComponent(a.member.level),b=a.workspace.query.helper.getHierarchy(c),e=[],f=this.show_totals_option;0!==$(this.el).find(".used_selections input").length&& (a.workspace.query.helper.removeAllLevelCalculatedMember(c),$(this.el).find(".used_selections .option_value input").each(function(b,f){var g=$(f).val();if($(f).hasClass("cmember")){var m=$(f).attr("label");a.workspace.toolbar.group_parents();a.workspace.query.helper.includeLevelCalculatedMember(a.axis,c,d,decodeURIComponent(g),0);e.push({uniqueName:decodeURIComponent(g),caption:decodeURIComponent(m),type:"calculatedmember"})}else m=$(f).attr("label"),e.push({uniqueName:decodeURIComponent(g),caption:decodeURIComponent(m)})})); var g=$("#parameter").val();b&&b.levels.hasOwnProperty(d)&&(b.levels[d].aggregators=[],f&&b.levels[d].aggregators.push(f),f=$(a.el).find("input.selection_type:checked").val(),b.levels[d].selection={type:f?f:"INCLUSION",members:e},Settings.ALLOW_PARAMETERS&&g&&(b.levels[d].selection.parameterName=g,a.workspace.query.helper.model()));this.finished()},finished:function(){$("#filter_selections").remove();this.available_members=null;$(this.el).find(".filterbox").autocomplete("destroy").remove();$(this.el).dialog("destroy"); $(this.el).remove();this.query.run()}}),DrillthroughModal=Modal.extend({type:"drillthrough",buttons:[{text:"Ok",method:"ok"},{text:"Cancel",method:"close"}],events:{"click .collapsed":"select","click .expand":"select","click .folder_collapsed":"select","click .folder_expanded":"select","click .dialog_footer a":"call","click .parent_dimension input":"select_dimension","click .measure_tree input":"select_measure","click input.all_measures":"select_all_measures","click input.all_dimensions":"select_all_dimensions"}, allMeasures:!1,templateContent:function(){return $("#template-drillthrough").html()},initialize:function(a){_.extend(this,a);this.options.title=a.title;this.query=a.workspace.query;this.position=a.position;this.action=a.action;Saiku.ui.unblock();_.bindAll(this,"ok","drilled","template");this.render();$(this.el).find(".dialog_body").html(_.template(this.templateContent())(this));$(this.el).find(".maxrows").val(this.maxrows);this.query.get("schema");a=$("#template-drillthrough-list").html();var b=Saiku.session.sessionworkspace.cube[e], c=null,d=null,e=this.workspace.selected_cube;b&&b.has("data")&&(c=b.get("data").dimensions,d=b.get("data").measures);b&&c&&d||("undefined"!==typeof localStorage&&localStorage&&null!==localStorage.getItem("cube."+e)?Saiku.session.sessionworkspace.cube[e]=new Cube(JSON.parse(localStorage.getItem("cube."+e))):(Saiku.session.sessionworkspace.cube[e]=new Cube({key:e}),Saiku.session.sessionworkspace.cube[e].fetch({async:!1})),c=Saiku.session.sessionworkspace.cube[e].get("data").dimensions,d=Saiku.session.sessionworkspace.cube[e].get("data").measures); e=_.template($("#template-drillthrough-dimensions").html())({dimensions:c});d=_.template($("#template-drillthrough-measures").html())({measures:d,allMeasures:this.allMeasures});$(a).appendTo($(this.el).find(".dialog_body"));$(this.el).find(".sidebar").height($("body").height()/2+$("body").height()/6);$(this.el).find(".sidebar").width(380);$(this.el).find(".dimension_tree").html("").append($(e));$(this.el).find(".measure_tree").html("").append($(d));Saiku.i18n.translate()},select:function(a){a=$(a.target).hasClass("root")? $(a.target):$(a.target).parent().find("span");a.hasClass("root")&&(a.find("a").toggleClass("folder_collapsed").toggleClass("folder_expand"),a.toggleClass("collapsed").toggleClass("expand"),a.parents("li").find("ul").children("li").toggle());return!1},select_dimension:function(a){a=$(a.target);var b=a.is(":checked");a.parent().find("input").attr("checked",b)},select_all_dimensions:function(a){a=$(a.target).is(":checked");$(this.el).find(".dimension_tree input").attr("checked",a)},select_all_measures:function(a){a= $(a.target).is(":checked");$(this.el).find(".measure_tree input").attr("checked",a)},select_measure:function(a){$(a.target).is(":checked")},ok:function(){"undefined"!=typeof ga&&ga("send","event","Drillthrough","Execute");var a=$("\x3cdiv\x3eDrilling through...\x3c/div\x3e");$(this.el).find(".dialog_body").children().hide();$(this.el).find(".dialog_body").prepend(a);var b="";$(this.el).find(".check_level:checked").each(function(a){0isIE)$(this.el).find("form").on("submit",this.save)},save:function(a){a.preventDefault();a=$(this.el).find('input[name\x3d"name"]').val();(new SavedQuery({file:this.path+a,name:a})).save({},{success:this.success,dataType:"text",error:this.error});this.close();return!1},error:function(){$(this.el).find("dialog_body").html("Could not add new folder")}}),FilterModal=Modal.extend({type:"filter",closeText:"Save",events:{"click .dialog_footer a":"call","click .insert-member":"open_select_member_selector"}, buttons:[{text:"OK",method:"save"},{text:"Cancel",method:"close"},{text:"Help",method:"help"}],message:"",expression_text:function(){var a="\x3cdiv class\x3d'sidebar'\x3e\x3ctable border\x3d'0px'\x3e";"Order"==this.expressionType&&(a+="\x3ctr\x3e\x3ctd class\x3d'col1'\x3e\x3clabel\x3eSort Type\x3c/label\x3e \x3cselect class\x3d'form-control' id\x3d'fun'\x3e\x3coption\x3eASC\x3c/option\x3e\x3coption\x3eBASC\x3c/option\x3e\x3coption\x3eDESC\x3c/option\x3e\x3coption\x3eBDESC\x3c/option\x3e \x3c/select\x3e\x3c/td\x3e\x3c/tr\x3e"); return a+="\x3ctr\x3e\x3ctd class\x3d'col1'\x3e"+this.expressionType+" MDX Expression:\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd class\x3d'col1' style\x3d'width:380px'\x3e\x3cdiv class\x3d'filter-editor' style\x3d'width:380px' id\x3d'"+this.id+"'\x3e\x3c/div\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3ca href\x3d'#' class\x3d'form_button btn btn-default insert-member'\x3eInsert Member\x3c/a\x3e\x3c/div\x3e"},expression:" ",expressonType:"",initialize:function(a){var b=this;this.id=_.uniqueId("filter-modal-"); this.workspace=a.workspace;this.axis=a.axis;this.query=a.query;this.success=a.success;this.expression=a.expression;this.expressionType=a.expressionType;_.bindAll(this,"save","expression_text");_.extend(this.options,{title:"Custom "+this.expressionType+" for "+this.axis});this.message=this.expression_text(this.expressionType);this.bind("open",function(){$(this.el).find(".sidebar").width(380);this.editor=ace.edit(this.id);this.editor.setValue(b.expression);this.editor.setShowPrintMargin(!1);this.editor.setFontSize(11)}); if(isIE&&9>isIE)$(this.el).find("form").on("submit",this.save)},save:function(a){a.preventDefault();this.expression=this.editor.getValue();a="";"undefined"!=typeof this.expression&&this.expression&&""!==this.expression?("Order"==this.expressionType?(a=$("#fun").val(),this.success(a,this.expression)):this.success(this.expression),this.close()):(a+="You have to enter a MDX expression for the "+this.expressionType+" function! ",alert(a));return!1},error:function(){$(this.el).find("dialog_body").html("Could not add new folder")}, open_select_member_selector:function(a){a.preventDefault();a=this.$el.find("#cms-dimension option:selected").val();var b=this.$el.find("#cms-dimension option:selected").text(),c=this.$el.find("#cms-dimension option:selected").data("dimension");this.$el.find("#cms-dimension option:selected").data("type");var d=ace.edit(this.id),e=this;(new ParentMemberSelectorModal({dialog:this,workspace:this.workspace,cube:this.workspace.selected_cube,dimensions:Saiku.session.sessionworkspace.cube[this.workspace.selected_cube].get("data").dimensions, selectDimension:a,dimension:c,hierarchy:b,uniqueName:this.pmUniqueName,lastLevel:this.pmLevel,breadcrumbs:this.pmBreadcrumbs,select_type:"select_member",selected_member:this.selected_member,close_callback:function(a){e.close_select_modal(d,a)}})).render().open();this.$el.parents(".ui-dialog").find(".ui-dialog-title").text("Custom Filter")},close_select_modal:function(a,b){a.insert(b)},help:function(){window.open("http://wiki.meteorite.bi/display/SAIK/Filtering")}}),CustomFilterModal=Modal.extend({type:"filter", closeText:"Save",events:{"submit form":"save","change .function":"switch_function","change .type":"switch_type","click .dialog_footer a":"call"},buttons:[{text:"OK",method:"save"},{text:"Cancel",method:"close"}],message:"\x3cform id\x3d'custom_filter'\x3e\x3ctable border\x3d'0px'\x3e\x3ctr\x3e\x3ctd class\x3d'col0'\x3eDefine Filter\x3cselect class\x3d'form-control function'\x3e\x3coption\x3eSelect a Function...\x3c/option\x3e\x3coption value\x3d'TopCount'\x3eTopCount\x3c/option\x3e\x3coption value\x3d'TopPercent'\x3eTopPercent\x3c/option\x3e\x3coption value\x3d'TopSum'\x3eTopSum\x3c/option\x3e\x3coption value\x3d'BottomCount'\x3eBottomCount\x3c/option\x3e\x3coption value\x3d'BottomPercent'\x3eBottomPercent\x3c/option\x3e\x3coption value\x3d'BottomSum'\x3eBottomSum\x3c/option\x3e\x3c/select\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr class\x3d'filter_details hide'\x3e\x3ctd\x3e\x3cspan class\x3d'ntype'\x3e\x3c/span\x3e\x3cinput class\x3d'n form-control' /\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr class\x3d'filter_details hide'\x3e\x3ctd\x3eSort by\x3cselect class\x3d'type form-control'\x3e\x3coption value\x3d'measure'\x3eMeasure\x3c/option\x3e\x3coption value\x3d'custom'\x3eMDX Expression\x3c/option\x3e\x3c/select\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr class\x3d'filter_details hide sortingoption'\x3e\x3ctd\x3e\x26nbsp; \x26nbsp;\x3c/td\x3e\x3c/table\x3e\x3c/form\x3e", func:null,func_type:"Measure",n:"",sortliteral:"",measure_list:null,initialize:function(a){var b=this;this.axis=a.axis;this.measures=a.measures;this.query=a.query;this.success=a.success;this.func=a.func;this.n=a.n;this.sortliteral=a.sortliteral;this.isMdx=!0;_.bindAll(this,"build_measures_list","save");this.measure_list=this.build_measures_list();_.extend(this.options,{title:"Custom Filter for "+this.axis});this.bind("open",function(){null!==b.func&&($(b.el).find(".function").val(b.func),b.switch_function({target:$(b.el).find(".function")}), $(b.el).find(".n").val(b.n),!0===b.isMdx&&null!==b.sortliteral&&($(this.el).find(".type").val("custom"),$(this.el).find(".sortingoption").html("").html("\x3ctextarea class\x3d'form-control sortliteral'\x3e"+b.sortliteral+"\x3c/textarea\x3e")))});if(isIE&&9>isIE)$(this.el).find("form").on("submit",this.save)},build_measures_list:function(){var a=this;if(null!==this.measure_list)return"";var b="\x3cselect class\x3d'form-control sortliteral'\x3e";_.each(this.measures,function(c){var d="";c.uniqueName== a.sortliteral&&(d=" selected ",a.isMdx=!1);b+="\x3coption "+d+"value\x3d'"+c.uniqueName+"'\x3e"+c.caption+"\x3c/option\x3e"});return b+="\x3c/select\x3e"},switch_function:function(a){a=$(a.target).val();"undefined"==typeof a||""===a?$(this.el).find(".filter_details").hide():(a=a.replace("Top","").replace("Bottom",""),$(this.el).find(".ntype").html(a+":"),$(this.el).find(".filter_details").show(),$(this.el).find(".sortingoption").html("").html(this.measure_list));return!1},switch_type:function(a){"measure"== $(a.target).val()?$(this.el).find(".sortingoption").html("").html(this.measure_list):$(this.el).find(".sortingoption").html("").html("\x3ctextarea class\x3d'form-control sortliteral' /\x3e");return!1},save:function(a){a.preventDefault();this.func=$(this.el).find(".function").val();this.n=parseInt($(this.el).find(".n").val());this.sortliteral=$(this.el).find(".sortliteral").val();a="";"undefined"!=typeof this.n&&this.n||(a+="You have to enter a numeric for N! ");"undefined"!=typeof this.sortliteral&& this.sortliteral&&""!==this.sortliteral||(a+="You have to enter a MDX expression for the sort literal! ");""!==a?alert(a):(this.success(this.func,this.n,this.sortliteral),this.close());return!1},error:function(){$(this.el).find("dialog_body").html("Could not add new folder")}}),CalculatedMemberModal=Modal.extend({type:"calculated-member",template_modal:_.template('\x3cdiv class\x3d"cms-container-group"\x3e\x3cdiv class\x3d"calculated-measure-group"\x3e\x3ch4 class\x3d"i18n"\x3eCalculated Measures:\x3c/h4\x3e\x3cdiv class\x3d"cms-box"\x3e\x3ctable class\x3d"cms-list measures-list"\x3e\x3c%\x3d tplCalculatedMeasures %\x3e\x3c/table\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"calculated-member-group"\x3e\x3ch4 class\x3d"i18n"\x3eCalculated Members:\x3c/h4\x3e\x3cdiv class\x3d"cms-box"\x3e\x3ctable class\x3d"cms-list members-list"\x3e\x3c%\x3d tplCalculatedMembers %\x3e\x3c/table\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"cms-container-form"\x3e\x3cform class\x3d"form-group-inline" data-action\x3d"cad"\x3e\x3cdiv class\x3d"form-group"\x3e\x3clabel for\x3d"cms-name" class\x3d"i18n"\x3eName:\x3c/label\x3e\x3cinput type\x3d"text" class\x3d"form-control" id\x3d"cms-name" autofocus\x3e\x3c/div\x3e\x3cdiv class\x3d"cms-measure form-inline" style\x3d"padding-bottom:10px;"\x3e\x3clabel for\x3d"cms-measure" class\x3d"i18n"\x3eInsert Member:\x3c/label\x3e \x3cinput type\x3d"button" class\x3d"form-control btn-primary btn btn-select-member" value\x3d"Select Member" title\x3d"Insert a member into the formula editor " id\x3d"insertmember"\x3e \x3c/input\x3e \x3c/div\x3e\x3clabel for\x3d"\x3c%\x3d idEditor %\x3e" class\x3d"i18n"\x3eFormula:\x3c/label\x3e\x3cdiv class\x3d"formula-editor" style\x3d"padding-bottom:10px" id\x3d"\x3c%\x3d idEditor %\x3e"\x3e\x3c/div\x3e\x3cdiv class\x3d"btn-groups"\x3e\x3ca class\x3d"form_button btn btn-default minimal_padding btn-math" href\x3d"#add_math_operator_formula" data-math\x3d"+"\x3e\x26nbsp;+\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding" href\x3d"#add_math_operator_formula" data-math\x3d"-"\x3e\x26nbsp;-\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding" href\x3d"#add_math_operator_formula" data-math\x3d"*"\x3e\x26nbsp;*\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding" href\x3d"#add_math_operator_formula" data-math\x3d"/"\x3e\x26nbsp;/\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding" href\x3d"#add_math_operator_formula" data-math\x3d"("\x3e\x26nbsp;(\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding" href\x3d"#add_math_operator_formula" data-math\x3d")"\x3e\x26nbsp;)\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding i18n" href\x3d"#add_math_operator_formula" data-math\x3d"and"\x3e\x26nbsp;and\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding i18n" href\x3d"#add_math_operator_formula" data-math\x3d"or"\x3e\x26nbsp;or\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-math minimal_padding i18n" href\x3d"#add_math_operator_formula" data-math\x3d"not"\x3e\x26nbsp;not\x26nbsp;\x3c/a\x3e\x3cbr/\x3e\x3cdiv class\x3d"form-inline"\x3e\x3cselect class\x3d"cms-functionlist form-control"\x3e\x3coption value\x3d""\x3e---Insert MDX Function---\x3c/select\x3e\x26nbsp; \x3ca href\x3d"" class\x3d"cms-doclink" target\x3d"_blank" style\x3d"display: none;"\x3eDocumentation\x3c/a\x3e\x3cbr/\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"cms-function"\x3e\x3clabel for\x3d"cms-function" class\x3d"i18n"\x3eFunctions:\x3c/label\x3e \x3cinput type\x3d"button" class\x3d"form_button btn btn-primary growthBtn"# value\x3d"Predefined Calculations" title\x3d"Calculate difference. Good to calculate previous period growth " id\x3d"growthBtn" \x3e \x3c/input\x3e \x3cinput type\x3d"button" class\x3d"form_button btn btn-primary formatBtn" value\x3d"Format %" id\x3d"formatBtn" title\x3d"Post-process step: format this view as percentage of rows, columns or grand total. " /\x3e\x3c/div\x3e\x3cbr/\x3e\x3cdiv style\x3d"padding-bottom:10px;"\x3e\x3clabel for\x3d"cms-dimension" class\x3d"i18n"\x3eDimension:\x3c/label\x3e\x3cselect id\x3d"cms-dimension" class\x3d"form-control" style\x3d"width:365px"\x3e\x3coption class\x3d"i18n" value\x3d"" selected\x3e-- Select an existing dimension --\x3c/option\x3e\x3c% if (measures.length \x3e 0) { %\x3e\x3coptgroup label\x3d"\x3c%\x3d dataMeasures.name %\x3e"\x3e\x3coption value\x3d"\x3c%\x3d dataMeasures.uniqueName %\x3e" data-type\x3d"calcmeasure"\x3e\x3c%\x3d dataMeasures.name %\x3e\x3c/option\x3e\x3c/optgroup\x3e\x3c% } %\x3e\x3c% _(dimensions).each(function(dimension) { %\x3e\x3coptgroup label\x3d"\x3c%\x3d dimension.name %\x3e"\x3e\x3c% _(dimension.hierarchies).each(function(hierarchy) { %\x3e\x3coption value\x3d"\x3c%\x3d hierarchy.uniqueName %\x3e" data-dimension\x3d"\x3c%\x3d dimension.name %\x3e" data-type\x3d"calcmember"\x3e\x3c%\x3d hierarchy.name %\x3e\x3c/option\x3e\x3c% }); %\x3e\x3c/optgroup\x3e\x3c% }); %\x3e\x3c/select\x3e\x3c/div\x3e\x3c% if (Settings.BIPLUGIN5 \x3d\x3d false) { %\x3e\x3cdiv class\x3d"btn-groups" style\x3d"padding-bottom:10px"\x3e\x3ca class\x3d"form_button btn btn-primary btn-parent-member" href\x3d"#add_math_operator_formula" disabled\x3e\x26nbsp;Parent Member Selector\x26nbsp;\x3c/a\x3e\x3ca class\x3d"form_button btn btn-default btn-clear-parent" href\x3d"#add_math_operator_formula" disabled\x3e\x26nbsp;Clear Parent Member\x26nbsp;\x3c/a\x3e\x3c/div\x3e\x3clabel class\x3d"i18n" for\x3d"cms-pmember"\x3eParent Member:\x3c/label\x3e\x3cinput class\x3d"form-control" readonly\x3d"true" type\x3d"text" id\x3d"cms-pmember"\x3e\x3cbr/\x3e\x3c% } %\x3e\x3cdiv style\x3d"padding-bottom:10px;"\x3e\x3clabel for\x3d"cms-format" class\x3d"i18n"\x3eFormat:\x3c/label\x3e\x3cselect id\x3d"cms-format" class\x3d"form-control" style\x3d"width:365px"\x3e\x3coption class\x3d"i18n" value\x3d"" selected\x3e-- Select a format --\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"custom"\x3eCustom\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"#,##0.00"\x3e#,##0.00 Decimal\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"#,###"\x3e#,### Integer\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"##.##%"\x3e##.##% Decimal percentage\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"##%"\x3e##% Integer percentage\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"mmmm dd yyyy"\x3emmmm dd yyyy Month Day Year\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"mmmm yyyy"\x3emmmm yyyy Month Year\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"yyyy-mm-dd"\x3eyyyy-mm-dd ISO format date\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"yyyy-mm-dd hh:mi:ss"\x3eyyyy-mm-dd hh:mi:ss Date and time\x3c/option\x3e\x3coption class\x3d"i18n" value\x3d"##h ##m"\x3e##h ##m Minutes\x3c/option\x3e\x3c/select\x3e\x3c/div\x3e\x3cdiv class\x3d"div-format-custom" style\x3d"padding-bottom:10px"\x3e\x3clabel for\x3d"cms-format-custom" class\x3d"i18n"\x3eFormat Custom:\x3c/label\x3e\x3cinput type\x3d"text" class\x3d"form-control" id\x3d"cms-format-custom" value\x3d"" placeholder\x3d"Add a custom format"\x3e\x3c/div\x3e\x3c/form\x3e\x3c/div\x3e'), buttons:[{text:"Add",method:"save"},{text:"Update",method:"save"},{text:"New",method:"new"},{text:"Cancel",method:"close"},{text:"Help",method:"help"}],events:{"click .dialog_footer a":"call","blur #cms-name":"trigger_input_name","change #cms-measure":"add_measure_formula","click .btn-math":"add_math_operator_formula","change #cms-dimension":"type_dimension","change #cms-format":"type_format","click .btn-action-edit":"edit_cms","click .btn-action-del":"show_del_cms","click .form_button.growthBtn":"openGrowthModal", "click .form_button.formatBtn":"openFormatModal","click .btn-parent-member":"open_parent_member_selector","click .btn-clear-parent":"reset_parent_member","click .cms-functionlist":"change_function_list","click .btn-select-member":"open_select_member_selector"},initialize:function(a){_.extend(this,a);this.workspace=a.workspace;this.options.title="Calculated Member";this.id=_.uniqueId("cms-formula-");var b=this,c=this.workspace.selected_cube;a=Saiku.session.sessionworkspace.cube[c].get("data").measures; var c=Saiku.session.sessionworkspace.cube[c].get("data").dimensions,d=this.workspace.query.helper.getCalculatedMeasures(),e=this.workspace.query.helper.getCalculatedMembers(),d=this.template_cms(d,"calcmeasure"),e=this.template_cms(e,"calcmember"),f={name:a?a[0].dimensionUniqueName.replace(/[\[\]]/gi,""):null,uniqueName:a?a[0].hierarchyUniqueName:null};Saiku.ui.block('\x3cspan class\x3d"i18n"\x3eLoading...\x3c/span\x3e');this.message=this.template_modal({tplCalculatedMeasures:d,tplCalculatedMembers:e, idEditor:this.id,measures:a,dataMeasures:f,dimensions:c});this.bind("open",function(){this.populate_function_list();var a=this.$el.find(".cms-container-form").height();this.post_render();this.$el.find(".dialog_footer a:nth-child(2)").hide();this.$el.find(".dialog_footer a:nth-child(3)").hide();this.$el.find(".cms-container-group").height(a);this.$el.find(".calculated-measure-group").height(a/2);this.$el.find(".calculated-member-group").height(a/2);_.defer(function(){b.start_editor()})});Saiku.session.bind("ParentMemberSelectorModal:save", this.add_selected_dimension)},add_selected_dimension:function(a){console.log(a);a.dialog.$el.find("#cms-dimension").val(a.selectedDimension)},post_render:function(){var a=($("body").height()-570)/2*100/$("body").height(),b=($("body").width()-800)/2*100/$("body").width();this.$el.dialog("option","position","center");this.$el.parents(".ui-dialog").css({width:"800px",top:a+"%",left:b+"%"})},start_editor:function(){this.formulaEditor=ace.edit(this.id);this.formulaEditor.getSession().setMode("ace/mode/text"); this.formulaEditor.getSession().setUseWrapMode(!0);Saiku.ui.unblock()},template_cms:function(a,b){var c=this,d="";a&&0!==a.length?"calcmeasure"===b?_.each(a,function(a){d+='\x3ctr class\x3d"row-cms-'+c.replace_cms(a.name)+'"\x3e\x3ctd class\x3d"cms-name"\x3e'+a.name+'\x3c/td\x3e\x3ctd class\x3d"cms-actions"\x3e\x3ca class\x3d"edit button sprite btn-action-edit" href\x3d"#edit_cms" data-name\x3d"'+a.name+'" data-type\x3d"calcmeasure"\x3e\x3c/a\x3e\x3ca class\x3d"delete button sprite btn-action-del" href\x3d"#show_del_cms" data-name\x3d"'+ a.name+'" data-type\x3d"calcmeasure"\x3e\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e'}):_.each(a,function(a){-1==a.name.indexOf("*TOTAL_MEMBER_SEL~SUM")&&(d+='\x3ctr class\x3d"row-cms-'+c.replace_cms(a.name)+'"\x3e\x3ctd class\x3d"cms-name"\x3e'+a.name+'\x3c/td\x3e\x3ctd class\x3d"cms-actions"\x3e\x3ca class\x3d"edit button sprite btn-action-edit" href\x3d"#edit_cms" data-name\x3d"'+a.name+'" data-type\x3d"calcmember"\x3e\x3c/a\x3e\x3ca class\x3d"delete button sprite btn-action-del" href\x3d"#show_del_cms" data-name\x3d"'+ a.name+'" data-type\x3d"calcmember"\x3e\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e')}):d="calcmeasure"===b?'\x3cp class\x3d"msg-no-cms i18n"\x3eNo calculated measures created\x3c/p\x3e':'\x3cp class\x3d"msg-no-cms i18n"\x3eNo calculated members created\x3c/p\x3e';return d},replace_cms:function(a){return a=a.replace(/\s/g,"-")},edit_cms:function(a){a.preventDefault();var b=this,c=$(a.currentTarget);a="calcmeasure"===c.data("type")?this.workspace.query.helper.getCalculatedMeasures():this.workspace.query.helper.getCalculatedMembers(); this.$el.find(".cms-actions a").removeClass("on");_.each(a,function(a){a.name===c.data("name")&&(c.addClass("on"),b.$el.find("#cms-name").val(a.name),b.formulaEditor.setValue(a.formula),b.$el.find("#cms-dimension").val(a.hierarchyName),b.$el.find("#cms-pmember").val(a.parentMember),0!==$('#cms-format option[value\x3d"'+a.properties.FORMAT_STRING+'"]').length||void 0===a.properties.FORMAT_STRING&&0===$('#cms-format option[value\x3d"'+a.properties.FORMAT_STRING+'"]').length?(b.$el.find("#cms-format").val(a.properties.FORMAT_STRING), b.$el.find(".div-format-custom").hide()):(b.$el.find("#cms-format").prop("selectedIndex",1),b.$el.find(".div-format-custom").show(),b.$el.find("#cms-format-custom").val(a.properties.FORMAT_STRING)),b.pmUniqueName=a.parentMember||"",b.pmLevel=a.parentMemberLevel||"",b.lastLevel=a.previousLevel||"",b.pmBreadcrumbs=a.parentMemberBreadcrumbs||[],b.actualLevel=a.assignedLevel||"",b.type_dimension(),b.$el.find(".form-group-inline").data("action","edit"),b.$el.find(".form-group-inline").data("oldcms",a.name))}); this.$el.find(".dialog_footer a:nth-child(1)").hide();this.$el.find(".dialog_footer a:nth-child(2)").show();this.$el.find(".dialog_footer a:nth-child(3)").show()},show_del_cms:function(a){a.preventDefault();a=$(a.currentTarget);var b="calcmeasure"===a.data("type")?'\x3cspan class\x3d"i18n"\x3emeasure\x3c/span\x3e':'\x3cspan class\x3d"i18n"\x3emember\x3c/span\x3e';this.$delcms=a;this.new();(new WarningModal({title:'\x3cspan class\x3d"i18n"\x3eDelete Member\x3c/span\x3e',message:'\x3cspan class\x3d"i18n"\x3eYou want to delete this\x3c/span\x3e '+ b+" \x3cb\x3e"+a.data("name")+"\x3c/b\x3e?",okay:this.del_cms,okayobj:this})).render().open();this.$el.parents(".ui-dialog").find(".ui-dialog-title").text("Calculated Member");Saiku.i18n.translate()},del_cms:function(a){a.$delcms.parent().closest(".row-cms-"+a.replace_cms(a.$delcms.data("name"))).remove();"calcmeasure"===a.$delcms.data("type")?a.workspace.query.helper.removeCalculatedMeasure(a.$delcms.data("name")):a.workspace.query.helper.removeCalculatedMember(a.$delcms.data("name"));a.workspace.sync_query(); a.workspace.drop_zones.set_measures();a.new();a.check_len_cms(a.$delcms.data("type"))||("calcmeasure"===a.$delcms.data("type")?a.$el.find(".measures-list").append('\x3cp class\x3d"msg-no-cms i18n"\x3eNo calculated measures created\x3c/p\x3e'):a.$el.find(".members-list").append('\x3cp class\x3d"msg-no-cms i18n"\x3eNo calculated members created\x3c/p\x3e'));Saiku.i18n.translate()},trigger_input_name:function(){var a=this.$el.find(".form-group-inline").data("action"),b=this.$el.find("#cms-name").val(), c=this.$el.find("#cms-dimension option:selected").data("type"),d="";"calcmeasure"===c?this.check_name_cms(c,b)&&"cad"===a&&(d="Exists a measure with the same name added!"):"calcmember"===c?this.check_name_cms(c,b)&&"cad"===a&&(d="Exists a member with the same name added!"):this.check_name_cms(c,b)&&"cad"===a&&(d="Exists a measure or member with the same name added!");""!==d&&alert(d)},check_name_cms:function(a,b){var c="calcmeasure"===a?this.workspace.query.helper.getCalculatedMeasures():this.workspace.query.helper.getCalculatedMembers(); if(null===a||void 0===a)var d=this.workspace.query.helper.getCalculatedMeasures(),e=this.workspace.query.helper.getCalculatedMembers(),c=[],c=c.concat(d,e);for(;0isIE)$(this.el).find("form").on("submit",this.save);this.message=this.addMeasureTemplate({measures:this.measures,dimensions:this.dimensions,measureExpression:this.measureExpression});this.$el.find(".dialog_icon")},save:function(a){a.preventDefault(); var b=this,c=$(this.el).find(".measure_name").val(),d=$(this.el).find(".measureFormula").val();a=$(this.el).find(".measure_format").val();var e="";"undefined"!=typeof c&&c||(e+="You have to enter a name for the measure! ");"undefined"!=typeof d&&d&&""!==d||(e+="You have to enter a MDX formula for the calculated measure! ");""!==e?alert(e):(this.asPercentAlternative?(_.each(this.memberExpression,function(a){b.workspace.query.helper.addCalculatedMember({name:a.name,dimension:a.dimension,uniqueName:a.uniqueName, caption:"*TOTAL_MEMBER_SEL~SUM",properties:{},formula:a.statement,hierarchyName:a.hierarchy,parentMember:"",parentMemberLevel:"",previousLevel:"",parentMemberBreadcrumbs:[]})}),c={name:c,formula:d,properties:{},uniqueName:"[Measures]."+c},a&&(c.properties.FORMAT_STRING="###0.00%")):(c={name:c,formula:d,properties:{},uniqueName:"[Measures]."+c},a&&(c.properties.FORMAT_STRING=a)),b.workspace.query.helper.addCalculatedMeasure(c),b.workspace.sync_query(),this.close());return!1},endswith:function(a,b){return-1!== a.indexOf(b,a.length-b.length)},updateCalculatedMemberField:function(){var a="[Measures]."+this.surroundWithSquareBrackets(this.selectedMeasure),b=this.selectedDimension+".CurrentMember.PrevMember";if(this.asPercent)this.measureExpression="( IIF( IsEmpty("+b+"),NULL, ( "+a+" - ("+a+", "+b+")) / ( "+a+", "+b+")))";else if(this.asPercentAround100)this.measureExpression="( IIF( IsEmpty("+b+"),NULL, 1 + ( "+a+" - ("+a+", "+b+")) / ( "+a+", "+b+")))";else if(this.asPercentAlternative){b=this.workspace.query.helper.getAxis("ROWS").hierarchies; this.memberExpression=[];for(var c=$(this.el).find("#Dimensions").val(),d=!1,e=this.calculate_nonempty_crossjoin(b),f=0;fisIE)$(this.el).find("form").on("submit",this.save);this.userFeedback=this.checkRowsOrColumnsPresent(this.selectedColumns,this.selectedRows); this.message=this.addMeasureTemplate({userFeedback:this.userFeedback});this.$el.find(".dialog_icon")},save:function(a,b,c){var d=$(this.el).find(".measure_name").val();if(null==d||""==d)d=b+" % of "+c;b="";"undefined"!=typeof d&&d||(b+="You have to enter a name for the measure! ");"undefined"!=typeof a&&a&&""!==a||(b+="You have to enter a MDX formula for the calculated measure! ");""!==b?alert(b):(a={name:d,formula:a,properties:{},uniqueName:"[Measures]."+d},a.properties.FORMAT_STRING="0.00%",this.workspace.query.helper.addCalculatedMeasure(a), this.generatedMeasures.push(a))},format:function(a){a.preventDefault();a=a.target.id;for(var b=this.determineFormatOver(a),c=0;c=b.length)return a.length+1;var d=0,e=0;for(c=c?1:b.length;;)if(e=a.indexOf(b,e),0<=e)d++,e+=c;else break;return d},makeCrossJoinExpression:function(a){for(var b=a[0],c=1;ca?a:b.editor.getSession().getScreenLength())+1)*b.editor.renderer.lineHeight+b.editor.renderer.scrollBar.getWidth();$mdx_editor.height(a.toString()+"px");b.editor.resize();b.workspace.adjust()};a=function(){var a=b.editor.session;b.editor.resize();a.setUseWrapMode(!0);if(a.getUseWrapMode()){var c=b.editor.renderer.characterWidth,f=b.editor.renderer.scroller.clientWidth;0_.indexOf(this.item.acl,"WRITE")&&(this.isReadOnly=!0,this.viewState="view");a&&(a.query||a.viewState)||(this.viewState="edit");a&&a.query&&(this.query=a.query,this.query.workspace=this,this.query.save({},{success:this.init_query,error:function(){Saiku.ui.unblock();if(1>$("body").find(".error_loading_query").length){var a=Saiku.i18n&&Saiku.i18n.po_file.error_loading_query?Saiku.i18n.po_file.error_loading_query:null;a||($('\x3cspan class\x3d"i18n error_loading_query"\x3eError Loading Query\x3c/span\x3e').hide().appendTo("body"), Saiku.i18n.translate(),a=$(".error_loading_query").text())}else a=$(".error_loading_query").text();alert(a)}}));Saiku.session.bind("tab:add",this.prepare);var b=Saiku.URLParams.paramsURI();void 0!=a&&void 0!=a.processURI&&0==a.processURI&&(b={});Saiku.URLParams.equals({schema:b.schema,cube:b.cube});this.data_connections(b)},afterRender:function(){console.log("After render")},caption:function(a){if(this.query&&this.query.model){if(this.item&&this.item.name)return this.item.name.split(".")[0];if(this.query.model.mdx)return this.query.model.name}else if(this.query&& this.query.get("name"))return this.query.get("name");a&&Saiku.tabs.queryCount++;return"\x3cspan class\x3d'i18n'\x3eUnsaved query\x3c/span\x3e ("+Saiku.tabs.queryCount+")"},selected_cube_template:function(a){var b=Saiku.session.sessionworkspace;b.selected=a;return _.template('\x3cselect class\x3d"cubes"\x3e\x3coption value\x3d"" class\x3d"i18n"\x3eSelect a cube\x3c/option\x3e\x3c% _.each(connections, function(connection) { %\x3e\x3c% _.each(connection.catalogs, function(catalog) { %\x3e\x3c% _.each(catalog.schemas, function(schema) { %\x3e\x3c% if (schema.cubes.length \x3e 0) { %\x3e\x3coptgroup label\x3d"\x3c%\x3d (schema.name !\x3d\x3d "" ? schema.name : catalog.name) %\x3e \x3c%\x3d (connection.name) %\x3e"\x3e\x3c% _.each(schema.cubes, function(cube) { %\x3e\x3c% if ((typeof cube["visible"] \x3d\x3d\x3d "undefined" || cube["visible"]) \x26\x26 selected !\x3d\x3d cube.caption) { %\x3e\x3coption value\x3d"\x3c%\x3d connection.name %\x3e/\x3c%\x3d catalog.name %\x3e/\x3c%\x3d ((schema.name \x3d\x3d\x3d "" || schema.name \x3d\x3d\x3d null) ? "null" : schema.name) %\x3e/\x3c%\x3d encodeURIComponent(cube.name) %\x3e"\x3e\x3c%\x3d ((cube.caption \x3d\x3d\x3d "" || cube.caption \x3d\x3d\x3d null) ? cube.name : cube.caption) %\x3e\x3c/option\x3e\x3c% } else if ((typeof cube["visible"] \x3d\x3d\x3d "undefined" || cube["visible"]) \x26\x26 selected \x3d\x3d\x3d cube.caption) { %\x3e\x3coption value\x3d"\x3c%\x3d connection.name %\x3e/\x3c%\x3d catalog.name %\x3e/\x3c%\x3d ((schema.name \x3d\x3d\x3d "" || schema.name \x3d\x3d\x3d null) ? "null" : schema.name) %\x3e/\x3c%\x3d encodeURIComponent(cube.name) %\x3e" selected\x3e\x3c%\x3d ((cube.caption \x3d\x3d\x3d "" || cube.caption \x3d\x3d\x3d null) ? cube.name : cube.caption) %\x3e\x3c/option\x3e\x3c% } %\x3e\x3c% }); %\x3e\x3c/optgroup\x3e\x3c% } %\x3e\x3c% }); %\x3e\x3c% }); %\x3e\x3c% }); %\x3e\x3c/select\x3e')(b)}, template:function(){var a=$("#template-workspace").html()||"",b=!1;this.isUrlCubeNavigation&&(b=this.selected_cube.split("/")[3],b=this.selected_cube_template(b));return _.template(a)({cube_navigation:b?b:Saiku.session.sessionworkspace.cube_navigation})},refresh:function(a){a&&a.preventDefault();Saiku.session.sessionworkspace.refresh()},render:function(){$(this.el).html(this.template());this.processing=$(this.el).find(".query_processing");this.isReadOnly||Settings.MODE&&("view"==Settings.MODE||"table"== Settings.MODE||"map"==Settings.MODE||"chart"==Settings.MODE)?($(this.el).find(".workspace_editor").remove(),this.toggle_sidebar(),$(this.el).find(".sidebar_separator").remove(),$(this.el).find(".workspace_inner").css({"margin-left":0}),$(this.el).find(".workspace_fields").remove(),$(this.el).find(".sidebar").hide(),$(this.toolbar.el).find(".run, .auto, .toggle_fields, .toggle_sidebar,.switch_to_mdx, .new").parent().remove()):($(this.el).find(".workspace_editor").append($(this.drop_zones.el)),$(this.el).find(".sidebar").droppable({accept:".d_measure, .selection"}), $(this.el).find(".workspace_results").droppable({accept:".d_measure, .selection"}));!Settings.MODE||"table"!=Settings.MODE&&"chart"!=Settings.MODE&&"map"!=Settings.MODE?($(this.el).find(".workspace_toolbar").append($(this.toolbar.el)),$(this.el).find(".query_toolbar").append($(this.querytoolbar.el)),$(this.el).find(".upgrade").append($(this.upgrade.el))):($(this.el).find(".workspace_toolbar").remove(),$(this.el).find(".query_toolbar").remove());this.switch_view_state(this.viewState,!0);$(this.el).find(".workspace_results").append($(this.table.el)); this.chart.render_view();this.tab.bind("tab:select",this.adjust);$(window).resize(this.adjust);Saiku.session.trigger("workspace:new",{workspace:this});if(Settings.PLUGIN&&0==Settings.BIPLUGIN5&&Saiku.session.isAdmin){var a=$("\x3ca /\x3e").attr({href:"#adminconsole",title:"Admin Console"}).click(Saiku.AdminConsole.show_admin).addClass("button admin_console");$(this.el).find(".refresh_cubes_nav").css("margin-right","40px");$(this.el).find(".admin_console_nav").append(a)}Saiku.session.isAdmin||!1!== Settings.SHOW_REFRESH_NONADMIN||$(this.el).find(".refresh_cubes_nav").hide();return this},clear:function(){this.table.clearOut();$(this.el).find(".workspace_results table,.connectable").html("");$(this.el).find(".workspace_results_info").empty();$(this.el).find(".parameter_input").empty();$(this.chart.el).find("div.canvas").empty();$(this.querytoolbar.el).find("ul.options a.on").removeClass("on");$(this.el).find('.fields_list[title\x3d"ROWS"] .limit').removeClass("on");$(this.el).find('.fields_list[title\x3d"COLUMNS"] .limit').removeClass("on"); Saiku.session.trigger("workspace:clear",{workspace:this})},adjust:function(){var a=$(this.el).find(".sidebar_separator"),b=87;if(!0===Settings.PLUGIN||!0===Settings.BIPLUGIN)b=2,"table"==Settings.MODE&&(b=-5);if(0===$("#header").length||$("#header").is("hidden"))b=2;a.height($("body").height()-b);$(this.el).find(".sidebar").height($("body").height()-b);$(this.querytoolbar.el).find("div").height($("body").height()-b-10);var a=$(this.el).find(".workspace_editor").is(":hidden")?0:$(this.el).find(".workspace_editor").height(), c=$(this.el).find(".query_processing").is(":hidden")?0:$(this.el).find(".query_processing").height()+62,d=$(this.el).find(".upgradeheader").is(":hidden")?0:$(this.el).find(".upgrade").height();$(this.el).find(".workspace_results").css({height:$("body").height()-b-$(this.el).find(".workspace_toolbar").height()-$(this.el).find(".workspace_results_info").height()-a-c-d-20});this.querytoolbar&&$(this.querytoolbar.el).find("a").tipsy({delayIn:700,fade:!0});this.toolbar&&$(this.toolbar.el).find("a").tipsy({delayIn:900, fade:!0});$(this.el).find(".workspace_fields").css({height:$("body").height()-b-$(this.el).find(".workspace_toolbar").height()-d-20});this.trigger("workspace:adjust",{workspace:this})},toggle_sidebar:function(){$(this.el).find(".sidebar").toggleClass("hide");$(this.toolbar.el).find(".toggle_sidebar").toggleClass("on");var a=($(this.el).find(".sidebar").is(":visible")?$(this.el).find(".sidebar").width():0)+$(this.el).find(".sidebar_separator").width()+1;$(this.el).find(".workspace_inner").css({"margin-left":a})}, prepare:function(){},setDefaultFilters:function(a,b){_.each(a,function(a){var d=a.filtername,e=d.substring(0,d.lastIndexOf("[")-1),d=d.substring(d.lastIndexOf("["));b.helper.setDefaultFilter(e,d,a.filtervalue)})},data_connections:function(a){var b=this;_.each(Saiku.session.sessionworkspace.connections,function(c){_.each(c.catalogs,function(d){_.each(d.schemas,function(e){0b&&(b="0"+b);var c=(new Date).getMinutes();10>c&&(c="0"+c);b=b+":"+c;c=null!==a.data.runtime?(a.data.runtime/1E3).toFixed(2):"";b='\x3cb\x3e\x3cspan class\x3d"i18n"\x3eInfo:\x3c/span\x3e\x3c/b\x3e \x26nbsp;'+b+"\x26emsp;/ \x26nbsp;"+a.data.width+" x "+a.data.height+"\x26nbsp; / \x26nbsp;"+c+"s";this.update_parameters();$(this.el).find(".workspace_results_info").html(b);a=a.workspace.query.getProperty("saiku.ui.headings");void 0!=a&&(a=JSON.parse(a),b="",null!=a.title&& ""!=a.title&&(b='\x3ch3\x3e\x3cspan class\x3d"i18n"\x3eTitle:\x3c/span\x3e\x3c/h3\x3e \x26nbsp;'+a.title+"\x3cbr/\x3e"),null!=a.variable&&""!=a.variable&&(b+='\x3ch3\x3e\x3cspan class\x3d"i18n"\x3eVariable:\x3c/span\x3e\x3c/h3\x3e \x26nbsp;'+a.variable+"\x3cbr/\x3e"),null!=a.explanation&&""!=a.explanation&&(b+='\x3ch3\x3e\x3cspan class\x3d"i18n"\x3eExplanation:\x3c/span\x3e\x3c/h3\x3e \x26nbsp;'+a.explanation),$(this.el).find(".workspace_results_titles").html(b));this.adjust();Saiku.i18n.translate()}, switch_view_state:function(a,b){var c=a||"edit";"edit"==c?(this.toolbar.toggle_fields_action("show",b),this.query&&"MDX"==this.query.get("type")&&this.toolbar.editor.gotoLine(0),$(this.el).find(".sidebar").hasClass("hide")&&this.toggle_sidebar(),$(this.toolbar.el).find(".auto, .toggle_fields, .toggle_sidebar,.switch_to_mdx, .new").parent().css({display:"block"})):"view"==c&&(this.toolbar.toggle_fields_action("hide",b),$(this.el).find(".sidebar").hasClass("hide")||this.toggle_sidebar(),$(this.toolbar.el).find(".auto, .toggle_fields, .toggle_sidebar,.switch_to_mdx").parent().hide()); this.viewState=c;this.update_parameters();$(window).trigger("resize")},block:function(a){Settings.LOGO_32x32?$(this.el).block({message:'\x3cimg class\x3d"saiku_logo_override" style\x3d"float:left" src\x3d"'+Settings.LOGO_32x32+'"/\x3e '+a}):$(this.el).block({message:'\x3cspan class\x3d"saiku_logo" style\x3d"float:left"\x3e\x26nbsp;\x26nbsp;\x3c/span\x3e '+a});Saiku.i18n.translate()},unblock:function(){isIE||$(this.el).unblock();Saiku.ui.unblock()},cancel:function(a){var b=this;a&&a.preventDefault(); this.query.action.del("/cancel",{success:function(){b.cancelled()}})},admin:function(a){Saiku.AdminConsole.show_admin()},cancelled:function(a){this.processing.html('\x3cspan class\x3d"processing_image"\x3e\x26nbsp;\x26nbsp;\x3c/span\x3e \x3cspan class\x3d"i18n"\x3eCanceling Query...\x3c/span\x3e').show()},no_results:function(a){this.processing.html('\x3cspan class\x3d"i18n"\x3eNo Results\x3c/span\x3e').show()},error:function(a){this.processing.html(safe_tags_replace(a.data.error)).show()}}),DeleteRepositoryObject= Modal.extend({type:"delete",buttons:[{text:"Yes",method:"del"},{text:"No",method:"close"}],initialize:function(a){this.options.title="Confirm deletion";this.query=a.query;this.success=a.success;this.message='\x3cspan class\x3d"i18n"\x3eAre you sure you want to delete \x3c/span\x3e\x3cspan\x3e'+this.query.get("name")+"?\x3c/span\x3e"},del:function(){this.query.set("id",_.uniqueId("query_"));this.query.id=_.uniqueId("query_");this.query.url=this.query.url()+"?file\x3d"+encodeURIComponent(this.query.get("file")); this.query.destroy({success:this.success,dataType:"text",error:this.error,wait:!0});this.close()},error:function(){$(this.el).find("dialog_body").html('\x3cspan class\x3d"i18n"\x3eCould not delete repository object\x3c/span\x3e')}}),MoveRepositoryObject=Modal.extend({type:"save",closeText:"Move",events:{click:"select_root_folder","click .dialog_footer a":"call","click .query":"select_name","dblclick .query":"open_query","click li.folder":"toggle_folder","keyup .search_file":"search_file","click .cancel_search":"cancel_search", "click .export_btn":"export_zip","change .file":"select_file"},buttons:[{id:"test",text:"Move",method:"open_query"},{text:"Cancel",method:"close"}],initialize:function(a){var b=this;this.movefolder=a.query;this.success=a.success;this.message='\x3cbr/\x3e\x3cb\x3e\x3cdiv class\x3d\'query_name\'\x3e\x3cspan class\x3d\'i18n\'\x3ePlease select a folder.....\x3c/span\x3e\x3c/div\x3e\x3c/b\x3e\x3cbr/\x3e\x3cdiv class\x3d\'RepositoryObjects i18n\'\x3eLoading...\x3c/div\x3e\x3cbr\x3e\x3cdiv style\x3d"height:25px; line-height:25px;"\x3e\x3cb\x3e\x3cspan class\x3d"i18n"\x3eSearch:\x3c/span\x3e\x3c/b\x3e \x26nbsp; \x3cspan class\x3d"search"\x3e\x3cinput type\x3d"text" class\x3d"search_file"\x3e\x3c/input\x3e\x3cspan class\x3d"cancel_search"\x3e\x3c/span\x3e\x3c/span\x3e\x3c/div\x3e'; _.extend(this.options,{title:"Move"});this.selected_folder=null;this.repository=new Repository({},{dialog:this});this.bind("open",function(){var a=$("body").height()/2+$("body").height()/6;420_.indexOf(d.acl,"WRITE")?(b.commands["delete"].disabled=!0,b.items["delete"].disabled=!0,b.commands.edit.disabled=!0,b.items.edit.disabled=!0,b.commands.move.disabled=!0,b.items.move.disabled=!0):(b.commands["delete"].disabled=!1,b.items["delete"].disabled=!1,b.commands.edit.disabled=!1,b.items.edit.disabled=!1,b.commands.move.disabled=!1,b.items.move.disabled=!1);$(this).hasClass("folder_row")? (b.commands.open.disabled=!0,b.items.open.disabled=!0):(b.commands.open.disabled=!1,b.items.open.disabled=!1)}},callback:function(b,d){var e=$(this).find("a").attr("href").replace("#",""),f=a.queries[e];a.selected_query=new SavedQuery({file:e,name:f.name,type:f.type});"open"==b&&$(this).hasClass("query")&&a.open_query();"edit"==b&&$(this).hasClass("query")?a.edit_query():"new"==b?a.add_folder():"delete"==b?a.delete_repoObject():"move"==b?a.move_repoObject():"opencontents"==b&&a.open_contents()},items:b}); Saiku.session.trigger("openQuery:new",{openQuery:this});Settings.REPOSITORY_LAZY&&this.$el.find(".search_file").prop("disabled",!0);return this},initialize:function(a){_.bindAll(this,"adjust","fetch_queries","clear_query","select_and_open_query","cancel_search","add_folder");this.repository=new Repository({},{dialog:this})},fetch_queries:function(){this.repository.fetch()},populate:function(a){function b(a){_.forEach(a,function(a){c.queries[a.path]=a;"FOLDER"===a.type&&b(a.repoObjects)})}var c=this; c.template_repository_objects(a);c.queries={};b(a)},search_file:function(a){var b=$(this.el).find(".search_file").val().toLowerCase();"undefined"==typeof b||""===b||null===b||27==a.which||9==a.which?this.cancel_search():($(this.el).find(".search_file").val()?$(this.el).find(".cancel_search").show():$(this.el).find(".cancel_search").hide(),$(this.el).find("li.query").removeClass("hide"),$(this.el).find("li.query a").each(function(a){-1==$(this).text().toLowerCase().indexOf(b)&&$(this).parent("li.query").addClass("hide")}), $(this.el).find("li.folder").addClass("hide"),$(this.el).find("li.query").not(".hide").parents("li.folder").removeClass("hide"),$(this.el).find("li.folder .folder_row").find(".sprite").removeClass("collapsed"),$(this.el).find("li.folder .folder_content").removeClass("hide"));return!1},cancel_search:function(a){$(this.el).find("input.search_file").val("");$(this.el).find(".cancel_search").hide();$(this.el).find("li.query, li.folder").removeClass("hide");$(this.el).find(".folder_row").find(".sprite").addClass("collapsed"); $(this.el).find("li.folder .folder_content").addClass("hide");$(this.el).find(".search_file").val("").focus();$(this.el).find(".cancel_search").hide()},view_query:function(a){a.preventDefault();a=$(a.currentTarget);var b=a.find("a");this.unselect_current_selected();a.addClass("selected");a=b.attr("href").replace("#","");var b=b.text(),c=this.queries[a];$(this.el).find(".workspace_toolbar").removeClass("hide");$(this.el).find(".for_queries").addClass("hide");$(this.el).find(".for_folder").addClass("hide"); $(this.el).find(".add_folder").parent().addClass("hide");"undefined"!=typeof c.acl&&-1<_.indexOf(c.acl,"READ")&&$(this.el).find(".for_queries .run").parent().removeClass("hide");"undefined"!=typeof c.acl&&-1<_.indexOf(c.acl,"WRITE")&&($(this.el).find(".for_queries .delete").parent().removeClass("hide"),$(this.el).find(".for_queries .edit").parent().removeClass("hide"));"undefined"!=typeof c.acl&&-1<_.indexOf(c.acl,"GRANT")&&$(this.el).find(".for_queries .edit_permissions").parent().removeClass("hide"); try{var d=a.split("/");if(1isIE)$(this.el).find("form").on("submit",this.save)},populate:function(a){$(this.el).find(".RepositoryObjects").html(_.template($("#template-repository-objects").html())({repoObjects:a}));this.context_menu_disabled();this.select_last_location()},context_menu_disabled:function(){this.$el.find(".RepositoryObjects").find(".folder_row, .query").addClass("context-menu-disabled")},select_root_folder:function(a){"name"!== $(a.target).attr("name")&&this.unselect_current_selected_folder()},toggle_folder:function(a){a=$(a.currentTarget);var b=a.children(".folder_row").find("a").attr("href"),b=b.replace("#","");this.unselect_current_selected_folder();a.children(".folder_row").addClass("selected");var c=a.find("a").attr("href").replace("#","");this.set_name(c,null);c=a.children(".folder_content");a.children(".folder_row").find(".sprite").hasClass("collapsed")?(a.children(".folder_row").find(".sprite").removeClass("collapsed"), c.removeClass("hide"),Settings.REPOSITORY_LAZY&&this.fetch_lazyload(a,b)):(a.children(".folder_row").find(".sprite").addClass("collapsed"),c.addClass("hide"),Settings.REPOSITORY_LAZY&&a.find(".folder_content").remove());this.set_last_location(b);$(this.el).find('input[name\x3d"name"]').focus();return!1},fetch_lazyload:function(a,b){(new RepositoryLazyLoad({},{dialog:this,folder:a,path:b})).fetch();Saiku.ui.block("Loading...")},template_repository_folder_lazyload:function(a,b){a.find(".folder_content").remove(); a.append(_.template($("#template-repository-folder-lazyload").html())({repoObjects:b}))},populate_lazyload:function(a,b){Saiku.ui.unblock();this.template_repository_folder_lazyload(a,b)},set_name:function(a,b){if(null!==a){this.folder_name=a;var c=(null!==this.folder_name?this.folder_name+"/":"")+(null!==this.file_name?this.file_name:"");$(this.el).find('input[name\x3d"name"]').val(c)}null!==b&&$(this.el).find('input[name\x3d"name"]').val(b)},search_file:function(a){var b=$(this.el).find(".search_file").val().toLowerCase(); "undefined"==typeof b||""===b||null===b||27==a.which||9==a.which?this.cancel_search():($(this.el).find(".search_file").val()?$(this.el).find(".cancel_search").show():$(this.el).find(".cancel_search").hide(),$(this.el).find("li.query").removeClass("hide"),$(this.el).find("li.query a").filter(function(a){return-1==$(this).text().toLowerCase().indexOf(b)}).parent().addClass("hide"),$(this.el).find("li.folder").addClass("hide"),$(this.el).find("li.query").not(".hide").parents("li.folder").removeClass("hide"), $(this.el).find("li.folder .folder_row").find(".sprite").removeClass("collapsed"),$(this.el).find("li.folder .folder_content").removeClass("hide"));return!1},cancel_search:function(a){$(this.el).find("input.search_file").val("");$(this.el).find(".cancel_search").hide();$(this.el).find("li.query, li.folder").removeClass("hide");$(this.el).find(".folder_row").find(".sprite").addClass("collapsed");$(this.el).find("li.folder .folder_content").addClass("hide");$(this.el).find(".search_file").val("").focus(); $(this.el).find(".cancel_search").hide()},select_name:function(a){a=$(a.currentTarget);this.unselect_current_selected_folder();a.addClass("selected");var b=a.find("a").attr("href").replace("#","");this.set_name(null,b);a=a.parent().parent().has(".folder").children(".folder_row").find("a").attr("href");a=a.replace("#","");this.set_last_location(a);$(this.el).find('input[name\x3d"name"]').focus();return!1},unselect_current_selected_folder:function(){$(this.el).find(".selected").removeClass("selected")}, save:function(a){var b=this,c=$(this.el).find('input[name\x3d"name"]').val();null!==this.folder_name&&void 0!==this.folder_name&&0=d.length);g++)if("9"===c[g]&&d[e].match(/[0-9]/)||"A"===c[g]&&d[e].match(/[a-zA-Z]/)||"S"===c[g]&&d[e].match(/[0-9a-zA-Z]/))c[g]= d[e++];else if("9"===c[g]||"A"===c[g]||"S"===c[g])c=c.slice(0,g);return c.join("").substr(0,g)}};Saiku.singleton=function(){var a;Saiku.singleton=function(){if(a)return a;a=this;this.set=function(a){this.data=a};this.get=function(){return this.data}};return Saiku.singleton}();Backbone.emulateHTTP=!1; Settings.BIPLUGIN||$(document).ready(function(){var a=new PluginCollection;a.fetch({success:function(){var b=new SettingsOverrideCollection;b.fetch({success:function(){var c=a.size(),d=0;a.each(function(a){d+=1;if("js/saiku/plugins/I18n/plugin.js"!=a.attributes.path)jQuery.ajax({async:!1,type:"GET",url:a.attributes.path,data:null,success:function(){if(d==c){var a=b.size(),e=0;b.each(function(b){e+=1;for(var c in b.attributes)Settings[c]=b.attributes[c];void 0!=Settings.CSS&&Saiku.loadCSS(Settings.CSS, null);a==e&&(Saiku.session=new Session({},{username:Settings.USERNAME,password:Settings.PASSWORD}),Saiku.toolbar=new Toolbar)})}},dataType:"script"});else if(d==c){var f=b.size(),g=0;b.each(function(a){g+=1;for(var b in a.attributes)Settings[b]=a.attributes[b];void 0!=Settings.CSS&&Saiku.loadCSS(Settings.CSS,null);f==g&&(Saiku.session=new Session({},{username:Settings.USERNAME,password:Settings.PASSWORD}),Saiku.toolbar=new Toolbar)})}})},error:function(){var b=a.size(),d=0;a.each(function(a){d+=1; "js/saiku/plugins/I18n/plugin.js"!=a.attributes.path?jQuery.ajax({async:!1,type:"GET",url:a.attributes.path,data:null,success:function(){d==b&&(void 0!=Settings.CSS&&Saiku.loadCSS(Settings.CSS,null),Saiku.session=new Session({},{username:Settings.USERNAME,password:Settings.PASSWORD}),Saiku.toolbar=new Toolbar)},dataType:"script"}):d==b&&(void 0!=Settings.CSS&&Saiku.loadCSS(Settings.CSS,null),Saiku.session=new Session({},{username:Settings.USERNAME,password:Settings.PASSWORD}),Saiku.toolbar=new Toolbar)})}})}})}); var SaikuTimeLogger=function(a){this._element=$(a);this._timestamps=[];this._events=[]};SaikuTimeLogger.prototype.log=function(a){var b=(new Date).getTime();a||(a="Unknown");if(0 $(window).width()?$(window).width():600;$(a.modal.el).parents(".ui-dialog").css({width:c,left:"inherit",margin:"0",height:490}).offset({left:b})},check_saikuDayFormatString:function(){var a=this;this.$el.find(".selection-radio").each(function(b,c){_.find(a.dataLevels,function(b){a.name===b.name&&b.saikuDayFormatString&&$(c).prop("disabled",!1)})})},show_fields:function(a){a=a.type?$(a.currentTarget):$(a);var b=a.data("operator");if(void 0!==b)switch(b){case "equals":case "different":a.closest(".selection-options").find("#div-selection-date").show(); a.closest(".selection-options").find("#div-selected-date").show();a.closest(".selection-options").find("#div-select-start-date").hide();a.closest(".selection-options").find("#div-select-end-date").hide();a.closest(".selection-options").find("#add-date").show();this.clear_operators();break;case "after":case "after\x26equals":case "before":case "before\x26equals":a.closest(".selection-options").find("#div-selection-date").show();a.closest(".selection-options").find("#div-selected-date").hide();a.closest(".selection-options").find("#div-select-start-date").hide(); a.closest(".selection-options").find("#div-select-end-date").hide();a.closest(".selection-options").find("#add-date").hide();this.clear_operators();break;case "between":case "notbetween":a.closest(".selection-options").find("#div-selection-date").hide();a.closest(".selection-options").find("#div-selected-date").hide();a.closest(".selection-options").find("#div-select-start-date").show();a.closest(".selection-options").find("#div-select-end-date").show();a.closest(".selection-options").find("#add-date").hide(); this.clear_operators();break;default:a.closest(".selection-options").find("#div-selection-date").hide(),a.closest(".selection-options").find("#div-selected-date").hide(),a.closest(".selection-options").find("#div-select-start-date").hide(),a.closest(".selection-options").find("#div-select-end-date").hide(),a.closest(".selection-options").find("#add-date").hide(),this.clear_operators()}else this.$el.find(".selection-options").find("#div-selection-date").hide(),this.$el.find(".selection-options").find("#div-selected-date").hide(), this.$el.find(".selection-options").find("#div-select-start-date").hide(),this.$el.find(".selection-options").find("#div-select-end-date").hide(),this.$el.find(".selection-options").find("#add-date").hide(),this.clear_operators()},save_data_levels:function(){var a=this,b=[];_.each(this.data.hierarchies.levels,function(c,d,e){if(void 0!==e[d].annotations.AnalyzerDateFormat||void 0!==e[d].annotations.SaikuDayFormatString)void 0!==e[d].annotations.AnalyzerDateFormat?b.push({name:e[d].name,analyzerDateFormat:e[d].annotations.AnalyzerDateFormat.replace(/[.]/gi, "\\."),levelType:e[d].levelType,saikuDayFormatString:e[d].annotations.SaikuDayFormatString||""}):b.push({name:e[d].name,analyzerDateFormat:"",levelType:e[d].levelType,saikuDayFormatString:e[d].annotations.SaikuDayFormatString||""}),e[d].annotations.SaikuDayFormatString&&(a.saikuDayFormatString=e[d].annotations.SaikuDayFormatString)});return b},add_values_fixed_date:function(){var a=this;this.$el.find(".available-selections").each(function(b,c){"fixed-date"===$(c).attr("selection-name")&&($(c).find("input:radio").each(function(b, c){var f=$(c).data("leveltype");_.find(a.dataLevels,function(b,d){f===b.levelType?$(c).val(a.dataLevels[d].analyzerDateFormat):"yesterday"!==f&&"today"!==f||b.name!==a.name||_.isEmpty(a.dataLevels[d].analyzerDateFormat)||void 0===a.dataLevels[d].analyzerDateFormat||null===a.dataLevels[d].analyzerDateFormat||"TIME_DAYS"!==a.dataLevels[d].levelType||$(c).val(a.dataLevels[d].analyzerDateFormat)})}),$(c).find("input:radio").each(function(a,b){null!==$(b).val()&&void 0!==$(b).val()&&""!==$(b).val()&&"on"!== $(b).val()||$(b).addClass("keep-disabled")}))})},add_values_last_periods:function(){var a=this;this.$el.find(".available-selections").each(function(b,c){"rolling-date"===$(c).attr("selection-name")&&($(c).find("#period-select \x3e option").each(function(b,c){var f=$(c).attr("name");_.find(a.dataLevels,function(b,d){f===b.levelType&&$(c).val(a.dataLevels[d].analyzerDateFormat)})}),$(c).find("#period-select \x3e option").each(function(a,b){null!==$(b).attr("value")&&void 0!==$(b).attr("value")&&""!== $(b).attr("value")||$(b).addClass("keep-disabled")}))})},selection_date:function(a){a=$(a.currentTarget);var b=this.saikuDayFormatString.replace(/yyyy/gi,"yy");a.datepicker({dateFormat:b})},clear_selections:function(a){this.show_fields(a);this.$el.find('input[type\x3d"text"]').val("");this.$el.find("select").prop("selectedIndex",0);this.$el.find("#selected-date").empty();this.$el.find(".available-selections *").prop("checked",!1);this.selectedDates=[]},clear_operators:function(){this.$el.find('input[type\x3d"text"]').val(""); this.$el.find("#selected-date").empty();this.selectedDates=[]},disable_divselections:function(a){var b=Array.prototype.slice.call(arguments),c=a.type?$(a.currentTarget):$(a);b[1]||this.clear_selections(a);this.$el.find(".available-selections").attr("available",!1);this.$el.find(".available-selections *").prop("disabled",!0).off("click");c.closest(".box-selections").find(".available-selections").attr("available",!0);c.closest(".box-selections").find(".available-selections *:not(.keep-disabled)").prop("disabled", !1).on("click");a.type&&c.closest(".box-selections").find("select").each(function(a,b){$(b).find("option:not([disabled])").first().attr("selected","selected")})},day_format_string:function(){var a=this.saikuDayFormatString;return a=a.replace(/[a-zA-Z]/gi,"9")},add_selected_date:function(a){a.preventDefault();var b=$(a.currentTarget),c=this.day_format_string();a=this.$el.find("#selection-date");b=b.closest(".inline-form-group").find("#div-selected-date").find("#selected-date");""!==a.val()?(c=Saiku.toPattern(a.val(), c),a.css("border","1px solid #ccc"),b.append($("\x3cli\x3e\x3c/li\x3e").text(c).append('\x3ca href\x3d"#" class\x3d"del-date" data-date\x3d"'+c+'"\x3ex\x3c/a\x3e')),this.selectedDates.push(c)):a.css("border","1px solid red");a.val("")},del_selected_date:function(a){a.preventDefault();a=$(a.currentTarget);var b=a.data("date");this.selectedDates=_.without(this.selectedDates,b);a.parent().remove()},populate:function(){var a=this.get_date_filter(),b;if(a&&!_.isEmpty(a))if("operator"===a.type){var c=this.$el.find("#"+ a.checked),d=c.data("operator"),e=this;b=this.$el.find("#selection-radio-operator");b.prop("checked",!0);c.prop("checked",!0);this.disable_divselections(b,!0);this.show_fields(c);this.selectedDates=a.values;"after"===d||"after\x26equals"===d||"before"===d||"before\x26equals"===d?this.$el.find("#selection-date").val(this.selectedDates[0]):"between"===d?(e.$el.find("#start-date").val(this.selectedDates[0]),e.$el.find("#end-date").val(this.selectedDates[1])):"notbetween"===d?(e.$el.find("#start-date").val(this.selectedDates[0]), e.$el.find("#end-date").val(this.selectedDates[1])):_.each(this.selectedDates,function(a,b){e.$el.find("#selected-date").append($("\x3cli\x3e\x3c/li\x3e").text(a).append('\x3ca href\x3d"#" class\x3d"del-date" data-date\x3d"'+a+'"\x3ex\x3c/a\x3e'))})}else"fixed-date"===a.type?(b=this.$el.find("#selection-radio-fixed-date"),b.prop("checked",!0),this.$el.find("#"+a.checked).prop("checked",!0)):(b=this.$el.find("#selection-radio-available"),b.prop("checked",!0),this.$el.find("#date-input").val(a.periodAmount), this.$el.find('select#period-select option[id\x3d"'+a.periodSelect+'"]').prop("selected",!0)),this.disable_divselections(b,!0)},populate_mdx:function(a,b,c){a.tagdim=a.dimension.replace(/m/g,"\\m").replace(/y/g,"\\y").replace(/q/g,"\\q").replace(/d/g,"\\d");a.taghier=a.hierarchy.replace(/m/g,"\\m").replace(/y/g,"\\y").replace(/q/g,"\\q").replace(/d/g,"\\d");a.workinglevel!==a.level&&void 0!==a.workinglevel?(a.parent="[{dimension}.{hierarchy}].[{level}].members,",a.parent=a.parent.replace(/{(\w+)}/g, function(b,c){return a[c]})):a.parent="";this.template_mdx=this.template_mdx.replace(/{(\w+)}/g,function(b,c){return a[c]});if("dayperiods"===b){a.parent="[{dimension}.{hierarchy}].[{level}]";a.parent=a.parent.replace(/{(\w+)}/g,function(b,c){return a[c]});if(1>2&63;c=(c&3)<<4|f>>4&15;h=(f&15)<<2|l>>6&3;k=l&63;f?l||(k=64):h=k=64;q+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(c)+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(k)}return q}})})(this); Backbone.sync=function(a,b,c){methodMap={create:"POST",read:"GET",update:"PUT","delete":"DELETE"};var d=methodMap[a],e=Settings.REST_URL+(_.isFunction(b.url)?b.url():b.url);"undefined"==typeof Settings.ERRORS&&(Settings.ERRORS=0);var f=function(){Settings.ERRORS++;Settings.ERRORS