diff --git a/assets/css/common/global.css b/assets/css/common/global.css new file mode 100644 index 00000000..e39b6884 --- /dev/null +++ b/assets/css/common/global.css @@ -0,0 +1,12 @@ +/** + * Global CSS rules + * + * @author Pierre HUBERT + */ + +/** + * elements + */ +a { + cursor: pointer; +} \ No newline at end of file diff --git a/assets/css/common/page/waitSplashScreen.css b/assets/css/common/page/waitSplashScreen.css index 47449750..8bcae2db 100644 --- a/assets/css/common/page/waitSplashScreen.css +++ b/assets/css/common/page/waitSplashScreen.css @@ -4,8 +4,27 @@ * @author Pierre HUBERT */ +/** + * Full splash screen + */ .waitSplashScreen { background-color: rgba(128, 128, 128, 0.06); padding-top: 10%; text-align: center; +} + + +/** + * Transparent wait splash screen + */ +.transparentWaitSplashScreen { + position: fixed; + width: 100%; + height: 100%; + top: 0px; + background-color: #0C0C0C; + z-index: 500; + text-align: center; + opacity: 0.5; + padding-top: 30%; } \ No newline at end of file diff --git a/assets/img/barProgress.gif b/assets/img/barProgress.gif new file mode 100644 index 00000000..2fd8e073 Binary files /dev/null and b/assets/img/barProgress.gif differ diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 011283d8..7e236fe6 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -88,6 +88,11 @@ var ComunicWeb = { * Return current URL opened on the website */ getCurrentWebsiteURL: function(){}, + + /** + * Change the current website URI + */ + changeURI: function(newTitle, newURI){}, }, /** @@ -104,6 +109,11 @@ var ComunicWeb = { */ showWaitSplashScreen: function(){}, + /** + * Show a transparent wait splash screen + */ + showTransparentWaitSplashScreen: function(){}, + /** * Open a page */ @@ -301,6 +311,11 @@ var ComunicWeb = { * Open login page */ openLoginPage: function(additionnalData, targetElement){}, + + /** + * Perform user login + */ + loginSubmit: function(){}, } }, diff --git a/assets/js/common/page.js b/assets/js/common/page.js index f95908cb..31f3e01e 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -57,6 +57,28 @@ ComunicWeb.common.page = { }, + /** + * Show a transparent wait splash screen + * + * @returns {elem} The splash screen element to let it being deleted + */ + showTransparentWaitSplashScreen: function(){ + //Create the element + var waitSplashScreen = document.createElement("div"); + waitSplashScreen.className = "transparentWaitSplashScreen"; + + //Populate it + var imgElem = document.createElement("img"); + imgElem.src = ComunicWeb.__config.assetsURL+"img/barProgress.gif"; + waitSplashScreen.appendChild(imgElem); + + //Apply splash screen + document.body.appendChild(waitSplashScreen); + + //Return wait splash screen element + return waitSplashScreen; + }, + /** * Open a page * @@ -68,7 +90,7 @@ ComunicWeb.common.page = { ComunicWeb.debug.logMessage("Open the following page: " + pageURI); //Extract the first part of the URL - var firstPartURI = pageURI; + var firstPartURI = pageURI.toString(); //Check if pageURI is empty if(firstPartURI == ""){ @@ -93,6 +115,9 @@ ComunicWeb.common.page = { //Change page title document.title = pageInfos.pageTitle; + //Change page URL + ComunicWeb.common.url.changeURI(document.title, pageURI); + //Get the main contener of the page //var mainContenerElem = document.getElementById("wrapper"); @@ -160,6 +185,26 @@ ComunicWeb.common.page = { //Apply template source targetElem.innerHTML = templateContent; + //Make a link live + var aElems = targetElem.getElementsByTagName("a"); + for(num in aElems){ + + //Export current element + var currentElement = aElems[num]; + + //Check if it is a real html elements and if it contains a "target" attribute + if(currentElement.attributes){ + if(currentElement.attributes.target){ + + //Change the onclick behavior of the elements + currentElement.onclick = (function() { + ComunicWeb.common.page.openPage(this.getAttribute("target")); + }); + + } + } + } + //Perform next action (if there is) if(afterParsingHTMLtemplate) afterParsingHTMLtemplate(); diff --git a/assets/js/common/url.js b/assets/js/common/url.js index b48fc2e7..ad6fe604 100644 --- a/assets/js/common/url.js +++ b/assets/js/common/url.js @@ -20,4 +20,23 @@ ComunicWeb.common.url = { //Return result return uripage; }, + + /** + * Change the current website URI + * + * @param {String} newTitle New title for the page + * @param {String} newURI The new URI + * @return {Boolean} False if it fails + */ + changeURI: function(newTitle, newURI){ + + //Determine the new URL + var newURL = ComunicWeb.__config.siteURL + newURI; + + //Apply it + window.history.pushState("object or string", newTitle, newURI); + + //Everything is OK + return true; + }, }; \ No newline at end of file diff --git a/assets/js/pages/login.js b/assets/js/pages/login.js index 5a6f44ea..b57a4ca2 100644 --- a/assets/js/pages/login.js +++ b/assets/js/pages/login.js @@ -41,9 +41,28 @@ ComunicWeb.pages.login = { increaseArea: '20%' // optional }); }); + + //Get login form element + var loginBody = document.getElementById("loginForm"); + + //Get login button + var loginButton = loginBody.getElementsByClassName("btn-login")[0]; + + loginButton.onclick=ComunicWeb.pages.login.loginSubmit; }; //Apply template ComunicWeb.common.page.getAndShowTemplate(targetElement, additionalData, "pages/login/loginPage.tpl", afterParsingTemplate, true); - } + }, + + /** + * Perform user login + * + * @return {Boolean} False if it fails + */ + loginSubmit: function(){ + alert("Login"); + + //var overlay = ComunicWeb.common.page.showTransparentWaitSplashScreen(); + }, }; \ No newline at end of file diff --git a/assets/templates/pages/login/loginPage.tpl b/assets/templates/pages/login/loginPage.tpl index c08681f2..8b8f48cb 100644 --- a/assets/templates/pages/login/loginPage.tpl +++ b/assets/templates/pages/login/loginPage.tpl @@ -1,12 +1,14 @@ +
-
+ + -
+
@@ -25,13 +27,11 @@
- +
-
+
- - diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index 1e9405e4..83302f05 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -19,6 +19,7 @@ $config['CSSfiles'] = array( "%PATH_ASSETS%adminLTE/dist/css/skins/_all-skins.min.css", //App stylesheets + "%PATH_ASSETS%css/common/global.css", "%PATH_ASSETS%css/common/page/waitSplashScreen.css", );