137 lines
15 KiB
JavaScript
137 lines
15 KiB
JavaScript
/******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId]) {
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ i: moduleId,
|
||
/******/ l: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.l = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // define getter function for harmony exports
|
||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = function(exports) {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/
|
||
/******/ // create a fake namespace object
|
||
/******/ // mode & 1: value is a module id, require it
|
||
/******/ // mode & 2: merge all properties of value into the ns
|
||
/******/ // mode & 4: return value when already ns object
|
||
/******/ // mode & 8|1: behave like require
|
||
/******/ __webpack_require__.t = function(value, mode) {
|
||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||
/******/ if(mode & 8) return value;
|
||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||
/******/ var ns = Object.create(null);
|
||
/******/ __webpack_require__.r(ns);
|
||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||
/******/ return ns;
|
||
/******/ };
|
||
/******/
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = function(module) {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ function getDefault() { return module['default']; } :
|
||
/******/ function getModuleExports() { return module; };
|
||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/
|
||
/******/ // Object.prototype.hasOwnProperty.call
|
||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = "./src/app.js");
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ({
|
||
|
||
/***/ "./src/app.js":
|
||
/*!********************!*\
|
||
!*** ./src/app.js ***!
|
||
\********************/
|
||
/*! no exports provided */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _assets_js_login_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assets/js/login.js */ \"./src/assets/js/login.js\");\n// Import des autres modules\n\n\n// Exports functions\nwindow.loadMain = loadMain;\nwindow.tryConnect = _assets_js_login_js__WEBPACK_IMPORTED_MODULE_0__[\"tryConnect\"];\nwindow.Quit = Quit;\n\n\n/**\n * loadMain is the main page load\n * \n */\n function loadMain()\n {\n var token='';\n \n token = getCookie('aduc');\n if( token == \"\" )\n {\n console.log('No cookie defined');\n _assets_js_login_js__WEBPACK_IMPORTED_MODULE_0__[\"displayLogin\"]();\n } else {\n console.log(\"Cookie \"+token);\n }\n }\n\n /**\n * getCookie get cookie's content\n * \n * @param {*} cname Cookie's name\n * @returns \n */\nfunction getCookie(cname) {\n var name = cname + \"=\";\n var decodedCookie = decodeURIComponent(document.cookie);\n var ca = decodedCookie.split(';');\n for(var i = 0; i <ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n}\n\n\n/**\n * setCookie : set a cookie\n * \n * @param {*} cname Cookie's name to set\n * @param {*} cvalue Cookie's value\n * @param {*} timeOut Cookie's expiration in seconds\n */\nfunction setCookie(cname, cvalue, timeOut) \n{\n var d = new Date();\n d.setTime(d.getTime() + (timeOut*1000));\n var expires = \"expires=\"+ d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n}\n\n/**\n * delCookie()\n * \n * @param {*} cname \n */\nfunction delCookie( cname ) \n{\n document.cookie = cname + \"=;expires=Thu, 01 Jan 1970 00:00:01 GMT\";\n}\n\n\n\n\n/**\n * Exit program (logout)\n * \n */\nfunction Quit()\n{\n delCookie(\"aduc\");\n document.location = \"/index.php\";\n}\n\nfunction doLdap()\n{\n document.location = \"/ldap.php\";\n}\n\nfunction doRedis()\n{\n document.location = \"/redis.php\";\n}\n\n\n\n\n\n\n\n\n//# sourceURL=webpack:///./src/app.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/assets/js/entity.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/assets/js/entity.js ***!
|
||
\*********************************/
|
||
/*! exports provided: addEntity, displayRoot */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addEntity\", function() { return addEntity; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"displayRoot\", function() { return displayRoot; });\n/**\n * addEntity\n */\n function addEntity()\n {\n alert(\"Ajout d'une entité\");\n }\n \n \n /**\n * displayRoot : display root screen\n */\n function displayRoot()\n {\n var Header='';\n Header = \"<h5 class='modal-title' id='popup-title'>Root</h5>\";\n Header += \"<button type='button' class='close' data-dismiss='modal'>\";\n Header += \"<span aria-hidden='true'>×</span>\";\n Header += \"</button>\";\n $('#popup-header').html(Header);\n $('#popup-body').html(getRootForm());\n $('#popup-footer').css('display','block');\n $('#popup-footer').html(getRootFooter());\n $('#popup').modal('show');\n }\n \n /**\n * \n * @returns \n */\n function getRootFooter()\n {\n var ret='';\n \n ret += '<button type=\"button\" class=\"btn btn-primary\" onClick=\"SaveRoot();\" id=\"cnxButton\">Save</button>';\n return ret;\n }\n \n /**\n * \n * @returns string\n */\n function getRootForm()\n {\n var ret;\n \n ret = \"<div class='form-group'>\\n\";\n ret += \" <label for='sInputEmail'>Account (email form)</label>\\n\";\n ret += \" <div class='fx-relay-email-input-wrapper'>\\n\";\t\t\t\t\t\n ret += \" <input type='email' class='form-control' id='sInputEmail' />\\n\";\t\t\t\t\t\n ret += \"\t</div>\\n\";\n ret += \"</div>\";\n ret += \"<div class='form-group'>\\n\";\n ret += \" <label for='sInputPassword'>Password</label>\\n\";\n ret += \"\t<input type='password' class='form-control' id='sInputPassword' />\\n\";\n ret += \"</div>\";\n return ret;\n }\n \n\n//# sourceURL=webpack:///./src/assets/js/entity.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/assets/js/jstree.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/assets/js/jstree.js ***!
|
||
\*********************************/
|
||
/*! exports provided: initJsTree */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"initJsTree\", function() { return initJsTree; });\n/* harmony import */ var _entity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./entity.js */ \"./src/assets/js/entity.js\");\n\n\n\n\n/**\n * initJsTree\n */\nfunction initJsTree()\n {\n $('#jsTree')\n .jstree({\n 'core' : {\n \"check_callback\" : true,\n 'data' : {\n 'url' : 'src/ajax.php?Action=get_node',\n 'data' : function (node) {\n console.log(node.id);\n return { 'id' : node.id };\n }\n },\n \"themes\" : {\n \"variant\" : \"large\"\n }\n },\n 'contextmenu' : {\n 'items' : function(node) {\n return contextMenu(node);\n }\n },\n \"types\" : {\n \"#\" : {\n \"max_children\" : 1,\n \"max_depth\" : 4,\n \"valid_children\" : [\"root\"]\n },\n \"root\" : {\n \"icon\" : \"./src/assets/global.png\",\n \"valid_children\" : [\"default\"]\n },\n \"Organizational-Unit\" : {\n \"icon\" : \"./src/assets/folder-blue.png\",\n \"valid_children\" : [\"default\",\"file\"]\n },\n \"Container\" : {\n \"icon\" : \"./src/assets/folder-blue.png\"\n },\n \"Builtin-Domain\" : {\n \"icon\" : \"./src/assets/folder-blue.png\",\n \"valid_children\" : []\n },\n \"Foreign-Security-Principal\" : {\n \"icon\" : \"./src/assets/key.png\"\n },\n \"Group\": {\n \"icon\" : \"./src/assets/users-icon.png\",\n },\n \"Computer\": {\n \"icon\" : \"./src/assets/computer.png\",\n },\n \"Person\": {\n \"icon\" : \"./src/assets/User.png\"\n },\n \"Physical-Location\": {\n \"icon\" : \"./src/assets/building.png\"\n },\n },\n \"plugins\" : [\"contextmenu\",\"dnd\",\"search\",\"types\"]\n });\n }\n \n /**\n * contextMenu\n */\nfunction contextMenu(node)\n{\n console.log(node);\n var tmp = $.jstree.defaults.contextmenu.items();\n console.log(tmp);\n delete tmp.create.action;\n\n switch(node.type)\n { \n case 'root':\n var tmp;\n tmp = {\n \"create\": {\n \"label\": \"Nouvelle entité\",\n \"action\": function(data){\n console.log(data);\n _entity_js__WEBPACK_IMPORTED_MODULE_0__[\"addEntity\"]();\n }\n }\n }\n return tmp;\n }\n\n\n if(node.type === \"demo\") {\n tmp = { 'create': {\n \"label\": \"Ajouter\"\n }};\n return tmp;\n }\n\n tmp.create.label = \"Ajouter\";\n tmp.create.submenu = {\n \"create_folder\" : {\n \"separator_after\"\t: true,\n \"label\"\t\t\t\t: \"Utilisateur\",\n \"action\"\t\t\t: function (data) {\n // console.log(data);\n alert('Ajout user');\n }\n },\n \"create_file\" : {\n \"label\"\t\t\t\t: \"Machine\",\n \"action\"\t\t\t: function (data) {\n alert('Machine');\n }\n }\n };\n return tmp;\n}\n// https://www.jstree.com/demo/\n\n\n\n//# sourceURL=webpack:///./src/assets/js/jstree.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/assets/js/login.js":
|
||
/*!********************************!*\
|
||
!*** ./src/assets/js/login.js ***!
|
||
\********************************/
|
||
/*! exports provided: displayLogin, tryConnect */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"displayLogin\", function() { return displayLogin; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tryConnect\", function() { return tryConnect; });\n/* harmony import */ var _jstree_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jstree.js */ \"./src/assets/js/jstree.js\");\n/* harmony import */ var _entity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./entity.js */ \"./src/assets/js/entity.js\");\n/**\n * Login related functions\n */\n\n\n\n\n\n/**\n * displayLogin : display login screen\n */\n function displayLogin()\n {\n $('#popup-header').html(\"<h5>Login</h5>\");\n $('#popup-body').html(getLoginForm());\n $('#popup-footer').css('display','block');\n $('#popup-footer').html(getLoginFooter());\n $('#popup').modal('show');\n }\n \n /**\n * \n * @returns string\n */\n function getLoginForm()\n {\n var ret;\n \n ret = \"<div class='form-group'>\\n\";\n ret += \" <label for='sInputEmail'>Account (email form)</label>\\n\";\n ret += \" <div class='fx-relay-email-input-wrapper'>\\n\";\t\t\t\t\t\n ret += \" <input type='email' class='form-control' id='sInputEmail' />\\n\";\t\t\t\t\t\n ret += \"\t</div>\\n\";\n ret += \"</div>\";\n ret += \"<div class='form-group'>\\n\";\n ret += \" <label for='sInputPassword'>Password</label>\\n\";\n ret += \"\t<input type='password' class='form-control' id='sInputPassword' />\\n\";\n ret += \"</div>\";\n return ret;\n }\n \n\n/**\n * \n * @returns \n */\n function getLoginFooter()\n {\n var ret='';\n \n ret += '<button type=\"button\" class=\"btn btn-primary\" onClick=\"window.tryConnect();\" id=\"cnxButton\">Connect</button>';\n ret += \"<div class='alert alert-danger' style='display: none; margin-top: 5px' id='loginAlert'>\";\n ret += \"<h4>Compte ou login invalide</h4></div>\";\n return ret;\n }\n \n\n /**\n * \n * @returns \n */\nfunction tryConnect()\n{\n var sEmail, sPassword, sAction;\n // $('#cnxButton').fadeOut();\n console.log('try to connect');\n sEmail = document.getElementById(\"sInputEmail\").value;\n sPassword = document.getElementById(\"sInputPassword\").value;\n if( sPassword == \"\" ){\n return;\n }\n if( sEmail == \"\" ){\n return;\n }\n var oData = { Action: 'validLogin', Email: \"\"+sEmail, Password: \"\"+sPassword };\n // Ask server\n $.post(\"src/ajax.php\",oData, function (data, status){\n if( status != \"success\"){\n alert('error');\n }\n if( data.Errno == -1){\n //$('#loginAlert').css('display','block');\n $('#loginAlert').fadeIn();\n setTimeout( function() {$('#loginAlert').fadeOut();} ,3000);\n } else {\n $('#popup').modal('hide');\n $('#navbar').css('display','flex');\n $('#jsTree').css('display','block');\n _jstree_js__WEBPACK_IMPORTED_MODULE_0__[\"initJsTree\"]();\n $(\"#jsTree\").on('select_node.jstree', function(e,data){\n //alert('Selected');\n //var id = $(\"#jsTree\").jstree(true).get_node($(this)).id;\n var id = atob(data.node.id);\n\n console.log(\"ID : \"+ id);\n console.log(\"Type : \"+ data.node.type);\n switch( data.node.type )\n {\n case 'Person':\n alert(\"Edit User\");\n break;\n \n case 'root':\n _entity_js__WEBPACK_IMPORTED_MODULE_1__[\"displayRoot\"]();\n break;\n }\n });\n }\n }); \n}\n\n\n//# sourceURL=webpack:///./src/assets/js/login.js?");
|
||
|
||
/***/ })
|
||
|
||
/******/ }); |