<style>#content-main{display:none;}</style>
<script>
$j(document).ready(()=>{
    //Global Plugin Name
    const pluginName='MBA Teacher Email';
    const ezLink="https://mba-link.com/freeplugins/easy-update/";
    var msg='';
    //Check status of ez update plugin
    if(window.ezStatus==undefined){
        window.ezStatus=`~[tlist_sql;
            select case sum(cnt) when 1 then 'missing' when 2 then 'disabled' when 3 then 'enabled' end as status from(
            select 1 as cnt from dual
            union all
            select count(id) as cnt from plugindef where name='MBA EasyUpdate'
            union all
            select count(id) as cnt from plugindef where name='MBA EasyUpdate' and nvl(isenabled,0)=1
        );
        ]~(status)[/tlist_sql]`;
        //Admin
        if("~[directory]"=="admin"){
            msg=`<h1>MBA Easy Update Plugin Required</h1>`;
            //Not Installed
            if(window.ezStatus=="missing"){
                msg += `<p style="margin-bottom:300px;">The Easy Update Plugin is required to use the ${pluginName} plugin. <a href="${ezLink}" target="_blank">Click here</a> to download.</p>`;
                $j('#content-main').html(msg);
            }
            //Not Enabled
            if(window.ezStatus=="disabled"){
                msg += `<p style="margin-bottom:300px;">Please <strong>Enable</strong> the Easy Update Plugin before using the ${pluginName} plugin.</p>`;
                $j('#content-main').html(msg);
            }
            //Otherwise... Do nothing...
        }
        //Teachers
        if("~[directory]"=="teachers"){
            if(window.ezStatus=="missing" || window.ezStatus=="disabled"){
                msg=`<h1>Email Students</h1>`;
                msg += `<p style="margin-bottom:300px;">The MBA Teacher Email plugin is not accessible, please contact the District Administrator</p>`;
                $j('#content-main').html(msg);
            }
        }
    }
    $j('#content-main').show();
});
</script>
