1- if ( ! javaxt ) var javaxt = { } ;
2- if ( ! javaxt . express ) javaxt . express = { } ;
3- javaxt . express . Confirm = null ;
41
52 //**************************************************************************
63 //** confirm
@@ -9,83 +6,6 @@ javaxt.express.Confirm = null;
96 * javaxt.express.Confirm window.
107 */
118 var confirm = function ( msg , config ) {
12-
13- if ( ! ( typeof ( msg ) === 'string' || msg instanceof String ) ) {
14- config = msg ;
15- }
16-
17-
18- javaxt . dhtml . utils . merge ( config , {
19- title : "Confirm" ,
20- text : msg
21- } ) ;
22-
23-
24- var win = javaxt . express . Confirm ;
25- if ( ! win ) {
26- var body = document . getElementsByTagName ( "body" ) [ 0 ] ;
27-
28- var buttonDiv = document . createElement ( "div" ) ;
29- buttonDiv . className = "button-div" ;
30-
31- var createButton = function ( label , result ) {
32- var input = document . createElement ( "input" ) ;
33- input . type = "button" ;
34- input . className = "form-button" ;
35- input . onclick = function ( ) {
36- win . result = this . result ;
37- win . close ( ) ;
38- } ;
39- input . setLabel = function ( label ) {
40- if ( label ) this . name = this . value = label ;
41- } ;
42- input . setValue = function ( b ) {
43- if ( b === true || b === false ) this . result = b ;
44- } ;
45- input . update = function ( config ) {
46- if ( config ) {
47- this . setLabel ( config . label ) ;
48- this . setValue ( config . value ) ;
49- }
50- } ;
51- input . setLabel ( label ) ;
52- input . setValue ( result ) ;
53- buttonDiv . appendChild ( input ) ;
54- return input ;
55- } ;
56-
57-
58- win = javaxt . express . Confirm = new javaxt . dhtml . Window ( body , {
59- width : 450 ,
60- height : 150 ,
61- valign : "top" ,
62- modal : true ,
63- footer : buttonDiv ,
64- style : {
65- panel : "window" ,
66- header : "window-header" ,
67- title : "window-title" ,
68- buttonBar : "window-header-button-bar" ,
69- button : "window-header-button" ,
70- body : "window-body confirm-body"
71- }
72- } ) ;
73-
74-
75- win . leftButton = createButton ( "OK" , true ) ;
76- win . rightButton = createButton ( "Cancel" , false ) ;
77- }
78-
79-
80- win . setTitle ( config . title ) ;
81- win . setContent ( config . text . replace ( "\n" , "<p></p>" ) ) ;
82- win . leftButton . update ( config . leftButton ) ;
83- win . rightButton . update ( config . rightButton ) ;
84- win . result = false ;
85- win . onClose = function ( ) {
86- var callback = config . callback ;
87- if ( callback ) callback . apply ( win , [ win . result ] ) ;
88- } ;
89- win . show ( ) ;
9+ javaxt . dhtml . utils . confirm ( msg , config ) ;
9010 return false ;
9111 } ;
0 commit comments