<?php
// Copyright 1999-2026. WebPros International GmbH. All rights reserved.
?>
<?php
$phpElement = $this->element->getElement('php');
$phpArgumentsElement = $this->element->getElement('phpArguments');
$subscriptionElement = $this->element->getForm()->getElement('subscription');
?>
<div class='form-row' id="<?php echo $phpElement->getId(); ?>-form-row">
    <div class='field-name'>
        <?php echo $this->elementPart($phpElement)->label(); ?>
    </div>
    <div class='field-value'>
        <?php echo $this->elementPart($phpElement)->content(); ?>
        <?php if ($subscriptionElement): ?>
            <a href="#" class="btn btn-icon-only input-btn" aria-label="<?php echo $this->jsLmsg('components.forms.scheduler.task.chooseFile') ?>" onClick="Smb.Scheduler.showScriptPathPopup(event);"><i class="icon-folder"></i></a>
        <?php endif; ?>
        <?php echo $this->elementPart($phpArgumentsElement)->label(); ?>
        <?php echo $this->elementPart($phpArgumentsElement)->content(); ?>
        <span class="field-errors" style="display: none;"></span>
        <span class="hint"><?php echo $this->elementPart($phpElement)->description(); ?></span>
    </div>
</div>
<?php if ($subscriptionElement): ?>
<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function() {
    Jsw.namespace('Smb.Scheduler');

    Smb.Scheduler.showScriptPathPopup = function (event) {
        event.preventDefault();

        new Jsw.DirectoryBrowser({
            cls: 'popup-panel',
            locale: {
                title: <?php echo $this->jsLmsg('components.forms.scheduler.task.scriptPathPopupTitle') ?>,
                buttonOk: <?php echo $this->jsLmsg('components.buttons.ok') ?>,
                buttonCancel: <?php echo $this->jsLmsg('components.buttons.cancel') ?>
            },
            pathElementId: '<?php echo $phpElement->getId() ?>',
            subscriptionId: document.getElementById('<?php echo $subscriptionElement->getId() ?>').value,
            showFiles: true
        });
    };
});
//]]>
</script>
<?php endif; ?>
