text: define(["require","underscore","bundle!all","dataSource/fileDataSource/SimpleDomainView","dataSource/saveDialog/BaseSaveDialogView","text!dataSource/saveDialog/template/textDataSourceSaveDialogTemplate.htm"],function(e){var t=e("underscore"),a=e("bundle!all"),o=e("dataSource/fileDataSource/SimpleDomainView"),i=e("dataSource/saveDialog/BaseSaveDialogView"),r=e("text!dataSource/saveDialog/template/textDataSourceSaveDialogTemplate.htm");return i.extend({saveDialogTemplate:r,constructor:function(e){e||(e={}),this.options=t.extend({},e),this.options.isEmbedded=!!this.options.saveFn,i.prototype.constructor.call(this,e)},initialize:function(){this.preSelectedFolder=this.options.model.options.parentFolderUri,i.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:prepareDataForReporting",this._onPrepareDataForReportingChange)},extendModel:function(e){var t=i.prototype.extendModel.call(this,e);return t.set("prepareDataForReporting",!(this.options.isEmbedded||this.options.isEditMode)),t},_onPrepareDataForReportingChange:function(){var e=this._getLabelForSaveButton();this.changeButtonLabel("save",a[e])},_getLabelForSaveButton:function(e){e=e||this.model;var t="resource.datasource.saveDialog.save";return"textDataSource"===e.get("dataSourceName")&&e.get("prepareDataForReporting")&&(t="resource.datasource.saveDialog.saveAndCreateDomain"),t},_saveSuccessCallback:function(){if(this.model.get("prepareDataForReporting")){var e=new o({cancel:this.options.success,dataSource:this.model.toJSON()});e.startDialog()}else t.isFunction(this.options.success)&&this.options.success();this._closeDialog()}})});