Files
CyberPanel/static/websiteFunctions/websiteFunctions.js

6776 lines
178 KiB
JavaScript
Raw Normal View History

2017-10-24 19:16:36 +05:00
/**
* Created by usman on 7/26/17.
*/
function getCookie(name) {
var cookieValue = null;
var t = document.cookie;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
2017-10-24 19:16:36 +05:00
/* Java script code to create account */
2018-11-16 17:53:51 +05:00
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
2018-07-30 17:33:28 +05:00
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
2017-10-24 19:16:36 +05:00
2018-07-30 17:33:28 +05:00
var statusFile;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.createWebsite = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.webSiteCreationLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$scope.currentStatus = "Starting creation..";
2018-07-30 17:33:28 +05:00
2020-02-18 22:09:23 +05:00
var ssl, dkimCheck, openBasedir, mailDomain;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
if ($scope.sslCheck === true) {
ssl = 1;
} else {
2018-11-16 17:53:51 +05:00
ssl = 0
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if ($scope.dkimCheck === true) {
dkimCheck = 1;
} else {
2018-11-16 17:53:51 +05:00
dkimCheck = 0
}
2018-05-01 00:49:47 +05:00
2018-11-16 17:53:51 +05:00
if ($scope.openBasedir === true) {
openBasedir = 1;
} else {
2018-11-16 17:53:51 +05:00
openBasedir = 0
}
2018-05-21 21:52:35 +05:00
2020-02-18 22:09:23 +05:00
if ($scope.mailDomain === true) {
mailDomain = 1;
} else {
mailDomain = 0
}
2018-11-16 17:53:51 +05:00
url = "/websites/submitWebsiteCreation";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var package = $scope.packageForWebsite;
var domainName = $scope.domainNameCreate;
var adminEmail = $scope.adminEmail;
var phpSelection = $scope.phpSelection;
var websiteOwner = $scope.websiteOwner;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
package: package,
domainName: domainName,
adminEmail: adminEmail,
phpSelection: phpSelection,
ssl: ssl,
websiteOwner: websiteOwner,
dkimCheck: dkimCheck,
2020-02-18 22:09:23 +05:00
openBasedir: openBasedir,
mailDomain: mailDomain
2018-11-16 17:53:51 +05:00
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.createWebSiteStatus === 1) {
statusFile = response.data.tempStatusPath;
getCreationStatus();
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
}
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
2018-07-30 17:33:28 +05:00
$scope.goBack = function () {
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-11-16 17:53:51 +05:00
function getCreationStatus() {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpressStatus";
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile
};
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = false;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
2018-07-30 17:33:28 +05:00
} else {
2018-07-30 17:33:28 +05:00
$scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessageBox = false;
2018-07-30 17:33:28 +05:00
$scope.success = true;
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
2018-07-30 17:33:28 +05:00
$scope.goBackDisable = false;
}
} else {
2018-11-16 17:53:51 +05:00
$("#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;
}
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
});
/* Java script code to create account ends here */
/* Java script code to list accounts */
$("#listFail").hide();
2018-11-16 17:53:51 +05:00
app.controller('listWebsites', function ($scope, $http) {
2017-10-24 19:16:36 +05:00
2019-08-25 05:25:48 +05:00
$scope.currentPage = 1;
$scope.recordsToShow = 10;
2017-10-24 19:16:36 +05:00
2019-08-25 05:25:48 +05:00
$scope.getFurtherWebsitesFromDB = function () {
2017-10-24 19:16:36 +05:00
var config = {
2018-11-16 17:53:51 +05:00
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2019-08-25 05:25:48 +05:00
var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
2017-10-24 19:16:36 +05:00
2019-08-25 05:25:48 +05:00
dataurl = "/websites/fetchWebsitesList";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialData(response) {
if (response.data.listWebSiteStatus === 1) {
2017-10-24 19:16:36 +05:00
2019-08-25 05:25:48 +05:00
$scope.WebSitesList = JSON.parse(response.data.data);
$scope.pagination = response.data.pagination;
$scope.clients = JSON.parse(response.data.data);
2018-11-16 17:53:51 +05:00
$("#listFail").hide();
} else {
2018-11-16 17:53:51 +05:00
$("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialData(response) {
}
2017-10-24 19:16:36 +05:00
2019-02-04 01:03:18 +05:00
};
2019-08-25 05:25:48 +05:00
$scope.getFurtherWebsitesFromDB();
2019-02-04 01:03:18 +05:00
$scope.cyberPanelLoading = true;
$scope.issueSSL = function (virtualHost) {
$scope.cyberPanelLoading = false;
var url = "/manageSSL/issueSSL";
var data = {
virtualHost: virtualHost
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberPanelLoading = true;
if (response.data.SSL === 1) {
new PNotify({
title: 'Success!',
text: 'SSL successfully issued.',
type: 'success'
});
} else {
2019-02-04 01:03:18 +05:00
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
2018-11-16 17:53:51 +05:00
};
2019-02-22 09:19:16 +05:00
$scope.cyberPanelLoading = true;
$scope.searchWebsites = function () {
$scope.cyberPanelLoading = false;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
patternAdded: $scope.patternAdded
};
dataurl = "/websites/searchWebsites";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberPanelLoading = true;
if (response.data.listWebSiteStatus === 1) {
var finalData = JSON.parse(response.data.data);
$scope.WebSitesList = finalData;
$("#listFail").hide();
} else {
2019-02-22 09:19:16 +05:00
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Connect disrupted, refresh the page.',
type: 'error'
});
2019-02-22 09:19:16 +05:00
}
};
2020-01-07 11:38:47 +05:00
});
app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
$scope.currentPage = 1;
$scope.recordsToShow = 10;
$scope.getFurtherWebsitesFromDB = function () {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
dataurl = "/websites/fetchChildDomainsMain";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
if (response.data.listWebSiteStatus === 1) {
$scope.WebSitesList = JSON.parse(response.data.data);
$scope.pagination = response.data.pagination;
$scope.clients = JSON.parse(response.data.data);
$("#listFail").hide();
} else {
$("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialData(response) {
}
};
$scope.getFurtherWebsitesFromDB();
$scope.cyberPanelLoading = true;
$scope.issueSSL = function (virtualHost) {
$scope.cyberPanelLoading = false;
var url = "/manageSSL/issueSSL";
var data = {
virtualHost: virtualHost
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberPanelLoading = true;
if (response.data.SSL === 1) {
new PNotify({
title: 'Success!',
text: 'SSL successfully issued.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
};
$scope.cyberPanelLoading = true;
$scope.searchWebsites = function () {
$scope.cyberPanelLoading = false;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
patternAdded: $scope.patternAdded
};
dataurl = "/websites/searchWebsites";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberPanelLoading = true;
if (response.data.listWebSiteStatus === 1) {
var finalData = JSON.parse(response.data.data);
$scope.WebSitesList = finalData;
$("#listFail").hide();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Connect disrupted, refresh the page.',
type: 'error'
});
}
};
2020-03-10 21:04:57 +05:00
$scope.initConvert = function (virtualHost) {
2020-01-07 11:38:47 +05:00
$scope.domainName = virtualHost;
};
var statusFile;
$scope.installationProgress = true;
$scope.convert = function () {
$scope.cyberPanelLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$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/convertDomainToSite";
var data = {
package: $scope.packageForWebsite,
domainName: $scope.domainName,
adminEmail: $scope.adminEmail,
phpSelection: $scope.phpSelection,
websiteOwner: $scope.websiteOwner,
ssl: ssl,
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.cyberPanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberPanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
};
$scope.goBack = function () {
$scope.cyberPanelLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getCreationStatus() {
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.abort === 1) {
if (response.data.installStatus === 1) {
$scope.cyberPanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
} else {
$scope.cyberPanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = 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.cyberPanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
}
2017-10-24 19:16:36 +05:00
});
/* Java script code to list accounts ends here */
/* Java script code to delete Website */
$("#websiteDeleteFailure").hide();
$("#websiteDeleteSuccess").hide();
$("#deleteWebsiteButton").hide();
$("#deleteLoading").hide();
2018-11-16 17:53:51 +05:00
app.controller('deleteWebsiteControl', function ($scope, $http) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.deleteWebsite = function () {
2017-10-24 19:16:36 +05:00
$("#deleteWebsiteButton").fadeIn();
};
2018-11-16 17:53:51 +05:00
$scope.deleteWebsiteFinal = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$("#deleteLoading").show();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var websiteName = $scope.websiteToBeDeleted;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/submitWebsiteDeletion";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
websiteName: websiteName
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2019-08-03 14:53:31 +05:00
if (response.data.websiteDeleteStatus === 0) {
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
$("#websiteDeleteFailure").fadeIn();
$("#websiteDeleteSuccess").hide();
$("#deleteWebsiteButton").hide();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$("#deleteLoading").hide();
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$("#websiteDeleteFailure").hide();
$("#websiteDeleteSuccess").fadeIn();
$("#deleteWebsiteButton").hide();
$scope.deletedWebsite = websiteName;
$("#deleteLoading").hide();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
}
2017-10-24 19:16:36 +05:00
};
});
/* Java script code to delete website ends here */
/* Java script code to modify package ends here */
$("#canNotModify").hide();
$("#webSiteDetailsToBeModified").hide();
$("#websiteModifyFailure").hide();
$("#websiteModifySuccess").hide();
$("#websiteSuccessfullyModified").hide();
$("#modifyWebsiteLoading").hide();
$("#modifyWebsiteButton").hide();
2018-11-16 17:53:51 +05:00
app.controller('modifyWebsitesController', function ($scope, $http) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.fetchWebsites = function () {
2017-10-24 19:16:36 +05:00
$("#modifyWebsiteLoading").show();
var websiteToBeModified = $scope.websiteToBeModified;
url = "/websites/getWebsiteDetails";
2018-11-16 17:53:51 +05:00
var data = {
websiteToBeModified: websiteToBeModified,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
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();
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
console.log(response.data);
$("#modifyWebsiteButton").fadeIn();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$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;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$("#webSiteDetailsToBeModified").fadeIn();
$("#websiteModifySuccess").fadeIn();
$("#modifyWebsiteButton").fadeIn();
$("#modifyWebsiteLoading").hide();
$("#canNotModify").hide();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
$("#websiteModifyFailure").fadeIn();
}
2017-10-24 19:16:36 +05:00
};
$scope.modifyWebsiteFunc = function () {
var domain = $scope.websiteToBeModified;
var packForWeb = $scope.selectedPack;
var email = $scope.adminEmail;
var phpVersion = $scope.phpSelection;
var admin = $scope.selectedAdmin;
$("#websiteModifyFailure").hide();
$("#websiteModifySuccess").hide();
$("#websiteSuccessfullyModified").hide();
$("#canNotModify").hide();
$("#modifyWebsiteLoading").fadeIn();
url = "/websites/saveWebsiteChanges";
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
packForWeb: packForWeb,
email: email,
phpVersion: phpVersion,
admin: admin
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.saveStatus === 0) {
$scope.errMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$("#canNotModify").fadeIn();
$("#websiteModifyFailure").hide();
$("#websiteModifySuccess").hide();
$("#websiteSuccessfullyModified").hide();
$("#modifyWebsiteLoading").hide();
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$("#modifyWebsiteButton").hide();
$("#canNotModify").hide();
$("#websiteModifyFailure").hide();
$("#websiteModifySuccess").hide();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$("#websiteSuccessfullyModified").fadeIn();
$("#modifyWebsiteLoading").hide();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteModified = domain;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
$scope.errMessage = response.data.error_message;
$("#canNotModify").fadeIn();
}
2017-10-24 19:16:36 +05:00
};
});
/* Java script code to Modify Pacakge ends here */
/* Java script code to create account */
2018-11-16 17:53:51 +05:00
app.controller('websitePages', function ($scope, $http, $timeout, $window) {
2017-10-24 19:16:36 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.hidelogsbtn = function () {
2017-10-24 19:16:36 +05:00
$scope.hideLogs = true;
};
2018-11-16 17:53:51 +05:00
$scope.hideErrorLogsbtn = function () {
$scope.hideLogs = true;
};
2018-11-16 17:53:51 +05:00
$scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text();
$scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall";
2018-07-13 21:45:40 +05:00
$scope.joomlaInstallURL = $("#domainNamePage").text() + "/joomlaInstall";
2018-07-26 04:11:10 +05:00
$scope.setupGit = $("#domainNamePage").text() + "/setupGit";
2018-08-05 01:46:31 +05:00
$scope.installPrestaURL = $("#domainNamePage").text() + "/installPrestaShop";
2019-11-07 16:53:02 +05:00
$scope.installMagentoURL = $("#domainNamePage").text() + "/installMagento";
2018-11-16 17:53:51 +05:00
$scope.domainAliasURL = "/websites/" + $("#domainNamePage").text() + "/domainAlias";
$scope.previewUrl = "/preview/" + $("#domainNamePage").text() + "/";
2017-10-24 19:16:36 +05:00
var logType = 0;
$scope.pageNumber = 1;
2018-11-16 17:53:51 +05:00
$scope.fetchLogs = function (type) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var pageNumber = $scope.pageNumber;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (type == 3) {
pageNumber = $scope.pageNumber + 1;
$scope.pageNumber = pageNumber;
} else if (type == 4) {
2018-11-16 17:53:51 +05:00
pageNumber = $scope.pageNumber - 1;
$scope.pageNumber = pageNumber;
} else {
2018-11-16 17:53:51 +05:00
logType = type;
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideErrorLogs = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/getDataFromLogFile";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var domainNamePage = $("#domainNamePage").text();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
logType: logType,
virtualHost: domainNamePage,
page: pageNumber,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.logstatus == 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideLogs = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.records = JSON.parse(response.data.data);
2017-10-24 19:16:36 +05:00
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
console.log(domainNamePage)
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
$scope.errorPageNumber = 1;
2018-11-16 17:53:51 +05:00
$scope.fetchErrorLogs = function (type) {
2018-11-16 17:53:51 +05:00
var errorPageNumber = $scope.errorPageNumber;
2018-11-16 17:53:51 +05:00
if (type == 3) {
errorPageNumber = $scope.errorPageNumber + 1;
$scope.errorPageNumber = errorPageNumber;
} else if (type == 4) {
2018-11-16 17:53:51 +05:00
errorPageNumber = $scope.errorPageNumber - 1;
$scope.errorPageNumber = errorPageNumber;
} else {
2018-11-16 17:53:51 +05:00
logType = type;
}
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideErrorLogs = true;
$scope.hideLogs = false;
2018-11-16 17:53:51 +05:00
url = "/websites/fetchErrorLogs";
2018-11-16 17:53:51 +05:00
var domainNamePage = $("#domainNamePage").text();
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: domainNamePage,
page: errorPageNumber,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.logstatus === 1) {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
$scope.hideErrorLogs = false;
2018-11-16 17:53:51 +05:00
$scope.errorLogsData = response.data.data;
} else {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
}
};
2017-10-24 19:16:36 +05:00
///////// Configurations Part
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2018-11-16 17:53:51 +05:00
$scope.hideconfigbtn = function () {
2017-10-24 19:16:36 +05:00
$scope.configurationsBox = true;
};
2018-11-16 17:53:51 +05:00
$scope.fetchConfigurations = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.hidsslconfigs = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
///
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/getDataFromConfigFile";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var virtualHost = $("#domainNamePage").text();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.configstatus === 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
//Rewrite rules
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
///
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$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;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configData = response.data.configData;
2017-10-24 19:16:36 +05:00
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
///
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = false;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
//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;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.saveCongiruations = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/saveConfigsToFile";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var virtualHost = $("#domainNamePage").text();
var configData = $scope.configData;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
configData: configData,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.configstatus === 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$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;
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = false;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = false;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
///////// Rewrite Rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
$scope.hideRewriteRulesbtn = function () {
2017-10-24 19:16:36 +05:00
$scope.configurationsBoxRewrite = true;
};
2018-11-16 17:53:51 +05:00
$scope.fetchRewriteFules = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.changePHPView = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$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;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/getRewriteRules";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var virtualHost = $("#domainNamePage").text();
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.rewriteStatus == 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
// from main
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
// main ends
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
//
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = false;
$scope.saveRewriteRulesBTN = false;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.rewriteRules = response.data.rewriteRules;
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
// 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
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
///
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = false;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
// from main
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
// from main
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
///
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.saveRewriteRules = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/saveRewriteRules";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var virtualHost = $("#domainNamePage").text();
var rewriteRules = $scope.rewriteRules;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
rewriteRules: rewriteRules,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.rewriteStatus == 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = false;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = false;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
//////// Application Installation part
$scope.installationDetailsForm = true;
2017-12-16 11:59:47 +05:00
$scope.installationDetailsFormJoomla = true;
2017-10-24 19:16:36 +05:00
$scope.applicationInstallerLoading = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.installationDetails = function () {
2017-10-24 19:16:36 +05:00
2017-12-16 11:59:47 +05:00
$scope.installationDetailsForm = !$scope.installationDetailsForm;
$scope.installationDetailsFormJoomla = true;
2017-10-24 19:16:36 +05:00
2018-05-03 01:22:28 +05:00
};
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsJoomla = function () {
2017-12-16 11:59:47 +05:00
$scope.installationDetailsFormJoomla = !$scope.installationDetailsFormJoomla;
$scope.installationDetailsForm = true;
2017-10-24 19:16:36 +05:00
2018-05-03 01:22:28 +05:00
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.installWordpress = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = false;
$scope.applicationInstallerLoading = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var domain = $("#domainNamePage").text();
var path = $scope.installPath;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpress";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var home = "1";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (typeof path != 'undefined') {
home = "0";
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
home: home,
path: path,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2019-12-06 16:21:13 +05:00
if (response.data.installStatus === 1) {
2018-11-16 17:53:51 +05:00
if (typeof path != 'undefined') {
$scope.installationURL = "http://" + domain + "/" + path;
} else {
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = false;
}
2017-10-24 19:16:36 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.installJoomla = function () {
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsFormJoomla = false;
$scope.applicationInstallerLoading = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
var domain = $("#domainNamePage").text();
var path = $scope.installPath;
var sitename = $scope.sitename;
var username = $scope.username;
var password = $scope.password;
var prefix = $scope.prefix;
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installJoomla";
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
var home = "1";
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
if (typeof path != 'undefined') {
home = "0";
}
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
home: home,
path: path,
sitename: sitename,
username: username,
password: password,
prefix: prefix,
};
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-12-16 11:59:47 +05:00
2019-12-06 16:21:13 +05:00
if (response.data.installStatus === 1) {
2018-11-16 17:53:51 +05:00
if (typeof path != 'undefined') {
$scope.installationURL = "http://" + domain + "/" + path;
} else {
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
}
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsFormJoomla = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
2017-12-16 11:59:47 +05:00
} else {
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsFormJoomla = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
}
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
}
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-12-16 11:59:47 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsFormJoomla = false;
$scope.applicationInstallerLoading = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = false;
}
2017-12-16 11:59:47 +05:00
};
2018-08-05 01:46:31 +05:00
2017-10-24 19:16:36 +05:00
//////// SSL Part
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.hidsslconfigs = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.hidesslbtn = function () {
2017-10-24 19:16:36 +05:00
$scope.hidsslconfigs = true;
};
2018-11-16 17:53:51 +05:00
$scope.addSSL = function () {
2017-10-24 19:16:36 +05:00
$scope.hidsslconfigs = false;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
2017-10-24 19:16:36 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.saveSSL = function () {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/saveSSL";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var virtualHost = $("#domainNamePage").text();
var cert = $scope.cert;
var key = $scope.key;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
cert: cert,
key: key
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.sslStatus == 1) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.sslSaved = false;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.sslSaved = true;
$scope.couldNotSaveSSL = false;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = false;
$scope.configFileLoading = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
};
//// Change PHP Master
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
$scope.changePHPView = true;
2018-11-16 17:53:51 +05:00
$scope.hideChangePHPMaster = function () {
$scope.changePHPView = true;
};
2018-11-16 17:53:51 +05:00
$scope.changePHPMaster = function () {
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = false;
};
2018-11-16 17:53:51 +05:00
$scope.changePHPVersionMaster = function (childDomain, phpSelection) {
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
var url = "/websites/changePHP";
2018-11-16 17:53:51 +05:00
var data = {
childDomain: $("#domainNamePage").text(),
phpSelection: $scope.phpSelectionMaster,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.changePHP === 1) {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
$scope.websiteDomain = $("#domainNamePage").text();
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = false;
$scope.couldNotConnect = true;
} else {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = false;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
2018-07-30 17:33:28 +05:00
};
////// create domain part
$("#domainCreationForm").hide();
$scope.showCreateDomainForm = function () {
$("#domainCreationForm").fadeIn();
};
$scope.hideDomainCreationForm = function () {
$("#domainCreationForm").fadeOut();
};
$scope.masterDomain = $("#domainNamePage").text();
// notifcations settings
$scope.domainLoading = true;
2018-07-30 17:33:28 +05:00
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
2018-07-30 17:33:28 +05:00
$scope.goBackDisable = true;
var statusFile;
2018-11-16 17:53:51 +05:00
$scope.createDomain = function () {
2018-11-16 17:53:51 +05:00
$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..";
2018-05-03 01:22:28 +05:00
2018-11-16 17:53:51 +05:00
var ssl, dkimCheck, openBasedir;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
if ($scope.sslCheck === true) {
ssl = 1;
} else {
2018-11-16 17:53:51 +05:00
ssl = 0
}
2018-11-16 17:53:51 +05:00
if ($scope.dkimCheck === true) {
dkimCheck = 1;
} else {
2018-11-16 17:53:51 +05:00
dkimCheck = 0
}
2018-11-16 17:53:51 +05:00
if ($scope.openBasedir === true) {
openBasedir = 1;
} else {
2018-11-16 17:53:51 +05:00
openBasedir = 0
}
2018-11-16 17:53:51 +05:00
url = "/websites/submitDomainCreation";
var domainName = $scope.domainNameCreate;
var phpSelection = $scope.phpSelection;
2018-11-16 17:53:51 +05:00
var path = $scope.docRootPath;
2018-11-16 17:53:51 +05:00
if (typeof path === 'undefined') {
path = "";
}
2018-11-16 17:53:51 +05:00
var data = {
domainName: domainName,
phpSelection: phpSelection,
ssl: ssl,
path: path,
masterDomain: $("#domainNamePage").text(),
dkimCheck: dkimCheck,
openBasedir: openBasedir
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.createWebSiteStatus === 1) {
statusFile = response.data.tempStatusPath;
getCreationStatus();
} else {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
2018-11-16 17:53:51 +05:00
}
};
2018-07-30 17:33:28 +05:00
$scope.goBack = function () {
$scope.domainLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-11-16 17:53:51 +05:00
function getCreationStatus() {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpressStatus";
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile
};
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = false;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
2018-07-30 17:33:28 +05:00
} else {
2018-07-30 17:33:28 +05:00
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessageBox = false;
2018-07-30 17:33:28 +05:00
$scope.success = true;
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
2018-07-30 17:33:28 +05:00
$scope.goBackDisable = false;
}
} else {
2018-11-16 17:53:51 +05:00
$("#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;
}
2018-07-30 17:33:28 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-30 17:33:28 +05:00
////// List Domains Part
////////////////////////
// notifcations
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
2018-05-21 21:52:35 +05:00
$scope.childBaseDirChanged = true;
$("#listDomains").hide();
$scope.showListDomains = function () {
fetchDomains();
$("#listDomains").fadeIn();
};
$scope.hideListDomains = function () {
$("#listDomains").fadeOut();
};
2018-11-16 17:53:51 +05:00
function fetchDomains() {
$scope.domainLoading = false;
2018-11-16 17:53:51 +05:00
var url = "/websites/fetchDomains";
2018-11-16 17:53:51 +05:00
var data = {
masterDomain: $("#domainNamePage").text(),
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.fetchStatus === 1) {
2018-11-16 17:53:51 +05:00
$scope.childDomains = JSON.parse(response.data.data);
$scope.domainLoading = true;
} else {
2018-11-16 17:53:51 +05:00
$scope.domainError = false;
$scope.errorMessage = response.data.error_message;
$scope.domainLoading = true;
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
$scope.changePHP = function (childDomain, phpSelection) {
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.domainLoading = false;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
var url = "/websites/changePHP";
2018-11-16 17:53:51 +05:00
var data = {
childDomain: childDomain,
phpSelection: phpSelection,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.changePHP === 1) {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
2018-11-16 17:53:51 +05:00
$scope.changedPHPVersion = phpSelection;
2018-11-16 17:53:51 +05:00
// notifcations
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.phpChanged = false;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
2018-05-21 21:52:35 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
$scope.domainLoading = true;
2018-05-21 21:52:35 +05:00
// notifcations
$scope.phpChanged = true;
2018-11-16 17:53:51 +05:00
$scope.domainError = false;
2018-05-21 21:52:35 +05:00
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
// notifcations
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = false;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
};
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.changeChildBaseDir = function (childDomain, openBasedirValue) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
// notifcations
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.domainLoading = false;
$scope.childBaseDirChanged = true;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var url = "/websites/changeOpenBasedir";
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domainName: childDomain,
openBasedirValue: openBasedirValue
};
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.changeOpenBasedir === 1) {
2018-11-16 17:53:51 +05:00
$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;
2018-11-16 17:53:51 +05:00
$scope.domainError = false;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = false;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.domainLoading = true;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
$scope.deleteChildDomain = function (childDomain) {
$scope.domainLoading = false;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
2018-11-16 17:53:51 +05:00
url = "/websites/submitDomainDeletion";
2018-11-16 17:53:51 +05:00
var data = {
websiteName: childDomain,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.websiteDeleteStatus === 1) {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
$scope.deletedDomain = childDomain;
2018-11-16 17:53:51 +05:00
fetchDomains();
2018-11-16 17:53:51 +05:00
// notifications
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = false;
$scope.sslIssued = true;
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
$scope.domainLoading = true;
// notifcations
$scope.phpChanged = true;
2018-11-16 17:53:51 +05:00
$scope.domainError = false;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = false;
$scope.domainDeleted = true;
$scope.sslIssued = true;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.issueSSL = function (childDomain, path) {
$scope.domainLoading = false;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
var url = "/manageSSL/issueSSL";
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: childDomain,
path: path,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.SSL === 1) {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = false;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
$scope.sslDomainIssued = childDomain;
} else {
2018-11-16 17:53:51 +05:00
$scope.domainLoading = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = false;
$scope.couldNotConnect = true;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
}
}
function cantLoadInitialDatas(response) {
// notifcations
2018-11-16 17:53:51 +05:00
$scope.phpChanged = true;
$scope.domainError = true;
$scope.couldNotConnect = false;
$scope.domainDeleted = true;
$scope.sslIssued = true;
$scope.childBaseDirChanged = true;
2018-11-16 17:53:51 +05:00
}
};
2018-05-21 21:52:35 +05:00
/// Open_basedir protection
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = true;
2018-11-16 17:53:51 +05:00
$scope.openBaseDirView = function () {
2018-05-21 21:52:35 +05:00
$scope.openBaseDirBox = false;
};
$scope.hideOpenBasedir = function () {
$scope.openBaseDirBox = true;
};
2018-11-16 17:53:51 +05:00
$scope.applyOpenBasedirChanges = function (childDomain, phpSelection) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
// notifcations
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = false;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var url = "/websites/changeOpenBasedir";
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domainName: $("#domainNamePage").text(),
openBasedirValue: $scope.openBasedirValue
};
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.changeOpenBasedir === 1) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
2018-05-21 21:52:35 +05:00
} else {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = false;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = false;
$scope.openBaseDirBox = false;
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-21 21:52:35 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2019-03-09 00:59:05 +05:00
// REWRITE Template
const httpToHTTPS = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
### End CyberPanel Generated Rules.
`;
const nonWWWToWWW = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
### End CyberPanel Generated Rules.
`;
$scope.applyRewriteTemplate = function () {
if ($scope.rewriteTemplate === "Force HTTP -> HTTPS") {
$scope.rewriteRules = httpToHTTPS + $scope.rewriteRules;
} else if ($scope.rewriteTemplate === "Force NON-WWW -> WWW") {
$scope.rewriteRules = nonWWWToWWW + $scope.rewriteRules;
}
2019-03-09 00:59:05 +05:00
};
2017-10-24 19:16:36 +05:00
});
/* Java script code to create account ends here */
/* Java script code to suspend/un-suspend Website */
2018-11-16 17:53:51 +05:00
app.controller('suspendWebsiteControl', function ($scope, $http) {
2017-10-24 19:16:36 +05:00
$scope.suspendLoading = true;
$scope.stateView = true;
$scope.websiteSuspendFailure = true;
$scope.websiteUnsuspendFailure = true;
$scope.websiteSuccess = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.showSuspendUnsuspend = function () {
2017-10-24 19:16:36 +05:00
$scope.stateView = false;
};
2018-11-16 17:53:51 +05:00
$scope.save = function () {
$scope.suspendLoading = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var websiteName = $scope.websiteToBeSuspended
var state = $scope.state;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/submitWebsiteStatus";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var data = {
websiteName: websiteName,
state: state,
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.websiteStatus === 1) {
if (state == "Suspend") {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.suspendLoading = true;
$scope.stateView = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteSuspendFailure = true;
$scope.websiteUnsuspendFailure = true;
$scope.websiteSuccess = false;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteStatus = websiteName;
$scope.finalStatus = "Suspended";
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.suspendLoading = true;
$scope.stateView = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteSuspendFailure = true;
$scope.websiteUnsuspendFailure = true;
$scope.websiteSuccess = false;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteStatus = websiteName;
$scope.finalStatus = "Un-suspended";
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
} else {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
if (state == "Suspend") {
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.suspendLoading = true;
$scope.stateView = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteSuspendFailure = false;
$scope.websiteUnsuspendFailure = true;
$scope.websiteSuccess = true;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
} else {
2018-11-16 17:53:51 +05:00
$scope.suspendLoading = true;
$scope.stateView = false;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteSuspendFailure = true;
$scope.websiteUnsuspendFailure = false;
$scope.websiteSuccess = true;
$scope.couldNotConnect = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
$scope.couldNotConnect = false;
$scope.suspendLoading = true;
$scope.stateView = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
$scope.websiteSuspendFailure = true;
$scope.websiteUnsuspendFailure = true;
$scope.websiteSuccess = true;
2017-10-24 19:16:36 +05:00
2018-11-16 17:53:51 +05:00
}
2017-10-24 19:16:36 +05:00
};
});
2018-03-01 16:14:18 +00:00
/* Java script code to suspend/un-suspend ends here */
2018-03-02 18:13:26 +05:00
/* Java script code to manage cron */
2018-03-01 16:14:18 +00:00
2018-11-16 17:53:51 +05:00
app.controller('manageCronController', function ($scope, $http) {
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").hide();
$("#modifyCronForm").hide();
$("#cronTable").hide();
$("#saveCronButton").hide();
$("#addCronButton").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.fetchWebsites = function () {
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").show();
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
var websiteToBeModified = $scope.websiteToBeModified;
url = "/websites/getWebsiteCron";
var data = {
domain: websiteToBeModified,
};
var config = {
2018-11-16 17:53:51 +05:00
headers: {
2018-03-01 16:14:18 +00:00
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-03-01 16:14:18 +00:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.getWebsiteCron === 0) {
2018-03-01 16:14:18 +00:00
console.log(response.data);
$scope.errorMessage = response.data.error_message;
$("#cronTable").hide();
$("#manageCronLoading").hide();
$("#modifyCronForm").hide();
$("#saveCronButton").hide();
$("#addCronButton").hide();
} else {
2018-03-01 16:14:18 +00:00
console.log(response.data);
var finalData = response.data.crons;
$scope.cronList = finalData;
$("#cronTable").show();
$("#manageCronLoading").hide();
$("#modifyCronForm").hide();
$("#saveCronButton").hide();
$("#addCronButton").hide();
}
}
2018-11-16 17:53:51 +05:00
2018-03-01 16:14:18 +00:00
function cantLoadInitialDatas(response) {
$("#manageCronLoading").hide();
$("#cronTable").hide();
$("#fetchCronFailure").show();
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
}
};
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.fetchCron = function (cronLine) {
2018-03-01 16:14:18 +00:00
$("#cronTable").show();
$("#manageCronLoading").show();
$("#modifyCronForm").show();
$("#saveCronButton").show();
$("#addCronButton").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$scope.line = cronLine;
console.log($scope.line);
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
var websiteToBeModified = $scope.websiteToBeModified;
url = "/websites/getCronbyLine";
var data = {
domain: websiteToBeModified,
line: cronLine
};
var config = {
2018-11-16 17:53:51 +05:00
headers: {
2018-03-01 16:14:18 +00:00
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-03-01 16:14:18 +00:00
function ListInitialDatas(response) {
console.log(response);
2018-11-16 17:53:51 +05:00
if (response.data.getWebsiteCron === 0) {
2018-03-01 16:14:18 +00:00
console.log(response.data);
$scope.errorMessage = response.data.error_message;
$("#cronTable").show();
$("#manageCronLoading").hide();
$("#modifyCronForm").hide();
$("#saveCronButton").hide();
$("#addCronButton").hide();
} else {
2018-03-01 16:14:18 +00:00
console.log(response.data);
$scope.minute = response.data.cron.minute
$scope.hour = response.data.cron.hour
$scope.monthday = response.data.cron.monthday
$scope.month = response.data.cron.month
$scope.weekday = response.data.cron.weekday
$scope.command = response.data.cron.command
$scope.line = response.data.line
$("#cronTable").show();
$("#manageCronLoading").hide();
$("#modifyCronForm").fadeIn();
$("#addCronButton").hide();
$("#saveCronButton").show();
}
}
2018-11-16 17:53:51 +05:00
2018-03-01 16:14:18 +00:00
function cantLoadInitialDatas(response) {
$("#manageCronLoading").hide();
$("#fetchCronFailure").show();
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
}
};
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.populate = function () {
2018-03-01 16:14:18 +00:00
splitTime = $scope.defined.split(" ");
$scope.minute = splitTime[0];
$scope.hour = splitTime[1];
$scope.monthday = splitTime[2];
$scope.month = splitTime[3];
$scope.weekday = splitTime[4];
}
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.addCronForm = function () {
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
$("#manageCronLoading").hide();
if (!$scope.websiteToBeModified) {
alert("Please select a domain first");
} else {
2018-03-01 16:14:18 +00:00
$scope.minute = $scope.hour = $scope.monthday = $scope.month = $scope.weekday = $scope.command = $scope.line = "";
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$("#cronTable").hide();
$("#manageCronLoading").hide();
$("#modifyCronForm").show();
$("#saveCronButton").hide()
$("#addCronButton").show();
}
};
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.addCronFunc = function () {
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").show();
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
var websiteToBeModified = $scope.websiteToBeModified;
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
url = "/websites/addNewCron";
var data = {
2018-11-16 17:53:51 +05:00
domain: websiteToBeModified,
minute: $scope.minute,
hour: $scope.hour,
monthday: $scope.monthday,
month: $scope.month,
weekday: $scope.weekday,
cronCommand: $scope.command
2018-03-01 16:14:18 +00:00
};
var config = {
2018-11-16 17:53:51 +05:00
headers: {
2018-03-01 16:14:18 +00:00
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-03-01 16:14:18 +00:00
function ListInitialDatas(response) {
console.log(response);
2018-11-16 17:53:51 +05:00
if (response.data.addNewCron === 0) {
2018-03-02 18:13:26 +05:00
$scope.errorMessage = response.data.error_message
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
$("#addCronFailure").show();
} else {
2018-03-01 16:14:18 +00:00
$("#cronTable").hide();
$("#manageCronLoading").hide();
$("#cronEditSuccess").show();
$("#fetchCronFailure").hide();
$("#addCronFailure").hide();
}
}
2018-11-16 17:53:51 +05:00
2018-03-01 16:14:18 +00:00
function cantLoadInitialDatas(response) {
$("#manageCronLoading").hide();
$("#addCronFailure").show();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
}
};
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.removeCron = function (line) {
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").show();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
url = "/websites/remCronbyLine";
var data = {
2018-11-16 17:53:51 +05:00
domain: $scope.websiteToBeModified,
line: line
2018-03-01 16:14:18 +00:00
};
var config = {
2018-11-16 17:53:51 +05:00
headers: {
2018-03-01 16:14:18 +00:00
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-03-01 16:14:18 +00:00
function ListInitialDatas(response) {
console.log(response);
2018-11-16 17:53:51 +05:00
if (response.data.remCronbyLine === 0) {
2018-03-01 16:14:18 +00:00
$scope.errorMessage = response.data.error_message;
$("#manageCronLoading").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
$("#addCronFailure").show();
} else {
2018-03-01 16:14:18 +00:00
$("#cronTable").hide();
$("#manageCronLoading").hide();
$("#cronEditSuccess").show();
$("#fetchCronFailure").hide();
$("#addCronFailure").hide();
}
}
2018-11-16 17:53:51 +05:00
2018-03-01 16:14:18 +00:00
function cantLoadInitialDatas(response) {
$("#manageCronLoading").hide();
$("#addCronFailure").show();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
}
};
2018-03-02 18:13:26 +05:00
2018-11-16 17:53:51 +05:00
$scope.modifyCronFunc = function () {
2018-03-01 16:14:18 +00:00
$("#manageCronLoading").show();
$("#addCronFailure").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
var websiteToBeModified = $scope.websiteToBeModified;
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
url = "/websites/saveCronChanges";
var data = {
2018-11-16 17:53:51 +05:00
domain: websiteToBeModified,
line: $scope.line,
minute: $scope.minute,
hour: $scope.hour,
monthday: $scope.monthday,
month: $scope.month,
weekday: $scope.weekday,
cronCommand: $scope.command
2018-03-01 16:14:18 +00:00
};
var config = {
2018-11-16 17:53:51 +05:00
headers: {
2018-03-01 16:14:18 +00:00
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-03-01 16:14:18 +00:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.addNewCron === 0) {
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
$scope.errorMessage = response.data.error_message;
$("#manageCronLoading").hide();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
$("#addCronFailure").show();
} else {
2018-03-01 16:14:18 +00:00
console.log(response.data);
$("#cronTable").hide();
$("#manageCronLoading").hide();
$("#cronEditSuccess").show();
$("#fetchCronFailure").hide();
$("#addCronFailure").hide();
}
}
2018-11-16 17:53:51 +05:00
2018-03-01 16:14:18 +00:00
function cantLoadInitialDatas(response) {
$("#manageCronLoading").hide();
$("#addCronFailure").show();
$("#cronEditSuccess").hide();
$("#fetchCronFailure").hide();
}
};
2018-03-02 18:13:26 +05:00
2018-03-01 16:14:18 +00:00
});
2018-05-08 21:25:37 +05:00
/* Java script code to manage cron ends here */
/* Java script code to manage cron */
2018-11-16 17:53:51 +05:00
app.controller('manageAliasController', function ($scope, $http, $timeout, $window) {
2018-05-08 21:25:37 +05:00
$('form').submit(function (e) {
e.preventDefault();
});
2018-05-08 21:25:37 +05:00
var masterDomain = "";
$scope.aliasTable = false;
$scope.addAliasButton = false;
$scope.domainAliasForm = true;
$scope.aliasError = true;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
$scope.createAliasEnter = function ($event) {
var keyCode = $event.which || $event.keyCode;
if (keyCode === 13) {
$scope.manageAliasLoading = false;
$scope.addAliasFunc();
}
};
2018-05-08 21:25:37 +05:00
$scope.showAliasForm = function (domainName) {
$scope.domainAliasForm = false;
$scope.aliasTable = true;
$scope.addAliasButton = true;
masterDomain = domainName;
};
$scope.addAliasFunc = function () {
$scope.manageAliasLoading = false;
2018-11-16 17:53:51 +05:00
var ssl;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
if ($scope.sslCheck === true) {
ssl = 1;
} else {
2018-11-16 17:53:51 +05:00
ssl = 0
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/submitAliasCreation";
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var data = {
masterDomain: masterDomain,
aliasDomain: $scope.aliasDomain,
ssl: ssl
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.createAliasStatus === 1) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = true;
$scope.addAliasButton = true;
$scope.domainAliasForm = false;
$scope.aliasError = true;
$scope.couldNotConnect = true;
$scope.aliasCreated = false;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$timeout(function () {
$window.location.reload();
}, 3000);
2018-05-08 21:25:37 +05:00
} else {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = true;
$scope.addAliasButton = true;
$scope.domainAliasForm = false;
$scope.aliasError = false;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = true;
$scope.addAliasButton = true;
$scope.domainAliasForm = false;
$scope.aliasError = true;
$scope.couldNotConnect = false;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
};
$scope.issueSSL = function (masterDomain, aliasDomain) {
$scope.manageAliasLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/issueAliasSSL";
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var data = {
masterDomain: masterDomain,
aliasDomain: aliasDomain,
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.sslStatus === 1) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = true;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = false;
2018-05-08 21:25:37 +05:00
} else {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = false;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = true;
$scope.couldNotConnect = false;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
};
$scope.removeAlias = function (masterDomain, aliasDomain) {
$scope.manageAliasLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/delateAlias";
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var data = {
masterDomain: masterDomain,
aliasDomain: aliasDomain,
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.deleteAlias === 1) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = true;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = false;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$timeout(function () {
$window.location.reload();
}, 3000);
2018-05-08 21:25:37 +05:00
} else {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = false;
$scope.couldNotConnect = true;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
$scope.aliasTable = false;
$scope.addAliasButton = true;
$scope.domainAliasForm = true;
$scope.aliasError = true;
$scope.couldNotConnect = false;
$scope.aliasCreated = true;
$scope.manageAliasLoading = true;
$scope.operationSuccess = true;
2018-05-08 21:25:37 +05:00
2018-11-16 17:53:51 +05:00
}
2018-05-08 21:25:37 +05:00
};
});
/* Java script code to manage cron ends here */
2018-11-16 17:53:51 +05:00
app.controller('launchChild', function ($scope, $http) {
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
$scope.hidelogsbtn = function () {
$scope.hideLogs = true;
};
2018-11-16 17:53:51 +05:00
$scope.hideErrorLogsbtn = function () {
$scope.hideLogs = true;
};
2018-11-16 17:53:51 +05:00
$scope.fileManagerURL = "/filemanager/" + $("#domainNamePage").text();
$scope.previewUrl = "/preview/" + $("#childDomain").text() + "/";
2018-08-18 00:39:10 +05:00
$scope.wordPressInstallURL = "/websites/" + $("#childDomain").text() + "/wordpressInstall";
$scope.joomlaInstallURL = "/websites/" + $("#childDomain").text() + "/joomlaInstall";
$scope.setupGit = "/websites/" + $("#childDomain").text() + "/setupGit";
$scope.installPrestaURL = "/websites/" + $("#childDomain").text() + "/installPrestaShop";
2019-11-07 16:53:02 +05:00
$scope.installMagentoURL = "/websites/" + $("#childDomain").text() + "/installMagento";
var logType = 0;
$scope.pageNumber = 1;
2018-11-16 17:53:51 +05:00
$scope.fetchLogs = function (type) {
2018-11-16 17:53:51 +05:00
var pageNumber = $scope.pageNumber;
2018-11-16 17:53:51 +05:00
if (type == 3) {
pageNumber = $scope.pageNumber + 1;
$scope.pageNumber = pageNumber;
} else if (type == 4) {
2018-11-16 17:53:51 +05:00
pageNumber = $scope.pageNumber - 1;
$scope.pageNumber = pageNumber;
} else {
2018-11-16 17:53:51 +05:00
logType = type;
}
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
url = "/websites/getDataFromLogFile";
2018-11-16 17:53:51 +05:00
var domainNamePage = $("#domainNamePage").text();
2018-11-16 17:53:51 +05:00
var data = {
logType: logType,
virtualHost: domainNamePage,
page: pageNumber,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.logstatus === 1) {
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = false;
$scope.hideLogs = false;
2018-11-16 17:53:51 +05:00
$scope.records = JSON.parse(response.data.data);
} else {
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
console.log(domainNamePage)
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = false;
2018-11-16 17:53:51 +05:00
}
};
$scope.errorPageNumber = 1;
2018-11-16 17:53:51 +05:00
$scope.fetchErrorLogs = function (type) {
2018-11-16 17:53:51 +05:00
var errorPageNumber = $scope.errorPageNumber;
2018-11-16 17:53:51 +05:00
if (type === 3) {
errorPageNumber = $scope.errorPageNumber + 1;
$scope.errorPageNumber = errorPageNumber;
} else if (type === 4) {
2018-11-16 17:53:51 +05:00
errorPageNumber = $scope.errorPageNumber - 1;
$scope.errorPageNumber = errorPageNumber;
} else {
2018-11-16 17:53:51 +05:00
logType = type;
}
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = false;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideErrorLogs = true;
$scope.hideLogs = false;
2018-11-16 17:53:51 +05:00
url = "/websites/fetchErrorLogs";
2018-11-16 17:53:51 +05:00
var domainNamePage = $("#domainNamePage").text();
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: domainNamePage,
page: errorPageNumber,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.logstatus === 1) {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = false;
$scope.hideErrorLogs = false;
2018-11-16 17:53:51 +05:00
$scope.errorLogsData = response.data.data;
} else {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = false;
$scope.couldNotConnect = true;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
// notifications
2018-11-16 17:53:51 +05:00
$scope.logFileLoading = true;
$scope.logsFeteched = true;
$scope.couldNotFetchLogs = true;
$scope.couldNotConnect = false;
$scope.fetchedData = true;
$scope.hideLogs = true;
$scope.hideErrorLogs = true;
2018-11-16 17:53:51 +05:00
}
};
///////// Configurations Part
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2018-11-16 17:53:51 +05:00
$scope.hideconfigbtn = function () {
$scope.configurationsBox = true;
};
2018-11-16 17:53:51 +05:00
$scope.fetchConfigurations = function () {
2018-11-16 17:53:51 +05:00
$scope.hidsslconfigs = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
2018-11-16 17:53:51 +05:00
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
///
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/getDataFromConfigFile";
2018-11-16 17:53:51 +05:00
var virtualHost = $("#childDomain").text();
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.configstatus === 1) {
2018-11-16 17:53:51 +05:00
//Rewrite rules
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
///
2018-11-16 17:53:51 +05:00
$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;
2018-11-16 17:53:51 +05:00
$scope.configData = response.data.configData;
} else {
2018-11-16 17:53:51 +05:00
//Rewrite rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
///
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = false;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
//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;
2018-11-16 17:53:51 +05:00
}
};
2018-11-16 17:53:51 +05:00
$scope.saveCongiruations = function () {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/saveConfigsToFile";
2018-11-16 17:53:51 +05:00
var virtualHost = $("#childDomain").text();
var configData = $scope.configData;
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
configData: configData,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.configstatus == 1) {
2018-11-16 17:53:51 +05:00
$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 {
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = true;
$scope.fetchedConfigsData = false;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = false;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.couldNotConnect = false;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
2018-11-16 17:53:51 +05:00
}
};
///////// Rewrite Rules
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
$scope.hideRewriteRulesbtn = function () {
$scope.configurationsBoxRewrite = true;
};
2018-11-16 17:53:51 +05:00
$scope.fetchRewriteFules = function () {
2018-11-16 17:53:51 +05:00
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.changePHPView = true;
2018-11-16 17:53:51 +05:00
$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;
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/getRewriteRules";
2018-11-16 17:53:51 +05:00
var virtualHost = $("#childDomain").text();
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.rewriteStatus == 1) {
2018-11-16 17:53:51 +05:00
// from main
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
2018-11-16 17:53:51 +05:00
// main ends
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
//
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = false;
$scope.saveRewriteRulesBTN = false;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.rewriteRules = response.data.rewriteRules;
} else {
2018-11-16 17:53:51 +05:00
// 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
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
///
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = false;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
// from main
2018-11-16 17:53:51 +05:00
$scope.configurationsBox = true;
$scope.configsFetched = true;
$scope.couldNotFetchConfigs = true;
$scope.fetchedConfigsData = true;
$scope.configFileLoading = true;
$scope.configSaved = true;
$scope.couldNotSaveConfigurations = true;
$scope.saveConfigBtn = true;
2018-11-16 17:53:51 +05:00
// from main
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
///
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = true;
$scope.rewriteRulesFetched = true;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = true;
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
};
2018-11-16 17:53:51 +05:00
$scope.saveRewriteRules = function () {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/saveRewriteRules";
2018-11-16 17:53:51 +05:00
var virtualHost = $("#childDomain").text();
var rewriteRules = $scope.rewriteRules;
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
rewriteRules: rewriteRules,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.rewriteStatus == 1) {
2018-11-16 17:53:51 +05:00
$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 {
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = false;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.configurationsBoxRewrite = false;
$scope.rewriteRulesFetched = false;
$scope.couldNotFetchRewriteRules = true;
$scope.rewriteRulesSaved = true;
$scope.couldNotSaveRewriteRules = true;
$scope.fetchedRewriteRules = true;
$scope.saveRewriteRulesBTN = false;
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
};
//////// SSL Part
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.hidsslconfigs = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
$scope.hidesslbtn = function () {
$scope.hidsslconfigs = true;
};
2018-11-16 17:53:51 +05:00
$scope.addSSL = function () {
$scope.hidsslconfigs = false;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = true;
};
2018-11-16 17:53:51 +05:00
$scope.saveSSL = function () {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
url = "/websites/saveSSL";
2018-11-16 17:53:51 +05:00
var virtualHost = $("#childDomain").text();
var cert = $scope.cert;
var key = $scope.key;
2018-11-16 17:53:51 +05:00
var data = {
virtualHost: virtualHost,
cert: cert,
key: key,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.sslStatus === 1) {
2018-11-16 17:53:51 +05:00
$scope.sslSaved = false;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
} else {
2018-11-16 17:53:51 +05:00
$scope.sslSaved = true;
$scope.couldNotSaveSSL = false;
$scope.couldNotConnect = true;
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.sslSaved = true;
$scope.couldNotSaveSSL = true;
$scope.couldNotConnect = false;
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
}
};
//// Change PHP Master
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
$scope.changePHPView = true;
2018-11-16 17:53:51 +05:00
$scope.hideChangePHPMaster = function () {
$scope.changePHPView = true;
};
2018-11-16 17:53:51 +05:00
$scope.changePHPMaster = function () {
$scope.hidsslconfigs = true;
$scope.configurationsBox = true;
$scope.configurationsBoxRewrite = true;
$scope.changePHPView = false;
};
2018-11-16 17:53:51 +05:00
$scope.changePHPVersionMaster = function (childDomain, phpSelection) {
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = false;
2018-11-16 17:53:51 +05:00
var url = "/websites/changePHP";
2018-11-16 17:53:51 +05:00
var data = {
childDomain: $("#childDomain").text(),
phpSelection: $scope.phpSelectionMaster,
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.changePHP === 1) {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
$scope.websiteDomain = $("#childDomain").text();
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = false;
$scope.couldNotConnect = true;
} else {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = false;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = true;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.configFileLoading = true;
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.failedToChangePHPMaster = true;
$scope.phpChangedMaster = true;
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
2018-08-18 00:39:10 +05:00
};
/// Open_basedir protection
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = true;
2018-11-16 17:53:51 +05:00
$scope.openBaseDirView = function () {
$scope.openBaseDirBox = false;
};
$scope.hideOpenBasedir = function () {
$scope.openBaseDirBox = true;
};
2018-11-16 17:53:51 +05:00
$scope.applyOpenBasedirChanges = function (childDomain, phpSelection) {
2018-11-16 17:53:51 +05:00
// notifcations
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = false;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
2018-11-16 17:53:51 +05:00
var url = "/websites/changeOpenBasedir";
2018-11-16 17:53:51 +05:00
var data = {
domainName: $("#childDomain").text(),
openBasedirValue: $scope.openBasedirValue
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.changeOpenBasedir === 1) {
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
} else {
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = false;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.openBaseDirBox = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.baseDirLoading = true;
$scope.operationFailed = true;
$scope.operationSuccessfull = true;
$scope.couldNotConnect = false;
$scope.openBaseDirBox = false;
2018-11-16 17:53:51 +05:00
}
}
});
/* Application Installer */
2018-11-16 17:53:51 +05:00
app.controller('installWordPressCTRL', function ($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
var statusFile;
var domain = $("#domainNamePage").text();
var path;
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-11-16 17:53:51 +05:00
$scope.installWordPress = function () {
2018-11-16 17:53:51 +05:00
$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..";
2018-11-16 17:53:51 +05:00
path = $scope.installPath;
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpress";
2018-11-16 17:53:51 +05:00
var home = "1";
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
home = "0";
}
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
home: home,
path: path,
blogTitle: $scope.blogTitle,
adminUser: $scope.adminUser,
passwordByPass: $scope.adminPassword,
2018-11-16 17:53:51 +05:00
adminEmail: $scope.adminEmail
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
statusFile = response.data.tempStatusPath;
getInstallStatus();
} else {
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
}
};
2018-11-16 17:53:51 +05:00
function getInstallStatus() {
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpressStatus";
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile,
domainName: domain
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
$scope.installationURL = "http://" + domain + "/" + path;
} else {
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
}
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
} else {
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
2018-11-16 17:53:51 +05:00
}
} else {
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
2018-11-16 17:53:51 +05:00
$timeout(getInstallStatus, 1000);
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-11-16 17:53:51 +05:00
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
});
2018-11-16 17:53:51 +05:00
app.controller('installJoomlaCTRL', function ($scope, $http, $timeout) {
2018-07-13 21:45:40 +05:00
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
2018-07-26 04:11:10 +05:00
$scope.databasePrefix = 'jm_';
2018-07-13 21:45:40 +05:00
var statusFile;
var domain = $("#domainNamePage").text();
var path;
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-11-16 17:53:51 +05:00
function getInstallStatus() {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpressStatus";
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile,
domainName: domain
};
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
$scope.installationURL = "http://" + domain + "/" + path;
} else {
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
}
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
2018-07-13 21:45:40 +05:00
} else {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
} else {
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$timeout(getInstallStatus, 1000);
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$scope.installJoomla = function () {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
$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..";
2018-11-16 17:53:51 +05:00
path = $scope.installPath;
2018-11-16 17:53:51 +05:00
url = "/websites/installJoomla";
2018-11-16 17:53:51 +05:00
var home = "1";
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
home = "0";
}
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
home: home,
path: path,
sitename: $scope.blogTitle,
username: $scope.adminUser,
passwordByPass: $scope.adminPassword,
2018-11-16 17:53:51 +05:00
prefix: $scope.databasePrefix
};
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
statusFile = response.data.tempStatusPath;
getInstallStatus();
} else {
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
}
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-07-13 21:45:40 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
};
});
2018-11-16 17:53:51 +05:00
app.controller('setupGit', function ($scope, $http, $timeout, $window) {
2018-07-26 04:11:10 +05:00
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.githubBranch = 'master';
$scope.installProg = true;
2018-07-26 23:13:02 +05:00
$scope.goBackDisable = true;
2018-07-27 04:13:10 +05:00
var defaultProvider = 'github';
$scope.setProvider = function (provider) {
defaultProvider = provider;
};
2018-07-26 04:11:10 +05:00
var statusFile;
var domain = $("#domainNamePage").text();
2018-11-16 17:53:51 +05:00
function getInstallStatus() {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/installWordpressStatus";
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile,
domainName: domain
};
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.goBackDisable = true;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
$timeout(function () {
$window.location.reload();
}, 3000);
2018-07-26 04:11:10 +05:00
} else {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.goBackDisable = false;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
$scope.goBackDisable = false;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
} else {
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$timeout(getInstallStatus, 1000);
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
$scope.goBackDisable = false;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.attachRepo = function () {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = false;
$scope.installProg = false;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.currentStatus = "Attaching GIT..";
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/setupGitRepo";
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
username: $scope.githubUserName,
reponame: $scope.githubRepo,
branch: $scope.githubBranch,
defaultProvider: defaultProvider
};
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
statusFile = response.data.tempStatusPath;
getInstallStatus();
} else {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
$scope.goBackDisable = false;
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-07-26 04:11:10 +05:00
2018-11-16 17:53:51 +05:00
}
};
2018-07-26 23:13:02 +05:00
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installProg = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-07-28 01:25:51 +05:00
/// Detach Repo
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.successMessageBranch = true;
2018-11-16 17:53:51 +05:00
$scope.detachRepo = function () {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.gitLoading = false;
$scope.successMessageBranch = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/detachRepo";
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain
};
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.gitLoading = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.status === 1) {
$scope.failedMesg = true;
$scope.successMessage = false;
$scope.couldNotConnect = true;
$scope.successMessageBranch = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$timeout(function () {
$window.location.reload();
}, 3000);
2018-07-28 01:25:51 +05:00
} else {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.failedMesg = false;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.successMessageBranch = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
}
function cantLoadInitialDatas(response) {
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = false;
$scope.gitLoading = true;
$scope.successMessageBranch = true;
}
2018-07-28 01:25:51 +05:00
};
2018-11-16 17:53:51 +05:00
$scope.changeBranch = function () {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.gitLoading = false;
$scope.successMessageBranch = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/changeBranch";
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
githubBranch: $scope.githubBranch
};
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.gitLoading = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.status === 1) {
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.successMessageBranch = false;
2018-07-28 01:25:51 +05:00
} else {
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.failedMesg = false;
$scope.successMessage = true;
$scope.couldNotConnect = true;
$scope.successMessageBranch = true;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
}
2018-07-28 01:25:51 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
$scope.failedMesg = true;
$scope.successMessage = true;
$scope.couldNotConnect = false;
$scope.gitLoading = true;
$scope.successMessageBranch = true;
}
2018-07-28 01:25:51 +05:00
};
2018-07-26 23:13:02 +05:00
2018-08-05 01:46:31 +05:00
});
2018-11-16 17:53:51 +05:00
app.controller('installPrestaShopCTRL', function ($scope, $http, $timeout) {
2018-08-05 01:46:31 +05:00
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$scope.databasePrefix = 'ps_';
var statusFile;
var domain = $("#domainNamePage").text();
var path;
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
2018-11-16 17:53:51 +05:00
function getInstallStatus() {
url = "/websites/installWordpressStatus";
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
var data = {
statusFile: statusFile,
domainName: domain
};
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.abort === 1) {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
$scope.installationURL = "http://" + domain + "/" + path;
} else {
2018-11-16 17:53:51 +05:00
$scope.installationURL = domain;
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
2018-08-05 01:46:31 +05:00
} else {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
} else {
2018-11-16 17:53:51 +05:00
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$timeout(getInstallStatus, 1000);
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.installPrestShop = function () {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$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..";
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
path = $scope.installPath;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
url = "/websites/prestaShopInstall";
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
var home = "1";
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
if (typeof path !== 'undefined') {
home = "0";
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
var data = {
domain: domain,
home: home,
path: path,
shopName: $scope.shopName,
firstName: $scope.firstName,
lastName: $scope.lastName,
databasePrefix: $scope.databasePrefix,
email: $scope.email,
passwordByPass: $scope.password
2018-11-16 17:53:51 +05:00
};
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
function ListInitialDatas(response) {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
if (response.data.installStatus === 1) {
statusFile = response.data.tempStatusPath;
getInstallStatus();
} else {
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
$scope.errorMessage = response.data.error_message;
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
}
2018-08-05 01:46:31 +05:00
2018-11-16 17:53:51 +05:00
function cantLoadInitialDatas(response) {
}
2018-08-05 01:46:31 +05:00
};
});
app.controller('sshAccess', function ($scope, $http, $timeout) {
$scope.wpInstallLoading = true;
$scope.setupSSHAccess = function () {
$scope.wpInstallLoading = false;
url = "/websites/saveSSHAccessChanges";
var data = {
domain: $("#domainName").text(),
externalApp: $("#externalApp").text(),
password: $scope.password
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.wpInstallLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes Successfully Applied.',
type: 'success'
});
} else {
new PNotify({
title: 'Error!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
new PNotify({
title: 'Error!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2019-08-03 14:53:31 +05:00
});
/* Java script code to cloneWebsite */
app.controller('cloneWebsite', function ($scope, $http, $timeout, $window) {
$('form').submit(function (e) {
e.preventDefault();
});
2019-08-03 14:53:31 +05:00
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.goBackDisable = true;
$scope.cloneEnter = function ($event) {
var keyCode = $event.which || $event.keyCode;
if (keyCode === 13) {
$scope.cyberpanelLoading = false;
$scope.startCloning();
}
};
2019-08-03 14:53:31 +05:00
var statusFile;
$scope.startCloning = function () {
$scope.cyberpanelLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = true;
$scope.currentStatus = "Cloning started..";
url = "/websites/startCloning";
var data = {
masterDomain: $("#domainName").text(),
domainName: $scope.domain
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
statusFile = response.data.tempStatusPath;
getCreationStatus();
} else {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
};
$scope.goBack = function () {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getCreationStatus() {
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.abort === 1) {
if (response.data.installStatus === 1) {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
} else {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = 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.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
}
});
/* Java script code to cloneWebsite ends here */
/* Java script code to syncWebsite */
app.controller('syncWebsite', function ($scope, $http, $timeout, $window) {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.goBackDisable = true;
var statusFile;
$scope.startSyncing = function () {
$scope.cyberpanelLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = true;
$scope.currentStatus = "Cloning started..";
url = "/websites/startSync";
var data = {
childDomain: $("#childDomain").text(),
eraseCheck: $scope.eraseCheck,
dbCheck: $scope.dbCheck,
copyChanged: $scope.copyChanged
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
statusFile = response.data.tempStatusPath;
getCreationStatus();
} else {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
};
$scope.goBack = function () {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getCreationStatus() {
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.abort === 1) {
if (response.data.installStatus === 1) {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
} else {
$scope.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
$scope.currentStatus = 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.cyberpanelLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.goBackDisable = false;
}
}
});
2019-11-07 16:53:02 +05:00
/* Java script code to syncWebsite ends here */
app.controller('installMagentoCTRL', function ($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$scope.databasePrefix = 'ps_';
var statusFile;
var domain = $("#domainNamePage").text();
var path;
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getInstallStatus() {
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile,
domainName: domain
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.abort === 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";
}
} 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;
}
}
$scope.installMagento = 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/magentoInstall";
var home = "1";
if (typeof path !== 'undefined') {
home = "0";
}
var sampleData;
if ($scope.sampleData === true) {
sampleData = 1;
} else {
sampleData = 0
}
var data = {
domain: domain,
home: home,
path: path,
firstName: $scope.firstName,
lastName: $scope.lastName,
username: $scope.username,
email: $scope.email,
passwordByPass: $scope.password,
sampleData: sampleData
};
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) {
}
};
2020-03-10 21:04:57 +05:00
});
/* Java script code to git tracking */
app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
$scope.cyberpanelLoading = true;
$scope.loadingSticks = true;
$scope.gitTracking = true;
$scope.gitEnable = true;
$scope.statusBox = true;
2020-03-12 13:47:27 +05:00
$scope.gitCommitsTable = true;
2020-03-10 21:04:57 +05:00
var statusFile;
$scope.fetchFolderDetails = function () {
$scope.cyberpanelLoading = false;
2020-03-12 18:56:28 +05:00
$scope.gitCommitsTable = true;
2020-03-10 21:04:57 +05:00
url = "/websites/fetchFolderDetails";
var data = {
domain: $("#domain").text(),
folder: $scope.folder
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
if (response.data.repo === 1) {
$scope.gitTracking = true;
$scope.gitEnable = false;
$scope.branches = response.data.finalBranches;
$scope.deploymentKey = response.data.deploymentKey;
$scope.remote = response.data.remote;
$scope.remoteResult = response.data.remoteResult;
$scope.totalCommits = response.data.totalCommits;
2020-03-12 13:47:27 +05:00
$scope.home = response.data.home;
2020-03-16 19:14:39 +05:00
$scope.webHookURL = response.data.webHookURL;
$scope.autoCommitCurrent = response.data.autoCommitCurrent;
$scope.autoPushCurrent = response.data.autoPushCurrent;
$scope.emailLogsCurrent = response.data.emailLogsCurrent;
2020-03-10 21:04:57 +05:00
} else {
$scope.gitTracking = false;
$scope.gitEnable = true;
2020-03-12 13:47:27 +05:00
$scope.home = response.data.home;
$scope.deploymentKey = response.data.deploymentKey;
2020-03-10 21:04:57 +05:00
}
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.initRepo = function () {
$scope.cyberpanelLoading = false;
url = "/websites/initRepo";
var data = {
domain: $("#domain").text(),
folder: $scope.folder
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Repo initiated.',
type: 'success'
});
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.setupRemote = function () {
$scope.cyberpanelLoading = false;
url = "/websites/setupRemote";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
gitHost: $scope.gitHost,
gitUsername: $scope.gitUsername,
gitReponame: $scope.gitReponame,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Remote successfully set.',
type: 'success'
});
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2020-03-15 15:26:24 +05:00
var changeBranch = 0;
2020-03-10 21:04:57 +05:00
$scope.changeBranch = function () {
2020-03-15 15:26:24 +05:00
if(changeBranch === 1){
changeBranch = 0;
return 0;
}
2020-03-10 21:04:57 +05:00
$scope.loadingSticks = false;
$("#showStatus").modal();
url = "/websites/changeGitBranch";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
branchName: $scope.branchName
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.loadingSticks = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
$timeout(function () {
$window.location.reload();
}, 3000);
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.loadingSticks = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.createNewBranch = function () {
$scope.cyberpanelLoading = false;
$scope.commandStatus = "";
$scope.statusBox = false;
2020-03-15 15:26:24 +05:00
changeBranch = 1;
2020-03-10 21:04:57 +05:00
url = "/websites/createNewBranch";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
newBranchName: $scope.newBranchName
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = false;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.commitChanges = function () {
$scope.cyberpanelLoading = false;
$scope.commandStatus = "";
$scope.statusBox = false;
url = "/websites/commitChanges";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
commitMessage: $scope.commitMessage
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = false;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.gitPull = function () {
$scope.loadingSticks = false;
$("#showStatus").modal();
url = "/websites/gitPull";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.loadingSticks = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.loadingSticks = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.gitPush = function () {
$scope.loadingSticks = false;
$("#showStatus").modal();
url = "/websites/gitPush";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.loadingSticks = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.loadingSticks = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2020-03-12 13:47:27 +05:00
$scope.attachRepoGIT = function () {
$scope.cyberpanelLoading = false;
$scope.commandStatus = "";
$scope.statusBox = false;
url = "/websites/attachRepoGIT";
2020-03-10 21:04:57 +05:00
var data = {
2020-03-12 13:47:27 +05:00
domain: $("#domain").text(),
folder: $scope.folder,
gitHost: $scope.gitHost,
gitUsername: $scope.gitUsername,
gitReponame: $scope.gitReponame,
overrideData: $scope.overrideData
2020-03-10 21:04:57 +05:00
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2020-03-12 13:47:27 +05:00
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.commandStatus = response.data.commandStatus;
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
$scope.commandStatus = response.data.commandStatus;
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = false;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.removeTracking = function () {
$scope.cyberpanelLoading = false;
url = "/websites/removeTracking";
var data = {
domain: $("#domain").text(),
folder: $scope.folder
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2020-03-10 21:04:57 +05:00
function ListInitialDatas(response) {
2020-03-12 13:47:27 +05:00
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Changes applied.',
type: 'success'
});
$scope.fetchFolderDetails();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
}
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
}
};
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
$scope.fetchGitignore = function () {
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
$scope.cyberpanelLoading = false;
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
url = "/websites/fetchGitignore";
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
var data = {
domain: $("#domain").text(),
folder: $scope.folder
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fetched.',
type: 'success'
});
$scope.gitIgnoreContent = response.data.gitIgnoreContent;
2020-03-10 21:04:57 +05:00
} else {
2020-03-12 13:47:27 +05:00
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
2020-03-10 21:04:57 +05:00
}
2020-03-12 13:47:27 +05:00
2020-03-10 21:04:57 +05:00
}
function cantLoadInitialDatas(response) {
2020-03-12 13:47:27 +05:00
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
}
};
$scope.saveGitIgnore = function () {
$scope.cyberpanelLoading = false;
url = "/websites/saveGitIgnore";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
gitIgnoreContent: $scope.gitIgnoreContent
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
2020-03-10 21:04:57 +05:00
$scope.cyberpanelLoading = true;
2020-03-12 13:47:27 +05:00
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully saved.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
2020-03-10 21:04:57 +05:00
}
2020-03-12 13:47:27 +05:00
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
2020-03-10 21:04:57 +05:00
2020-03-12 13:47:27 +05:00
}
};
2020-03-10 21:04:57 +05:00
2020-03-12 18:56:28 +05:00
$scope.fetchCommits = function () {
$scope.cyberpanelLoading = false;
url = "/websites/fetchCommits";
var data = {
domain: $("#domain").text(),
folder: $scope.folder
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
$scope.gitCommitsTable = false;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fetched.',
type: 'success'
});
$scope.commits = JSON.parse(response.data.commits);
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2020-03-13 11:12:40 +05:00
var currentComit;
2020-03-15 15:26:24 +05:00
var fetchFileCheck = 0;
2020-03-13 11:12:40 +05:00
$scope.fetchFiles = function (commit) {
currentComit = commit;
$scope.cyberpanelLoading = false;
2020-03-15 15:26:24 +05:00
fetchFileCheck = 1;
2020-03-13 11:12:40 +05:00
url = "/websites/fetchFiles";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
commit: commit
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
$scope.gitCommitsTable = false;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fetched.',
type: 'success'
});
$scope.files = response.data.files;
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.fileStatus = true;
$scope.fetchChangesInFile = function () {
2020-03-15 15:26:24 +05:00
$scope.fileStatus = true;
if(fetchFileCheck === 1){
fetchFileCheck = 0;
return 0;
}
2020-03-13 11:12:40 +05:00
$scope.cyberpanelLoading = false;
2020-03-14 13:24:17 +05:00
$scope.currentSelectedFile = $scope.changeFile;
2020-03-13 11:12:40 +05:00
url = "/websites/fetchChangesInFile";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
file: $scope.changeFile,
commit: currentComit
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fetched.',
type: 'success'
});
$scope.fileStatus = false;
2020-03-13 20:41:50 +05:00
document.getElementById("fileChangedContent").innerHTML = response.data.fileChangedContent;
2020-03-13 11:12:40 +05:00
} else {
2020-03-15 15:26:24 +05:00
$scope.fileStatus = true;
2020-03-13 11:12:40 +05:00
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2020-03-16 19:14:39 +05:00
$scope.saveGitConfigurations = function () {
$scope.cyberpanelLoading = false;
url = "/websites/saveGitConfigurations";
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
autoCommit: $scope.autoCommit,
autoPush: $scope.autoPush,
emailLogs: $scope.emailLogs,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully saved.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.currentPage = 1;
$scope.recordsToShow = 10;
$scope.fetchGitLogs = function () {
$scope.cyberpanelLoading = false;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
domain: $("#domain").text(),
folder: $scope.folder,
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
dataurl = "/websites/fetchGitLogs";
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fetched.',
type: 'success'
});
$scope.logs = JSON.parse(response.data.logs);
$scope.pagination = response.data.pagination;
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
2020-03-10 21:04:57 +05:00
});
/* Java script code to git tracking ends here */