Blame view

plugins/content/osyoutube/views/installer/tmpl/default_license.php 3.97 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
<?php
/**
 * @package   AllediaInstaller
 * @contact   www.joomlashack.com, help@joomlashack.com
 * @copyright Copyright (C) 2016 Open Sources Training, LLC, All rights reserved
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die();

if ($this->isLicensesManagerInstalled) :
    ?>
    <div class="joomlashack-license-form">
        <?php
        if (!empty($this->licenseKey)) :
            ?>
            <a href="javascript:void(0);" class="joomlashack-installer-change-license-button joomlashack-button">
                <?php echo JText::_('LIB_ALLEDIAINSTALLER_CHANGE_LICENSE_KEY'); ?>
            </a>
        <?php
        endif;
        ?>

        <div id="joomlashack-installer-license-panel"
             style="display: <?php echo empty($this->licenseKey) ? '' : 'none'; ?>;">
            <input
                type="text"
                name="joomlashack-license-keys"
                id="joomlashack-license-keys"
                value="<?php echo $this->licenseKey; ?>"
                placeholder="<?php echo JText::_('LIB_ALLEDIAINSTALLER_LICENSE_KEYS_PLACEHOLDER'); ?>"/>

            <p class="joomlashack-empty-key-msg">
                <?php echo JText::_('LIB_ALLEDIAINSTALLER_MSG_LICENSE_KEYS_EMPTY'); ?>&nbsp;
                <a href="https://www.joomlashack.com/account/key/" target="_blank">
                    <?php echo JText::_('LIB_ALLEDIAINSTALLER_I_DONT_REMEMBER_MY_KEY'); ?>
                </a>
            </p>

            <a id="joomlashack-license-save-button"
               class="joomlashack-button"
               href="javascript:void(0);">
                <?php echo JText::_('LIB_ALLEDIAINSTALLER_SAVE_LICENSE_KEY'); ?>
            </a>
        </div>

        <div id="joomlashack-installer-license-success" style="display: none">
            <p>
                <?php echo JText::_('LIB_ALLEDIAINSTALLER_LICENSE_KEY_SUCCESS'); ?>
            </p>
        </div>

        <div id="joomlashack-installer-license-error" style="display: none">
            <p>
                <?php echo JText::_('LIB_ALLEDIAINSTALLER_LICENSE_KEY_ERROR'); ?>
            </p>
        </div>
    </div>

    <script>
        (function($) {
            $(function() {
                $('.joomlashack-installer-change-license-button').on('click', function() {
                    $('#joomlashack-installer-license-panel').show();
                    $(this).hide();
                });

                $('#joomlashack-license-save-button').on('click', function() {

                    $.post('<?php echo JURI::root(); ?>/administrator/index.php?plugin=system_osmylicensesmanager&task=license.save',
                        {
                            'license-keys': $('#joomlashack-license-keys').val()
                        },
                        function(data) {
                            try {
                                var result = JSON.parse(data);

                                $('#joomlashack-installer-license-panel').hide();

                                if (result.success) {
                                    $('#joomlashack-installer-license-success').show();
                                } else {
                                    $('#joomlashack-installer-license-error').show();
                                }
                            } catch (e) {
                                $('#joomlashack-installer-license-panel').hide();
                                $('#joomlashack-installer-license-error').show();
                            }
                        },
                        'text'
                    ).fail(function() {
                        $('#joomlashack-installer-license-panel').hide();
                        $('#joomlashack-installer-license-error').show();
                    });

                });
            });

        })(jQuery);
    </script>

<?php
else :
    ?>
    <div class="error">
        <?php echo JText::_('LIB_ALLEDIAINSTALLER_LICENSE_KEYS_MANAGER_REQUIRED'); ?>
    </div>
<?php
endif;