D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
plib
/
modules
/
git
/
views
/
scripts
/
partials
/
forms
/
Filename :
external-relations.phtml
back
Copy
<?php // Copyright 1999-2023. Plesk International GmbH. All rights reserved. ?> <script> //<![CDATA[ Jsw.onReady(function() { // lookup relation var gitSshKeyElement = $('git-sshKey'), gitSubFormIsHidden, showGitSubForm, hideGitSubForm, domainComponent = Jsw.getComponent(<?php echo $this->jsHtml($this->domainElementId) ?>), emptyValue = <?php echo $this->jsHtml($this->emptyValue) ?>; if (gitSshKeyElement && domainComponent) { var defaultKey = gitSshKeyElement.value; var onSshKeyChange = function () { if (domainComponent.getValue() == emptyValue) { gitSshKeyElement.value = defaultKey; } else { new Ajax.Request(Jsw.prepareUrl(<?php echo $this->jsHtml($this->getSshUrl) ?>), { method: 'get', parameters: { id: domainComponent.getValue() }, onSuccess: function(transport) { var response = transport.responseText.evalJSON(); if ('error' == response.status || !response.data) { gitSshKeyElement.value = defaultKey; return; } gitSshKeyElement.value = response.data; } }); } }; domainComponent.addEventObserver('component:change', onSshKeyChange); onSshKeyChange(); } // hosting type relation var domainGitSubForm = $('git'); if (domainGitSubForm) { var hostingTypes = $$('select[name="hostingType[hosting]"]'), currentType = false; gitSubFormIsHidden = $('git-isHidden'); hideGitSubForm = function() { gitSubFormIsHidden.value = 1; domainGitSubForm.hide(); }; showGitSubForm = function() { gitSubFormIsHidden.value = 0; domainGitSubForm.show(); }; if (hostingTypes && (currentType = hostingTypes.first())) { var hostingChange = function () { var hostingType = currentType; if (!hostingType) { return; } if (domainGitSubForm && 'hosting' === hostingType.value) { showGitSubForm(); } else { hideGitSubForm(); } }; currentType.observe('change', hostingChange); hostingChange(); } // git domain permission if (domainComponent) { var gitDomainPermissionChange = function () { if (domainComponent.getValue() == emptyValue) { showGitSubForm(); } else { new Ajax.Request(Jsw.prepareUrl(<?php echo $this->jsHtml($this->getDomainPermissionUrl) ?>), { method: 'get', parameters: { id: domainComponent.getValue() }, onSuccess: function (transport) { var response = transport.responseText.evalJSON(); if ('error' == response.status || !response.data) { return; } if (response.data.permission && response.data.hosting) { showGitSubForm(); } else { hideGitSubForm(); } } }); } }; domainComponent.addEventObserver('component:change', gitDomainPermissionChange); gitDomainPermissionChange(); } } // git plan permission (manage-git) var planSelector = $('subscription-subscriptionInfo-servicePlan'); var subscriptionGitSubForm = $('subscription-git'); if (subscriptionGitSubForm) { gitSubFormIsHidden = $('subscription-git-isHidden'); hideGitSubForm = function() { gitSubFormIsHidden.value = 1; subscriptionGitSubForm.hide(); }; showGitSubForm = function() { gitSubFormIsHidden.value = 0; subscriptionGitSubForm.show(); }; if (planSelector) { var planChange = function () { new Ajax.Request(Jsw.prepareUrl(<?php echo $this->jsHtml($this->getPlanPermissionUrl) ?>), { method: 'get', parameters: { id: planSelector.getValue() }, onSuccess: function (transport) { var response = transport.responseText.evalJSON(); if ('error' == response.status || !response.data) { return; } if (response.data.permission) { showGitSubForm(); } else { hideGitSubForm(); } } }); }; planSelector.observe('change', planChange); planChange(); } // customer with subscription var createSubscriptionCheckbox = $('subscription-domainInfo-createSubscription'); if (createSubscriptionCheckbox) { var createSubscriptionChange = function () { if (createSubscriptionCheckbox.getValue()) { showGitSubForm(); } else { hideGitSubForm(); } }; createSubscriptionCheckbox.observe('change', createSubscriptionChange); createSubscriptionChange(); } } // pre-filling deploymentPath var hostingSettingsSubForm = $('hostingSettings'); var documentRootElement = $('hostingSettings-root'); var deploymentPathElement = $('git-deploymentPath'); if (hostingSettingsSubForm && documentRootElement && deploymentPathElement) { var changeDeploymentPath = function (event){ if (hostingSettingsSubForm.visible() && '' !== event.element().value) { deploymentPathElement.value = event.element().value; } }; $w('change keyup value:change').each(function (eventName) { documentRootElement.observe(eventName, changeDeploymentPath); }); var disableDocumentRootObserver = function() { $w('change keyup value:change').each(function (event) { documentRootElement.stopObserving(event, changeDeploymentPath); }); }; $w('change keyup').each(function (eventName) { deploymentPathElement.observe(eventName, function () { disableDocumentRootObserver(); }) }); } }); //]]> </script>