/**
 * Created with JetBrains WebStorm.
 * User: Cmma
 * Date: 7/29/14
 * Time: 2:12 PM
 * To change this template use File | Settings | File Templates.
 */

define(function (require, exports) {

    function UploadFinishDlg() {

        this.showDialog = function (callback) {
            var _self = this;

            if ($('#modal-content')) {
                $('#modal-content').remove();
            }

            var dlg = $('<div id="modal-content" class="modal fade" tabindex="-1" role="dialog">' +
                '<div class="modal-dialog" style="width: 250px;">' +
                '<div class="modal-content">' +
                '<div class="test_temp_tit">' +
                '<a href="javascript:;" class="test_temp_close" data-dismiss="modal" title="关闭">X</a>' +
                '上传' +
                '</div>' +
                '<div>' +
                '<div id="uploadFinishFrame" width="250px" height="150px">' +
                '<div class="test_temp test_temp_upload">' +
                '<div class="test_temp_upload_cont">' +
                '<p class="upload_text_sal"><img src="./images/upload_sal.png" alt="">上传成功</p>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>');

            $('body').append(dlg);
            var clientHeight = document.body.clientHeight;
            dlg.find(".modal-content").css("margin-top", (clientHeight - 250) / 2);

            dlg.find(".test_temp_close").bind('click', function () {
                dlg.modal('hide');
                setTimeout(function () {
                    dlg.remove();
                    $("body").find(".modal-backdrop.fade.in").remove();
                }, 500);
            });

            _self.dlg = dlg;
            dlg.modal({show: true});
        };

    };

    exports.UploadFinishDlg = UploadFinishDlg;

})