ComunicWeb/assets/js/pages/settings/main.js

69 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-04-12 14:17:41 +00:00
/**
* User settings main script file
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.settings.main = {
/**
* Open settings page
*
* @param {object} args Optionnal arguments
* @param {HTMLElement} target The target for the page
*/
open: function(args, target){
//Settings page is organized like an array with two columns
//Left column : settings sections menu
//Rigth column : current settings section
//Create a row
var row = createElem2({
appendTo: target,
type: "div",
class: "row settings-page-container"
});
//Left area
var leftArea = createElem2({
appendTo: row,
type: "div",
class: "col-md-3"
});
2018-04-13 17:00:49 +00:00
//Right area
var rightArea = createElem2({
appendTo: row,
type: "div",
class: "col-md-9"
});
2018-04-12 14:17:41 +00:00
//Display left navigation pane
ComunicWeb.pages.settings.navigationPane.display(leftArea);
2018-04-13 17:00:49 +00:00
//Determine which page to open
var section = args.subfolder ? args.subfolder : "general";
//Check if the section exists or not
if(ComunicWeb.pages.settings.sectionsList[section]){
//Extract section information
var section = ComunicWeb.pages.settings.sectionsList[section];
//Update document title
document.title += " - " + section.title;
2018-04-13 17:00:49 +00:00
//Call handler
eval(section.handler + "(args, rightArea);");
}
//The section is not found
else {
//Display error page (404)
ComunicWeb.common.error.pageNotFound(args, target);
}
2018-04-12 14:17:41 +00:00
},
}