diff --git a/emailMarketing/emailMarketing.py b/emailMarketing/emailMarketing.py index 57841b1e4..d21d9d3d1 100644 --- a/emailMarketing/emailMarketing.py +++ b/emailMarketing/emailMarketing.py @@ -187,7 +187,6 @@ class emailMarketing(multi.Thread): from email.mime.text import MIMEText import re - message = MIMEMultipart('alternative') tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) for items in allEmails: diff --git a/filemanager/static/filemanager/js/fileManager.js b/filemanager/static/filemanager/js/fileManager.js index 24a4713a7..9decf19cf 100755 --- a/filemanager/static/filemanager/js/fileManager.js +++ b/filemanager/static/filemanager/js/fileManager.js @@ -1,13 +1,13 @@ var fileManager = angular.module('fileManager', ['angularFileUpload']); -fileManager.config(['$interpolateProvider', function($interpolateProvider) { - $interpolateProvider.startSymbol('{$'); - $interpolateProvider.endSymbol('$}'); - }]); +fileManager.config(['$interpolateProvider', function ($interpolateProvider) { + $interpolateProvider.startSymbol('{$'); + $interpolateProvider.endSymbol('$}'); +}]); -fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $window) { +fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, $window) { - $( document.body ).click(function() { + $(document.body).click(function () { rightClickNode.style.display = "none"; }); @@ -17,10 +17,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var domainName = $("#domainNameInitial").text(); var domainRandomSeed = ""; - var homePathBack = "/home/"+domainName; - $scope.currentPath = "/home/"+domainName; + var homePathBack = "/home/" + domainName; + $scope.currentPath = "/home/" + domainName; $scope.startingPath = domainName; - $scope.completeStartingPath = "/home/"+domainName; + $scope.completeStartingPath = "/home/" + domainName; $scope.editDisable = true; // disable loading image on tree loading @@ -31,7 +31,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.saveSuccess = true; var allFilesAndFolders = []; - $scope.showUploadBox = function(){ + $scope.showUploadBox = function () { $('#uploadBox').modal('show'); }; @@ -47,7 +47,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // tree - $scope.fetchChilds = function (element,completePath,functionName) { + $scope.fetchChilds = function (element, completePath, functionName) { // start loading tree $scope.treeLoading = false; @@ -55,21 +55,21 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var funcCompletePath = ""; var nodeForChilds = ""; - if(functionName === "primary") { + if (functionName === "primary") { nodeForChilds = element.currentTarget.parentNode; funcCompletePath = completePath; } - else{ + else { nodeForChilds = element.parentNode; funcCompletePath = completePath; } - url = domainName+"/php/fileManager.php"; + url = domainName + "/php/fileManager.php"; var data = { - completeStartingPath : completePath, - method : "list", - domainRandomSeed:domainRandomSeed, + completeStartingPath: completePath, + method: "list", + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -83,7 +83,6 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w if (response.data.fetchStatus === 1) { - /// node prepration var ulNode = prepareChildNodeUL(); @@ -93,7 +92,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var keys = Object.keys(filesData); - for (var i=0; i < keys.length; i++) { + for (var i = 0; i < keys.length; i++) { if (keys[i] === "error_message" | keys[i] === "fetchStatus") { continue; } @@ -101,11 +100,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w path = filesData[keys[i]][0]; completePath = filesData[keys[i]][1]; dropDown = filesData[keys[i]][2]; - finalPrepration(ulNode,path,completePath,dropDown); + finalPrepration(ulNode, path, completePath, dropDown); } } - activateMinus(nodeForChilds,funcCompletePath); + activateMinus(nodeForChilds, funcCompletePath); } else { } @@ -117,11 +116,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w }; - function finalPrepration(parentNode, path,completePath,dropDown){ - parentNode.appendChild(prepareChildNodeLI(path,completePath,dropDown)); + function finalPrepration(parentNode, path, completePath, dropDown) { + parentNode.appendChild(prepareChildNodeLI(path, completePath, dropDown)); } - function prepareChildNodeLI(path,completePath,dropDown){ + function prepareChildNodeLI(path, completePath, dropDown) { // text nodes are created var spaceNode = document.createTextNode(" "); @@ -129,37 +128,39 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // - var attachFunc = function(){ $scope.fetchChilds(aNode, completePath,"secondary"); }; + var attachFunc = function () { + $scope.fetchChilds(aNode, completePath, "secondary"); + }; var aNode = document.createElement('a'); - aNode.setAttribute('href','#'); + aNode.setAttribute('href', '#'); aNode.addEventListener("click", attachFunc); - aNode.setAttribute('onclick','return false;'); + aNode.setAttribute('onclick', 'return false;'); var secondANode = document.createElement('a'); - secondANode.setAttribute('href','#'); - secondANode.setAttribute('onclick','return false;'); + secondANode.setAttribute('href', '#'); + secondANode.setAttribute('onclick', 'return false;'); // var iNodePlus = document.createElement('i'); - iNodePlus.setAttribute('class','fa fa-plus'); - iNodePlus.setAttribute('aria-hidden','true'); + iNodePlus.setAttribute('class', 'fa fa-plus'); + iNodePlus.setAttribute('aria-hidden', 'true'); iNodePlus.style.color = "#007bff"; var iNodeFolder = document.createElement('i'); - iNodeFolder.setAttribute('class','fa fa-folder'); - iNodeFolder.setAttribute('aria-hidden','true'); + iNodeFolder.setAttribute('class', 'fa fa-folder'); + iNodeFolder.setAttribute('aria-hidden', 'true'); var iNodeFile = document.createElement('i'); - iNodeFile.setAttribute('class','fa fa-file'); - iNodeFile.setAttribute('aria-hidden','true'); + iNodeFile.setAttribute('class', 'fa fa-file'); + iNodeFile.setAttribute('aria-hidden', 'true'); iNodeFile.style.color = "#007bff"; // var liNode = document.createElement('li'); - liNode.setAttribute('class','list-group-item'); + liNode.setAttribute('class', 'list-group-item'); liNode.style.border = "None"; // node preparation @@ -167,7 +168,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w if (dropDown == true) { secondANode.appendChild(iNodeFolder); secondANode.appendChild(pathNode); - secondANode.addEventListener("click", function(){ $scope.fetchForTableSecondary(secondANode,"fromTree",completePath);}); + secondANode.addEventListener("click", function () { + $scope.fetchForTableSecondary(secondANode, "fromTree", completePath); + }); // This makes completion of {{ startingPath }} @@ -183,7 +186,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w return liNode; } - else{ + else { liNode.appendChild(iNodeFile); liNode.appendChild(pathNode); return liNode; @@ -192,32 +195,34 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w } - function prepareChildNodeUL(){ + function prepareChildNodeUL() { // text nodes are created var ulNode = document.createElement('ul'); - ulNode.setAttribute('class','list-group list-group-flush'); + ulNode.setAttribute('class', 'list-group list-group-flush'); return ulNode; } - function activateMinus(node,completePath){ + function activateMinus(node, completePath) { var collectionOfA = node.getElementsByTagName("a"); // var aNode = document.createElement('a'); - aNode.setAttribute('href','#'); - aNode.addEventListener("click", function(){ deleteChilds(aNode,completePath);}); - aNode.setAttribute('onclick','return false;'); + aNode.setAttribute('href', '#'); + aNode.addEventListener("click", function () { + deleteChilds(aNode, completePath); + }); + aNode.setAttribute('onclick', 'return false;'); // var spaceNode = document.createTextNode(" "); var iNodeMinus = document.createElement('i'); - iNodeMinus.setAttribute('class','fa fa-minus'); - iNodeMinus.setAttribute('aria-hidden','true'); + iNodeMinus.setAttribute('class', 'fa fa-minus'); + iNodeMinus.setAttribute('aria-hidden', 'true'); iNodeMinus.style.color = "#007bff"; // prepare node @@ -225,12 +230,12 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w aNode.appendChild(iNodeMinus); aNode.appendChild(spaceNode); - node.insertBefore(aNode,collectionOfA[1]); + node.insertBefore(aNode, collectionOfA[1]); node.removeChild(collectionOfA[0]); } - function deleteChilds(aNode,completePath) { + function deleteChilds(aNode, completePath) { parent = aNode.parentNode; @@ -243,17 +248,19 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // var newANode = document.createElement('a'); - newANode.setAttribute('href','#'); - newANode.addEventListener("click", function(){ $scope.fetchChilds(newANode, completePath,"secondary");}); - newANode.setAttribute('onclick','return false;'); + newANode.setAttribute('href', '#'); + newANode.addEventListener("click", function () { + $scope.fetchChilds(newANode, completePath, "secondary"); + }); + newANode.setAttribute('onclick', 'return false;'); // var spaceNode = document.createTextNode(" "); var iNodePlus = document.createElement('i'); - iNodePlus.setAttribute('class','fa fa-plus'); - iNodePlus.setAttribute('aria-hidden','true'); + iNodePlus.setAttribute('class', 'fa fa-plus'); + iNodePlus.setAttribute('aria-hidden', 'true'); iNodePlus.style.color = "#007bff"; // prepare node @@ -261,7 +268,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w newANode.appendChild(iNodePlus); newANode.appendChild(spaceNode); - parent.insertBefore(newANode,collectionOfA[1]); + parent.insertBefore(newANode, collectionOfA[1]); parent.removeChild(collectionOfA[0]); @@ -278,7 +285,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var collectionOfA = tableBody.getElementsByTagName("tr"); - for(var i = 0; i < collectionOfA.length ; i++){ + for (var i = 0; i < collectionOfA.length; i++) { collectionOfA[i].style.background = "aliceblue"; var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML; allFilesAndFolders.push(getFileName); @@ -295,27 +302,27 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var collectionOfA = tableBody.getElementsByTagName("tr"); - for(var i = 0; i < collectionOfA.length ; i++){ + for (var i = 0; i < collectionOfA.length; i++) { collectionOfA[i].style.background = "None"; } $scope.buttonActivator(); }; - function addFileOrFolderToList(nodeName){ + function addFileOrFolderToList(nodeName) { var rightClickNode = document.getElementById("rightClick") var check = 1; var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML; - if(nodeName.style.backgroundColor == "aliceblue") { + if (nodeName.style.backgroundColor == "aliceblue") { var tempArray = []; nodeName.style.background = "None"; - for(var j = 0; j < allFilesAndFolders.length; j++){ - if (allFilesAndFolders[j] != getFileName){ + for (var j = 0; j < allFilesAndFolders.length; j++) { + if (allFilesAndFolders[j] != getFileName) { tempArray.push(allFilesAndFolders[j]); } } @@ -328,13 +335,13 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w nodeName.style.background = "aliceblue"; - for(var j = 0; j < allFilesAndFolders.length; j++){ - if (allFilesAndFolders[j] === getFileName){ + for (var j = 0; j < allFilesAndFolders.length; j++) { + if (allFilesAndFolders[j] === getFileName) { check = 0; break; } } - if(check === 1) { + if (check === 1) { allFilesAndFolders.push(getFileName); } @@ -347,17 +354,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w /* - - public_html - 26KB - 26 Oct - 775 - Folder/File + + public_html + 26KB + 26 Oct + 775 + Folder/File */ - function createTR(fileName,fileSize,lastModified,permissions,dirCheck){ + function createTR(fileName, fileSize, lastModified, permissions, dirCheck) { // text nodes are created var fileNameNode = document.createTextNode(fileName); @@ -366,19 +373,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var permissionsNode = document.createTextNode(permissions); - - // var iNodeFolder = document.createElement('i'); - iNodeFolder.setAttribute('class','fa fa-folder'); - iNodeFolder.setAttribute('aria-hidden','true'); + iNodeFolder.setAttribute('class', 'fa fa-folder'); + iNodeFolder.setAttribute('aria-hidden', 'true'); iNodeFolder.style.color = "#007bff"; var iNodeFile = document.createElement('i'); - iNodeFile.setAttribute('class','fa fa-file'); - iNodeFile.setAttribute('aria-hidden','true'); + iNodeFile.setAttribute('class', 'fa fa-file'); + iNodeFile.setAttribute('aria-hidden', 'true'); iNodeFile.style.color = "#007bff"; // @@ -395,7 +400,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var thNode = document.createElement('th'); - thNode.setAttribute('scope','row'); + thNode.setAttribute('scope', 'row'); // @@ -411,20 +416,30 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w if (dirCheck == true) { thNode.appendChild(iNodeFolder); trNode.appendChild(thNode); - trNode.addEventListener("dblclick", function(){ $scope.fetchForTableSecondary(firstTDNode,"doubleClick");}); - trNode.addEventListener("click", function(){ addFileOrFolderToList(trNode);}); - trNode.addEventListener("contextmenu", function(event){$scope.rightClickCallBack(event,trNode);}); + trNode.addEventListener("dblclick", function () { + $scope.fetchForTableSecondary(firstTDNode, "doubleClick"); + }); + trNode.addEventListener("click", function () { + addFileOrFolderToList(trNode); + }); + trNode.addEventListener("contextmenu", function (event) { + $scope.rightClickCallBack(event, trNode); + }); // Hidden td to represent file or folder var fileOrFolderNode = document.createTextNode("Folder"); fifthTDNode.appendChild(fileOrFolderNode) } - else{ + else { thNode.appendChild(iNodeFile); trNode.appendChild(thNode); - trNode.addEventListener("click", function(){ addFileOrFolderToList(trNode);}); - trNode.addEventListener("contextmenu", function(event){ $scope.rightClickCallBack(event,trNode); }); + trNode.addEventListener("click", function () { + addFileOrFolderToList(trNode); + }); + trNode.addEventListener("contextmenu", function (event) { + $scope.rightClickCallBack(event, trNode); + }); // Hidden td to represent file or folder @@ -448,7 +463,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.buttonActivator = function () { // for edit button - if (allFilesAndFolders.length === 1){ + if (allFilesAndFolders.length === 1) { var editNode = document.getElementById("editFile"); editNode.style.pointerEvents = "auto"; @@ -456,28 +471,28 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var result = findFileExtension(allFilesAndFolders[0]); - if(result !== undefined){ - if (result[0] === "js"){ + if (result !== undefined) { + if (result[0] === "js") { aceEditorMode = "ace/mode/javascript"; editNotRight.style.display = "Block"; } - else if (result[0] === "html"){ + else if (result[0] === "html") { aceEditorMode = "ace/mode/html"; editNotRight.style.display = "Block"; } - else if (result[0] === "css"){ + else if (result[0] === "css") { aceEditorMode = "ace/mode/css"; editNotRight.style.display = "Block"; } - else if (result[0] === "php"){ + else if (result[0] === "php") { aceEditorMode = "ace/mode/php"; editNotRight.style.display = "Block"; } - else if(result[0] === "txt"){ + else if (result[0] === "txt") { aceEditorMode = ""; editNotRight.style.display = "Block"; } - else if(result[0] === "htaccess"){ + else if (result[0] === "htaccess") { aceEditorMode = ""; editNotRight.style.display = "Block"; } @@ -487,20 +502,20 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w editNotRight.style.display = "None"; } } - else{ + else { var editNode = document.getElementById("editFile"); editNode.style.pointerEvents = "none"; editNotRight.style.display = "None"; } } - else{ + else { var editNode = document.getElementById("editFile"); editNode.style.pointerEvents = "none"; } // extraction button - if (allFilesAndFolders.length === 1){ + if (allFilesAndFolders.length === 1) { var extractFileNode = document.getElementById("extractFile"); extractFileNode.style.pointerEvents = "auto"; @@ -508,25 +523,25 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var result = findFileExtension(allFilesAndFolders[0]); - if(result !== undefined){ - if (result[0] === "gz"){ + if (result !== undefined) { + if (result[0] === "gz") { extractFileNode.style.pointerEvents = "auto"; extractNodeRight.style.display = "Block"; } - else if (result[0] === "zip"){ + else if (result[0] === "zip") { extractFileNode.style.pointerEvents = "auto"; extractNodeRight.style.display = "Block"; - }else{ + } else { extractFileNode.style.pointerEvents = "none"; extractNodeRight.style.display = "None"; } } - else{ + else { extractFileNode.style.pointerEvents = "none"; extractNodeRight.style.display = "None"; } } - else{ + else { var extractFileNode = document.getElementById("extractFile"); extractFileNode.style.pointerEvents = "none"; } @@ -534,24 +549,24 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // move button - if (allFilesAndFolders.length >= 1){ + if (allFilesAndFolders.length >= 1) { var moveFileNode = document.getElementById("moveFile"); moveFileNode.style.pointerEvents = "auto"; } - else{ + else { var moveFileNode = document.getElementById("moveFile"); moveFileNode.style.pointerEvents = "none"; } //copy button - if (allFilesAndFolders.length >= 1){ + if (allFilesAndFolders.length >= 1) { var copeFileNode = document.getElementById("copyFile"); copeFileNode.style.pointerEvents = "auto"; } - else{ + else { var copeFileNode = document.getElementById("copyFile"); copeFileNode.style.pointerEvents = "none"; } @@ -559,12 +574,12 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // rename button - if (allFilesAndFolders.length === 1){ + if (allFilesAndFolders.length === 1) { var renameFileNode = document.getElementById("renameFile"); renameFileNode.style.pointerEvents = "auto"; } - else{ + else { var renameFileNode = document.getElementById("renameFile"); renameFileNode.style.pointerEvents = "none"; } @@ -572,11 +587,11 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // compress button - if (allFilesAndFolders.length >= 1){ + if (allFilesAndFolders.length >= 1) { var compressFile = document.getElementById("compressFile"); compressFile.style.pointerEvents = "auto"; } - else{ + else { var compressFile = document.getElementById("compressFile"); compressFile.style.pointerEvents = "none"; } @@ -584,68 +599,64 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w // move button - if (allFilesAndFolders.length >= 1){ + if (allFilesAndFolders.length >= 1) { var deleteFile = document.getElementById("deleteFile"); deleteFile.style.pointerEvents = "auto"; } - else{ + else { var deleteFile = document.getElementById("deleteFile"); deleteFile.style.pointerEvents = "none"; } - - }; $scope.buttonActivator(); // table functions - - $scope.fetchForTableSecondary = function(node,functionName) { + $scope.fetchForTableSecondary = function (node, functionName) { allFilesAndFolders = []; $scope.buttonActivator(); - url = domainName+"/php/fileManager.php"; + url = domainName + "/php/fileManager.php"; var completePathToFile = ""; - if(functionName === "startPoint"){ + if (functionName === "startPoint") { completePathToFile = $scope.currentPath; } - else if(functionName==="doubleClick"){ - completePathToFile = $scope.currentPath +"/"+ node.innerHTML; + else if (functionName === "doubleClick") { + completePathToFile = $scope.currentPath + "/" + node.innerHTML; } - else if(functionName==="homeFetch"){ + else if (functionName === "homeFetch") { completePathToFile = homePathBack; } - else if(functionName === "goBackOnPath"){ + else if (functionName === "goBackOnPath") { var pos = $scope.currentPath.lastIndexOf("/"); completePathToFile = $scope.currentPath.slice(0, pos); } - else if(functionName === "refresh"){ + else if (functionName === "refresh") { completePathToFile = $scope.currentPath; var rightClickNode = document.getElementById("rightClick"); } - else if(functionName === "fromTree") - { + else if (functionName === "fromTree") { completePathToFile = arguments[2]; } $scope.currentPath = completePathToFile; var data = { - completeStartingPath : completePathToFile, - method : "listForTable", + completeStartingPath: completePathToFile, + method: "listForTable", home: homePathBack, - domainRandomSeed:domainRandomSeed, + domainRandomSeed: domainRandomSeed, domainName: domainName }; var tableBody = document.getElementById("tableBodyFiles"); var loadingPath = "/static/filemanager/images/loading.gif"; - tableBody.innerHTML = ''; + tableBody.innerHTML = ''; $http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas); @@ -664,7 +675,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var keys = Object.keys(filesData); - for (var i=0; i < keys.length; i++) { + for (var i = 0; i < keys.length; i++) { if (keys[i] === "error_message" | keys[i] === "fetchStatus") { continue; } @@ -675,18 +686,20 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var permissions = filesData[keys[i]][4]; var dirCheck = filesData[keys[i]][5]; console.log(fileName); - if(fileName === "..filemanagerkey"){ + if (fileName === "..filemanagerkey") { - continue; + continue; } - tableBody.appendChild(createTR(fileName,fileSize,lastModified,permissions,dirCheck)); + tableBody.appendChild(createTR(fileName, fileSize, lastModified, permissions, dirCheck)); } } } else { - var notification = alertify.notify(response.data.error_message, 'error', 10, function(){ console.log('dismissed'); }); - $scope.fetchForTableSecondary(null,'homeFetch'); + var notification = alertify.notify(response.data.error_message, 'error', 10, function () { + console.log('dismissed'); + }); + $scope.fetchForTableSecondary(null, 'homeFetch'); } } @@ -696,51 +709,50 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w }; - function findFileExtension(fileName){ + function findFileExtension(fileName) { return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined; } // Create entry point for domain - function createEntryPoint(){ + function createEntryPoint() { url = "/filemanager/createTemporaryFile"; - var data = { - domainName:domainName - }; + var data = { + domainName: domainName + }; - var config = {}; + var config = {}; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if(response.data.createTemporaryFile === 1){ - domainRandomSeed = response.data.domainRandomSeed; - $scope.fetchForTableSecondary(null,"startPoint"); - } - else - { - var notification = alertify.notify(response.data.error_message, 'error', 10, function(){ console.log('dismissed'); }); - } - } - function cantLoadInitialDatas(response) { - var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function(){ console.log('dismissed'); }); - } + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + function ListInitialDatas(response) { + if (response.data.createTemporaryFile === 1) { + domainRandomSeed = response.data.domainRandomSeed; + $scope.fetchForTableSecondary(null, "startPoint"); + } + else { + var notification = alertify.notify(response.data.error_message, 'error', 10, function () { + console.log('dismissed'); + }); + } + } + function cantLoadInitialDatas(response) { + var notification = alertify.notify("Could not connec to server, refresh page.", 'error', 10, function () { + console.log('dismissed'); + }); + } } + createEntryPoint(); - - // html editor $scope.getFileContents = function () { @@ -749,9 +761,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var data = { - fileName : completePathForFile, - method : "readFileContents", - domainRandomSeed:domainRandomSeed, + fileName: completePathForFile, + method: "readFileContents", + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -776,6 +788,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w } } + function cantLoadInitialDatas(response) { } @@ -790,10 +803,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var completePathForFile = $scope.currentPath + "/" + allFilesAndFolders[0]; var data = { - fileName : completePathForFile, - method : "writeFileContents", + fileName: completePathForFile, + method: "writeFileContents", fileContent: editor.getValue(), - domainRandomSeed:domainRandomSeed, + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -814,6 +827,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w } } + function cantLoadInitialDatas(response) { } @@ -825,31 +839,31 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.errorMessage = true; var uploader = $scope.uploader = new FileUploader({ - url: domainName+"/php/caller.php", - formData: [ { + url: domainName + "/php/caller.php", + formData: [{ "method": "upload", - "home":homePathBack + "home": homePathBack }] }); - uploader.onCompleteItem = function(fileItem, response, status, headers) { - if(response.uploadStatus === 1) { + uploader.onCompleteItem = function (fileItem, response, status, headers) { + if (response.uploadStatus === 1) { $scope.errorMessage = true; $scope.fetchForTableSecondary(null, 'refresh'); } - else{ + else { $scope.errorMessage = false; $scope.fileName = response.fileName; $scope.error_message = response.error_message; } }; - uploader.onAfterAddingFile = function(fileItem) { + uploader.onAfterAddingFile = function (fileItem) { $scope.errorMessage = true; fileItem.formData.push( { - "completePath":$scope.currentPath, - domainRandomSeed:domainRandomSeed, + "completePath": $scope.currentPath, + domainRandomSeed: domainRandomSeed, domainName: domainName }); @@ -861,7 +875,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.errorMessageFolder = true; // - $scope.showCreateFolderModal = function(){ + $scope.showCreateFolderModal = function () { $scope.createSuccess = true; $scope.errorMessageFolder = true; $scope.newFolderName = ""; @@ -874,18 +888,17 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var completePathForFolder = $scope.currentPath + "/" + $scope.newFolderName; - if($scope.newFolderName.length === 0){ + if ($scope.newFolderName.length === 0) { $scope.errorMessageFolder = false; $scope.error_message = "Please enter folder name!"; return; } - var data = { - folderName : completePathForFolder, - method : "createNewFolder", - domainRandomSeed:domainRandomSeed, + folderName: completePathForFolder, + method: "createNewFolder", + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -896,7 +909,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w if (response.data.createStatus === 1) { $scope.createSuccess = false; - $scope.fetchForTableSecondary(null,'refresh'); + $scope.fetchForTableSecondary(null, 'refresh'); $('#showCreateFolder').modal('hide'); } else { @@ -905,6 +918,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w } } + function cantLoadInitialDatas(response) { } @@ -915,7 +929,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.createSuccess = true; $scope.errorMessageFile = true; - $scope.showCreateFileModal = function(){ + $scope.showCreateFileModal = function () { $scope.createSuccess = true; $scope.errorMessageFile = true; $scope.newFileName = ""; @@ -927,16 +941,16 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w var completePathForFile = $scope.currentPath + "/" + $scope.newFileName; $scope.errorMessageFile = true; - if($scope.newFileName.length === 0){ + if ($scope.newFileName.length === 0) { $scope.errorMessageFile = false; $scope.error_message = "Please enter file name!"; return; } var data = { - fileName : completePathForFile, - method : "createNewFile", - domainRandomSeed:domainRandomSeed, + fileName: completePathForFile, + method: "createNewFile", + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -947,7 +961,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w if (response.data.createStatus === 1) { $scope.createSuccess = false; - $scope.fetchForTableSecondary(null,'refresh'); + $scope.fetchForTableSecondary(null, 'refresh'); $('#showCreateFile').modal('hide'); } else { @@ -956,6 +970,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w } } + function cantLoadInitialDatas(response) { } @@ -968,7 +983,7 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.deleteLoading = true; - $scope.showDeleteModal = function(){ + $scope.showDeleteModal = function () { $('#showDelete').modal('show'); }; @@ -977,10 +992,10 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.deleteLoading = false; var data = { - path : $scope.currentPath, - method : "deleteFolderOrFile", + path: $scope.currentPath, + method: "deleteFolderOrFile", fileAndFolders: allFilesAndFolders, - domainRandomSeed:domainRandomSeed, + domainRandomSeed: domainRandomSeed, domainName: domainName }; @@ -991,14 +1006,19 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.deleteLoading = true; if (response.data.deleteStatus === 1) { $('#showDelete').modal('hide'); - var notification = alertify.notify('Successfully Deleted!', 'success', 5, function(){ console.log('dismissed'); }); - $scope.fetchForTableSecondary(null,'refresh'); + var notification = alertify.notify('Successfully Deleted!', 'success', 5, function () { + console.log('dismissed'); + }); + $scope.fetchForTableSecondary(null, 'refresh'); } else { - var notification = alertify.notify('Files/Folders can not be deleted', 'error', 5, function(){ console.log('dismissed'); }); + var notification = alertify.notify('Files/Folders can not be deleted', 'error', 5, function () { + console.log('dismissed'); + }); } } + function cantLoadInitialDatas(response) { } @@ -1009,13 +1029,13 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $w $scope.compressionLoading = true; - $scope.showCompressionModal = function(){ + $scope.showCompressionModal = function () { $('#showCompression').modal('show'); $scope.listOfFiles = ""; $scope.compressedFileName = ""; - for(var i=0;i + + php70 + + + lsphp70-debuginfo + Debug information for package lsphp70 + 0 + + + + lsphp70-pecl-igbinary-debuginfo + Debug information for package lsphp70-pecl-igbinary + 0 + + + + lsphp70-pecl-mcrypt-debuginfo + LSPHP70 lsphp70-pecl-mcrypt-debuginfo Extension + 0 + + + + lsphp70-bcmath + A extension for PHP applications for using the bcmath library. + 1 + + + + lsphp70-common + Common files for PHP. + 1 + + + + lsphp70-dba + A database abstraction layer extension for PHP applications. + 1 + + + + lsphp70-devel + Files needed for building PHP extensions. + 0 + + + + lsphp70-enchant + Enchant spelling extension for PHP applications. + 1 + + + + lsphp70-gd + A extension for PHP applications for using the gd graphics library. + 1 + + + + lsphp70-gmp + A extension for PHP applications for using the GNU MP library. + 1 + + + + lsphp70-imap + A extension for PHP applications that use IMAP. + 1 + + + + lsphp70-intl + Internationalization extension for PHP applications. + 1 + + + + lsphp70-json + LSPHP70 Json PHP Extension + 1 + + + + lsphp70-ldap + A extension for PHP applications that use LDAP. + 1 + + + + lsphp70-mbstring + A extension for PHP applications which need multi-byte string handling. + 1 + + + + lsphp70-mysqlnd + A extension for PHP applications that use MySQL databases. + 1 + + + + lsphp70-odbc + A extension for PHP applications that use ODBC databases. + 1 + + + + lsphp70-opcache + The Zend OPcache. + 1 + + + + lsphp70-pdo + A database access abstraction extension for PHP applications. + 1 + + + + lsphp70-pear + PHP Extension and Application Repository framework. + 1 + + + + lsphp70-pecl-apcu + APC User Cache. + 0 + + + + lsphp70-pecl-apcu-devel + APCu developer files (header). + 0 + + + + lsphp70-pecl-apcu-panel + APCu control panel. + 0 + + + + lsphp70-pecl-igbinary + Replacement for the standard PHP serializer. + 0 + + + + lsphp70-pecl-igbinary-devel + Igbinary developer files (header). + 0 + + + + lsphp70-pecl-mcrypt + LSPHP70 lsphp70-pecl-mcrypt Extension. + 0 + + + + lsphp70-pecl-memcache + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp70-pecl-memcached + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp70-pecl-msgpack + API for communicating with MessagePack serialization. + 0 + + + + lsphp70-pecl-msgpack-devel + MessagePack developer files (header). + 0 + + + + lsphp70-pecl-redis + Extension for communicating with the Redis key-value store. + 0 + + + + lsphp70-pgsql + A PostgreSQL database extension for PHP. + 1 + + + + lsphp70-process + extensions for PHP script using system process interfaces. + 1 + + + + lsphp70-pspell + A extension for PHP applications for using pspell interfaces. + 1 + + + + lsphp70-recode + A extension for PHP applications for using the recode library. + 1 + + + + lsphp70-snmp + A extension for PHP applications that query SNMP-managed devices. + 1 + + + + lsphp70-soap + A extension for PHP applications that use the SOAP protocol. + 1 + + + + lsphp70-tidy + Standard PHP extension provides tidy library support. + 1 + + + + lsphp70-xml + Standard PHP extension provides tidy library support. + 1 + + + + lsphp70-xmlrpc + A extension for PHP applications which use the XML-RPC protocol. + 1 + + + + lsphp70-zip + LSPHP70 Json PHP Extension + 0 + + + + lsphp70-mcrypt + Standard PHP extension provides mcrypt library support. + 1 + + + + lsphp70-dbg + php70-dbg lsphp70-package + 0 + + + \ No newline at end of file diff --git a/managePHP/php71.xml b/managePHP/php71.xml new file mode 100644 index 000000000..1437f3ec2 --- /dev/null +++ b/managePHP/php71.xml @@ -0,0 +1,263 @@ + + + php71 + + + lsphp71-debuginfo + Debug information for package lsphp71 + 0 + + + + lsphp71-pecl-igbinary-debuginfo + Debug information for package lsphp71-pecl-igbinary + 0 + + + + lsphp71-pecl-mcrypt-debuginfo + LSPHP71 lsphp71-pecl-mcrypt-debuginfo Extension + 0 + + + + lsphp71-bcmath + A extension for PHP applications for using the bcmath library. + 1 + + + + lsphp71-common + Common files for PHP. + 1 + + + + lsphp71-dba + A database abstraction layer extension for PHP applications. + 1 + + + + lsphp71-devel + Files needed for building PHP extensions. + 0 + + + + lsphp71-enchant + Enchant spelling extension for PHP applications. + 1 + + + + lsphp71-gd + A extension for PHP applications for using the gd graphics library. + 1 + + + + lsphp71-gmp + A extension for PHP applications for using the GNU MP library. + 1 + + + + lsphp71-imap + A extension for PHP applications that use IMAP. + 1 + + + + lsphp71-intl + Internationalization extension for PHP applications. + 1 + + + + lsphp71-json + LSPHP71 Json PHP Extension + 1 + + + + lsphp71-ldap + A extension for PHP applications that use LDAP. + 1 + + + + lsphp71-mbstring + A extension for PHP applications which need multi-byte string handling. + 1 + + + + lsphp71-mysqlnd + A extension for PHP applications that use MySQL databases. + 1 + + + + lsphp71-odbc + A extension for PHP applications that use ODBC databases. + 1 + + + + lsphp71-opcache + The Zend OPcache. + 1 + + + + lsphp71-pdo + A database access abstraction extension for PHP applications. + 1 + + + + lsphp71-pear + PHP Extension and Application Repository framework. + 1 + + + + lsphp71-pecl-apcu + APC User Cache. + 0 + + + + lsphp71-pecl-apcu-devel + APCu developer files (header). + 0 + + + + lsphp71-pecl-apcu-panel + APCu control panel. + 0 + + + + lsphp71-pecl-igbinary + Replacement for the standard PHP serializer. + 0 + + + + lsphp71-pecl-igbinary-devel + Igbinary developer files (header). + 0 + + + + lsphp71-pecl-mcrypt + LSPHP71 lsphp71-pecl-mcrypt Extension. + 0 + + + + lsphp71-pecl-memcache + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp71-pecl-memcached + Extension to work with the Memcached caching daemon. + 0 + + + + lsphp71-pecl-msgpack + API for communicating with MessagePack serialization. + 0 + + + + lsphp71-pecl-msgpack-devel + MessagePack developer files (header). + 0 + + + + lsphp71-pecl-redis + Extension for communicating with the Redis key-value store. + 0 + + + + lsphp71-pgsql + A PostgreSQL database extension for PHP. + 1 + + + + lsphp71-process + extensions for PHP script using system process interfaces. + 1 + + + + lsphp71-pspell + A extension for PHP applications for using pspell interfaces. + 1 + + + + lsphp71-recode + A extension for PHP applications for using the recode library. + 1 + + + + lsphp71-snmp + A extension for PHP applications that query SNMP-managed devices. + 1 + + + + lsphp71-soap + A extension for PHP applications that use the SOAP protocol. + 1 + + + + lsphp71-tidy + Standard PHP extension provides tidy library support. + 1 + + + + lsphp71-xml + Standard PHP extension provides tidy library support. + 1 + + + + lsphp71-xmlrpc + A extension for PHP applications which use the XML-RPC protocol. + 1 + + + + lsphp71-zip + LSPHP71 Json PHP Extension + 0 + + + + lsphp71-mcrypt + Standard PHP extension provides mcrypt library support. + 1 + + + + lsphp71-dbg + php71-dbg lsphp71-package + 0 + + + \ No newline at end of file diff --git a/managePHP/php72.xml b/managePHP/php72.xml index 0b486f731..782147783 100644 --- a/managePHP/php72.xml +++ b/managePHP/php72.xml @@ -253,5 +253,11 @@ Standard PHP extension provides mcrypt library support. 1 + + + lsphp71-dbg + php72-dbg lsphp72-package + 0 + \ No newline at end of file diff --git a/managePHP/views.py b/managePHP/views.py index ea13ae95c..60c363d60 100644 --- a/managePHP/views.py +++ b/managePHP/views.py @@ -13,13 +13,13 @@ import os from plogical.installUtilities import installUtilities from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging import re -from loginSystem.models import Administrator from plogical.virtualHostUtilities import virtualHostUtilities import subprocess import shlex from random import randint from xml.etree import ElementTree from plogical.acl import ACLManager +from plogical.processUtilities import ProcessUtilities # Create your views here. @@ -1880,11 +1880,20 @@ def getRequestStatus(request): size = data['size'] extensionName = data['extensionName'] + checkCommand = '' + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + checkCommand = 'yum list installed' + checkCommand = shlex.split(checkCommand) + else: + checkCommand = 'dpkg --list' + checkCommand = shlex.split(checkCommand) + requestStatus = unicode(open(phpUtilities.installLogPath, "r").read()) requestStatusSize = len(requestStatus) if requestStatus.find("PHP Extension Installed") > -1: - if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1: + if subprocess.check_output(checkCommand).find(extensionName) > -1: ext = installedPackages.objects.get(extensionName=extensionName) ext.status = 1 ext.save() @@ -1901,7 +1910,7 @@ def getRequestStatus(request): return HttpResponse(final_json) elif requestStatus.find("Can not be installed") > -1: - if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1: + if subprocess.check_output(checkCommand).find(extensionName) > -1: ext = installedPackages.objects.get(extensionName=extensionName) ext.status = 1 ext.save() @@ -1918,7 +1927,7 @@ def getRequestStatus(request): return HttpResponse(final_json) elif requestStatus.find("Can not un-install Extension") > -1: - if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1: + if subprocess.check_output(checkCommand).find(extensionName) > -1: ext = installedPackages.objects.get(extensionName=extensionName) ext.status = 1 ext.save() @@ -1935,7 +1944,7 @@ def getRequestStatus(request): return HttpResponse(final_json) elif requestStatus.find("PHP Extension Removed") > -1: - if subprocess.check_output(["yum", "list", "installed"]).find(extensionName) > -1: + if subprocess.check_output(checkCommand).find(extensionName) > -1: ext = installedPackages.objects.get(extensionName=extensionName) ext.status = 1 ext.save() diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 48f4626e3..07459e13b 100644 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -562,6 +562,8 @@ class ApplicationInstaller(multi.Thread): ## checking for directories/files + logging.writeToFile(finalPath) + if self.dataLossCheck(finalPath, tempStatusPath) == 0: return 0 @@ -573,8 +575,7 @@ class ApplicationInstaller(multi.Thread): try: - command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" git clone ' \ - '--depth 1 --no-single-branch git@' + defaultProvider +'.com:' + username + '/' + reponame + '.git -b ' + branch + ' ' + finalPath + command = 'sudo git clone https://' + defaultProvider +'.com/' + username + '/' + reponame + ' -b ' + branch + ' ' + finalPath subprocess.check_output(shlex.split(command)) except subprocess.CalledProcessError, msg: statusFile = open(tempStatusPath, 'w') @@ -605,9 +606,7 @@ class ApplicationInstaller(multi.Thread): except BaseException, msg: - os.remove('/home/cyberpanel/' + domainName + '.git') - statusFile = open(tempStatusPath, 'w') statusFile.writelines(str(msg) + " [404]") statusFile.close() @@ -630,14 +629,14 @@ class ApplicationInstaller(multi.Thread): logging.writeToFile('Git is not setup for this website.') return 0 - command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" git -C ' + finalPath + ' pull' + command = 'sudo git --git-dir=' + finalPath + '.git --work-tree=' + finalPath +' pull' subprocess.check_output(shlex.split(command)) + ## + website = Websites.objects.get(domain=domain) externalApp = website.externalApp - ## - command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath cmd = shlex.split(command) subprocess.call(cmd) diff --git a/plogical/ftpUtilities.py b/plogical/ftpUtilities.py index 321570dd3..ea5301207 100644 --- a/plogical/ftpUtilities.py +++ b/plogical/ftpUtilities.py @@ -22,146 +22,6 @@ from datetime import datetime class FTPUtilities: - # This function will only install FTP - @staticmethod - def installProFTPD(): - try: - cmd = [] - - - cmd.append("yum") - cmd.append("-y") - cmd.append("install") - cmd.append("proftpd-mysql") - res = subprocess.call(cmd) - if res == 1: - print("###############################################") - print(" Could not install ProFTPD ") - print("###############################################") - sys.exit() - else: - print("###############################################") - print(" ProFTPD Installed ") - print("###############################################") - except OSError,msg: - - logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [installProFTPD]") - return 0 - except ValueError,msg: - logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [installProFTPD]") - return 0 - - return 1 - - @staticmethod - def createFTPDataBaseinMariaDB(username,password): - try: - - #Create DB - #sql.mysqlUtilities.createDatabase("1qaz@9xvps", "ftp", username, password) - - #Add group - cmd = [] - - cmd.append("groupadd") - cmd.append("-g") - cmd.append("2001") - cmd.append("ftpgroup") - - res = subprocess.call(cmd) - if res == 1: - print "Group adding failed" - else: - print "Group added" - - #Add user to group - - cmd = [] - - cmd.append("useradd") - cmd.append("-u") - cmd.append("2001") - cmd.append("-s") - cmd.append("/bin/false") - cmd.append("-d") - cmd.append("/bin/null") - cmd.append("-c") - cmd.append("\"proftpd user\"") - cmd.append("-g") - cmd.append("ftpgroup") - cmd.append("ftpuser") - - res = subprocess.call(cmd) - if res == 1: - print "User adding failed" - else: - print "User added" - - #query = "CREATE TABLE ftp_ftpuser (id int(10) unsigned NOT NULL auto_increment,userid varchar(32) NOT NULL default '',passwd varchar(32) NOT NULL default '',uid smallint(6) NOT NULL default '2001',gid smallint(6) NOT NULL default '2001',homedir varchar(255) NOT NULL default '',shell varchar(16) NOT NULL default '/sbin/nologin',count int(11) NOT NULL default '0',accessed datetime NOT NULL default '0000-00-00 00:00:00',modified datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY (id),UNIQUE KEY userid (userid)) ENGINE=MyISAM COMMENT='ProFTP user table';" - #sql.mysqlUtilities.SendQuery(username,password,"ftp", query) - - #query = "CREATE TABLE ftpgroup (groupname varchar(16) NOT NULL default '',gid smallint(6) NOT NULL default '2001',members varchar(16) NOT NULL default '',KEY groupname (groupname)) ENGINE=MyISAM COMMENT='ProFTP group table';" - #sql.mysqlUtilities.SendQuery(username, password, "ftp", query) - - #query = "INSERT INTO ftpgroup (groupname, gid, members) VALUES ('ftpgroup', '2001', 'ftp_ftpuser');" - #sql.mysqlUtilities.SendQuery(username, password, "ftp", query) - - # File Write - lines = open("/etc/proftpd.conf").readlines() - data = open("/etc/proftpd.conf", "w") - - line1 = "\nLoadModule mod_sql.c\n" - line2 = "LoadModule mod_sql_mysql.c\n\n" - - line3 = "SQLAuthTypes Plaintext Crypt\n" - line4 = "SQLAuthenticate users groups\n\n" - - line5 = "SQLConnectInfo cybercp@localhost "+username+" "+password+"\n" - line6 = "SQLUserInfo ftp_ftp_ftpuser userid passwd uid gid homedir shell\n" - line7 = "SQLGroupInfo ftp_ftpgroup groupname gid members\n\n" - - line8 = "SQLLog PASS updatecount\n" - line9 = "SQLNamedQuery updatecount UPDATE \"count=count+1, accessed=now() WHERE userid='%u'\" ftp_ftpuser\n\n" - - line10 = "SQLLog STOR,DELE modified\n" - line11 = "SQLNamedQuery modified UPDATE \"modified=now() WHERE userid='%u'\" ftp_ftpuser" - - Auth0 = "\n#AuthPAMConfig\n" - Auth1 = "#AuthOrder\n" - for items in lines: - if ((items.find("AuthPAMConfig") > -1)): - data.writelines(Auth0) - continue - - if ((items.find("AuthOrder") > -1)): - data.writelines(Auth1) - continue - - data.writelines(items) - - - data.writelines(line1) - data.writelines(line2) - data.writelines(line3) - data.writelines(line4) - data.writelines(line5) - data.writelines(line6) - data.writelines(line7) - data.writelines(line8) - data.writelines(line9) - data.writelines(line10) - data.writelines(line11) - - data.close() - - #File Write End - - except BaseException, msg: - logging.CyberCPLogFileWriter.writeToFile( - str(msg) + " [IO Error with proftpd config file [createFTPDataBaseinMariaDB]]") - return 0 - return 1 - @staticmethod def createNewFTPAccount(udb,upass,username,password,path): try: diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 1ddcf94a3..c7e776622 100644 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -12,6 +12,7 @@ import shlex from mailServer.models import Domains,EUsers from emailPremium.models import DomainLimits, EmailLimits from websiteFunctions.models import Websites +from processUtilities import ProcessUtilities class mailUtilities: @@ -372,7 +373,10 @@ milter_default_action = accept mailUtilities.checkHome() - command = 'sudo yum install spamassassin -y' + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + command = 'sudo yum install spamassassin -y' + else: + command = 'sudo apt-get install spamassassin spamc -y' cmd = shlex.split(command) diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index 52d8d97c0..d281eb7f1 100644 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -6,6 +6,7 @@ import installUtilities import argparse import os from mailUtilities import mailUtilities +from processUtilities import ProcessUtilities class phpUtilities: @@ -17,7 +18,10 @@ class phpUtilities: mailUtilities.checkHome() - command = 'sudo yum install '+extension +' -y' + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + command = 'sudo yum install ' + extension + ' -y' + else: + command = 'sudo apt-get install ' + extension + ' -y' cmd = shlex.split(command) @@ -45,7 +49,10 @@ class phpUtilities: mailUtilities.checkHome() - command = 'sudo rpm --nodeps -e ' + extension + ' -v' + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + command = 'sudo rpm --nodeps -e ' + extension + ' -v' + else: + command = 'sudo apt-get remove -y ' + extension cmd = shlex.split(command) diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 750ba2612..4090d2093 100644 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -2,7 +2,6 @@ from CyberCPLogFileWriter import CyberCPLogFileWriter as logging import subprocess import shlex import os -from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging class ProcessUtilities: litespeedProcess = "litespeed" @@ -74,7 +73,7 @@ class ProcessUtilities: try: res = subprocess.call(shlex.split(command)) if res == 1: - raise 0 + return 0 else: return 1 except BaseException, msg: @@ -115,18 +114,5 @@ class ProcessUtilities: else: return ProcessUtilities.centos - @staticmethod - def executioner(command, statusFile): - try: - res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile) - if res == 1: - raise 0 - else: - return 1 - - except BaseException, msg: - logging.writeToFile(str(msg)) - return 0 - diff --git a/plogical/vhost.py b/plogical/vhost.py index e9932c80e..f627bb37b 100644 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -328,7 +328,7 @@ class vhost: accessControlEnds = " }\n" rewriteInherit = """ rewrite { - inherit 0 + inherit 1 } """ diff --git a/plogical/website.py b/plogical/website.py index 6eb595bd7..7c936298c 100644 --- a/plogical/website.py +++ b/plogical/website.py @@ -31,6 +31,7 @@ import hashlib from mysqlUtilities import mysqlUtilities from plogical import hashPassword from emailMarketing.emACL import emACL +from processUtilities import ProcessUtilities class WebsiteManager: def __init__(self, domain = None, childDomain = None): @@ -1253,18 +1254,23 @@ class WebsiteManager: website = Websites.objects.get(domain=self.domain) + try: + subprocess.call(('sudo', 'crontab', '-u', website.externalApp, '-')) + except: + pass + output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"]) if "no crontab for" in output: - echo = subprocess.Popen(('echo'), stdout=subprocess.PIPE) - output = subprocess.call(('sudo', 'crontab', '-u', website.externalApp, '-'), stdin=echo.stdout) + echo = subprocess.Popen((['cat', '/dev/null']), stdout=subprocess.PIPE) + subprocess.call(('sudo', 'crontab', '-u', website.externalApp, '-'), stdin=echo.stdout) echo.wait() echo.stdout.close() - - if "no crontab for" in output: - data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'} - final_json = json.dumps(data_ret) - return HttpResponse(final_json) + output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"]) + if "no crontab for" in output: + data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'} + final_json = json.dumps(data_ret) + return HttpResponse(final_json) tempPath = "/home/cyberpanel/" + website.externalApp + str(randint(10000, 99999)) + ".cron.tmp" @@ -1732,7 +1738,10 @@ class WebsiteManager: return render(request, 'websiteFunctions/setupGit.html', {'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL}) else: - command = 'sudo cat /root/.ssh/cyberpanel.pub' + command = "sudo ssh-keygen -f /root/.ssh/" + self.domain + " -t rsa -N ''" + ProcessUtilities.executioner(command) + + command = 'sudo cat /root/.ssh/' + self.domain + '.pub' deploymentKey = subprocess.check_output(shlex.split(command)).strip('\n') return render(request, 'websiteFunctions/setupGit.html', diff --git a/serverStatus/serverStatusUtil.py b/serverStatus/serverStatusUtil.py index a6391d5b6..a9f3adbf9 100644 --- a/serverStatus/serverStatusUtil.py +++ b/serverStatus/serverStatusUtil.py @@ -176,7 +176,7 @@ class ServerStatusUtil: except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile(str(msg)) - return 0 + return 0 @staticmethod def createDomain(website): @@ -192,8 +192,7 @@ class ServerStatusUtil: command = 'mkdir -p ' + confPath ServerStatusUtil.executioner(command, FNULL) - if vhost.perHostDomainConf(website.path, website.master.domain, virtualHostName, completePathToConfigFile, website.master.adminEmail, website.master.externalApp, - website.phpSelection, 1) == 1: + if vhost.perHostDomainConf(website.path, website.master.domain, virtualHostName, completePathToConfigFile, website.master.adminEmail, website.phpSelection, website.master.externalApp, 1) == 1: pass else: return 0 @@ -227,16 +226,28 @@ class ServerStatusUtil: return 0 childs = website.childdomains_set.all() + for child in childs: - if ServerStatusUtil.createDomain(child) == 0: - return 0 + try: + if ServerStatusUtil.createDomain(child) == 0: + logging.CyberCPLogFileWriter.writeToFile( + 'Error while creating child domain: ' + child.domain) + except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile( + 'Error while creating child domain: ' + child.domain + ' . Exact message: ' + str( + msg)) aliases = website.aliasdomains_set.all() for alias in aliases: - aliasDomain = alias.aliasDomain - alias.delete() - virtualHostUtilities.createAlias(website.domain, aliasDomain, 0, '/home', website.adminEmail, website.admin) + try: + aliasDomain = alias.aliasDomain + alias.delete() + virtualHostUtilities.createAlias(website.domain, aliasDomain, 0, '/home', website.adminEmail, website.admin) + except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile( + 'Error while creating alais domain: ' + aliasDomain + ' . Exact message: ' + str( + msg)) logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "vhost conf successfully built for: " + website.domain + ".\n", 1) @@ -304,6 +315,9 @@ class ServerStatusUtil: logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "vhost conf successfully built.\n", 1) + ProcessUtilities.stopLitespeed() + ProcessUtilities.restartLitespeed() + logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Successfully switched to LITESPEED ENTERPRISE WEB SERVER. [200]\n", 1) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index e5015e539..e8f047c82 100644 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -3,7 +3,7 @@ */ /* Java script code to create account */ -app.controller('createWebsite', function($scope, $http, $timeout, $window) { +app.controller('createWebsite', function ($scope, $http, $timeout, $window) { $scope.webSiteCreationLoading = true; $scope.installationDetailsForm = false; @@ -15,107 +15,103 @@ app.controller('createWebsite', function($scope, $http, $timeout, $window) { var statusFile; - $scope.createWebsite = function(){ + $scope.createWebsite = function () { - $scope.webSiteCreationLoading = false; + $scope.webSiteCreationLoading = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = true; + $scope.goBackDisable = true; + + $scope.currentStatus = "Starting creation.."; + + var ssl, dkimCheck, openBasedir; + + if ($scope.sslCheck === true) { + ssl = 1; + } + else { + ssl = 0 + } + + if ($scope.dkimCheck === true) { + dkimCheck = 1; + } + else { + dkimCheck = 0 + } + + if ($scope.openBasedir === true) { + openBasedir = 1; + } + else { + openBasedir = 0 + } + + url = "/websites/submitWebsiteCreation"; + + var package = $scope.packageForWebsite; + var domainName = $scope.domainNameCreate; + var adminEmail = $scope.adminEmail; + var phpSelection = $scope.phpSelection; + var websiteOwner = $scope.websiteOwner; + + + var data = { + package: package, + domainName: domainName, + adminEmail: adminEmail, + phpSelection: phpSelection, + ssl: ssl, + websiteOwner: websiteOwner, + dkimCheck: dkimCheck, + openBasedir: openBasedir + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.createWebSiteStatus === 1) { + statusFile = response.data.tempStatusPath; + getCreationStatus(); + } + else { + + $scope.webSiteCreationLoading = true; $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.errorMessageBox = true; + $scope.errorMessageBox = false; $scope.success = true; $scope.couldNotConnect = true; - $scope.goBackDisable = true; + $scope.goBackDisable = false; - $scope.currentStatus = "Starting creation.."; - - var ssl, dkimCheck, openBasedir; - - if ($scope.sslCheck === true){ - ssl = 1; - } - else{ - ssl = 0 - } - - if ($scope.dkimCheck === true){ - dkimCheck = 1; - } - else{ - dkimCheck = 0 - } - - if ($scope.openBasedir === true){ - openBasedir = 1; - } - else{ - openBasedir = 0 - } - - url = "/websites/submitWebsiteCreation"; - - var package = $scope.packageForWebsite; - var domainName = $scope.domainNameCreate; - var adminEmail = $scope.adminEmail; - var phpSelection = $scope.phpSelection; - var websiteOwner = $scope.websiteOwner; + $scope.errorMessage = response.data.error_message; + } - var data = { - package: package, - domainName: domainName, - adminEmail: adminEmail, - phpSelection: phpSelection, - ssl:ssl, - websiteOwner:websiteOwner, - dkimCheck:dkimCheck, - openBasedir:openBasedir - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.createWebSiteStatus === 1) - { - statusFile = response.data.tempStatusPath; - getCreationStatus(); - } - else{ - - $scope.webSiteCreationLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = false; - $scope.success = true; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - } - - - - } - function cantLoadInitialDatas(response) { - - $scope.webSiteCreationLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = true; - $scope.success = true; - $scope.couldNotConnect = false; - $scope.goBackDisable = false; - - } + } + function cantLoadInitialDatas(response) { + $scope.webSiteCreationLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = false; + $scope.goBackDisable = false; + } }; @@ -129,87 +125,87 @@ app.controller('createWebsite', function($scope, $http, $timeout, $window) { $scope.goBackDisable = true; $("#installProgress").css("width", "0%"); }; - function getCreationStatus(){ + function getCreationStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile - }; + var data = { + statusFile: statusFile + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ - - $scope.webSiteCreationLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = true; - $scope.success = false; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - - } - else{ - - $scope.webSiteCreationLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = false; - $scope.success = true; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - $scope.goBackDisable = false; - - } - - } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - $timeout(getCreationStatus,1000); - } - - } - function cantLoadInitialDatas(response) { + if (response.data.installStatus === 1) { $scope.webSiteCreationLoading = true; $scope.installationDetailsForm = true; $scope.installationProgress = false; $scope.errorMessageBox = true; + $scope.success = false; + $scope.couldNotConnect = true; + $scope.goBackDisable = false; + + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + + } + else { + + $scope.webSiteCreationLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = false; $scope.success = true; - $scope.couldNotConnect = false; + $scope.couldNotConnect = true; + $scope.goBackDisable = false; + + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; $scope.goBackDisable = false; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; + $timeout(getCreationStatus, 1000); + } - } + } + + function cantLoadInitialDatas(response) { + + $scope.webSiteCreationLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = false; + $scope.goBackDisable = false; + + } + + + } }); /* Java script code to create account ends here */ @@ -219,7 +215,7 @@ app.controller('createWebsite', function($scope, $http, $timeout, $window) { $("#listFail").hide(); -app.controller('listWebsites', function($scope,$http) { +app.controller('listWebsites', function ($scope, $http) { url = "/websites/submitWebsiteListing"; @@ -227,12 +223,12 @@ app.controller('listWebsites', function($scope,$http) { var data = {page: 1}; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { @@ -243,56 +239,55 @@ app.controller('listWebsites', function($scope,$http) { $scope.WebSitesList = finalData; $("#listFail").hide(); } - else - { + else { $("#listFail").fadeIn(); $scope.errorMessage = response.data.error_message; } } + function cantLoadInitialData(response) { console.log("not good"); } - $scope.getFurtherWebsitesFromDB = function(pageNumber) { + $scope.getFurtherWebsitesFromDB = function (pageNumber) { var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - var data = {page: pageNumber}; - - - dataurl = "/websites/submitWebsiteListing"; - - $http.post(dataurl, data,config).then(ListInitialData, cantLoadInitialData); - - - function ListInitialData(response) { - if (response.data.listWebSiteStatus ===1) { - - var finalData = JSON.parse(response.data.data); - $scope.WebSitesList = finalData; - $("#listFail").hide(); - } - else - { - $("#listFail").fadeIn(); - $scope.errorMessage = response.data.error_message; - console.log(response.data); - - } - } - function cantLoadInitialData(response) { - console.log("not good"); - } - - - + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } }; + + var data = {page: pageNumber}; + + + dataurl = "/websites/submitWebsiteListing"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + + function ListInitialData(response) { + if (response.data.listWebSiteStatus === 1) { + + var finalData = JSON.parse(response.data.data); + $scope.WebSitesList = finalData; + $("#listFail").hide(); + } + else { + $("#listFail").fadeIn(); + $scope.errorMessage = response.data.error_message; + console.log(response.data); + + } + } + + function cantLoadInitialData(response) { + console.log("not good"); + } + + + }; }); /* Java script code to list accounts ends here */ @@ -308,67 +303,66 @@ $("#websiteDeleteSuccess").hide(); $("#deleteWebsiteButton").hide(); $("#deleteLoading").hide(); -app.controller('deleteWebsiteControl', function($scope,$http) { +app.controller('deleteWebsiteControl', function ($scope, $http) { - $scope.deleteWebsite = function(){ + $scope.deleteWebsite = function () { $("#deleteWebsiteButton").fadeIn(); }; - $scope.deleteWebsiteFinal = function(){ + $scope.deleteWebsiteFinal = function () { - $("#deleteLoading").show(); + $("#deleteLoading").show(); - var websiteName = $scope.websiteToBeDeleted; + var websiteName = $scope.websiteToBeDeleted; + url = "/websites/submitWebsiteDeletion"; - url = "/websites/submitWebsiteDeletion"; + var data = { + websiteName: websiteName + }; - var data = { - websiteName: websiteName, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - console.log(response.data) + function ListInitialDatas(response) { + console.log(response.data) - if (response.data.websiteDeleteStatus == 0) - { - $scope.errorMessage = response.data.error_message; - $("#websiteDeleteFailure").fadeIn(); - $("#websiteDeleteSuccess").hide(); - $("#deleteWebsiteButton").hide(); + if (response.data.websiteDeleteStatus == 0) { + $scope.errorMessage = response.data.error_message; + $("#websiteDeleteFailure").fadeIn(); + $("#websiteDeleteSuccess").hide(); + $("#deleteWebsiteButton").hide(); - $("#deleteLoading").hide(); + $("#deleteLoading").hide(); - } - else{ - $("#websiteDeleteFailure").hide(); - $("#websiteDeleteSuccess").fadeIn(); - $("#deleteWebsiteButton").hide(); - $scope.deletedWebsite = websiteName; - $("#deleteLoading").hide(); + } + else { + $("#websiteDeleteFailure").hide(); + $("#websiteDeleteSuccess").fadeIn(); + $("#deleteWebsiteButton").hide(); + $scope.deletedWebsite = websiteName; + $("#deleteLoading").hide(); - } + } - } - function cantLoadInitialDatas(response) { - console.log("not good"); - } + } + + function cantLoadInitialDatas(response) { + console.log("not good"); + } }; @@ -376,7 +370,6 @@ app.controller('deleteWebsiteControl', function($scope,$http) { }); - /* Java script code to delete website ends here */ @@ -390,9 +383,9 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); -app.controller('modifyWebsitesController', function($scope,$http) { +app.controller('modifyWebsitesController', function ($scope, $http) { - $scope.fetchWebsites = function(){ + $scope.fetchWebsites = function () { $("#modifyWebsiteLoading").show(); @@ -401,64 +394,61 @@ app.controller('modifyWebsitesController', function($scope,$http) { url = "/websites/getWebsiteDetails"; - var data = { - websiteToBeModified: websiteToBeModified, - }; + var data = { + websiteToBeModified: websiteToBeModified, + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if (response.data.modifyStatus === 0) - { - console.log(response.data); - $scope.errorMessage = response.data.error_message; - $("#websiteModifyFailure").fadeIn(); - $("#websiteModifySuccess").hide(); - $("#modifyWebsiteButton").hide(); - $("#modifyWebsiteLoading").hide(); - $("#canNotModify").hide(); + if (response.data.modifyStatus === 0) { + console.log(response.data); + $scope.errorMessage = response.data.error_message; + $("#websiteModifyFailure").fadeIn(); + $("#websiteModifySuccess").hide(); + $("#modifyWebsiteButton").hide(); + $("#modifyWebsiteLoading").hide(); + $("#canNotModify").hide(); - } - else{ - console.log(response.data); - $("#modifyWebsiteButton").fadeIn(); + } + else { + console.log(response.data); + $("#modifyWebsiteButton").fadeIn(); - $scope.adminEmail = response.data.adminEmail; - $scope.currentPack = response.data.current_pack; - $scope.webpacks = JSON.parse(response.data.packages); - $scope.adminNames = JSON.parse(response.data.adminNames); - $scope.currentAdmin = response.data.currentAdmin; + $scope.adminEmail = response.data.adminEmail; + $scope.currentPack = response.data.current_pack; + $scope.webpacks = JSON.parse(response.data.packages); + $scope.adminNames = JSON.parse(response.data.adminNames); + $scope.currentAdmin = response.data.currentAdmin; - $("#webSiteDetailsToBeModified").fadeIn(); - $("#websiteModifySuccess").fadeIn(); - $("#modifyWebsiteButton").fadeIn(); - $("#modifyWebsiteLoading").hide(); - $("#canNotModify").hide(); + $("#webSiteDetailsToBeModified").fadeIn(); + $("#websiteModifySuccess").fadeIn(); + $("#modifyWebsiteButton").fadeIn(); + $("#modifyWebsiteLoading").hide(); + $("#canNotModify").hide(); + } - } + } - - } - function cantLoadInitialDatas(response) { - $("#websiteModifyFailure").fadeIn(); - } + function cantLoadInitialDatas(response) { + $("#websiteModifyFailure").fadeIn(); + } }; - $scope.modifyWebsiteFunc = function () { var domain = $scope.websiteToBeModified; @@ -468,7 +458,6 @@ app.controller('modifyWebsitesController', function($scope,$http) { var admin = $scope.selectedAdmin; - $("#websiteModifyFailure").hide(); $("#websiteModifySuccess").hide(); $("#websiteSuccessfullyModified").hide(); @@ -476,61 +465,59 @@ app.controller('modifyWebsitesController', function($scope,$http) { $("#modifyWebsiteLoading").fadeIn(); - url = "/websites/saveWebsiteChanges"; - var data = { - domain: domain, - packForWeb:packForWeb, - email:email, - phpVersion:phpVersion, - admin:admin - }; + var data = { + domain: domain, + packForWeb: packForWeb, + email: email, + phpVersion: phpVersion, + admin: admin + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if (response.data.saveStatus === 0) - { - $scope.errMessage = response.data.error_message; + if (response.data.saveStatus === 0) { + $scope.errMessage = response.data.error_message; - $("#canNotModify").fadeIn(); - $("#websiteModifyFailure").hide(); - $("#websiteModifySuccess").hide(); - $("#websiteSuccessfullyModified").hide(); - $("#modifyWebsiteLoading").hide(); + $("#canNotModify").fadeIn(); + $("#websiteModifyFailure").hide(); + $("#websiteModifySuccess").hide(); + $("#websiteSuccessfullyModified").hide(); + $("#modifyWebsiteLoading").hide(); - } - else{ - $("#modifyWebsiteButton").hide(); - $("#canNotModify").hide(); - $("#websiteModifyFailure").hide(); - $("#websiteModifySuccess").hide(); + } + else { + $("#modifyWebsiteButton").hide(); + $("#canNotModify").hide(); + $("#websiteModifyFailure").hide(); + $("#websiteModifySuccess").hide(); - $("#websiteSuccessfullyModified").fadeIn(); - $("#modifyWebsiteLoading").hide(); + $("#websiteSuccessfullyModified").fadeIn(); + $("#modifyWebsiteLoading").hide(); - $scope.websiteModified = domain; + $scope.websiteModified = domain; - } + } - } - function cantLoadInitialDatas(response) { - $scope.errMessage = response.data.error_message; - $("#canNotModify").fadeIn(); - } + } + function cantLoadInitialDatas(response) { + $scope.errMessage = response.data.error_message; + $("#canNotModify").fadeIn(); + } }; @@ -542,7 +529,7 @@ app.controller('modifyWebsitesController', function($scope,$http) { /* Java script code to create account */ -app.controller('websitePages', function($scope, $http, $timeout, $window) { +app.controller('websitePages', function ($scope, $http, $timeout, $window) { $scope.logFileLoading = true; $scope.logsFeteched = true; @@ -552,118 +539,116 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.hideLogs = true; $scope.hideErrorLogs = true; - $scope.hidelogsbtn = function(){ + $scope.hidelogsbtn = function () { $scope.hideLogs = true; }; - $scope.hideErrorLogsbtn = function(){ + $scope.hideErrorLogsbtn = function () { $scope.hideLogs = true; }; - $scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text(); + $scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text(); $scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall"; $scope.joomlaInstallURL = $("#domainNamePage").text() + "/joomlaInstall"; $scope.setupGit = $("#domainNamePage").text() + "/setupGit"; $scope.installPrestaURL = $("#domainNamePage").text() + "/installPrestaShop"; - $scope.domainAliasURL = "/websites/"+$("#domainNamePage").text()+"/domainAlias"; - $scope.previewUrl = "/preview/"+$("#domainNamePage").text()+"/"; + $scope.domainAliasURL = "/websites/" + $("#domainNamePage").text() + "/domainAlias"; + $scope.previewUrl = "/preview/" + $("#domainNamePage").text() + "/"; var logType = 0; $scope.pageNumber = 1; - $scope.fetchLogs = function(type){ + $scope.fetchLogs = function (type) { - var pageNumber = $scope.pageNumber; + var pageNumber = $scope.pageNumber; - if(type==3){ - pageNumber = $scope.pageNumber+1; - $scope.pageNumber = pageNumber; - } - else if(type==4){ - pageNumber = $scope.pageNumber-1; - $scope.pageNumber = pageNumber; - } - else{ - logType = type; - } + if (type == 3) { + pageNumber = $scope.pageNumber + 1; + $scope.pageNumber = pageNumber; + } + else if (type == 4) { + pageNumber = $scope.pageNumber - 1; + $scope.pageNumber = pageNumber; + } + else { + logType = type; + } - $scope.logFileLoading = false; - $scope.logsFeteched = true; + $scope.logFileLoading = false; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = true; + $scope.fetchedData = false; + $scope.hideErrorLogs = true; + + + url = "/websites/getDataFromLogFile"; + + var domainNamePage = $("#domainNamePage").text(); + + + var data = { + logType: logType, + virtualHost: domainNamePage, + page: pageNumber, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.logstatus == 1) { + + + $scope.logFileLoading = true; + $scope.logsFeteched = false; $scope.couldNotFetchLogs = true; $scope.couldNotConnect = true; $scope.fetchedData = false; - $scope.hideErrorLogs = true; + $scope.hideLogs = false; + $scope.records = JSON.parse(response.data.data); - url = "/websites/getDataFromLogFile"; + } - var domainNamePage = $("#domainNamePage").text(); + else { + + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = false; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideLogs = false; - var data = { - logType: logType, - virtualHost:domainNamePage, - page:pageNumber, - }; + $scope.errorMessage = response.data.error_message; + console.log(domainNamePage) - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } - if(response.data.logstatus == 1){ + function cantLoadInitialDatas(response) { + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = false; + $scope.fetchedData = true; + $scope.hideLogs = false; - $scope.logFileLoading = true; - $scope.logsFeteched = false; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = true; - $scope.fetchedData = false; - $scope.hideLogs = false; - - - $scope.records = JSON.parse(response.data.data); - - } - - else - { - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = false; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = false; - - - $scope.errorMessage = response.data.error_message; - console.log(domainNamePage) - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = false; - $scope.fetchedData = true; - $scope.hideLogs = false; - - } - + } }; @@ -671,108 +656,106 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.errorPageNumber = 1; - $scope.fetchErrorLogs = function(type){ + $scope.fetchErrorLogs = function (type) { - var errorPageNumber = $scope.errorPageNumber; + var errorPageNumber = $scope.errorPageNumber; - if(type==3){ - errorPageNumber = $scope.errorPageNumber+1; - $scope.errorPageNumber = errorPageNumber; - } - else if(type==4){ - errorPageNumber = $scope.errorPageNumber-1; - $scope.errorPageNumber = errorPageNumber; - } - else{ - logType = type; - } + if (type == 3) { + errorPageNumber = $scope.errorPageNumber + 1; + $scope.errorPageNumber = errorPageNumber; + } + else if (type == 4) { + errorPageNumber = $scope.errorPageNumber - 1; + $scope.errorPageNumber = errorPageNumber; + } + else { + logType = type; + } + + // notifications + + $scope.logFileLoading = false; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideErrorLogs = true; + $scope.hideLogs = false; + + + url = "/websites/fetchErrorLogs"; + + var domainNamePage = $("#domainNamePage").text(); + + + var data = { + virtualHost: domainNamePage, + page: errorPageNumber, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.logstatus === 1) { + // notifications - $scope.logFileLoading = false; - $scope.logsFeteched = true; + $scope.logFileLoading = true; + $scope.logsFeteched = false; $scope.couldNotFetchLogs = true; $scope.couldNotConnect = true; $scope.fetchedData = true; - $scope.hideErrorLogs = true; $scope.hideLogs = false; + $scope.hideErrorLogs = false; + $scope.errorLogsData = response.data.data; - url = "/websites/fetchErrorLogs"; + } - var domainNamePage = $("#domainNamePage").text(); + else { + + // notifications + + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = false; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideLogs = true; + $scope.hideErrorLogs = true; - var data = { - virtualHost:domainNamePage, - page:errorPageNumber, - }; + $scope.errorMessage = response.data.error_message; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } - if(response.data.logstatus === 1){ + function cantLoadInitialDatas(response) { + // notifications - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = false; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = false; - $scope.hideErrorLogs = false; - - - $scope.errorLogsData = response.data.data; - - } - - else - { - - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = false; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = true; - $scope.hideErrorLogs = true; - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = false; - $scope.fetchedData = true; - $scope.hideLogs = true; - $scope.hideErrorLogs = true; - - } + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = false; + $scope.fetchedData = true; + $scope.hideLogs = true; + $scope.hideErrorLogs = true; + } }; @@ -788,18 +771,83 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.configSaved = true; $scope.couldNotSaveConfigurations = true; - $scope.hideconfigbtn = function(){ + $scope.hideconfigbtn = function () { $scope.configurationsBox = true; }; - $scope.fetchConfigurations = function(){ + $scope.fetchConfigurations = function () { - $scope.hidsslconfigs = true; + $scope.hidsslconfigs = true; + $scope.configurationsBoxRewrite = true; + $scope.changePHPView = true; + + + //Rewrite rules + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + + /// + + $scope.configFileLoading = false; + + + url = "/websites/getDataFromConfigFile"; + + var virtualHost = $("#domainNamePage").text(); + + + var data = { + virtualHost: virtualHost, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.configstatus === 1) { + + //Rewrite rules + $scope.configurationsBoxRewrite = true; - $scope.changePHPView = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + /// + + $scope.configurationsBox = false; + $scope.configsFetched = false; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = false; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = false; + + + $scope.configData = response.data.configData; + + } + + else { //Rewrite rules $scope.configurationsBoxRewrite = true; @@ -811,196 +859,123 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.saveRewriteRulesBTN = true; /// - - $scope.configFileLoading = false; + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = false; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.errorMessage = response.data.error_message; - url = "/websites/getDataFromConfigFile"; - - var virtualHost = $("#domainNamePage").text(); + } + } - var data = { - virtualHost: virtualHost, - }; + function cantLoadInitialDatas(response) { - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + //Rewrite rules + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + /// - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = false; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; - function ListInitialDatas(response) { - - if(response.data.configstatus === 1){ - - //Rewrite rules - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - /// - - $scope.configurationsBox = false; - $scope.configsFetched = false; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = false; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = false; - - - - $scope.configData = response.data.configData; - - } - - else - { - - //Rewrite rules - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - /// - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = false; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - //Rewrite rules - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - /// - - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = false; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - - - } - + } }; - $scope.saveCongiruations = function(){ + $scope.saveCongiruations = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; + url = "/websites/saveConfigsToFile"; - url = "/websites/saveConfigsToFile"; - - var virtualHost = $("#domainNamePage").text(); - var configData = $scope.configData; + var virtualHost = $("#domainNamePage").text(); + var configData = $scope.configData; + var data = { + virtualHost: virtualHost, + configData: configData, + }; - var data = { - virtualHost: virtualHost, - configData:configData, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.configstatus === 1){ + if (response.data.configstatus === 1) { - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = false; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = false; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; - } + } - else - { - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = false; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = false; + else { + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = false; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = false; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = false; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; + function cantLoadInitialDatas(response) { + + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = false; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; - } - + } }; @@ -1016,235 +991,227 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.fetchedRewriteRules = true; $scope.saveRewriteRulesBTN = true; - $scope.hideRewriteRulesbtn = function() { + $scope.hideRewriteRulesbtn = function () { $scope.configurationsBoxRewrite = true; }; - $scope.fetchRewriteFules = function(){ + $scope.fetchRewriteFules = function () { - $scope.hidsslconfigs = true; - $scope.configurationsBox = true; - $scope.changePHPView = true; + $scope.hidsslconfigs = true; + $scope.configurationsBox = true; + $scope.changePHPView = true; + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; + + $scope.configFileLoading = false; + + + url = "/websites/getRewriteRules"; + + var virtualHost = $("#domainNamePage").text(); + + + var data = { + virtualHost: virtualHost, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.rewriteStatus == 1) { + + + // from main + $scope.configurationsBox = true; $scope.configsFetched = true; $scope.couldNotFetchConfigs = true; + $scope.fetchedConfigsData = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; + + // main ends + + $scope.configFileLoading = true; + + // + + + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = false; + $scope.saveRewriteRulesBTN = false; $scope.couldNotConnect = true; + + + $scope.rewriteRules = response.data.rewriteRules; + + } + + else { + // from main + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; $scope.fetchedConfigsData = true; $scope.configFileLoading = true; $scope.configSaved = true; $scope.couldNotSaveConfigurations = true; $scope.saveConfigBtn = true; + // from main - $scope.configFileLoading = false; + $scope.configFileLoading = true; + + /// + + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = false; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + $scope.couldNotConnect = true; + $scope.errorMessage = response.data.error_message; - url = "/websites/getRewriteRules"; - - var virtualHost = $("#domainNamePage").text(); + } + } - var data = { - virtualHost: virtualHost, - }; + function cantLoadInitialDatas(response) { + // from main - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + // from main + + $scope.configFileLoading = true; + + /// + + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + + $scope.couldNotConnect = false; - function ListInitialDatas(response) { - - if(response.data.rewriteStatus == 1){ - - - // from main - - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - - // main ends - - $scope.configFileLoading = true; - - // - - - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = false; - $scope.saveRewriteRulesBTN = false; - $scope.couldNotConnect = true; - - - - $scope.rewriteRules = response.data.rewriteRules; - - } - - else - { - // from main - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - // from main - - $scope.configFileLoading = true; - - /// - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = false; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - $scope.couldNotConnect = true; - - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - // from main - - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - - // from main - - $scope.configFileLoading = true; - - /// - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - $scope.couldNotConnect = false; - - - } - + } }; - $scope.saveRewriteRules = function(){ + $scope.saveRewriteRules = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; + url = "/websites/saveRewriteRules"; - url = "/websites/saveRewriteRules"; - - var virtualHost = $("#domainNamePage").text(); - var rewriteRules = $scope.rewriteRules; + var virtualHost = $("#domainNamePage").text(); + var rewriteRules = $scope.rewriteRules; + var data = { + virtualHost: virtualHost, + rewriteRules: rewriteRules, + }; - var data = { - virtualHost: virtualHost, - rewriteRules:rewriteRules, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.rewriteStatus == 1){ + if (response.data.rewriteStatus == 1) { - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = false; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - $scope.configFileLoading = true; + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = false; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + $scope.configFileLoading = true; - } + } - else - { - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = false; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = false; + else { + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = false; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = false; - $scope.configFileLoading = true; + $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = false; + function cantLoadInitialDatas(response) { - $scope.configFileLoading = true; + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = false; - $scope.couldNotConnect = false; + $scope.configFileLoading = true; + + $scope.couldNotConnect = false; - } - + } }; @@ -1259,186 +1226,186 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.couldNotConnect = true; - $scope.installationDetails = function(){ + $scope.installationDetails = function () { $scope.installationDetailsForm = !$scope.installationDetailsForm; $scope.installationDetailsFormJoomla = true; }; - $scope.installationDetailsJoomla = function(){ + $scope.installationDetailsJoomla = function () { $scope.installationDetailsFormJoomla = !$scope.installationDetailsFormJoomla; $scope.installationDetailsForm = true; }; - $scope.installWordpress = function(){ + $scope.installWordpress = function () { + $scope.installationDetailsForm = false; + $scope.applicationInstallerLoading = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + + var domain = $("#domainNamePage").text(); + var path = $scope.installPath; + + url = "/websites/installWordpress"; + + var home = "1"; + + if (typeof path != 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus == 1) { + if (typeof path != 'undefined') { + $scope.installationURL = "http://" + domain + "/" + path; + } + else { + $scope.installationURL = domain; + } + $scope.installationDetailsForm = false; - $scope.applicationInstallerLoading = false; + $scope.applicationInstallerLoading = true; $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + + } + else { + + $scope.installationDetailsForm = false; + $scope.applicationInstallerLoading = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - var domain = $("#domainNamePage").text(); - var path = $scope.installPath; + $scope.errorMessage = response.data.error_message; - url = "/websites/installWordpress"; - - var home = "1"; - - if (typeof path != 'undefined'){ - home = "0"; - } + } - var data = { - domain: domain, - home:home, - path:path, - }; + } - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + function cantLoadInitialDatas(response) { - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.installationDetailsForm = false; + $scope.applicationInstallerLoading = true; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = false; - - function ListInitialDatas(response) { - - if (response.data.installStatus == 1) - { - if (typeof path != 'undefined'){ - $scope.installationURL = "http://"+domain+"/"+path; - } - else{ - $scope.installationURL = domain; - } - - $scope.installationDetailsForm = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - - } - else{ - - $scope.installationDetailsForm = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.installationDetailsForm = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = true; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = false; - - } + } }; - $scope.installJoomla = function(){ + $scope.installJoomla = function () { + $scope.installationDetailsFormJoomla = false; + $scope.applicationInstallerLoading = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + + var domain = $("#domainNamePage").text(); + var path = $scope.installPath; + var sitename = $scope.sitename; + var username = $scope.username; + var password = $scope.password; + var prefix = $scope.prefix; + + + url = "/websites/installJoomla"; + + var home = "1"; + + if (typeof path != 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + sitename: sitename, + username: username, + password: password, + prefix: prefix, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus == 1) { + if (typeof path != 'undefined') { + $scope.installationURL = "http://" + domain + "/" + path; + } + else { + $scope.installationURL = domain; + } + $scope.installationDetailsFormJoomla = false; - $scope.applicationInstallerLoading = false; + $scope.applicationInstallerLoading = true; $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + + } + else { + + $scope.installationDetailsFormJoomla = false; + $scope.applicationInstallerLoading = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - var domain = $("#domainNamePage").text(); - var path = $scope.installPath; - var sitename = $scope.sitename; - var username = $scope.username; - var password = $scope.password; - var prefix = $scope.prefix; + $scope.errorMessage = response.data.error_message; + + } - url = "/websites/installJoomla"; + } - var home = "1"; + function cantLoadInitialDatas(response) { - if (typeof path != 'undefined'){ - home = "0"; - } + $scope.installationDetailsFormJoomla = false; + $scope.applicationInstallerLoading = true; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = false; - - var data = { - domain: domain, - home:home, - path:path, - sitename:sitename, - username:username, - password:password, - prefix:prefix, - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.installStatus == 1) - { - if (typeof path != 'undefined'){ - $scope.installationURL = "http://"+domain+"/"+path; - } - else{ - $scope.installationURL = domain; - } - - $scope.installationDetailsFormJoomla = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - - } - else{ - - $scope.installationDetailsFormJoomla = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.installationDetailsFormJoomla = false; - $scope.applicationInstallerLoading = true; - $scope.installationFailed = true; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = false; - - } + } }; @@ -1451,82 +1418,79 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.couldNotConnect = true; - $scope.hidesslbtn = function(){ + $scope.hidesslbtn = function () { $scope.hidsslconfigs = true; }; - $scope.addSSL = function(){ + $scope.addSSL = function () { $scope.hidsslconfigs = false; $scope.configurationsBox = true; $scope.configurationsBoxRewrite = true; $scope.changePHPView = true; }; - $scope.saveSSL = function(){ + $scope.saveSSL = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; - url = "/websites/saveSSL"; + url = "/websites/saveSSL"; - var virtualHost = $("#domainNamePage").text(); - var cert = $scope.cert; - var key = $scope.key; + var virtualHost = $("#domainNamePage").text(); + var cert = $scope.cert; + var key = $scope.key; + var data = { + virtualHost: virtualHost, + cert: cert, + key: key + }; - var data = { - virtualHost: virtualHost, - cert:cert, - key:key - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.sslStatus == 1){ + if (response.data.sslStatus == 1) { - $scope.sslSaved = false; - $scope.couldNotSaveSSL = true; - $scope.couldNotConnect = true; - $scope.configFileLoading = true; + $scope.sslSaved = false; + $scope.couldNotSaveSSL = true; + $scope.couldNotConnect = true; + $scope.configFileLoading = true; - } + } - else - { + else { - $scope.sslSaved = true; - $scope.couldNotSaveSSL = false; - $scope.couldNotConnect = true; - $scope.configFileLoading = true; + $scope.sslSaved = true; + $scope.couldNotSaveSSL = false; + $scope.couldNotConnect = true; + $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.sslSaved = true; - $scope.couldNotSaveSSL = true; - $scope.couldNotConnect = false; - $scope.configFileLoading = true; + function cantLoadInitialDatas(response) { + + $scope.sslSaved = true; + $scope.couldNotSaveSSL = true; + $scope.couldNotConnect = false; + $scope.configFileLoading = true; - - - } + } }; @@ -1539,82 +1503,83 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.changePHPView = true; - $scope.hideChangePHPMaster = function(){ + $scope.hideChangePHPMaster = function () { $scope.changePHPView = true; }; - $scope.changePHPMaster = function(){ + $scope.changePHPMaster = function () { $scope.hidsslconfigs = true; $scope.configurationsBox = true; $scope.configurationsBoxRewrite = true; $scope.changePHPView = false; }; - $scope.changePHPVersionMaster = function(childDomain,phpSelection){ + $scope.changePHPVersionMaster = function (childDomain, phpSelection) { + + // notifcations + + $scope.configFileLoading = false; + + var url = "/websites/changePHP"; + + var data = { + childDomain: $("#domainNamePage").text(), + phpSelection: $scope.phpSelectionMaster, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changePHP === 1) { + + $scope.configFileLoading = true; + $scope.websiteDomain = $("#domainNamePage").text(); + // notifcations - $scope.configFileLoading = false; - - var url = "/websites/changePHP"; - - var data = { - childDomain:$("#domainNamePage").text(), - phpSelection:$scope.phpSelectionMaster, - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.failedToChangePHPMaster = true; + $scope.phpChangedMaster = false; + $scope.couldNotConnect = true; - function ListInitialDatas(response) { + } + else { + + $scope.configFileLoading = true; + $scope.errorMessage = response.data.error_message; + + // notifcations + + $scope.failedToChangePHPMaster = false; + $scope.phpChangedMaster = true; + $scope.couldNotConnect = true; + + } - if(response.data.changePHP === 1){ + } - $scope.configFileLoading = true; - $scope.websiteDomain = $("#domainNamePage").text(); + function cantLoadInitialDatas(response) { + $scope.configFileLoading = true; - // notifcations + // notifcations - $scope.failedToChangePHPMaster = true; - $scope.phpChangedMaster = false; - $scope.couldNotConnect = true; + $scope.failedToChangePHPMaster = true; + $scope.phpChangedMaster = true; + $scope.couldNotConnect = false; - - } - else{ - - $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; - - // notifcations - - $scope.failedToChangePHPMaster = false; - $scope.phpChangedMaster = true; - $scope.couldNotConnect = true; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.configFileLoading = true; - - // notifcations - - $scope.failedToChangePHPMaster = true; - $scope.phpChangedMaster = true; - $scope.couldNotConnect = false; - - } + } }; @@ -1643,108 +1608,104 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { var statusFile; - $scope.createDomain = function(){ + $scope.createDomain = function () { - $scope.domainLoading = false; + $scope.domainLoading = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = true; + $scope.goBackDisable = true; + $scope.currentStatus = "Starting creation.."; + + var ssl, dkimCheck, openBasedir; + + if ($scope.sslCheck === true) { + ssl = 1; + } + else { + ssl = 0 + } + + if ($scope.dkimCheck === true) { + dkimCheck = 1; + } + else { + dkimCheck = 0 + } + + if ($scope.openBasedir === true) { + openBasedir = 1; + } + else { + openBasedir = 0 + } + + + url = "/websites/submitDomainCreation"; + var domainName = $scope.domainNameCreate; + var phpSelection = $scope.phpSelection; + + var path = $scope.docRootPath; + + if (typeof path === 'undefined') { + path = ""; + } + + + var data = { + domainName: domainName, + phpSelection: phpSelection, + ssl: ssl, + path: path, + masterDomain: $("#domainNamePage").text(), + dkimCheck: dkimCheck, + openBasedir: openBasedir + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.createWebSiteStatus === 1) { + statusFile = response.data.tempStatusPath; + getCreationStatus(); + } + else { + + $scope.domainLoading = true; $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.errorMessageBox = true; + $scope.errorMessageBox = false; $scope.success = true; $scope.couldNotConnect = true; - $scope.goBackDisable = true; - $scope.currentStatus = "Starting creation.."; + $scope.goBackDisable = false; - var ssl, dkimCheck, openBasedir; - - if ($scope.sslCheck === true){ - ssl = 1; - } - else{ - ssl = 0 - } - - if ($scope.dkimCheck === true){ - dkimCheck = 1; - } - else{ - dkimCheck = 0 - } - - if ($scope.openBasedir === true){ - openBasedir = 1; - } - else{ - openBasedir = 0 - } + $scope.errorMessage = response.data.error_message; + } - url = "/websites/submitDomainCreation"; - var domainName = $scope.domainNameCreate; - var phpSelection = $scope.phpSelection; - - var path = $scope.docRootPath; - - if (typeof path === 'undefined'){ - path = ""; - } - - - var data = { - domainName: domainName, - phpSelection: phpSelection, - ssl:ssl, - path:path, - masterDomain:$("#domainNamePage").text(), - dkimCheck:dkimCheck, - openBasedir:openBasedir - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.createWebSiteStatus === 1) - { - statusFile = response.data.tempStatusPath; - getCreationStatus(); - } - else{ - - $scope.domainLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = false; - $scope.success = true; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - } - - - - } - function cantLoadInitialDatas(response) { - - $scope.domainLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = true; - $scope.success = true; - $scope.couldNotConnect = false; - $scope.goBackDisable = false; - - } + } + function cantLoadInitialDatas(response) { + $scope.domainLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = false; + $scope.goBackDisable = false; + } }; @@ -1760,87 +1721,87 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $("#installProgress").css("width", "0%"); }; - function getCreationStatus(){ + function getCreationStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile - }; + var data = { + statusFile: statusFile + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ - - $scope.domainLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = true; - $scope.success = false; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - - } - else{ - - $scope.domainLoading = true; - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.errorMessageBox = false; - $scope.success = true; - $scope.couldNotConnect = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - $scope.goBackDisable = false; - - } - - } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - $timeout(getCreationStatus,1000); - } - - } - function cantLoadInitialDatas(response) { + if (response.data.installStatus === 1) { $scope.domainLoading = true; $scope.installationDetailsForm = true; $scope.installationProgress = false; $scope.errorMessageBox = true; + $scope.success = false; + $scope.couldNotConnect = true; + $scope.goBackDisable = false; + + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + + } + else { + + $scope.domainLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = false; $scope.success = true; - $scope.couldNotConnect = false; + $scope.couldNotConnect = true; + $scope.goBackDisable = false; + + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; $scope.goBackDisable = false; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; + $timeout(getCreationStatus, 1000); + } - } + } + + function cantLoadInitialDatas(response) { + + $scope.domainLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = false; + $scope.goBackDisable = false; + + } + + + } ////// List Domains Part @@ -1868,209 +1829,324 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $("#listDomains").fadeOut(); }; - function fetchDomains(){ - $scope.domainLoading = false; + function fetchDomains() { + $scope.domainLoading = false; - var url = "/websites/fetchDomains"; + var url = "/websites/fetchDomains"; - var data = { - masterDomain:$("#domainNamePage").text(), - }; + var data = { + masterDomain: $("#domainNamePage").text(), + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.fetchStatus === 1){ + if (response.data.fetchStatus === 1) { - $scope.childDomains = JSON.parse(response.data.data); - $scope.domainLoading = true; + $scope.childDomains = JSON.parse(response.data.data); + $scope.domainLoading = true; - } - else{ - $scope.domainError = false; - $scope.errorMessage = response.data.error_message; - $scope.domainLoading = true; - } + } + else { + $scope.domainError = false; + $scope.errorMessage = response.data.error_message; + $scope.domainLoading = true; + } - } - function cantLoadInitialDatas(response) { + } - $scope.couldNotConnect = false; + function cantLoadInitialDatas(response) { - } + $scope.couldNotConnect = false; + + } } - $scope.changePHP = function(childDomain,phpSelection){ + $scope.changePHP = function (childDomain, phpSelection) { + + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.domainLoading = false; + $scope.childBaseDirChanged = true; + + var url = "/websites/changePHP"; + + var data = { + childDomain: childDomain, + phpSelection: phpSelection, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changePHP === 1) { + + $scope.domainLoading = true; + + $scope.changedPHPVersion = phpSelection; + // notifcations - $scope.phpChanged = true; + $scope.phpChanged = false; $scope.domainError = true; $scope.couldNotConnect = true; $scope.domainDeleted = true; $scope.sslIssued = true; - $scope.domainLoading = false; $scope.childBaseDirChanged = true; - var url = "/websites/changePHP"; - var data = { - childDomain:childDomain, - phpSelection:phpSelection, - }; + } + else { + $scope.errorMessage = response.data.error_message; + $scope.domainLoading = true; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + // notifcations - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.phpChanged = true; + $scope.domainError = false; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.childBaseDirChanged = true; + } - function ListInitialDatas(response) { + } + function cantLoadInitialDatas(response) { - if(response.data.changePHP === 1){ + $scope.domainLoading = true; - $scope.domainLoading = true; + // notifcations - $scope.changedPHPVersion = phpSelection; + $scope.phpChanged = true; + $scope.domainError = false; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.childBaseDirChanged = true; - - // notifcations - - $scope.phpChanged = false; - $scope.domainError = true; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.childBaseDirChanged = true; - - - } - else{ - $scope.errorMessage = response.data.error_message; - $scope.domainLoading = true; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = false; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.childBaseDirChanged = true; - } - - - } - function cantLoadInitialDatas(response) { - - $scope.domainLoading = true; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = false; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.childBaseDirChanged = true; - - } + } }; - $scope.changeChildBaseDir = function(childDomain,openBasedirValue){ + $scope.changeChildBaseDir = function (childDomain, openBasedirValue) { - // notifcations + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.domainLoading = false; + $scope.childBaseDirChanged = true; + + + var url = "/websites/changeOpenBasedir"; + + var data = { + domainName: childDomain, + openBasedirValue: openBasedirValue + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changeOpenBasedir === 1) { $scope.phpChanged = true; $scope.domainError = true; $scope.couldNotConnect = true; $scope.domainDeleted = true; $scope.sslIssued = true; - $scope.domainLoading = false; + $scope.domainLoading = true; + $scope.childBaseDirChanged = false; + + } + else { + + $scope.phpChanged = true; + $scope.domainError = false; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.domainLoading = true; $scope.childBaseDirChanged = true; + $scope.errorMessage = response.data.error_message; - var url = "/websites/changeOpenBasedir"; - - var data = { - domainName:childDomain, - openBasedirValue:openBasedirValue - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } + + function cantLoadInitialDatas(response) { + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = false; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.domainLoading = true; + $scope.childBaseDirChanged = true; - if(response.data.changeOpenBasedir === 1){ - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.domainLoading = true; - $scope.childBaseDirChanged = false; - - } - else{ - - $scope.phpChanged = true; - $scope.domainError = false; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.domainLoading = true; - $scope.childBaseDirChanged = true; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = false; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.domainLoading = true; - $scope.childBaseDirChanged = true; - - - } + } } - $scope.deleteChildDomain = function(childDomain){ - $scope.domainLoading = false; + $scope.deleteChildDomain = function (childDomain) { + $scope.domainLoading = false; + + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + + url = "/websites/submitDomainDeletion"; + + var data = { + websiteName: childDomain, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.websiteDeleteStatus === 1) { + + $scope.domainLoading = true; + $scope.deletedDomain = childDomain; + + fetchDomains(); + + + // notifications + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = true; + $scope.domainDeleted = false; + $scope.sslIssued = true; + + + } + else { + $scope.errorMessage = response.data.error_message; + $scope.domainLoading = true; + + // notifcations + + $scope.phpChanged = true; + $scope.domainError = false; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + } + + + } + + function cantLoadInitialDatas(response) { + + $scope.domainLoading = true; + + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = false; + $scope.domainDeleted = true; + $scope.sslIssued = true; + + } + + }; + + $scope.issueSSL = function (childDomain, path) { + $scope.domainLoading = false; + + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = true; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.childBaseDirChanged = true; + + var url = "/manageSSL/issueSSL"; + + + var data = { + virtualHost: childDomain, + path: path, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.SSL === 1) { + + $scope.domainLoading = true; // notifcations @@ -2078,164 +2154,47 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.domainError = true; $scope.couldNotConnect = true; $scope.domainDeleted = true; - $scope.sslIssued = true; - - url = "/websites/submitDomainDeletion"; - - var data = { - websiteName: childDomain, - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.sslIssued = false; + $scope.childBaseDirChanged = true; - function ListInitialDatas(response) { + $scope.sslDomainIssued = childDomain; - if(response.data.websiteDeleteStatus === 1){ + } - $scope.domainLoading = true; - $scope.deletedDomain = childDomain; + else { + $scope.domainLoading = true; - fetchDomains(); - - - // notifications - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = true; - $scope.domainDeleted = false; - $scope.sslIssued = true; - - - - } - else{ - $scope.errorMessage = response.data.error_message; - $scope.domainLoading = true; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = false; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - } - - - } - function cantLoadInitialDatas(response) { - - $scope.domainLoading = true; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = false; - $scope.domainDeleted = true; - $scope.sslIssued = true; - - } - - }; - - $scope.issueSSL = function(childDomain,path){ - $scope.domainLoading = false; + $scope.errorMessage = response.data.error_message; // notifcations $scope.phpChanged = true; - $scope.domainError = true; + $scope.domainError = false; $scope.couldNotConnect = true; $scope.domainDeleted = true; $scope.sslIssued = true; $scope.childBaseDirChanged = true; - var url = "/manageSSL/issueSSL"; + } - var data = { - virtualHost:childDomain, - path:path, - }; + } - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - - if(response.data.SSL === 1){ - - $scope.domainLoading = true; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = false; - $scope.childBaseDirChanged = true; - - - - $scope.sslDomainIssued = childDomain; - - - } - - else - { - $scope.domainLoading = true; - - $scope.errorMessage = response.data.error_message; - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = false; - $scope.couldNotConnect = true; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.childBaseDirChanged = true; - - } - - - - } - function cantLoadInitialDatas(response) { - - // notifcations - - $scope.phpChanged = true; - $scope.domainError = true; - $scope.couldNotConnect = false; - $scope.domainDeleted = true; - $scope.sslIssued = true; - $scope.childBaseDirChanged = true; - - - } + function cantLoadInitialDatas(response) { + // notifcations + + $scope.phpChanged = true; + $scope.domainError = true; + $scope.couldNotConnect = false; + $scope.domainDeleted = true; + $scope.sslIssued = true; + $scope.childBaseDirChanged = true; + } }; @@ -2250,7 +2209,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.openBaseDirBox = true; - $scope.openBaseDirView = function(){ + $scope.openBaseDirView = function () { $scope.openBaseDirBox = false; }; @@ -2258,82 +2217,81 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) { $scope.openBaseDirBox = true; }; - $scope.applyOpenBasedirChanges = function(childDomain,phpSelection){ + $scope.applyOpenBasedirChanges = function (childDomain, phpSelection) { - // notifcations + // notifcations - $scope.baseDirLoading = false; + $scope.baseDirLoading = false; + $scope.operationFailed = true; + $scope.operationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.openBaseDirBox = false; + + + var url = "/websites/changeOpenBasedir"; + + var data = { + domainName: $("#domainNamePage").text(), + openBasedirValue: $scope.openBasedirValue + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changeOpenBasedir === 1) { + + $scope.baseDirLoading = true; $scope.operationFailed = true; + $scope.operationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.openBaseDirBox = false; + + } + else { + + $scope.baseDirLoading = true; + $scope.operationFailed = false; $scope.operationSuccessfull = true; $scope.couldNotConnect = true; $scope.openBaseDirBox = false; + $scope.errorMessage = response.data.error_message; - var url = "/websites/changeOpenBasedir"; - - var data = { - domainName:$("#domainNamePage").text(), - openBasedirValue:$scope.openBasedirValue - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } + + function cantLoadInitialDatas(response) { + + $scope.baseDirLoading = true; + $scope.operationFailed = true; + $scope.operationSuccessfull = true; + $scope.couldNotConnect = false; + $scope.openBaseDirBox = false; - if(response.data.changeOpenBasedir === 1){ - - $scope.baseDirLoading = true; - $scope.operationFailed = true; - $scope.operationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.openBaseDirBox = false; - - } - else{ - - $scope.baseDirLoading = true; - $scope.operationFailed = false; - $scope.operationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.openBaseDirBox = false; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.baseDirLoading = true; - $scope.operationFailed = true; - $scope.operationSuccessfull = true; - $scope.couldNotConnect = false; - $scope.openBaseDirBox = false; - - - } + } } - - }); /* Java script code to create account ends here */ /* Java script code to suspend/un-suspend Website */ -app.controller('suspendWebsiteControl', function($scope,$http) { +app.controller('suspendWebsiteControl', function ($scope, $http) { $scope.suspendLoading = true; $scope.stateView = true; @@ -2343,113 +2301,113 @@ app.controller('suspendWebsiteControl', function($scope,$http) { $scope.websiteSuccess = true; $scope.couldNotConnect = true; - $scope.showSuspendUnsuspend = function(){ + $scope.showSuspendUnsuspend = function () { $scope.stateView = false; }; - $scope.save = function(){ + $scope.save = function () { - $scope.suspendLoading = false; + $scope.suspendLoading = false; - var websiteName = $scope.websiteToBeSuspended - var state = $scope.state; + var websiteName = $scope.websiteToBeSuspended + var state = $scope.state; - url = "/websites/submitWebsiteStatus"; + url = "/websites/submitWebsiteStatus"; - var data = { - websiteName: websiteName, - state: state, - }; + var data = { + websiteName: websiteName, + state: state, + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if (response.data.websiteStatus === 1) - { - if(state=="Suspend"){ + if (response.data.websiteStatus === 1) { + if (state == "Suspend") { - $scope.suspendLoading = true; - $scope.stateView = false; - - $scope.websiteSuspendFailure = true; - $scope.websiteUnsuspendFailure = true; - $scope.websiteSuccess = false; - $scope.couldNotConnect = true; - - $scope.websiteStatus = websiteName; - $scope.finalStatus = "Suspended"; - - } - else{ - $scope.suspendLoading = true; - $scope.stateView = false; - - $scope.websiteSuspendFailure = true; - $scope.websiteUnsuspendFailure = true; - $scope.websiteSuccess = false; - $scope.couldNotConnect = true; - - $scope.websiteStatus = websiteName; - $scope.finalStatus = "Un-suspended"; - - } - - } - else{ - - if(state=="Suspend"){ - - $scope.suspendLoading = true; - $scope.stateView = false; - - $scope.websiteSuspendFailure = false; - $scope.websiteUnsuspendFailure = true; - $scope.websiteSuccess = true; - $scope.couldNotConnect = true; - - - } - else{ - $scope.suspendLoading = true; - $scope.stateView = false; - - $scope.websiteSuspendFailure = true; - $scope.websiteUnsuspendFailure = false; - $scope.websiteSuccess = true; - $scope.couldNotConnect = true; - - - } - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - $scope.couldNotConnect = false; $scope.suspendLoading = true; - $scope.stateView = true; + $scope.stateView = false; $scope.websiteSuspendFailure = true; $scope.websiteUnsuspendFailure = true; - $scope.websiteSuccess = true; + $scope.websiteSuccess = false; + $scope.couldNotConnect = true; + + $scope.websiteStatus = websiteName; + $scope.finalStatus = "Suspended"; } + else { + $scope.suspendLoading = true; + $scope.stateView = false; + + $scope.websiteSuspendFailure = true; + $scope.websiteUnsuspendFailure = true; + $scope.websiteSuccess = false; + $scope.couldNotConnect = true; + + $scope.websiteStatus = websiteName; + $scope.finalStatus = "Un-suspended"; + + } + + } + else { + + if (state == "Suspend") { + + $scope.suspendLoading = true; + $scope.stateView = false; + + $scope.websiteSuspendFailure = false; + $scope.websiteUnsuspendFailure = true; + $scope.websiteSuccess = true; + $scope.couldNotConnect = true; + + + } + else { + $scope.suspendLoading = true; + $scope.stateView = false; + + $scope.websiteSuspendFailure = true; + $scope.websiteUnsuspendFailure = false; + $scope.websiteSuccess = true; + $scope.couldNotConnect = true; + + + } + + + $scope.errorMessage = response.data.error_message; + + } + + + } + + function cantLoadInitialDatas(response) { + $scope.couldNotConnect = false; + $scope.suspendLoading = true; + $scope.stateView = true; + + $scope.websiteSuspendFailure = true; + $scope.websiteUnsuspendFailure = true; + $scope.websiteSuccess = true; + + } }; @@ -2460,7 +2418,7 @@ app.controller('suspendWebsiteControl', function($scope,$http) { /* Java script code to manage cron */ -app.controller('manageCronController', function($scope,$http) { +app.controller('manageCronController', function ($scope, $http) { $("#manageCronLoading").hide(); $("#modifyCronForm").hide(); $("#cronTable").hide(); @@ -2471,7 +2429,7 @@ app.controller('manageCronController', function($scope,$http) { $("#cronEditSuccess").hide(); $("#fetchCronFailure").hide(); - $scope.fetchWebsites = function(){ + $scope.fetchWebsites = function () { $("#manageCronLoading").show(); $("#addCronFailure").hide(); @@ -2485,16 +2443,15 @@ app.controller('manageCronController', function($scope,$http) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { - if (response.data.getWebsiteCron === 0) - { + if (response.data.getWebsiteCron === 0) { console.log(response.data); $scope.errorMessage = response.data.error_message; $("#cronTable").hide(); @@ -2503,7 +2460,7 @@ app.controller('manageCronController', function($scope,$http) { $("#saveCronButton").hide(); $("#addCronButton").hide(); } - else{ + else { console.log(response.data); var finalData = response.data.crons; $scope.cronList = finalData; @@ -2514,6 +2471,7 @@ app.controller('manageCronController', function($scope,$http) { $("#addCronButton").hide(); } } + function cantLoadInitialDatas(response) { $("#manageCronLoading").hide(); $("#cronTable").hide(); @@ -2523,7 +2481,7 @@ app.controller('manageCronController', function($scope,$http) { } }; - $scope.fetchCron = function(cronLine){ + $scope.fetchCron = function (cronLine) { $("#cronTable").show(); $("#manageCronLoading").show(); @@ -2546,17 +2504,16 @@ app.controller('manageCronController', function($scope,$http) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { console.log(response); - if (response.data.getWebsiteCron === 0) - { + if (response.data.getWebsiteCron === 0) { console.log(response.data); $scope.errorMessage = response.data.error_message; $("#cronTable").show(); @@ -2565,7 +2522,7 @@ app.controller('manageCronController', function($scope,$http) { $("#saveCronButton").hide(); $("#addCronButton").hide(); } - else{ + else { console.log(response.data); $scope.minute = response.data.cron.minute @@ -2584,6 +2541,7 @@ app.controller('manageCronController', function($scope,$http) { } } + function cantLoadInitialDatas(response) { $("#manageCronLoading").hide(); $("#fetchCronFailure").show(); @@ -2592,7 +2550,7 @@ app.controller('manageCronController', function($scope,$http) { } }; - $scope.populate = function(){ + $scope.populate = function () { splitTime = $scope.defined.split(" "); $scope.minute = splitTime[0]; $scope.hour = splitTime[1]; @@ -2601,7 +2559,7 @@ app.controller('manageCronController', function($scope,$http) { $scope.weekday = splitTime[4]; } - $scope.addCronForm = function(){ + $scope.addCronForm = function () { $("#addCronFailure").hide(); $("#cronEditSuccess").hide(); @@ -2610,8 +2568,7 @@ app.controller('manageCronController', function($scope,$http) { if (!$scope.websiteToBeModified) { alert("Please select a domain first"); } - else - { + else { $scope.minute = $scope.hour = $scope.monthday = $scope.month = $scope.weekday = $scope.command = $scope.line = ""; $("#cronTable").hide(); @@ -2622,7 +2579,7 @@ app.controller('manageCronController', function($scope,$http) { } }; - $scope.addCronFunc = function(){ + $scope.addCronFunc = function () { $("#manageCronLoading").show(); $("#addCronFailure").hide(); @@ -2633,34 +2590,33 @@ app.controller('manageCronController', function($scope,$http) { url = "/websites/addNewCron"; var data = { - domain : websiteToBeModified, - minute : $scope.minute, - hour : $scope.hour, - monthday : $scope.monthday, - month : $scope.month, - weekday : $scope.weekday, - command : $scope.command + domain: websiteToBeModified, + minute: $scope.minute, + hour: $scope.hour, + monthday: $scope.monthday, + month: $scope.month, + weekday: $scope.weekday, + command: $scope.command }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { console.log(response); - if (response.data.addNewCron === 0) - { + if (response.data.addNewCron === 0) { $scope.errorMessage = response.data.error_message $("#manageCronLoading").hide(); $("#cronEditSuccess").hide(); $("#fetchCronFailure").hide(); $("#addCronFailure").show(); } - else{ + else { $("#cronTable").hide(); $("#manageCronLoading").hide(); $("#cronEditSuccess").show(); @@ -2669,6 +2625,7 @@ app.controller('manageCronController', function($scope,$http) { } } + function cantLoadInitialDatas(response) { $("#manageCronLoading").hide(); $("#addCronFailure").show(); @@ -2678,7 +2635,7 @@ app.controller('manageCronController', function($scope,$http) { }; - $scope.removeCron = function(line){ + $scope.removeCron = function (line) { $("#manageCronLoading").show(); @@ -2688,29 +2645,28 @@ app.controller('manageCronController', function($scope,$http) { url = "/websites/remCronbyLine"; var data = { - domain : $scope.websiteToBeModified, - line : line + domain: $scope.websiteToBeModified, + line: line }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { console.log(response); - if (response.data.remCronbyLine === 0) - { + if (response.data.remCronbyLine === 0) { $scope.errorMessage = response.data.error_message; $("#manageCronLoading").hide(); $("#cronEditSuccess").hide(); $("#fetchCronFailure").hide(); $("#addCronFailure").show(); } - else{ + else { $("#cronTable").hide(); $("#manageCronLoading").hide(); $("#cronEditSuccess").show(); @@ -2719,6 +2675,7 @@ app.controller('manageCronController', function($scope,$http) { } } + function cantLoadInitialDatas(response) { $("#manageCronLoading").hide(); $("#addCronFailure").show(); @@ -2727,7 +2684,7 @@ app.controller('manageCronController', function($scope,$http) { } }; - $scope.modifyCronFunc = function(){ + $scope.modifyCronFunc = function () { $("#manageCronLoading").show(); $("#addCronFailure").hide(); @@ -2738,27 +2695,26 @@ app.controller('manageCronController', function($scope,$http) { url = "/websites/saveCronChanges"; var data = { - domain : websiteToBeModified, - line : $scope.line, - minute : $scope.minute, - hour : $scope.hour, - monthday : $scope.monthday, - month : $scope.month, - weekday : $scope.weekday, - command : $scope.command + domain: websiteToBeModified, + line: $scope.line, + minute: $scope.minute, + hour: $scope.hour, + monthday: $scope.monthday, + month: $scope.month, + weekday: $scope.weekday, + command: $scope.command }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { - if (response.data.addNewCron === 0) - { + if (response.data.addNewCron === 0) { $scope.errorMessage = response.data.error_message; $("#manageCronLoading").hide(); @@ -2766,7 +2722,7 @@ app.controller('manageCronController', function($scope,$http) { $("#fetchCronFailure").hide(); $("#addCronFailure").show(); } - else{ + else { console.log(response.data); $("#cronTable").hide(); $("#manageCronLoading").hide(); @@ -2776,6 +2732,7 @@ app.controller('manageCronController', function($scope,$http) { } } + function cantLoadInitialDatas(response) { $("#manageCronLoading").hide(); $("#addCronFailure").show(); @@ -2790,7 +2747,7 @@ app.controller('manageCronController', function($scope,$http) { /* Java script code to manage cron */ -app.controller('manageAliasController', function($scope,$http, $timeout, $window) { +app.controller('manageAliasController', function ($scope, $http, $timeout, $window) { var masterDomain = ""; @@ -2818,82 +2775,83 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window $scope.manageAliasLoading = false; - var ssl; + var ssl; - if ($scope.sslCheck === true){ - ssl = 1; - } - else{ - ssl = 0 - } + if ($scope.sslCheck === true) { + ssl = 1; + } + else { + ssl = 0 + } - url = "/websites/submitAliasCreation"; + url = "/websites/submitAliasCreation"; - var data = { - masterDomain: masterDomain, - aliasDomain:$scope.aliasDomain, - ssl:ssl + var data = { + masterDomain: masterDomain, + aliasDomain: $scope.aliasDomain, + ssl: ssl - }; + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.createAliasStatus === 1){ + if (response.data.createAliasStatus === 1) { - $scope.aliasTable = true; - $scope.addAliasButton = true; - $scope.domainAliasForm = false; - $scope.aliasError = true; - $scope.couldNotConnect = true; - $scope.aliasCreated = false; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + $scope.aliasTable = true; + $scope.addAliasButton = true; + $scope.domainAliasForm = false; + $scope.aliasError = true; + $scope.couldNotConnect = true; + $scope.aliasCreated = false; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - $timeout(function() { $window.location.reload(); }, 3000); + $timeout(function () { + $window.location.reload(); + }, 3000); - } - else{ + } + else { - $scope.aliasTable = true; - $scope.addAliasButton = true; - $scope.domainAliasForm = false; - $scope.aliasError = false; - $scope.couldNotConnect = true; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + $scope.aliasTable = true; + $scope.addAliasButton = true; + $scope.domainAliasForm = false; + $scope.aliasError = false; + $scope.couldNotConnect = true; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.aliasTable = true; - $scope.addAliasButton = true; - $scope.domainAliasForm = false; - $scope.aliasError = true; - $scope.couldNotConnect = false; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + function cantLoadInitialDatas(response) { + + $scope.aliasTable = true; + $scope.addAliasButton = true; + $scope.domainAliasForm = false; + $scope.aliasError = true; + $scope.couldNotConnect = false; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - - - } + } }; @@ -2903,69 +2861,68 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window $scope.manageAliasLoading = false; - url = "/websites/issueAliasSSL"; + url = "/websites/issueAliasSSL"; - var data = { - masterDomain: masterDomain, - aliasDomain:aliasDomain, - }; + var data = { + masterDomain: masterDomain, + aliasDomain: aliasDomain, + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.sslStatus === 1){ + if (response.data.sslStatus === 1) { - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = true; - $scope.couldNotConnect = true; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = false; + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = true; + $scope.couldNotConnect = true; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = false; - } - else{ + } + else { - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = false; - $scope.couldNotConnect = true; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = false; + $scope.couldNotConnect = true; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = true; - $scope.couldNotConnect = false; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + function cantLoadInitialDatas(response) { + + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = true; + $scope.couldNotConnect = false; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - - - } + } }; @@ -2974,71 +2931,72 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window $scope.manageAliasLoading = false; - url = "/websites/delateAlias"; + url = "/websites/delateAlias"; - var data = { - masterDomain: masterDomain, - aliasDomain:aliasDomain, - }; + var data = { + masterDomain: masterDomain, + aliasDomain: aliasDomain, + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.deleteAlias === 1){ + if (response.data.deleteAlias === 1) { - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = true; - $scope.couldNotConnect = true; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = false; + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = true; + $scope.couldNotConnect = true; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = false; - $timeout(function() { $window.location.reload(); }, 3000); + $timeout(function () { + $window.location.reload(); + }, 3000); - } - else{ + } + else { - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = false; - $scope.couldNotConnect = true; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = false; + $scope.couldNotConnect = true; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.aliasTable = false; - $scope.addAliasButton = true; - $scope.domainAliasForm = true; - $scope.aliasError = true; - $scope.couldNotConnect = false; - $scope.aliasCreated = true; - $scope.manageAliasLoading = true; - $scope.operationSuccess = true; + function cantLoadInitialDatas(response) { + + $scope.aliasTable = false; + $scope.addAliasButton = true; + $scope.domainAliasForm = true; + $scope.aliasError = true; + $scope.couldNotConnect = false; + $scope.aliasCreated = true; + $scope.manageAliasLoading = true; + $scope.operationSuccess = true; - - - } + } }; @@ -3048,7 +3006,7 @@ app.controller('manageAliasController', function($scope,$http, $timeout, $window /* Java script code to manage cron ends here */ -app.controller('launchChild', function($scope,$http) { +app.controller('launchChild', function ($scope, $http) { $scope.logFileLoading = true; $scope.logsFeteched = true; @@ -3058,16 +3016,16 @@ app.controller('launchChild', function($scope,$http) { $scope.hideLogs = true; $scope.hideErrorLogs = true; - $scope.hidelogsbtn = function(){ + $scope.hidelogsbtn = function () { $scope.hideLogs = true; }; - $scope.hideErrorLogsbtn = function(){ + $scope.hideErrorLogsbtn = function () { $scope.hideLogs = true; }; - $scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text(); - $scope.previewUrl = "/preview/"+$("#childDomain").text()+"/"; + $scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text(); + $scope.previewUrl = "/preview/" + $("#childDomain").text() + "/"; $scope.wordPressInstallURL = "/websites/" + $("#childDomain").text() + "/wordpressInstall"; $scope.joomlaInstallURL = "/websites/" + $("#childDomain").text() + "/joomlaInstall"; $scope.setupGit = "/websites/" + $("#childDomain").text() + "/setupGit"; @@ -3076,99 +3034,97 @@ app.controller('launchChild', function($scope,$http) { var logType = 0; $scope.pageNumber = 1; - $scope.fetchLogs = function(type){ + $scope.fetchLogs = function (type) { - var pageNumber = $scope.pageNumber; + var pageNumber = $scope.pageNumber; - if(type==3){ - pageNumber = $scope.pageNumber+1; - $scope.pageNumber = pageNumber; - } - else if(type==4){ - pageNumber = $scope.pageNumber-1; - $scope.pageNumber = pageNumber; - } - else{ - logType = type; - } + if (type == 3) { + pageNumber = $scope.pageNumber + 1; + $scope.pageNumber = pageNumber; + } + else if (type == 4) { + pageNumber = $scope.pageNumber - 1; + $scope.pageNumber = pageNumber; + } + else { + logType = type; + } - $scope.logFileLoading = false; - $scope.logsFeteched = true; + $scope.logFileLoading = false; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = true; + $scope.fetchedData = false; + $scope.hideErrorLogs = true; + + + url = "/websites/getDataFromLogFile"; + + var domainNamePage = $("#domainNamePage").text(); + + + var data = { + logType: logType, + virtualHost: domainNamePage, + page: pageNumber, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.logstatus === 1) { + + + $scope.logFileLoading = true; + $scope.logsFeteched = false; $scope.couldNotFetchLogs = true; $scope.couldNotConnect = true; $scope.fetchedData = false; - $scope.hideErrorLogs = true; + $scope.hideLogs = false; + $scope.records = JSON.parse(response.data.data); - url = "/websites/getDataFromLogFile"; + } - var domainNamePage = $("#domainNamePage").text(); + else { + + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = false; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideLogs = false; - var data = { - logType: logType, - virtualHost:domainNamePage, - page:pageNumber, - }; + $scope.errorMessage = response.data.error_message; + console.log(domainNamePage) - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } - if(response.data.logstatus === 1){ + function cantLoadInitialDatas(response) { + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = false; + $scope.fetchedData = true; + $scope.hideLogs = false; - $scope.logFileLoading = true; - $scope.logsFeteched = false; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = true; - $scope.fetchedData = false; - $scope.hideLogs = false; - - - $scope.records = JSON.parse(response.data.data); - - } - - else - { - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = false; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = false; - - - $scope.errorMessage = response.data.error_message; - console.log(domainNamePage) - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = false; - $scope.fetchedData = true; - $scope.hideLogs = false; - - } - + } }; @@ -3176,108 +3132,106 @@ app.controller('launchChild', function($scope,$http) { $scope.errorPageNumber = 1; - $scope.fetchErrorLogs = function(type){ + $scope.fetchErrorLogs = function (type) { - var errorPageNumber = $scope.errorPageNumber; + var errorPageNumber = $scope.errorPageNumber; - if(type === 3){ - errorPageNumber = $scope.errorPageNumber+1; - $scope.errorPageNumber = errorPageNumber; - } - else if(type === 4){ - errorPageNumber = $scope.errorPageNumber-1; - $scope.errorPageNumber = errorPageNumber; - } - else{ - logType = type; - } + if (type === 3) { + errorPageNumber = $scope.errorPageNumber + 1; + $scope.errorPageNumber = errorPageNumber; + } + else if (type === 4) { + errorPageNumber = $scope.errorPageNumber - 1; + $scope.errorPageNumber = errorPageNumber; + } + else { + logType = type; + } + + // notifications + + $scope.logFileLoading = false; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideErrorLogs = true; + $scope.hideLogs = false; + + + url = "/websites/fetchErrorLogs"; + + var domainNamePage = $("#domainNamePage").text(); + + + var data = { + virtualHost: domainNamePage, + page: errorPageNumber, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.logstatus === 1) { + // notifications - $scope.logFileLoading = false; - $scope.logsFeteched = true; + $scope.logFileLoading = true; + $scope.logsFeteched = false; $scope.couldNotFetchLogs = true; $scope.couldNotConnect = true; $scope.fetchedData = true; - $scope.hideErrorLogs = true; $scope.hideLogs = false; + $scope.hideErrorLogs = false; + $scope.errorLogsData = response.data.data; - url = "/websites/fetchErrorLogs"; + } - var domainNamePage = $("#domainNamePage").text(); + else { + + // notifications + + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = false; + $scope.couldNotConnect = true; + $scope.fetchedData = true; + $scope.hideLogs = true; + $scope.hideErrorLogs = true; - var data = { - virtualHost:domainNamePage, - page:errorPageNumber, - }; + $scope.errorMessage = response.data.error_message; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } - if(response.data.logstatus === 1){ + function cantLoadInitialDatas(response) { + // notifications - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = false; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = false; - $scope.hideErrorLogs = false; - - - $scope.errorLogsData = response.data.data; - - } - - else - { - - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = false; - $scope.couldNotConnect = true; - $scope.fetchedData = true; - $scope.hideLogs = true; - $scope.hideErrorLogs = true; - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - // notifications - - $scope.logFileLoading = true; - $scope.logsFeteched = true; - $scope.couldNotFetchLogs = true; - $scope.couldNotConnect = false; - $scope.fetchedData = true; - $scope.hideLogs = true; - $scope.hideErrorLogs = true; - - } + $scope.logFileLoading = true; + $scope.logsFeteched = true; + $scope.couldNotFetchLogs = true; + $scope.couldNotConnect = false; + $scope.fetchedData = true; + $scope.hideLogs = true; + $scope.hideErrorLogs = true; + } }; @@ -3293,18 +3247,83 @@ app.controller('launchChild', function($scope,$http) { $scope.configSaved = true; $scope.couldNotSaveConfigurations = true; - $scope.hideconfigbtn = function(){ + $scope.hideconfigbtn = function () { $scope.configurationsBox = true; }; - $scope.fetchConfigurations = function(){ + $scope.fetchConfigurations = function () { - $scope.hidsslconfigs = true; + $scope.hidsslconfigs = true; + $scope.configurationsBoxRewrite = true; + $scope.changePHPView = true; + + + //Rewrite rules + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + + /// + + $scope.configFileLoading = false; + + + url = "/websites/getDataFromConfigFile"; + + var virtualHost = $("#childDomain").text(); + + + var data = { + virtualHost: virtualHost, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.configstatus === 1) { + + //Rewrite rules + $scope.configurationsBoxRewrite = true; - $scope.changePHPView = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + /// + + $scope.configurationsBox = false; + $scope.configsFetched = false; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = false; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = false; + + + $scope.configData = response.data.configData; + + } + + else { //Rewrite rules $scope.configurationsBoxRewrite = true; @@ -3316,196 +3335,123 @@ app.controller('launchChild', function($scope,$http) { $scope.saveRewriteRulesBTN = true; /// - - $scope.configFileLoading = false; + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = false; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.errorMessage = response.data.error_message; - url = "/websites/getDataFromConfigFile"; - - var virtualHost = $("#childDomain").text(); + } + } - var data = { - virtualHost: virtualHost, - }; + function cantLoadInitialDatas(response) { - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + //Rewrite rules + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + /// - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = false; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; - function ListInitialDatas(response) { - - if(response.data.configstatus === 1){ - - //Rewrite rules - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - /// - - $scope.configurationsBox = false; - $scope.configsFetched = false; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = false; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = false; - - - - $scope.configData = response.data.configData; - - } - - else - { - - //Rewrite rules - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - /// - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = false; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - //Rewrite rules - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - /// - - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = false; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - - - } - + } }; - $scope.saveCongiruations = function(){ + $scope.saveCongiruations = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; + url = "/websites/saveConfigsToFile"; - url = "/websites/saveConfigsToFile"; - - var virtualHost = $("#childDomain").text(); - var configData = $scope.configData; + var virtualHost = $("#childDomain").text(); + var configData = $scope.configData; + var data = { + virtualHost: virtualHost, + configData: configData, + }; - var data = { - virtualHost: virtualHost, - configData:configData, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.configstatus == 1){ + if (response.data.configstatus == 1) { - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = false; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = false; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; - } + } - else - { - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = true; - $scope.fetchedConfigsData = false; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = false; + else { + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = false; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = false; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.configurationsBox = false; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.couldNotConnect = false; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; + function cantLoadInitialDatas(response) { + + $scope.configurationsBox = false; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = false; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; - } - + } }; @@ -3521,236 +3467,228 @@ app.controller('launchChild', function($scope,$http) { $scope.fetchedRewriteRules = true; $scope.saveRewriteRulesBTN = true; - $scope.hideRewriteRulesbtn = function() { + $scope.hideRewriteRulesbtn = function () { $scope.configurationsBoxRewrite = true; }; - $scope.fetchRewriteFules = function(){ + $scope.fetchRewriteFules = function () { - $scope.hidsslconfigs = true; - $scope.configurationsBox = true; - $scope.changePHPView = true; + $scope.hidsslconfigs = true; + $scope.configurationsBox = true; + $scope.changePHPView = true; + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.couldNotConnect = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; + + $scope.configFileLoading = false; + + + url = "/websites/getRewriteRules"; + + var virtualHost = $("#childDomain").text(); + + + var data = { + virtualHost: virtualHost, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.rewriteStatus == 1) { + + + // from main + $scope.configurationsBox = true; $scope.configsFetched = true; $scope.couldNotFetchConfigs = true; + $scope.fetchedConfigsData = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; + + // main ends + + $scope.configFileLoading = true; + + // + + + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = false; + $scope.saveRewriteRulesBTN = false; $scope.couldNotConnect = true; + + + $scope.rewriteRules = response.data.rewriteRules; + + } + + else { + // from main + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; $scope.fetchedConfigsData = true; $scope.configFileLoading = true; $scope.configSaved = true; $scope.couldNotSaveConfigurations = true; $scope.saveConfigBtn = true; + // from main - $scope.configFileLoading = false; + $scope.configFileLoading = true; + + /// + + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = false; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + $scope.couldNotConnect = true; + $scope.errorMessage = response.data.error_message; - url = "/websites/getRewriteRules"; - - var virtualHost = $("#childDomain").text(); + } + } - var data = { - virtualHost: virtualHost, - }; + function cantLoadInitialDatas(response) { + // from main - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.configurationsBox = true; + $scope.configsFetched = true; + $scope.couldNotFetchConfigs = true; + $scope.fetchedConfigsData = true; + $scope.configFileLoading = true; + $scope.configSaved = true; + $scope.couldNotSaveConfigurations = true; + $scope.saveConfigBtn = true; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + // from main + + $scope.configFileLoading = true; + + /// + + $scope.configurationsBoxRewrite = true; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + + $scope.couldNotConnect = false; - function ListInitialDatas(response) { - - if(response.data.rewriteStatus == 1){ - - - // from main - - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - - // main ends - - $scope.configFileLoading = true; - - // - - - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = false; - $scope.saveRewriteRulesBTN = false; - $scope.couldNotConnect = true; - - - - $scope.rewriteRules = response.data.rewriteRules; - - } - - else - { - // from main - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - // from main - - $scope.configFileLoading = true; - - /// - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = false; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - $scope.couldNotConnect = true; - - - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - // from main - - $scope.configurationsBox = true; - $scope.configsFetched = true; - $scope.couldNotFetchConfigs = true; - $scope.fetchedConfigsData = true; - $scope.configFileLoading = true; - $scope.configSaved = true; - $scope.couldNotSaveConfigurations = true; - $scope.saveConfigBtn = true; - - // from main - - $scope.configFileLoading = true; - - /// - - $scope.configurationsBoxRewrite = true; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - - $scope.couldNotConnect = false; - - - } - + } }; - $scope.saveRewriteRules = function(){ + $scope.saveRewriteRules = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; + url = "/websites/saveRewriteRules"; - url = "/websites/saveRewriteRules"; - - var virtualHost = $("#childDomain").text(); - var rewriteRules = $scope.rewriteRules; + var virtualHost = $("#childDomain").text(); + var rewriteRules = $scope.rewriteRules; + var data = { + virtualHost: virtualHost, + rewriteRules: rewriteRules, + }; - var data = { - virtualHost: virtualHost, - rewriteRules:rewriteRules, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.rewriteStatus == 1){ + if (response.data.rewriteStatus == 1) { - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = true; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = false; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = true; - $scope.configFileLoading = true; + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = true; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = false; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = true; + $scope.configFileLoading = true; - } + } - else - { - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = false; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = false; + else { + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = false; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = false; - $scope.configFileLoading = true; + $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.configurationsBoxRewrite = false; - $scope.rewriteRulesFetched = false; - $scope.couldNotFetchRewriteRules = true; - $scope.rewriteRulesSaved = true; - $scope.couldNotSaveRewriteRules = true; - $scope.fetchedRewriteRules = true; - $scope.saveRewriteRulesBTN = false; + function cantLoadInitialDatas(response) { - $scope.configFileLoading = true; + $scope.configurationsBoxRewrite = false; + $scope.rewriteRulesFetched = false; + $scope.couldNotFetchRewriteRules = true; + $scope.rewriteRulesSaved = true; + $scope.couldNotSaveRewriteRules = true; + $scope.fetchedRewriteRules = true; + $scope.saveRewriteRulesBTN = false; - $scope.couldNotConnect = false; + $scope.configFileLoading = true; + + $scope.couldNotConnect = false; - } - + } }; @@ -3764,11 +3702,11 @@ app.controller('launchChild', function($scope,$http) { $scope.couldNotConnect = true; - $scope.hidesslbtn = function(){ + $scope.hidesslbtn = function () { $scope.hidsslconfigs = true; }; - $scope.addSSL = function(){ + $scope.addSSL = function () { $scope.hidsslconfigs = false; $scope.configurationsBox = true; $scope.configurationsBoxRewrite = true; @@ -3776,71 +3714,68 @@ app.controller('launchChild', function($scope,$http) { }; - $scope.saveSSL = function(){ + $scope.saveSSL = function () { - $scope.configFileLoading = false; + $scope.configFileLoading = false; - url = "/websites/saveSSL"; + url = "/websites/saveSSL"; - var virtualHost = $("#childDomain").text(); - var cert = $scope.cert; - var key = $scope.key; + var virtualHost = $("#childDomain").text(); + var cert = $scope.cert; + var key = $scope.key; + var data = { + virtualHost: virtualHost, + cert: cert, + key: key, + }; - var data = { - virtualHost: virtualHost, - cert:cert, - key:key, - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.sslStatus === 1){ + if (response.data.sslStatus === 1) { - $scope.sslSaved = false; - $scope.couldNotSaveSSL = true; - $scope.couldNotConnect = true; - $scope.configFileLoading = true; + $scope.sslSaved = false; + $scope.couldNotSaveSSL = true; + $scope.couldNotConnect = true; + $scope.configFileLoading = true; - } + } - else - { + else { - $scope.sslSaved = true; - $scope.couldNotSaveSSL = false; - $scope.couldNotConnect = true; - $scope.configFileLoading = true; + $scope.sslSaved = true; + $scope.couldNotSaveSSL = false; + $scope.couldNotConnect = true; + $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { + } - $scope.sslSaved = true; - $scope.couldNotSaveSSL = true; - $scope.couldNotConnect = false; - $scope.configFileLoading = true; + function cantLoadInitialDatas(response) { + + $scope.sslSaved = true; + $scope.couldNotSaveSSL = true; + $scope.couldNotConnect = false; + $scope.configFileLoading = true; - - - } + } }; @@ -3854,11 +3789,11 @@ app.controller('launchChild', function($scope,$http) { $scope.changePHPView = true; - $scope.hideChangePHPMaster = function(){ + $scope.hideChangePHPMaster = function () { $scope.changePHPView = true; }; - $scope.changePHPMaster = function(){ + $scope.changePHPMaster = function () { $scope.hidsslconfigs = true; $scope.configurationsBox = true; $scope.configurationsBoxRewrite = true; @@ -3866,76 +3801,76 @@ app.controller('launchChild', function($scope,$http) { }; - $scope.changePHPVersionMaster = function(childDomain,phpSelection){ + $scope.changePHPVersionMaster = function (childDomain, phpSelection) { + + // notifcations + + $scope.configFileLoading = false; + + var url = "/websites/changePHP"; + + var data = { + childDomain: $("#childDomain").text(), + phpSelection: $scope.phpSelectionMaster, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changePHP === 1) { + + $scope.configFileLoading = true; + $scope.websiteDomain = $("#childDomain").text(); + // notifcations - $scope.configFileLoading = false; - - var url = "/websites/changePHP"; - - var data = { - childDomain:$("#childDomain").text(), - phpSelection:$scope.phpSelectionMaster, - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $scope.failedToChangePHPMaster = true; + $scope.phpChangedMaster = false; + $scope.couldNotConnect = true; - function ListInitialDatas(response) { + } + else { + + $scope.configFileLoading = true; + $scope.errorMessage = response.data.error_message; + + // notifcations + + $scope.failedToChangePHPMaster = false; + $scope.phpChangedMaster = true; + $scope.couldNotConnect = true; + + } - if(response.data.changePHP === 1){ + } - $scope.configFileLoading = true; - $scope.websiteDomain = $("#childDomain").text(); + function cantLoadInitialDatas(response) { + $scope.configFileLoading = true; - // notifcations + // notifcations - $scope.failedToChangePHPMaster = true; - $scope.phpChangedMaster = false; - $scope.couldNotConnect = true; + $scope.failedToChangePHPMaster = true; + $scope.phpChangedMaster = true; + $scope.couldNotConnect = false; - - } - else{ - - $scope.configFileLoading = true; - $scope.errorMessage = response.data.error_message; - - // notifcations - - $scope.failedToChangePHPMaster = false; - $scope.phpChangedMaster = true; - $scope.couldNotConnect = true; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.configFileLoading = true; - - // notifcations - - $scope.failedToChangePHPMaster = true; - $scope.phpChangedMaster = true; - $scope.couldNotConnect = false; - - } + } }; - /// Open_basedir protection $scope.baseDirLoading = true; @@ -3945,7 +3880,7 @@ app.controller('launchChild', function($scope,$http) { $scope.openBaseDirBox = true; - $scope.openBaseDirView = function(){ + $scope.openBaseDirView = function () { $scope.openBaseDirBox = false; }; @@ -3953,69 +3888,70 @@ app.controller('launchChild', function($scope,$http) { $scope.openBaseDirBox = true; }; - $scope.applyOpenBasedirChanges = function(childDomain,phpSelection){ + $scope.applyOpenBasedirChanges = function (childDomain, phpSelection) { - // notifcations + // notifcations - $scope.baseDirLoading = false; + $scope.baseDirLoading = false; + $scope.operationFailed = true; + $scope.operationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.openBaseDirBox = false; + + + var url = "/websites/changeOpenBasedir"; + + var data = { + domainName: $("#childDomain").text(), + openBasedirValue: $scope.openBasedirValue + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changeOpenBasedir === 1) { + + $scope.baseDirLoading = true; $scope.operationFailed = true; + $scope.operationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.openBaseDirBox = false; + + } + else { + + $scope.baseDirLoading = true; + $scope.operationFailed = false; $scope.operationSuccessfull = true; $scope.couldNotConnect = true; $scope.openBaseDirBox = false; + $scope.errorMessage = response.data.error_message; - var url = "/websites/changeOpenBasedir"; - - var data = { - domainName:$("#childDomain").text(), - openBasedirValue:$scope.openBasedirValue - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } + + function cantLoadInitialDatas(response) { + + $scope.baseDirLoading = true; + $scope.operationFailed = true; + $scope.operationSuccessfull = true; + $scope.couldNotConnect = false; + $scope.openBaseDirBox = false; - if(response.data.changeOpenBasedir === 1){ - - $scope.baseDirLoading = true; - $scope.operationFailed = true; - $scope.operationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.openBaseDirBox = false; - - } - else{ - - $scope.baseDirLoading = true; - $scope.operationFailed = false; - $scope.operationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.openBaseDirBox = false; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - $scope.baseDirLoading = true; - $scope.operationFailed = true; - $scope.operationSuccessfull = true; - $scope.couldNotConnect = false; - $scope.openBaseDirBox = false; - - - } + } } @@ -4023,7 +3959,7 @@ app.controller('launchChild', function($scope,$http) { /* Application Installer */ -app.controller('installWordPressCTRL', function($scope, $http, $timeout) { +app.controller('installWordPressCTRL', function ($scope, $http, $timeout) { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4038,7 +3974,6 @@ app.controller('installWordPressCTRL', function($scope, $http, $timeout) { var path; - $scope.goBack = function () { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4050,173 +3985,171 @@ app.controller('installWordPressCTRL', function($scope, $http, $timeout) { $("#installProgress").css("width", "0%"); }; - $scope.installWordPress = function(){ + $scope.installWordPress = function () { + + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = false; + $scope.goBackDisable = true; + $scope.currentStatus = "Starting installation.."; + + path = $scope.installPath; + + + url = "/websites/installWordpress"; + + var home = "1"; + + if (typeof path !== 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + blogTitle: $scope.blogTitle, + adminUser: $scope.adminUser, + adminPassword: $scope.adminPassword, + adminEmail: $scope.adminEmail + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus === 1) { + statusFile = response.data.tempStatusPath; + getInstallStatus(); + } + else { $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.installationFailed = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - $scope.wpInstallLoading = false; - $scope.goBackDisable = true; - $scope.currentStatus = "Starting installation.."; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; - path = $scope.installPath; + $scope.errorMessage = response.data.error_message; + + } - url = "/websites/installWordpress"; + } - var home = "1"; - - if (typeof path !== 'undefined'){ - home = "0"; - } + function cantLoadInitialDatas(response) { - var data = { - domain: domain, - home:home, - path:path, - blogTitle: $scope.blogTitle, - adminUser: $scope.adminUser, - adminPassword: $scope.adminPassword, - adminEmail: $scope.adminEmail - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.installStatus === 1) - { - statusFile = response.data.tempStatusPath; - getInstallStatus(); - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - - - } + } }; - function getInstallStatus(){ + function getInstallStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile, - domainName: domain - }; + var data = { + statusFile: statusFile, + domainName: domain + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ + if (response.data.installStatus === 1) { - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - if (typeof path !== 'undefined'){ - $scope.installationURL = "http://"+domain+"/"+path; - } - else{ - $scope.installationURL = domain; - } - - - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - - } + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + if (typeof path !== 'undefined') { + $scope.installationURL = "http://" + domain + "/" + path; } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - - $timeout(getInstallStatus,1000); - - - + else { + $scope.installationURL = domain; } + + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + } - function cantLoadInitialDatas(response) { + else { - $scope.canNotFetch = true; - $scope.couldNotConnect = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = false; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; - } + $timeout(getInstallStatus, 1000); + + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.canNotFetch = true; + $scope.couldNotConnect = false; + + + } + + + } }); -app.controller('installJoomlaCTRL', function($scope, $http, $timeout) { +app.controller('installJoomlaCTRL', function ($scope, $http, $timeout) { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4233,7 +4166,6 @@ app.controller('installJoomlaCTRL', function($scope, $http, $timeout) { var path; - $scope.goBack = function () { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4245,173 +4177,171 @@ app.controller('installJoomlaCTRL', function($scope, $http, $timeout) { $("#installProgress").css("width", "0%"); }; - function getInstallStatus(){ + function getInstallStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile, - domainName: domain - }; + var data = { + statusFile: statusFile, + domainName: domain + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ + if (response.data.installStatus === 1) { - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - if (typeof path !== 'undefined'){ - $scope.installationURL = "http://"+domain+"/"+path; - } - else{ - $scope.installationURL = domain; - } - - - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - - } + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + if (typeof path !== 'undefined') { + $scope.installationURL = "http://" + domain + "/" + path; } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - - $timeout(getInstallStatus,1000); - - - + else { + $scope.installationURL = domain; } + + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + } - function cantLoadInitialDatas(response) { + else { - $scope.canNotFetch = true; - $scope.couldNotConnect = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = false; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; - } + $timeout(getInstallStatus, 1000); - $scope.installJoomla = function(){ + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.canNotFetch = true; + $scope.couldNotConnect = false; + + + } + + + } + + $scope.installJoomla = function () { + + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = false; + $scope.goBackDisable = true; + $scope.currentStatus = "Starting installation.."; + + path = $scope.installPath; + + + url = "/websites/installJoomla"; + + var home = "1"; + + if (typeof path !== 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + sitename: $scope.blogTitle, + username: $scope.adminUser, + password: $scope.adminPassword, + prefix: $scope.databasePrefix + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus === 1) { + statusFile = response.data.tempStatusPath; + getInstallStatus(); + } + else { $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.installationFailed = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - $scope.wpInstallLoading = false; - $scope.goBackDisable = true; - $scope.currentStatus = "Starting installation.."; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; - path = $scope.installPath; + $scope.errorMessage = response.data.error_message; + + } - url = "/websites/installJoomla"; + } - var home = "1"; - - if (typeof path !== 'undefined'){ - home = "0"; - } + function cantLoadInitialDatas(response) { - var data = { - domain: domain, - home:home, - path:path, - sitename: $scope.blogTitle, - username: $scope.adminUser, - password: $scope.adminPassword, - prefix: $scope.databasePrefix - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.installStatus === 1) - { - statusFile = response.data.tempStatusPath; - getInstallStatus(); - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) { - - - - } + } }; }); -app.controller('setupGit', function($scope, $http, $timeout, $window) { +app.controller('setupGit', function ($scope, $http, $timeout, $window) { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4433,152 +4363,152 @@ app.controller('setupGit', function($scope, $http, $timeout, $window) { var statusFile; var domain = $("#domainNamePage").text(); - function getInstallStatus(){ + function getInstallStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile, - domainName: domain - }; + var data = { + statusFile: statusFile, + domainName: domain + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ + if (response.data.installStatus === 1) { - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.gitLoading = true; - $scope.goBackDisable = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.gitLoading = true; + $scope.goBackDisable = true; - $scope.installationURL = domain; + $scope.installationURL = domain; - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - $timeout(function() { $window.location.reload(); }, 3000); - - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.gitLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - $scope.goBackDisable = false; - - } - - } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - - $timeout(getInstallStatus,1000); - - - - } + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + $timeout(function () { + $window.location.reload(); + }, 3000); } - function cantLoadInitialDatas(response) { + else { - $scope.canNotFetch = true; - $scope.couldNotConnect = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = false; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.gitLoading = true; $scope.goBackDisable = false; + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; + $scope.goBackDisable = false; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; - } + $timeout(getInstallStatus, 1000); - $scope.attachRepo = function(){ + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.canNotFetch = true; + $scope.couldNotConnect = false; + $scope.goBackDisable = false; + + + } + + + } + + $scope.attachRepo = function () { + + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.gitLoading = false; + $scope.installProg = false; + + $scope.currentStatus = "Attaching GIT.."; + + url = "/websites/setupGitRepo"; + + var data = { + domain: domain, + username: $scope.githubUserName, + reponame: $scope.githubRepo, + branch: $scope.githubBranch, + defaultProvider: defaultProvider + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus === 1) { + statusFile = response.data.tempStatusPath; + getInstallStatus(); + } + else { $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.installationFailed = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - $scope.gitLoading = false; - $scope.installProg = false; + $scope.gitLoading = true; - $scope.currentStatus = "Attaching GIT.."; + $scope.errorMessage = response.data.error_message; + $scope.goBackDisable = false; - url = "/websites/setupGitRepo"; - - var data = { - domain: domain, - username: $scope.githubUserName, - reponame: $scope.githubRepo, - branch: $scope.githubBranch, - defaultProvider: defaultProvider - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + } - if (response.data.installStatus === 1) - { - statusFile = response.data.tempStatusPath; - getInstallStatus(); - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.gitLoading = true; - - $scope.errorMessage = response.data.error_message; - $scope.goBackDisable = false; - - } + function cantLoadInitialDatas(response) { - } - function cantLoadInitialDatas(response) { - - - - } + } }; @@ -4602,130 +4532,132 @@ app.controller('setupGit', function($scope, $http, $timeout, $window) { $scope.gitLoading = true; $scope.successMessageBranch = true; - $scope.detachRepo = function(){ + $scope.detachRepo = function () { - $scope.failedMesg = true; - $scope.successMessage = true; - $scope.couldNotConnect = true; - $scope.gitLoading = false; - $scope.successMessageBranch = true; + $scope.failedMesg = true; + $scope.successMessage = true; + $scope.couldNotConnect = true; + $scope.gitLoading = false; + $scope.successMessageBranch = true; - url = "/websites/detachRepo"; + url = "/websites/detachRepo"; - var data = { - domain: domain - }; + var data = { + domain: domain + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.gitLoading = true; + $scope.gitLoading = true; - if (response.data.status === 1) - { - $scope.failedMesg = true; - $scope.successMessage = false; - $scope.couldNotConnect = true; - $scope.successMessageBranch = true; + if (response.data.status === 1) { + $scope.failedMesg = true; + $scope.successMessage = false; + $scope.couldNotConnect = true; + $scope.successMessageBranch = true; - $timeout(function() { $window.location.reload(); }, 3000); + $timeout(function () { + $window.location.reload(); + }, 3000); - } - else{ + } + else { - $scope.failedMesg = false; - $scope.successMessage = true; - $scope.couldNotConnect = true; - $scope.successMessageBranch = true; + $scope.failedMesg = false; + $scope.successMessage = true; + $scope.couldNotConnect = true; + $scope.successMessageBranch = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { - $scope.failedMesg = true; - $scope.successMessage = true; - $scope.couldNotConnect = false; - $scope.gitLoading = true; - $scope.successMessageBranch = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.failedMesg = true; + $scope.successMessage = true; + $scope.couldNotConnect = false; + $scope.gitLoading = true; + $scope.successMessageBranch = true; + } }; - $scope.changeBranch = function(){ + $scope.changeBranch = function () { - $scope.failedMesg = true; - $scope.successMessage = true; - $scope.couldNotConnect = true; - $scope.gitLoading = false; - $scope.successMessageBranch = true; + $scope.failedMesg = true; + $scope.successMessage = true; + $scope.couldNotConnect = true; + $scope.gitLoading = false; + $scope.successMessageBranch = true; - url = "/websites/changeBranch"; + url = "/websites/changeBranch"; - var data = { - domain: domain, - githubBranch: $scope.githubBranch - }; + var data = { + domain: domain, + githubBranch: $scope.githubBranch + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.gitLoading = true; + $scope.gitLoading = true; - if (response.data.status === 1) - { - $scope.failedMesg = true; - $scope.successMessage = true; - $scope.couldNotConnect = true; - $scope.successMessageBranch = false; + if (response.data.status === 1) { + $scope.failedMesg = true; + $scope.successMessage = true; + $scope.couldNotConnect = true; + $scope.successMessageBranch = false; - } - else{ + } + else { - $scope.failedMesg = false; - $scope.successMessage = true; - $scope.couldNotConnect = true; - $scope.successMessageBranch = true; + $scope.failedMesg = false; + $scope.successMessage = true; + $scope.couldNotConnect = true; + $scope.successMessageBranch = true; - $scope.errorMessage = response.data.error_message; + $scope.errorMessage = response.data.error_message; - } + } - } - function cantLoadInitialDatas(response) { - $scope.failedMesg = true; - $scope.successMessage = true; - $scope.couldNotConnect = false; - $scope.gitLoading = true; - $scope.successMessageBranch = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.failedMesg = true; + $scope.successMessage = true; + $scope.couldNotConnect = false; + $scope.gitLoading = true; + $scope.successMessageBranch = true; + } }; }); -app.controller('installPrestaShopCTRL', function($scope, $http, $timeout) { +app.controller('installPrestaShopCTRL', function ($scope, $http, $timeout) { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4742,7 +4674,6 @@ app.controller('installPrestaShopCTRL', function($scope, $http, $timeout) { var path; - $scope.goBack = function () { $scope.installationDetailsForm = false; $scope.installationProgress = true; @@ -4754,164 +4685,164 @@ app.controller('installPrestaShopCTRL', function($scope, $http, $timeout) { $("#installProgress").css("width", "0%"); }; - function getInstallStatus(){ + function getInstallStatus() { - url = "/websites/installWordpressStatus"; + url = "/websites/installWordpressStatus"; - var data = { - statusFile: statusFile, - domainName: domain - }; + var data = { + statusFile: statusFile, + domainName: domain + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.abort === 1){ + if (response.data.abort === 1) { - if(response.data.installStatus === 1){ + if (response.data.installStatus === 1) { - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = true; - $scope.installationSuccessfull = false; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - if (typeof path !== 'undefined'){ - $scope.installationURL = "http://"+domain+"/"+path; - } - else{ - $scope.installationURL = domain; - } - - - $("#installProgress").css("width", "100%"); - $scope.installPercentage = "100"; - $scope.currentStatus = response.data.currentStatus; - $timeout.cancel(); - - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - $("#installProgress").css("width", "0%"); - $scope.installPercentage = "0"; - - } + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = false; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + if (typeof path !== 'undefined') { + $scope.installationURL = "http://" + domain + "/" + path; } - else{ - $("#installProgress").css("width", response.data.installationProgress + "%"); - $scope.installPercentage = response.data.installationProgress; - $scope.currentStatus = response.data.currentStatus; - - $timeout(getInstallStatus,1000); - - - + else { + $scope.installationURL = domain; } + + $("#installProgress").css("width", "100%"); + $scope.installPercentage = "100"; + $scope.currentStatus = response.data.currentStatus; + $timeout.cancel(); + } - function cantLoadInitialDatas(response) { + else { - $scope.canNotFetch = true; - $scope.couldNotConnect = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = false; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; + $scope.errorMessage = response.data.error_message; + + $("#installProgress").css("width", "0%"); + $scope.installPercentage = "0"; } + } + else { + $("#installProgress").css("width", response.data.installationProgress + "%"); + $scope.installPercentage = response.data.installationProgress; + $scope.currentStatus = response.data.currentStatus; - } + $timeout(getInstallStatus, 1000); - $scope.installPrestShop = function(){ + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.canNotFetch = true; + $scope.couldNotConnect = false; + + + } + + + } + + $scope.installPrestShop = function () { + + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.installationFailed = true; + $scope.installationSuccessfull = true; + $scope.couldNotConnect = true; + $scope.wpInstallLoading = false; + $scope.goBackDisable = true; + $scope.currentStatus = "Starting installation.."; + + path = $scope.installPath; + + + url = "/websites/prestaShopInstall"; + + var home = "1"; + + if (typeof path !== 'undefined') { + home = "0"; + } + + + var data = { + domain: domain, + home: home, + path: path, + shopName: $scope.shopName, + firstName: $scope.firstName, + lastName: $scope.lastName, + databasePrefix: $scope.databasePrefix, + email: $scope.email, + password: $scope.password + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.installStatus === 1) { + statusFile = response.data.tempStatusPath; + getInstallStatus(); + } + else { $scope.installationDetailsForm = true; $scope.installationProgress = false; - $scope.installationFailed = true; + $scope.installationFailed = false; $scope.installationSuccessfull = true; $scope.couldNotConnect = true; - $scope.wpInstallLoading = false; - $scope.goBackDisable = true; - $scope.currentStatus = "Starting installation.."; + $scope.wpInstallLoading = true; + $scope.goBackDisable = false; - path = $scope.installPath; + $scope.errorMessage = response.data.error_message; + + } - url = "/websites/prestaShopInstall"; + } - var home = "1"; - - if (typeof path !== 'undefined'){ - home = "0"; - } - - - var data = { - domain: domain, - home:home, - path:path, - shopName: $scope.shopName, - firstName: $scope.firstName, - lastName: $scope.lastName, - databasePrefix: $scope.databasePrefix, - email: $scope.email, - password: $scope.password - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - if (response.data.installStatus === 1) - { - statusFile = response.data.tempStatusPath; - getInstallStatus(); - } - else{ - - $scope.installationDetailsForm = true; - $scope.installationProgress = false; - $scope.installationFailed = false; - $scope.installationSuccessfull = true; - $scope.couldNotConnect = true; - $scope.wpInstallLoading = true; - $scope.goBackDisable = false; - - $scope.errorMessage = response.data.error_message; - - } - - - } - function cantLoadInitialDatas(response) {} + function cantLoadInitialDatas(response) { + } };