@@ -38,95 +38,92 @@ var libs = [
3838]
3939
4040define ( libs , function ( $ , io , i18next , init , utils ) {
41- $ ( function ( ) {
4241
43- var
44- infoText = {
45- version : 'v3.0.0-beta.8' ,
46- copyright : 'Copyright \u00A9 2015 - 2017 CBS, Statistics Netherlands'
47- } ;
42+ var infoText = {
43+ version : 'v3.0.0-rc.2' ,
44+ copyright : 'Copyright \u00A9 2015 - 2018 CBS, Statistics Netherlands'
45+ } ;
4846
49- /**
50- * Initializes the application
51- * @param {Object } socket The websocket used to show the progress of the operation to the user
52- * @return {void }
53- */
54- function initApp ( socket ) {
55- var files = [ "i18n/grid.locale-" + i18next . lng ( ) ] ,
56- strProcess = i18next . t ( "Main.Process" ) ,
57- strGet = i18next . t ( "Main.Get" ) ;
47+ /**
48+ * Initializes the application
49+ * @param {Object } socket The websocket used to show the progress of the operation to the user
50+ * @return {void }
51+ */
52+ function initApp ( socket ) {
53+ var files = [ "i18n/grid.locale-" + i18next . lng ( ) ] ,
54+ strProcess = i18next . t ( "Main.Process" ) ,
55+ strGet = i18next . t ( "Main.Get" ) ;
5856
59- if ( utils . getConfig ( ) . Locale != "en" ) {
60- files . push ( "globalize.culture." + utils . getConfig ( ) . Language ) ;
61- }
62-
63- socket . on ( 'source' , function ( data ) {
64- if ( ! utils . dialogProgress . dialog ( "isOpen" ) ) {
65- utils . dialogProgress . dialog ( "open" ) ;
66- }
67- utils . dialogProgress . children ( '#processSource' ) . text ( strGet + data . source + ' - ' + data . message ) ;
68- utils . dialogProgress . children ( '#processBar' ) . progressbar ( { value : data . index } ) ;
69- } ) ;
57+ if ( utils . getConfig ( ) . Locale != "en" ) {
58+ files . push ( "globalize.culture." + utils . getConfig ( ) . Language ) ;
59+ }
7060
71- socket . on ( 'processPG ' , function ( data ) {
72- utils . dialogProgress . dialog ( "option" , "title" , strProcess ) ;
61+ socket . on ( 'source ' , function ( data ) {
62+ if ( ! utils . dialogProgress . dialog ( "isOpen" ) ) {
7363 utils . dialogProgress . dialog ( "open" ) ;
74- utils . dialogProgress . children ( '#processBar' ) . progressbar ( { max : data . totalSources } ) ;
75- } ) ;
64+ }
65+ utils . dialogProgress . children ( '#processSource' ) . text ( strGet + data . source + ' - ' + data . message ) ;
66+ utils . dialogProgress . children ( '#processBar' ) . progressbar ( { value : data . index } ) ;
67+ } ) ;
7668
77- socket . on ( 'processPath' , function ( data ) {
78- utils . dialogProgress . children ( '#stepBar' ) . progressbar ( { max : data . totalSteps , value : data . index } ) ;
79- } ) ;
69+ socket . on ( 'processPG' , function ( data ) {
70+ utils . dialogProgress . dialog ( { title : strProcess } ) ;
71+ utils . dialogProgress . dialog ( "open" ) ;
72+ utils . dialogProgress . children ( '#processBar' ) . progressbar ( { max : data . totalSources } ) ;
73+ } ) ;
8074
81- socket . on ( 'step ' , function ( data ) {
82- utils . dialogProgress . children ( '#stepBar' ) . progressbar ( { value : data . index } ) ;
83- } ) ;
75+ socket . on ( 'processPath ' , function ( data ) {
76+ utils . dialogProgress . children ( '#stepBar' ) . progressbar ( { max : data . totalSteps , value : data . index } ) ;
77+ } ) ;
8478
85- require ( files , function ( ) {
86- Globalize . culture ( utils . getConfig ( ) . Locale ) ;
87- $ . getJSON ( '/data.html' , {
88- action : 'getProductgroup' ,
89- element : "sidebar"
90- } , function ( data ) {
91- init . initWindow ( data , infoText ) ;
92- } ) ;
79+ socket . on ( 'step' , function ( data ) {
80+ utils . dialogProgress . children ( '#stepBar' ) . progressbar ( { value : data . index } ) ;
81+ } ) ;
82+
83+ require ( files , function ( ) {
84+ Globalize . culture ( utils . getConfig ( ) . Locale ) ;
85+ $ . getJSON ( '/data.html' , {
86+ action : 'getProductgroup' ,
87+ element : "sidebar"
88+ } , function ( data ) {
89+ init . initWindow ( data , infoText ) ;
9390 } ) ;
94- }
91+ } ) ;
92+ }
9593
96- $ ( document ) . ready ( function ( ) {
97- var socket = io ( ) ;
94+ $ ( document ) . ready ( function ( ) {
95+ var socket = io ( ) ;
9896
99- utils . dialogProgress = $ ( 'div#dialogProgress' )
100- . dialog ( {
101- autoOpen : false ,
102- modal : true ,
103- dialogClass : 'no-close' ,
104- closeOnEscape : false ,
105- width : 400
106- } ) ;
97+ utils . dialogProgress = $ ( 'div#dialogProgress' )
98+ . dialog ( {
99+ autoOpen : false ,
100+ modal : true ,
101+ dialogClass : 'no-close' ,
102+ closeOnEscape : false ,
103+ width : 400
104+ } ) ;
107105
108- $ ( document ) . ajaxError ( function ( event , xhr ) {
109- var data ;
110- try {
111- data = JSON . parse ( xhr . responseText ) ;
112- if ( $ . inArray ( data . action , [ "updateSource" , "updateSourcePath" , "updateProductgroup" ] ) == - 1 ) {
113- alert ( data . message ) ;
114- }
115- } catch ( e ) {
106+ $ ( document ) . ajaxError ( function ( event , xhr ) {
107+ var data ;
108+ try {
109+ data = JSON . parse ( xhr . responseText ) ;
110+ if ( $ . inArray ( data . action , [ "updateSource" , "updateSourcePath" , "updateProductgroup" ] ) == - 1 ) {
111+ alert ( data . message ) ;
116112 }
117- $ ( "#spinner" ) . hide ( ) ;
118- } ) ;
113+ } catch ( e ) { }
114+ $ ( "#spinner" ) . hide ( ) ;
115+ } ) ;
119116
120- $ . getJSON ( '/config/config.json' , function ( cfg ) {
121- utils . setConfig ( cfg ) ;
122- i18next . init ( {
123- lng : cfg . Language ,
124- fallbackLng : "en" ,
125- resGetPath : '/locales/__ns__-__lng__.json'
126- } , function ( err , t ) {
127- initApp ( socket ) ;
128- } ) ;
117+ $ . get ( '/data.html?action=getConfig' , function ( cfg ) {
118+ utils . setConfig ( JSON . parse ( cfg ) ) ;
119+ i18next . init ( {
120+ lng : cfg . Language ,
121+ fallbackLng : "en" ,
122+ resGetPath : '/locales/__ns__-__lng__.json'
123+ } , function ( err , t ) {
124+ initApp ( socket ) ;
129125 } ) ;
130126 } ) ;
131127 } ) ;
128+
132129} ) ;
0 commit comments