// ================================Dialog===================================// Dialog = {}; $.fm.DialogClass = Control.subClass({ template: [ '
', ' ' ], init: function(options) { options = options ? options : {}; Control.call(this, options); this.createEl(); }, createEl: function() { var me = this; var el = this.el = $(this.template.join("")); this.title = $("#title", el); this.body = $("#dialog_body", el); this.body_title = $("#body_title", el); this.dialog_content = $("#dialog_content", el); this.dialog_footer = $("#dialog_footer", el); this.image = $("#image", el); this.text = $("#text", el); this.btn_cancel = $("#btn_cancel", el); this.btn_ok = $("#btn_ok", el); this.btn_cancel.click(function() { me.el.hide(); if (me.callback) { me.callback(false); } }); this.btn_ok.click(function() { me.el.hide(); if (me.callback) { me.callback(true); } }); this.canvas.append(this.el); }, databox: function(title, callback, config) { var input = config.input || ""; var body_title = config.body_title || ""; if (config.onShow) { onShow(); } this.title.html(title); this.body.removeAttr("class"); this.dialog_content.removeAttr("class"); this.image.removeAttr("class"); this.text.removeAttr("class"); this.dialog_footer.removeAttr("class"); this.body.addClass("databox_body"); this.dialog_content.addClass("databox_content"); this.image.addClass("databox_image"); this.text.addClass("databox_text"); this.dialog_footer.addClass("databox_footer"); this.body_title.html(body_title); this.text.html(input); this.btn_cancel.show(); this.callback = callback; this.el.show(); }, confirm: function (title, text, callback) { this.title.html(title); this.text.html(text); this.image.removeClass("icon_alert"); this.image.addClass("icon_confirm"); this.btn_cancel.show(); this.callback = callback; this.el.show(); }, alert: function (title, text1, text2, callback) { this.title.html(title); if (text2) { this.text.html(text1 + "