mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Ready to prepare user page implementation
This commit is contained in:
		@@ -643,6 +643,25 @@ var ComunicWeb = {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/**
 | 
				
			||||||
 | 
							 * User page
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							userPage: {
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								/**
 | 
				
			||||||
 | 
								 * Main user page
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								main: {
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									/**
 | 
				
			||||||
 | 
									 * Open user page
 | 
				
			||||||
 | 
									 */
 | 
				
			||||||
 | 
									open: function(params, target){},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/**
 | 
							/**
 | 
				
			||||||
		 * Login controller
 | 
							 * Login controller
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,7 +123,18 @@ ComunicWeb.common.page = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //Check if there is also subfolders
 | 
					        //Check if there is also subfolders
 | 
				
			||||||
        if(firstPartURI.indexOf("/") != -1){
 | 
					        if(firstPartURI.indexOf("/") != -1){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //Save the list of subfolders
 | 
				
			||||||
 | 
					            var subfoldersURIarray = firstPartURI.split("/");
 | 
				
			||||||
 | 
					            subfoldersURIarray.shift();
 | 
				
			||||||
 | 
					            subfoldersURI = subfoldersURIarray.join("/");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //Remove them to find the right page
 | 
				
			||||||
            firstPartURI = firstPartURI.split("/")[0];
 | 
					            firstPartURI = firstPartURI.split("/")[0];
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            //No subfolder was specified
 | 
				
			||||||
 | 
					            subfoldersURI = false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Check if specied page exists
 | 
					        //Check if specied page exists
 | 
				
			||||||
@@ -202,6 +213,11 @@ ComunicWeb.common.page = {
 | 
				
			|||||||
        //Check if some additionnal data was specified
 | 
					        //Check if some additionnal data was specified
 | 
				
			||||||
        if(!additionnalData)
 | 
					        if(!additionnalData)
 | 
				
			||||||
            additionnalData = {};
 | 
					            additionnalData = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Add the subfolder URI (if any)
 | 
				
			||||||
 | 
					        if(subfoldersURI){
 | 
				
			||||||
 | 
					            additionnalData.subfolder = subfoldersURI;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        //Call the method related to the page
 | 
					        //Call the method related to the page
 | 
				
			||||||
        eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
 | 
					        eval(pageInfos.methodHandler + ("(additionnalData, pageTarget);"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,50 +17,10 @@ ComunicWeb.pages.home.home = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //Check if user is in or not
 | 
					        //Check if user is in or not
 | 
				
			||||||
        if(userLoggedIn){
 | 
					        if(userLoggedIn){
 | 
				
			||||||
            //Dev feature : Show result
 | 
					 | 
				
			||||||
            targetElement.appendChild(ComunicWeb.common.messages.createCalloutElem("", "User logged in !", "info"));
 | 
					 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            //Create logout button
 | 
					            //Open current user page
 | 
				
			||||||
            var loginButton = document.createElement("button");
 | 
					            openPage("user/me");
 | 
				
			||||||
            loginButton.onclick = (function(){
 | 
					 | 
				
			||||||
                ComunicWeb.common.page.openPage("logout");
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
            loginButton.innerHTML="Logout";
 | 
					 | 
				
			||||||
            targetElement.appendChild(loginButton);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Dev feature emojies
 | 
					 | 
				
			||||||
            var emojiesArea = createElem2({
 | 
					 | 
				
			||||||
                appendTo: targetElement,
 | 
					 | 
				
			||||||
                type: "p",
 | 
					 | 
				
			||||||
                innerHTML: "Emoji test : :)  🇬🇫  🎅🏻 :( (movie) (cool)"
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Parse emojies
 | 
					 | 
				
			||||||
            ComunicWeb.components.emoji.parser.parse({
 | 
					 | 
				
			||||||
                element: emojiesArea,
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Create textarea element
 | 
					 | 
				
			||||||
            var textarea = createFormGroup({
 | 
					 | 
				
			||||||
                target: targetElement,
 | 
					 | 
				
			||||||
                type: "textarea",
 | 
					 | 
				
			||||||
                label: "Textarea",
 | 
					 | 
				
			||||||
                placeholder: "New message",
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
            textarea.style.width = "200px";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Initializate textarea
 | 
					 | 
				
			||||||
            var textarea2 = new ComunicWeb.components.textarea();
 | 
					 | 
				
			||||||
            textarea2.init({
 | 
					 | 
				
			||||||
                element: textarea,
 | 
					 | 
				
			||||||
                minHeight: "32px",
 | 
					 | 
				
			||||||
                maxHeight: "70px",
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else{
 | 
					        else{
 | 
				
			||||||
            //Display landing page
 | 
					            //Display landing page
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								assets/js/pages/userPage/main.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								assets/js/pages/userPage/main.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * User page
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Display the profile of the user
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Main file
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author Pierre HUBERT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					ComunicWeb.pages.userPage.main = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Open user page
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param {Object} params Parametres required to open the page
 | 
				
			||||||
 | 
						 * @param {HTMLElement} target The target for the user page
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						open: function(params, target){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							console.log(params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -14,6 +14,15 @@ ComunicWeb.pagesList = {
 | 
				
			|||||||
        disableMenus: false,
 | 
					        disableMenus: false,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * User profile page
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    user: {
 | 
				
			||||||
 | 
					        pageTitle: "User Page",
 | 
				
			||||||
 | 
					        methodHandler: "ComunicWeb.pages.userPage.main.open",
 | 
				
			||||||
 | 
					        disableMenus: false,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Login page
 | 
					     * Login page
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -168,6 +168,9 @@ $config['JSfiles'] = array(
 | 
				
			|||||||
		"%PATH_ASSETS%js/pages/home/home.js",
 | 
							"%PATH_ASSETS%js/pages/home/home.js",
 | 
				
			||||||
		"%PATH_ASSETS%js/pages/home/landingPage.js",
 | 
							"%PATH_ASSETS%js/pages/home/landingPage.js",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							//User page
 | 
				
			||||||
 | 
							"%PATH_ASSETS%js/pages/userPage/main.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Login page
 | 
							//Login page
 | 
				
			||||||
		"%PATH_ASSETS%js/pages/login.js",
 | 
							"%PATH_ASSETS%js/pages/login.js",
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user