Skip to content

Commit b595576

Browse files
committed
bug fix: child domains
1 parent ec3dcf6 commit b595576

File tree

1 file changed

+318
-0
lines changed

1 file changed

+318
-0
lines changed

static/websiteFunctions/websiteFunctions.js

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,324 @@ app.controller('listWebsites', function ($scope, $http) {
376376
};
377377

378378

379+
});
380+
381+
app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
382+
383+
384+
$scope.currentPage = 1;
385+
$scope.recordsToShow = 10;
386+
387+
$scope.getFurtherWebsitesFromDB = function () {
388+
389+
var config = {
390+
headers: {
391+
'X-CSRFToken': getCookie('csrftoken')
392+
}
393+
};
394+
395+
var data = {
396+
page: $scope.currentPage,
397+
recordsToShow: $scope.recordsToShow
398+
};
399+
400+
401+
dataurl = "/websites/fetchChildDomainsMain";
402+
403+
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
404+
405+
406+
function ListInitialData(response) {
407+
if (response.data.listWebSiteStatus === 1) {
408+
409+
$scope.WebSitesList = JSON.parse(response.data.data);
410+
$scope.pagination = response.data.pagination;
411+
$scope.clients = JSON.parse(response.data.data);
412+
$("#listFail").hide();
413+
} else {
414+
$("#listFail").fadeIn();
415+
$scope.errorMessage = response.data.error_message;
416+
417+
}
418+
}
419+
420+
function cantLoadInitialData(response) {
421+
}
422+
423+
424+
};
425+
$scope.getFurtherWebsitesFromDB();
426+
427+
$scope.cyberPanelLoading = true;
428+
429+
$scope.issueSSL = function (virtualHost) {
430+
$scope.cyberPanelLoading = false;
431+
432+
var url = "/manageSSL/issueSSL";
433+
434+
435+
var data = {
436+
virtualHost: virtualHost
437+
};
438+
439+
var config = {
440+
headers: {
441+
'X-CSRFToken': getCookie('csrftoken')
442+
}
443+
};
444+
445+
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
446+
447+
448+
function ListInitialDatas(response) {
449+
$scope.cyberPanelLoading = true;
450+
if (response.data.SSL === 1) {
451+
new PNotify({
452+
title: 'Success!',
453+
text: 'SSL successfully issued.',
454+
type: 'success'
455+
});
456+
} else {
457+
new PNotify({
458+
title: 'Operation Failed!',
459+
text: response.data.error_message,
460+
type: 'error'
461+
});
462+
}
463+
464+
}
465+
466+
function cantLoadInitialDatas(response) {
467+
$scope.cyberPanelLoading = true;
468+
new PNotify({
469+
title: 'Operation Failed!',
470+
text: 'Could not connect to server, please refresh this page',
471+
type: 'error'
472+
});
473+
}
474+
475+
476+
};
477+
478+
$scope.cyberPanelLoading = true;
479+
480+
$scope.searchWebsites = function () {
481+
482+
$scope.cyberPanelLoading = false;
483+
484+
var config = {
485+
headers: {
486+
'X-CSRFToken': getCookie('csrftoken')
487+
}
488+
};
489+
490+
var data = {
491+
patternAdded: $scope.patternAdded
492+
};
493+
494+
dataurl = "/websites/searchWebsites";
495+
496+
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
497+
498+
499+
function ListInitialData(response) {
500+
$scope.cyberPanelLoading = true;
501+
if (response.data.listWebSiteStatus === 1) {
502+
503+
var finalData = JSON.parse(response.data.data);
504+
$scope.WebSitesList = finalData;
505+
$("#listFail").hide();
506+
} else {
507+
new PNotify({
508+
title: 'Operation Failed!',
509+
text: response.data.error_message,
510+
type: 'error'
511+
});
512+
513+
}
514+
}
515+
516+
function cantLoadInitialData(response) {
517+
$scope.cyberPanelLoading = true;
518+
new PNotify({
519+
title: 'Operation Failed!',
520+
text: 'Connect disrupted, refresh the page.',
521+
type: 'error'
522+
});
523+
}
524+
525+
526+
};
527+
528+
$scope.initConvert = function(virtualHost){
529+
$scope.domainName = virtualHost;
530+
};
531+
532+
var statusFile;
533+
534+
$scope.installationProgress = true;
535+
536+
$scope.convert = function () {
537+
538+
$scope.cyberPanelLoading = false;
539+
$scope.installationDetailsForm = true;
540+
$scope.installationProgress = false;
541+
$scope.goBackDisable = true;
542+
543+
$scope.currentStatus = "Starting creation..";
544+
545+
var ssl, dkimCheck, openBasedir;
546+
547+
if ($scope.sslCheck === true) {
548+
ssl = 1;
549+
} else {
550+
ssl = 0
551+
}
552+
553+
if ($scope.dkimCheck === true) {
554+
dkimCheck = 1;
555+
} else {
556+
dkimCheck = 0
557+
}
558+
559+
if ($scope.openBasedir === true) {
560+
openBasedir = 1;
561+
} else {
562+
openBasedir = 0
563+
}
564+
565+
url = "/websites/convertDomainToSite";
566+
567+
568+
var data = {
569+
package: $scope.packageForWebsite,
570+
domainName: $scope.domainName,
571+
adminEmail: $scope.adminEmail,
572+
phpSelection: $scope.phpSelection,
573+
websiteOwner: $scope.websiteOwner,
574+
ssl: ssl,
575+
dkimCheck: dkimCheck,
576+
openBasedir: openBasedir
577+
};
578+
579+
var config = {
580+
headers: {
581+
'X-CSRFToken': getCookie('csrftoken')
582+
}
583+
};
584+
585+
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
586+
587+
588+
function ListInitialDatas(response) {
589+
590+
if (response.data.createWebSiteStatus === 1) {
591+
statusFile = response.data.tempStatusPath;
592+
getCreationStatus();
593+
} else {
594+
595+
$scope.cyberPanelLoading = true;
596+
$scope.installationDetailsForm = true;
597+
$scope.installationProgress = false;
598+
$scope.goBackDisable = false;
599+
600+
$scope.currentStatus = response.data.error_message;
601+
}
602+
603+
604+
}
605+
606+
function cantLoadInitialDatas(response) {
607+
608+
$scope.cyberPanelLoading = true;
609+
$scope.installationDetailsForm = true;
610+
$scope.installationProgress = false;
611+
$scope.goBackDisable = false;
612+
613+
}
614+
615+
616+
};
617+
$scope.goBack = function () {
618+
$scope.cyberPanelLoading = true;
619+
$scope.installationDetailsForm = false;
620+
$scope.installationProgress = true;
621+
$scope.goBackDisable = true;
622+
$("#installProgress").css("width", "0%");
623+
};
624+
625+
function getCreationStatus() {
626+
627+
url = "/websites/installWordpressStatus";
628+
629+
var data = {
630+
statusFile: statusFile
631+
};
632+
633+
var config = {
634+
headers: {
635+
'X-CSRFToken': getCookie('csrftoken')
636+
}
637+
};
638+
639+
640+
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
641+
642+
643+
function ListInitialDatas(response) {
644+
645+
646+
if (response.data.abort === 1) {
647+
648+
if (response.data.installStatus === 1) {
649+
650+
$scope.cyberPanelLoading = true;
651+
$scope.installationDetailsForm = true;
652+
$scope.installationProgress = false;
653+
$scope.goBackDisable = false;
654+
655+
$("#installProgress").css("width", "100%");
656+
$scope.installPercentage = "100";
657+
$scope.currentStatus = response.data.currentStatus;
658+
$timeout.cancel();
659+
660+
} else {
661+
662+
$scope.cyberPanelLoading = true;
663+
$scope.installationDetailsForm = true;
664+
$scope.installationProgress = false;
665+
$scope.goBackDisable = false;
666+
667+
$scope.currentStatus = response.data.error_message;
668+
669+
$("#installProgress").css("width", "0%");
670+
$scope.installPercentage = "0";
671+
$scope.goBackDisable = false;
672+
673+
}
674+
675+
} else {
676+
$("#installProgress").css("width", response.data.installationProgress + "%");
677+
$scope.installPercentage = response.data.installationProgress;
678+
$scope.currentStatus = response.data.currentStatus;
679+
$timeout(getCreationStatus, 1000);
680+
}
681+
682+
}
683+
684+
function cantLoadInitialDatas(response) {
685+
686+
$scope.cyberPanelLoading = true;
687+
$scope.installationDetailsForm = true;
688+
$scope.installationProgress = false;
689+
$scope.goBackDisable = false;
690+
691+
}
692+
693+
694+
}
695+
696+
379697
});
380698

381699
/* Java script code to list accounts ends here */

0 commit comments

Comments
 (0)