Subversion Repositories DevTools

Rev

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

Rev 6695 Rev 6697
Line 24... Line 24...
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,
28
        timeout : null,
29
        dlg : null
29
        dlg : null,
-
 
30
        deferred : null,
30
     };
31
     };
31
     $.extend( defaults, parms);
32
     $.extend( defaults, parms);
32
 
33
 
33
     defaults.open = function() {
34
     defaults.open = function() {
34
        $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); 
35
        $(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus(); 
Line 47... Line 48...
47
 
48
 
48
    defaults.close = function() {
49
    defaults.close = function() {
49
        $(this).remove();
50
        $(this).remove();
50
    };
51
    };
51
 
52
 
-
 
53
    if(typeof(defaults.deferred) == typeof(true)){
-
 
54
        if ( defaults.deferred ) {
-
 
55
            defaults.deferred = new $.Deferred();
-
 
56
        }
-
 
57
    }
-
 
58
    
52
    defaults.buttons = [];
59
    defaults.buttons = [];
53
    if ( defaults.button != null ) {
60
    if ( defaults.button != null ) {
54
        defaults.buttons.push({
61
        defaults.buttons.push({
55
            text : defaults.button,
62
            text : defaults.button,
56
            click : function (){
63
            click : function (){
Line 64... Line 71...
64
                        window.location.href = defaults.url;
71
                        window.location.href = defaults.url;
65
                    }
72
                    }
66
                    if (defaults.post != null ) {
73
                    if (defaults.post != null ) {
67
                        $('form[name="'+defaults.post+'"]').submit();    
74
                        $('form[name="'+defaults.post+'"]').submit();    
68
                    }
75
                    }
-
 
76
                    if ( defaults.deferred != null ) {
-
 
77
                        defaults.deferred.resolve();
-
 
78
                    }
69
                    $(this).dialog("close");
79
                    $(this).dialog("close");
70
                }
80
                }
71
        });
81
        });
72
    }
82
    }
73
 
83
 
74
    if(typeof(defaults.cancel) == 'boolean' && defaults.cancel) {
84
    if(typeof(defaults.cancel) == 'boolean' && defaults.cancel) {
75
        defaults.buttons.push({
85
        defaults.buttons.push({
76
            text : 'Cancel',
86
            text : 'Cancel',
77
            click : function (){
87
            click : function (){
78
                $(this).dialog("close");
88
                $(this).dialog("close");
-
 
89
                if ( defaults.deferred != null) {
-
 
90
                        defaults.deferred.reject();
-
 
91
                    }
79
                }
92
                }
80
        });
93
        });
81
    }
94
    }
82
 
95
 
83
     var dd = $( "<div>Confirm</div>" ).dialog(defaults);
96
     var dd = $( "<div>Confirm</div>" ).dialog(defaults);
Line 92... Line 105...
92
     else
105
     else
93
     {
106
     {
94
         dd.dialog("widget").position(defaults.position);
107
         dd.dialog("widget").position(defaults.position);
95
         //console.log("Original position");
108
         //console.log("Original position");
96
     }
109
     }
-
 
110
 
-
 
111
     // If using deferred objects
-
 
112
     if ( defaults.deferred ) {
-
 
113
         return defaults.deferred.promise();
-
 
114
     }
97
     
115
     
98
     // Return false incase this is used as an onClick
116
     // Return false incase this is used as an onClick
99
     return false;
117
     return false;
100
}
118
}
101
 
119