Skip to content

Commit

Permalink
Safer Buy URL getter + moved JS code from global.js to the view script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Lomakin committed Feb 16, 2017
1 parent aff9bbe commit b6b5070
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
18 changes: 0 additions & 18 deletions htdocs/global.js

This file was deleted.

29 changes: 27 additions & 2 deletions plib/views/scripts/index/settings.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,32 @@

<?php if (! \Modules_SpamexpertsExtension_Form_Settings::retrieveFromPleskLicense()) : ?>
<h4>You can buy antispam services and obtain valid configuration directives in our
<a href="https://go.plesk.com/buy-plesk-ext/spamexperts-extension" target="_blank">online store</a></h4>
<a href="<?php

echo method_exists('pm_Context', 'getBuyUrl')
? \pm_Context::getBuyUrl()
: 'https://go.plesk.com/buy-plesk-ext/spamexperts-extension';

?>" target="_blank">online store</a></h4>
<?php endif; ?>

<?php echo $this->form; ?>
<?php echo $this->form; ?>

<script>
document.observe('dom:loaded', function () {
var affectedFields = ['#spampanel_url', '#apihost', '#mx1', '#mx2', '#mx3', '#mx4', '#support_email'];

if (! $('apiuser').disabled) {
affectedFields.push('#apiuser');
affectedFields.push('#apipass');
}

$$('#use_config_from_license').each(function (checkbox) {
Event.on(checkbox, 'click', function () {
$$(affectedFields.join(',')).each(function (input) {
input.disabled = checkbox.checked;
});
});
});
});
</script>

0 comments on commit b6b5070

Please sign in to comment.