dojo.provide("parus.excelFileFormatDialog");

dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.Select");
dojo.require("dijit.form.CheckBox");

dojo.require("parus.parus8");
dojo.require("parus.dialog");

dojo.declare("parus.excelFileFormatDialog", [parus.Dialog], {

  _lastValues: null,

  allowSave: false,
  allowTypeSelect: false,

  onShow: function() {
    this._lastValues = parus.userdata.get(this.declaredClass) || {};
    this.userSize = this._lastValues["userSize"] || null;
    this.formatEdit.attr("value", this._lastValues["formatEdit"]);
    this.otherSheetsCheckBox.attr("checked", this._lastValues["otherSheetsCheckBox"]);

    if (this.allowSave && parus.parus8.optionValue("BalanceOnlineSaveReportUserProcedure") === null) {
      this.allowSave = false;
    }

    if (parus.database.attributes.newoffice == "1") this.showFileFormatRow.style.display = "";

    if (this.allowSave) {
      this.showSaveCheckBoxRow.style.display = "";
      this.saveCheckBox.attr("checked", this._lastValues["saveCheckBox"]);
    }

    if (this.allowTypeSelect) {
      this.typeEditRow.style.display = "";
      this.typeEdit.attr("value", this._lastValues["typeEdit"]);
    }

    //    if (!parus.database.attributes.newoffice && !this.allowSave) this.apply();
  },

  onClose: function() {
    this._lastValues["formatEdit"] = this.formatEdit.attr("value");
    this._lastValues["saveCheckBox"] = this.saveCheckBox.attr("checked");
    this._lastValues["otherSheetsCheckBox"] = this.otherSheetsCheckBox.attr("checked");
    this._lastValues["typeEdit"] = this.typeEdit.attr("value");
    this._lastValues["userSize"] = this.userSize;

    parus.userdata.set(this.declaredClass, this._lastValues);
  }

});