<commit_before>//some Users Module
    var facebook = require('./facebookComunication.js'),
         setTime = require('./setTime.js'),
        mongo = require('./mongoFunctions.js');


var time = new setTime();
function redirect(req,callback){
    //console.log('redirect');
     //var reqCookie=req.cookies.cookieName; //cookie
       // console.log('this user dialog');
        //console
        facebook.createPersonToken(req.query['code'],function(token){
            facebook.getInfoAboutToken(token,function(returnData){
                var id=returnData['data'].user_id; //id
                //cookie.addNewSession(id,reqCookie);
                console.log('id: '+id);
                console.log('token: '+token);
                //if()
                //mongo.findById(id,)
                facebook.savePerson(id,token,function(){
                    
                    facebook.addName(id,token,function(){
                        
                        
                    })
                    //in the future will get name
                    setImmediate(function() {
                        callback(id);
                    });
                });
                /*
                facebook.checkIfLongTokenExist(id,function(comunicat){
                    if(comunicat != 'ok'){
                        facebook.tokenToLongLife(token,function(x){
                            console.log('some long');
                            console.log(x);
                        
                            mongo.modifyById(id,'person',{longToken:x},function(){})    
                            
                        });
                        
                        mongo.findById(id,'person',function(z){
                            console.log(z);
                        })
                    }
                    
                });
                */
                //data['user_id']=returnData['data'].user_id;
                //facebook.saveIdAndAccesToken 
            }); 
        });  
}
var pageSettings = {
    fields:{
        cancelled:'typ',
        note:'komentarz',
        periods:'lekcja',
        subjects:'przedmiot',
        teachers:'nauczyciel',
        classes:'klasa',
        classrooms:'sala',
        groupnames:'grupa',
        changes:'zmiany',
        //brak:'brak',
        substitution_types:'rodzaj'
    },
    event:{
        changeDisplayEvents :{
            'home':['navbar_home','homePage'],
            'substitution':['navbar_substitution','substitutionList'],
            'settings':['navbar_settings','settingsMenu']
        }
    },
    events:['homePage','substitutionList','settingsMenu'],
    formValues:['1b','yes']
    
}
    
    //var reqCookie=req.cookies.cookieName;
    //var userId=cookie.findIfSessionExist(reqCookie);
function postCall(userId,body,callback){

    var res='';
    //console.log('Mode: '+req.body['mode']);
    //var body=req.body;
    
        if(body.mode=='getSettings'){
            //console.log(id);
            mongo.findById(userId,'person',function(err,doc){
                if (err){console.log('prolem with settings: ',userId)};
                console.log('Settings file: ',doc);
                var params = (doc['settings']);
                if(params == ''){params={setClass:'all',notification:'no'}}
                var table=[];
                table[0]=params.setClass;
                table[1]=params.notification;
                pageSettings['formValues']=table;
                res = JSON.stringify(pageSettings); 
                setImmediate(function() {
                    callback(res);
                });
                //console.log('response Settings',res);
            })        
        }<commit_msg>new settings about for send<commit_after>//some Users Module
    var facebook = require('./facebookComunication.js'),
         setTime = require('./setTime.js'),
        mongo = require('./mongoFunctions.js');


var time = new setTime();
function redirect(req,callback){
    //console.log('redirect');
     //var reqCookie=req.cookies.cookieName; //cookie
       // console.log('this user dialog');
        //console
        facebook.createPersonToken(req.query['code'],function(token){
            facebook.getInfoAboutToken(token,function(returnData){
                var id=returnData['data'].user_id; //id
                //cookie.addNewSession(id,reqCookie);
                console.log('id: '+id);
                console.log('token: '+token);
                //if()
                //mongo.findById(id,)
                facebook.savePerson(id,token,function(){
                    
                    facebook.addName(id,token,function(){
                        
                        
                    })
                    //in the future will get name
                    setImmediate(function() {
                        callback(id);
                    });
                });
                /*
                facebook.checkIfLongTokenExist(id,function(comunicat){
                    if(comunicat != 'ok'){
                        facebook.tokenToLongLife(token,function(x){
                            console.log('some long');
                            console.log(x);
                        
                            mongo.modifyById(id,'person',{longToken:x},function(){})    
                            
                        });
                        
                        mongo.findById(id,'person',function(z){
                            console.log(z);
                        })
                    }
                    
                });
                */
                //data['user_id']=returnData['data'].user_id;
                //facebook.saveIdAndAccesToken 
            }); 
        });  
}
var pageSettings = {
    fields:{
        cancelled:'typ',
        note:'komentarz',
        periods:'lekcja',
        subjects:'przedmiot',
        teachers:'nauczyciel',
        classes:'klasa',
        classrooms:'sala',
        groupnames:'grupa',
        changes:'zmiany',
        //brak:'brak',
        substitution_types:'rodzaj'
    },
    event:{
        changeDisplayEvents :{
            'home':[['navbar_home','navbar_homeD'],'homePage'],
            'substitution':[['navbar_substitution','navbar_substitutionD'],'substitutionList'],
            'about':[['navbar_photo','navbar_photoD'],'about1'],
            'settings':[['navbar_settings','navbar_settingsD'],'settingsMenu']
            
        }
    },
    events:['homePage','substitutionList','settingsMenu','about1'],
    formValues:['all','no']
    
}
    
    //var reqCookie=req.cookies.cookieName;
    //var userId=cookie.findIfSessionExist(reqCookie);
function postCall(userId,body,callback){

    var res='';
    //console.log('Mode: '+req.body['mode']);
    //var body=req.body;
    
        if(body.mode=='getSettings'){
            //console.log(id);
            mongo.findById(userId,'person',function(err,doc){
                if (err){console.log('prolem with settings: ',userId)};
                console.log('Settings file: ',doc);
                var params = (doc['settings']);
                if(params == ''){params={setClass:'all',notification:'no'}}
                var table=[];
                table[0]=params.setClass;
                table[1]=params.notification;
                pageSettings['formValues']=table;
                res = JSON.stringify(pageSettings); 
                setImmediate(function() {
                    callback(res);
                });
                //console.log('response Settings',res);
            })        
        }
{'fraction_non_alphanumeric': 0.14038763750654792, 'fraction_numerical': 0.0009167103195390257, 'mean_word_length': 1.4023277760301982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5797693', 'n_tokens_mistral': 2025, 'n_tokens_neox': 1905, 'n_words': 241}