export.js
/**
 * Prompt user and password, then make a queue of exports to process
 */
Prompt user and password, then make a queue of exports to process
Prompt user and password then make a queue of exports to process
function run() {
	readConfig();
	var dhis2Instances = {};
	for (var i = 0; i < conf.export.length; i++) {
		for (var j = 0; j < conf.export[i]._url.length; j++) {
			if (!dhis2Instances[conf.export[i]._url[j]]) {
				dhis2Instances[conf.export[i]._url[j]] = [conf.export[i]];
			}
			else {
				dhis2Instances[conf.export[i]._url[j]].push(conf.export[i]);
			}
		}
	}
	for (var instance in dhis2Instances) {
		for (var i = 0; i < dhis2Instances[instance].length; i++) {
			var exp = JSON.parse(JSON.stringify(dhis2Instances[instance][i]));
			exp.url = instance;
			exportQueue.push(exp);
		}
	}
	nextExport();
}
function run ( ) { readConfig ( ) ; var dhis2Instances = { } ; for ( var i = 0 ; i < conf . export . length ; i ++ ) { for ( var j = 0 ; j < conf . export [ i ] . _url . length ; j ++ ) { if ( ! dhis2Instances [ conf . export [ i ] . _url [ j ] ] ) { dhis2Instances [ conf . export [ i ] . _url [ j ] ] = [ conf . export [ i ] ] ; } else { dhis2Instances [ conf . export [ i ] . _url [ j ] ] . push ( conf . export [ i ] ) ; } } } for ( var instance in dhis2Instances ) { for ( var i = 0 ; i < dhis2Instances [ instance ] . length ; i ++ ) { var exp = JSON . parse ( JSON . stringify ( dhis2Instances [ instance ] [ i ] ) ) ; exp . url = instance ; exportQueue . push ( exp ) ; } } nextExport ( ) ; }
Prompt user and password, then make a queue of exports to process
Prompt user and password then make a queue of exports to process
//Read configuration file. Will exit if not found or if not in correct format //Iterate over complete export file, and sort exports per server (to avoid asking for user/pwd multiple times) //Copy export specification, then specify the URL