Subversion Repositories DevTools

Rev

Rev 6427 | Rev 6589 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6427 Rev 6577
Line 22... Line 22...
22
        url : null,
22
        url : null,
23
        ok : null,
23
        ok : null,
24
        post : null,
24
        post : null,
25
        button : "Confirm",
25
        button : "Confirm",
26
        progress : "#ProgressBar",
26
        progress : "#ProgressBar",
27
        cancel : true
27
        cancel : true,
-
 
28
        timeout : null,
-
 
29
        dlg : null
28
     };
30
     };
29
     $.extend( defaults, parms);
31
     $.extend( defaults, parms);
30
 
32
 
31
     defaults.open = function() {
33
     defaults.open = function() {
32
        $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); 
34
        $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); 
-
 
35
        var markup = "";
-
 
36
        if (defaults.icon != null ) {
33
        var markup = '<img src="'+defaults.icon+'" style="float:left; margin:0 7px 20px 0;">' + text;
37
            markup += '<img src="'+ defaults.icon+ '" style="float:left; margin:0 7px 20px 0;">';
-
 
38
            }
-
 
39
        markup += text;
34
        $(this).html(markup);
40
        $(this).html(markup);
-
 
41
         if ( defaults.timeout != null ) {
-
 
42
             setTimeout(function(){
-
 
43
                 defaults.dlg.dialog("close");
-
 
44
                }, defaults.timeout);
-
 
45
         }
35
     };
46
     };
36
 
47
 
37
    defaults.close = function() {
48
    defaults.close = function() {
38
        $(this).remove();
49
        $(this).remove();
39
    };
50
    };
40
 
51
 
41
    defaults.buttons = [
52
    defaults.buttons = [];
-
 
53
    if ( defaults.button != null ) {
42
        {
54
        defaults.buttons.push({
43
        text : defaults.button,
55
            text : defaults.button,
44
        click : function (){
56
            click : function (){
45
                if (defaults.ok != null ){
57
                    if (defaults.ok != null ){
46
                    defaults.ok(defaults);
58
                        defaults.ok(defaults);
47
                }
59
                    }
48
                if ( defaults.progress != null) {
60
                    if ( defaults.progress != null) {
49
                    $(defaults.progress).show().css("visibility", "visible");    
61
                        $(defaults.progress).show().css("visibility", "visible");    
50
                }
62
                    }
51
                if (defaults.url != null ) {
63
                    if (defaults.url != null ) {
52
                    window.location.href = defaults.url;
64
                        window.location.href = defaults.url;
53
                }
65
                    }
54
                if (defaults.post != null ) {
66
                    if (defaults.post != null ) {
55
                    $('form[name="'+defaults.post+'"]').submit();    
67
                        $('form[name="'+defaults.post+'"]').submit();    
-
 
68
                    }
-
 
69
                    $(this).dialog("close");
56
                }
70
                }
57
                $(this).dialog("close");
-
 
58
            }
71
        });
59
        }];
72
    }
60
 
73
 
61
		if(typeof(defaults.cancel) == 'boolean' && defaults.cancel)
74
    if(typeof(defaults.cancel) == 'boolean' && defaults.cancel) {
62
		{
-
 
63
				defaults.buttons.push({
75
        defaults.buttons.push({
64
					text : 'Cancel',
76
            text : 'Cancel',
65
					click : function (){
77
            click : function (){
66
						$(this).dialog("close");
78
                $(this).dialog("close");
67
						}
79
                }
68
				});
80
        });
69
		}
81
    }
70
 
82
 
71
     var dd = $( "<div>Confirm</div>" ).dialog(defaults);
83
     var dd = $( "<div>Confirm</div>" ).dialog(defaults);
-
 
84
     defaults.dlg = dd;
72
     // Once the dialog has been instantiated the autosize dimensions are known
85
     // Once the dialog has been instantiated the autosize dimensions are known
73
     // and the dialog can be correctly positioned
86
     // and the dialog can be correctly positioned
74
     if (defaults.position == 'center')
87
     if (defaults.position == 'center')
75
     {
88
     {
76
         dd.dialog("widget").center();
89
         dd.dialog("widget").center();