diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index f0f238931..314bf7785 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -1321,8 +1321,68 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo } }; + + FinalDeployToProduction = function () { + $('#wordpresshomeloading').show(); + $('#DeployToProduction').modal('hide'); + var data = { + WPid: $('#WPid').html(), + StagingID: DeploytoProductionID + } + + var url = "/websites/DeploytoProduction"; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + + $('#wordpresshomeloading').hide(); + if (response.data.status === 1) { + new PNotify({ + title: 'Success!', + text: 'Deploy To Production start!.', + type: 'success' + }); + statusFile = response.data.tempStatusPath; + getCreationStatus(); + + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + + } + + } + + function cantLoadInitialDatas(response) { + $('#wordpresshomeloading').hide(); + new PNotify({ + title: 'Operation Failed!', + text: response, + type: 'error' + }); + + } + + }; + }); +var DeploytoProductionID; +function DeployToProductionInitial(vall){ + DeploytoProductionID=vall; +} + function AddStagings(value, index, array) { var FinalMarkup = '' for (let x in value) { diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index 7394dc8d1..bd8767a22 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -18,7 +18,7 @@ src="{% static 'images/loading.gif' %}">

-
+

{% trans "WordPress Manager" %} @@ -338,30 +338,29 @@

-
- -
+
+
+
+ + + + + + + + + + + +
NameDomainPathAction
+ +
-
-
-

List staging site

- - - - - - - - - - - -
NameDomainPathAction
@@ -479,4 +478,39 @@ + + + {% endblock %} diff --git a/websiteFunctions/templates/websiteFunctions/WPsitesList.html b/websiteFunctions/templates/websiteFunctions/WPsitesList.html index 8b863ab68..44ce35825 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsitesList.html +++ b/websiteFunctions/templates/websiteFunctions/WPsitesList.html @@ -14,72 +14,74 @@ + /* Firefox 1-3.6 */ + -moz-border-radius: 0px 20px 20px 0px; + + /* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */ + border-radius: 0px 20px 20px 0px; + } + +
@@ -94,86 +96,85 @@
+ + + + + + -
WordPress Site Title + Domain + Action +
- - - - - + + + + {% for sub in wpsite %} - - + + + - - {% for sub in wpsite %} + - - + + + - - {% endfor %} + + {% endfor %} - -
WordPress Site Title - Domain - Action -
+ +

{{ sub.title }}

+
+
+ Visit + +
-
- -

{{ sub.title }}

-
-
- Visit - - - - - + -
+ + diff --git a/websiteFunctions/urls.py b/websiteFunctions/urls.py index 23d8efa3a..456273364 100755 --- a/websiteFunctions/urls.py +++ b/websiteFunctions/urls.py @@ -38,6 +38,7 @@ urlpatterns = [ url(r'^CreateStagingNow', views.CreateStagingNow, name='CreateStagingNow'), url(r'^fetchstaging', views.fetchstaging, name='fetchstaging'), url(r'^SaveUpdateConfig', views.SaveUpdateConfig, name='SaveUpdateConfig'), + url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'), diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 1bf06ecf2..2c3f730d1 100755 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -301,6 +301,27 @@ def SaveUpdateConfig(request): except KeyError: return redirect(loadLoginPage) +def DeploytoProduction(request): + try: + userID = request.session['userID'] + + result = pluginManager.preWebsiteCreation(request) + + if result != 200: + return result + + wm = WebsiteManager() + coreResult = wm.DeploytoProduction(userID, json.loads(request.body)) + + result = pluginManager.postWebsiteCreation(request, coreResult) + if result != 200: + return result + + return coreResult + + except KeyError: + return redirect(loadLoginPage) + def GetCurrentThemes(request): diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index ac8b85fea..d97e00370 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -647,6 +647,51 @@ class WebsiteManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) + + def DeploytoProduction(self, userID=None, data=None): + try: + + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + WPManagerID = data['WPid'] + statgingID = data['StagingID'] + wpsite = WPSites.objects.get(pk=WPManagerID) + StagingObj = WPSites.objects.get(pk=statgingID) + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + extraArgs = {} + extraArgs['adminID'] = admin.pk + extraArgs['StagingDomain'] = StagingObj.FinalURL + extraArgs['StagingName'] = StagingObj.title + extraArgs['WPid'] = WPManagerID + extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999)) + + + if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + background = ApplicationInstaller('CreateStagingNow', extraArgs) + background.start() + + time.sleep(2) + + data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', + 'tempStatusPath': extraArgs['tempStatusPath']} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + def UpdatePlugins(self, userID=None, data=None): try: