

<script>
function OpenSetExecUserButtonHtml() { return HomeMenuButtons('/assets/exec.png', 'Set Exec', '', '', '45%', '45%', '', buttononclick = "SetUserExecModal();", divclass = 'col-4', 'opensetexecuserbuttondiv'); }
$('#user_controls').append(OpenSetExecUserButtonHtml());

function EraseUserExecTarget(){
            function ShowConfirmationEraseUserExecTarget(response){
                if (response){
                    ModalQuickDismiss('Success', 'Exec Deleted');
                    hidemodal('SetUserExecModal');
                }else{
                    ModalQuickDismiss('Failed', 'Unable to Delete Exec.');
                }
            }
            AjaxDo('?admin/user/exec/delete',{targethash:currenttarget},ShowConfirmationEraseUserExecTarget,null,'POST',false);
        }

function UpdateUserExecTarget(){
let newexecvalue  = $('#SetUserExecContentTextArea').val();
if (!newexecvalue){ModalQuickDismiss('Failed', 'No Content. Exec was not updated.'); return false;}

function ExecUpdateConfirmationTarget(response){
if (!response){
    ModalQuickDismiss('Failed', 'Unable to Update Exec'); return false;
}else{
    ModalQuickDismiss('Updated', 'Exec Updated.');
    hidemodal('SetUserExecModal');return true;
}
}
 AjaxDo('?admin/user/exec/update',{targethash:currenttarget, newexeccontent: newexecvalue},ExecUpdateConfirmationTarget,null,'POST',false);

}


    function SetUserExecModal() {
        let modalbody = `<textarea id="SetUserExecContentTextArea" class="form-control" rows="4" cols="50">
                        </textarea>`;

        


        let modalfooter = `<button class="btn btn-primary" onclick="UpdateUserExecTarget()">Update</button><button class="btn  btn-danger" onclick="EraseUserExecTarget();">Clear</button>`;
        CreateAndShowModal('SetUserExecModal', 'Set Exec For User', modalbody, modalfooter, modalfooterclose = true, topclosebutton = true, modalbodyclass = 'modal-body', modalheaderclass = 'modal-header');
        $('#SetUserExecContentTextArea').load('?admin/user/exec/content',{targethash:currenttarget});
    }

</script>