Help me fill the missing pieces of code



  • Could anybody help me in writing some code whose comments are in Capital letters in the code below?

    Also pl. confirm whether I am in the right direction?

    //Client-side JavaScript
    if (window.location.href.endsWith('map?section=A')) {
    
    	if (!ajaxify.data.loggedIn) {	//If the user is not logged in, raise the error
    		console.log(not_logged_in);
                    //DISPLAY THE ERROR IN LEFT BOTTOM (AS NODEBB DISPLAYS IT)
                    //REDIRECT THE USER TO LOGIN SCREEN
                   //AFTER LOGIN IS SUCCESSFUL, HE IS REDIRECTED BACK TO THE /map ROUTE
    	}
    	else {		//user is logged in
    		console.log("Logged in");
    		var location;
    
    	      //CHECK WHETHER THE USER LOCATION IS STORED IN THE DB
    	     if (true) {			//Fetch the location from the db and display that on the map
    		userLocation = [Lat, Lng];				//LAT AND LNG FETCHED FROM THE USER DB
    		map = new L.map('mapid').setView(userLocation, 10);
    		location = userLocation;
    	   }
    ...
    }				//End of map?section=A
    

    I will be really grateful if anybody can help me out including writing the controller for these two features and storing the coordinates in the db. Today I spent the entire day but was not successful.

    Thanking you in anticipation



  • I am able to solve the first issue. I needed to add checks in map.tpl instead of relying upon pure client-side JS solution.


 

Suggested Topics

| |