Location: PHPKode > projects > phlyMail Lite > phlymail/config/templates/um.editacc.tpl
<script type="text/javascript" src="{frontend_path}/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="{frontend_path}/js/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
//<![CDATA[
aliasaction = false;
aliasid     = false;
open_mask   = false;
sigid       = false;
sigaction   = false;
sigcache = [];
currprofile = 0;
acctype = false;
EffectiveUID = {effective_uid};
_editor_url  = '{frontend_path}/js/ckeditor/'
_editor_lang = '{user_lang}';
ssl_available = 0<!-- START ssl_available --> + 1<!-- END ssl_available -->;

function confirm_delete() { return confirm('{kill_request}'); }

function copyf(from, to) { document.getElementsByName(to)[0].value = document.getElementsByName(from)[0].value; }

function AJAX_call(url, method, data)
{
    if (!method || method == 'get') method = 'GET';
    if (method == 'post') method = 'POST';
    var payload = {'url': url, 'type': method, 'success': AJAX_process};
    if (method == 'POST' && data) {
        payload.data = data;
    }
    $.ajax(payload);
}

function AJAX_process(next)
{
    if (next['alias']) build_aliaslist(next['alias']);
    if (next['uhead']) build_uheadlist(next['uhead']);
    if (next['signatures']) build_siglist(next['signatures']);
    if (next['signature']) {
        sigcache[sigid]['signature'] = next['signature'];
        sigcache[sigid]['signature_html'] = next['signature_html'];
        while (next['signature'].match(/\n/)) {
            next['signature'] = next['signature'].replace(/\n/, '<br />');
        }
        fill_sigpreview(next['signature']);
    }
    if (next['profsaved']) window.location.reload();
    if (next['profile']) fillfields(next['profile']);
}

function build_aliaslist(data)
{
    cnt = document.getElementById('aliascontainer');
    // Throw away any already existant childs
    $(cnt).empty();

    for (var i in data) {
        showname = data[i]['email'];
        if (data[i]['real_name']) showname = data[i]['real_name'] + ' <' + showname +'>';
        aline = document.createElement('div');
        aline.className = 'menuline';
        edlnk = document.createElement('a');
        edlnk.href = 'javascript:open_editalias(' + data[i]['aid'] + ', "' + data[i]['email'] + '", "' + data[i]['real_name'].replace(/\"/g, '&quot;') + '", "' + data[i]['signature'] + '", "' + data[i]['sendvcf'] + '")';
        edlnk.style.textDecoration = 'none';
        img = document.createElement('img');
        img.src = '{confpath}/icons/edit_menu.gif';
        img.alt = '';
        img.title = '[E]';
        edlnk.appendChild(img);
        aline.appendChild(edlnk);
        aline.appendChild(document.createTextNode(' '));
        delnk = document.createElement('a');
        delnk.href = 'javascript:deletealias(' + data[i]['aid'] + ');';
        delnk.style.textDecoration = 'none';
        img = document.createElement('img');
        img.src = '{confpath}/icons/dustbin_menu.gif';
        img.alt = '';
        img.title = '[X]';
        delnk.appendChild(img);
        aline.appendChild(delnk);
        aline.appendChild(document.createTextNode(' '));
        aline.appendChild(document.createTextNode(showname));
        cnt.appendChild(aline);
    }
}

function open_editalias(id, email, realname, sig, vcf)
{
    aliasaction = 'add';
    aliasid = false;
    if (id) {
        aliasaction = 'edit';
        aliasid = id;
    }

    var html = '<option value="">{msg_sig_default}</option><option value="0">{msg_sig_none}</option>';
    $.each(sigcache, function(i, val) {
        if (!val || !val['title']) {
            return;
        }
        html += '<option value="' + i + '">' + val['title'] + '</option>';
    });
    $('#aliassignature').html(html);
    if (sig || sig == 0) $('#aliassignature').val(sig);

    $('#aliasrealname').val(realname ? realname.replace(/&quot;/g, '"') : '');
    $('#aliasemail').val(email ? email : '');
    if (vcf) $('#aliassendvcf').val(vcf);
    $('#editalias').show();
}

function react_editalias()
{
    if ('add' == aliasaction) { addalias(); } else { editalias(aliasid); }
}

function cancel_alias()
{
    $('#editalias').hide();
}

function addalias()
{
    var email = $('#aliasemail').val();
    if (!email) {
        alert('{e_enteremail}');
        return;
    }
    var realname = $('#aliasrealname').val();
    var sig = $('#aliassignature').val();
    var vcf = $('#aliassendvcf').val();
    url = '{addaliaslink}&id=' + currprofile + '&email=' + encodeURIComponent(email) + '&real_name=' + encodeURIComponent(realname);
    url += '&signature=' + encodeURIComponent(sig) + '&sendvcf=' + encodeURIComponent(vcf);
    cancel_alias();
    AJAX_call(url, 'get');
}

function editalias(id)
{
    var email = $('#aliasemail').val();
    if (!email) {
        alert('{e_enteremail}');
        return;
    }
    var realname = $('#aliasrealname').val();
    var sig = $('#aliassignature').val();
    var vcf = $('#aliassendvcf').val();
    url = '{editaliaslink}&id=' + currprofile + '&aid=' + id + '&email=' + encodeURIComponent(email) + '&real_name=' + encodeURIComponent(realname);
    url += '&signature=' + encodeURIComponent(sig) + '&sendvcf=' + encodeURIComponent(vcf);
    cancel_alias();
    AJAX_call(url, 'get');
}

function deletealias(id)
{
    if (confirm('{msg_reallydropalias}')) {
        AJAX_call('{dropaliaslink}&id=' + currprofile + '&aid=' + id, 'get');
    }
}

function build_uheadlist(data)
{
    cnt = document.getElementById('uheadcontainer');
    // Throw away any already existant childs
    $(cnt).empty();

    for (var i in data) {
        showname = data[i]['hkey'] + ': ' + data[i]['hval'];
        aline = document.createElement('div');
        aline.className = 'inboxline';
        edlnk = document.createElement('a');
        edlnk.href = 'javascript:open_edituhead("' + data[i]['hkey'] + '", "' + data[i]['hkey'] + '", "' + data[i]['hval'].replace(/\"/g, '&quot;') + '")';
        edlnk.style.textDecoration = 'none';

        img = document.createElement('img');
        img.src = '{confpath}/icons/edit_menu.gif';
        img.alt = '';
        img.title = '[E]';
        edlnk.appendChild(img);
        aline.appendChild(edlnk);

        aline.appendChild(document.createTextNode(' '));

        delnk = document.createElement('a');
        delnk.href = 'javascript:deleteuhead("' + data[i]['hkey'] + '");';
        delnk.style.textDecoration = 'none';

        img = document.createElement('img');
        img.src = '{confpath}/icons/dustbin_menu.gif';
        img.alt = '';
        img.title = '[X]';
        delnk.appendChild(img);
        aline.appendChild(delnk);
        aline.appendChild(document.createTextNode(' ' + showname));

        cnt.appendChild(aline);
    }
}

function open_edituhead(id, hkey, hval)
{
    uheadaction = 'add';
    uheadid = false;
    if (id) {
        uheadaction = 'edit';
        uheadid = id;
    }
    document.getElementById('uheadhval').value = (hval) ? hval.replace(/&quot;/g, '"') : '';
    document.getElementById('uheadhkey').value = (hkey) ? hkey : '';
    $('#edituhead').show();
}

function react_edituhead()
{
    if ('add' == uheadaction) { adduhead(); } else { edituhead(uheadid); }
}

function cancel_uhead()
{
    $('#edituhead').hide();
}

function adduhead()
{
    hkey = document.getElementById('uheadhkey').value;
    hval = document.getElementById('uheadhval').value;
    if (!hkey) {
        alert('{e_enterhkey}');
    } else {
        url = '{adduheadlink}&id=' + currprofile + '&hkey=' + encodeURIComponent(hkey) + '&hval=' + encodeURIComponent(hval);
        cancel_uhead();
        AJAX_call(url, 'get');
    }
}

function edituhead(id)
{
    hkey = document.getElementById('uheadhkey').value;
    hval = document.getElementById('uheadhval').value;
    if (!hkey) {
        alert('{e_enterhkey}');
    } else {
        url = '{edituheadlink}&id=' + currprofile + '&ohkey=' + encodeURIComponent(id) + '&hkey=' + encodeURIComponent(hkey) + '&hval=' + encodeURIComponent(hval);
        cancel_uhead();
        AJAX_call(url, 'get');
    }
}

function deleteuhead(id)
{
    if (confirm('{msg_reallydropuhead}')) {
        AJAX_call('{dropuheadlink}&id=' + currprofile + '&hkey=' + encodeURIComponent(id), 'get');
    }
}

function build_siglist(data)
{
    var cnt = document.getElementById('sigcontain');
    // Throw away any already existant childs
    while (cnt.childNodes.length) {
        cnt.removeChild(cnt.firstChild);
    }
    for (var i in data) {
        sigcache[data[i]['id']] = {'title' : data[i]['title'], 'signature' : ''};
        var div = document.createElement('div');
        div.style.cursor = 'pointer';
        div.onclick = switchsig;
        div.id = 'sigsel_' + data[i]['id'];
        if ((data[i]['id'] == sigid)) {
            div.className = 'inboxlinemarked';
            AJAX_call('{getsignatureurl}&id=' + sigid, 'get');
        } else {
            div.className = 'inboxline';
        }
        div.appendChild(document.createTextNode(data[i]['title']));
        cnt.appendChild(div);
    }
}

function fill_sigpreview(data)
{
    document.getElementById('sigpreview').innerHTML = data;
}

function open_editsig(is_edit)
{
    $('#sigvaltabs').tabs();
    document.getElementById('editsig').style.display = 'block';
    if (is_edit) {
        sigaction = 'edit';
        document.getElementById('ta_sigval_text').value = sigcache[sigid]['signature'];
        document.getElementById('ta_sigval_html').value = sigcache[sigid]['signature_html'];
        document.getElementById('sigtitle').value = sigcache[sigid]['title'];
    } else {
        sigaction = 'add';
        document.getElementById('ta_sigval_text').value = '';
        document.getElementById('ta_sigval_html').value = '';
        document.getElementById('sigtitle').value = '';
    }
    $('#ta_sigval_html').ckeditor(function() { /* callback code */ },{ baseHref : _editor_url, language : _editor_lang, uiColor : themeBaseColour, toolbarStartupExpanded : true, toolbar : 'Basic', height: 210} );
}

function react_editsig()
{
    if ('add' == sigaction) { addsig(); } else { editsig(sigid); }
}

function cancel_sig()
{
    $('#sigvaltabs').tabs('destroy');
    $('#ta_sigval_html').ckeditorGet().destroy();
    document.getElementById('editsig').style.display = 'none';
}

function addsig()
{
    var sigval = encodeURIComponent(document.getElementById('ta_sigval_text').value);
    var sigvalhtml = encodeURIComponent($('#ta_sigval_html').val());
    var sigttl = encodeURIComponent(document.getElementById('sigtitle').value);
    if (sigval.length || sigvalhtml.length) {
        AJAX_call('{addsignaturelink}&signature=' + sigval + '&signature_html=' + sigvalhtml + '&title=' + sigttl, 'get');
    }
    cancel_sig();
}

function editsig(id)
{
    var sigval = encodeURIComponent(document.getElementById('ta_sigval_text').value);
    var sigvalhtml = encodeURIComponent($('#ta_sigval_html').val());
    var sigttl = encodeURIComponent(document.getElementById('sigtitle').value);
    if (sigval.length || sigvalhtml.length) {
        AJAX_call('{editsignaturelink}&id=' + id + '&signature=' + sigval + '&signature_html=' + sigvalhtml + '&title=' + sigttl, 'get');
    }
    cancel_sig();
}

function dele_signature()
{
    if (confirm('{q_reallydelesig}')) {
        AJAX_call('{dropsignaturelink}&id=' + encodeURIComponent(sigid), 'get');
    }
}

function switchsig(id)
{
    $('#sigsel_' + sigid).removeClass('marked');
    sigid = this.id.replace(/^sigsel_/, '');
    $('#sigsel_' + sigid).addClass('marked');
    AJAX_call('{getsignatureurl}&id=' + sigid, 'get');
}

function loadprofile(id)
{
    // unmark current profile in list
    if (currprofile != 0) {
        var line = document.getElementById('prof_' + currprofile);
        for (var i = 0; i < line.childNodes.length; ++i) {
            if (line.childNodes[i].nodeName != 'TD') continue;
            line.childNodes[i].className = 'inboxline';
        }
    }
    currprofile = id;
    AJAX_call('{editlink}' + id, 'get');
}

function fillfields(data)
{
    // Mark current profile in list
    var line = document.getElementById('prof_' + currprofile);
    for (var i = 0; i < line.childNodes.length; ++i) {
        if (line.childNodes[i].nodeName != 'TD') continue;
        line.childNodes[i].className = 'inboxlinemarked';
    }
    emptyfields();
    sigid = data['signature'];
    form = document.forms.mainform;
    form.popname.value = data['profilename'];
    form.address.value = data['address'];
    form.real_name.value = data['real_name'];
    form.sent_objects.selectedIndex = 0;
    for (var i = 0; i < form.sent_objects.options.length; ++i) {
        if (form.sent_objects.options[i].value == data['sent_objects']) {
            form.sent_objects.selectedIndex = i;
            break;
        }
    }
    form.sendvcf.selectedIndex = 0;
    for (var i = 0; i < form.sendvcf.options.length; ++i) {
        if (form.sendvcf.options[i].value == data['sendvcf']) {
            form.sendvcf.selectedIndex = i;
            break;
        }
    }
    form.junk.selectedIndex = 0;
    for (var i = 0; i < form.junk.options.length; ++i) {
        if (form.junk.options[i].value == data['junk']) {
            form.junk.selectedIndex = i;
            break;
        }
    }
    form.waste.selectedIndex = 0;
    for (var i = 0; i < form.waste.options.length; ++i) {
        if (form.waste.options[i].value == data['waste']) {
            form.waste.selectedIndex = i;
            break;
        }
    }
    form.drafts.selectedIndex = 0;
    for (var i = 0; i < form.drafts.options.length; ++i) {
        if (form.drafts.options[i].value == data['drafts']) {
            form.drafts.selectedIndex = i;
            break;
        }
    }
    form.templates.selectedIndex = 0;
    for (var i = 0; i < form.templates.options.length; ++i) {
        if (form.templates.options[i].value == data['templates']) {
            form.templates.selectedIndex = i;
            break;
        }
    }
    if (data['acctype'] == 'imap') {
        acctype = 'imap';
        form.imapserver.value = data['popserver'];
        form.imapport.value = data['popport'];
        form.imapuser.value = data['popuser'];
        form.imappass.value = data['poppass'];
        // form.cachetype.selectedIndex = (data['cachetype'] == 'struct') ? 0 : 1;
        form.imaptls.selectedIndex = (data['popapop'] == 0) ? 0 : 1;
        form.onlysubscribed.checked = (data['onlysubscribed'] == 1) ? true : false;
        form.imapprefix.value = data['imapprefix'];/*
        try {
            document.getElementById('imapcache').style.display = 'table-row';
        } catch (e) {
            document.getElementById('imapcache').style.display = 'inline';
        }*/
        document.getElementById('reiter_pop3').style.display = 'none';
        document.getElementById('reiter_imap').style.display = 'inline';
    } else {
        acctype = 'pop3';
        form.popserver.value = data['popserver'];
        form.popport.value = data['popport'];
        form.popuser.value = data['popuser'];
        form.poppass.value = data['poppass'];
        form.poptls.selectedIndex = (data['popsec'] == 'AUTO') ? 1 : 0;
        form.popapop.selectedIndex = (data['popapop'] == 0) ? 0 : 1;
        form.inbox.selectedIndex = 0;
        for (var i = 0; i < form.inbox.options.length; ++i) {
            if (form.inbox.options[i].value == data['inbox']) {
                form.inbox.selectedIndex = i;
                break;
            }
        }
        document.getElementById('pop3_leaveonserver').style.display = 'block';
        form.leaveonserver.checked = (data['leaveonserver'] == 1) ? true : false;
        form.localkillserver.checked = (data['localkillserver'] == 1) ? true : false;
        try {
            document.getElementById('pop3_inboxline').style.display = 'table-row';
        } catch (e) {
            document.getElementById('pop3_inboxline').style.display = 'inline';
        }
        try {
            document.getElementById('pop3_smtpafterpop').style.display = 'table-row';
        } catch (e) {
            document.getElementById('pop3_smtpafterpop').style.display = 'inline';
        }
        document.getElementById('reiter_pop3').style.display = 'inline';
        document.getElementById('reiter_imap').style.display = 'none';
    }
    form.smtp_host.value = data['smtp_host'];
    form.smtp_port.value = data['smtp_port'];
    form.smtp_user.value = data['smtp_user'];
    form.smtp_pass.value = data['smtp_pass'];
    form.smtptls.selectedIndex = (data['smtpsec'] == 'AUTO') ? 1 : 0;
    form.checkspam.checked = (data['checkspam'] == 1) ? true : false;
    form.checkevery.value = data['checkevery'];
    form.be_checkevery.value = data['be_checkevery'];
    form.smtpafterpop.checked = (data['smtpafterpop'] == 1) ? true : false;
    form.sig_on.checked = (data['sig_on'] == 1) ? true : false;
    document.getElementById('addalias').style.display = 'inline';
    document.getElementById('adduhead').style.display = 'inline';
    document.getElementById('delebutton').style.display = 'inline';
    AJAX_call('{getaliasesurl}&id=' + currprofile, 'get');
    AJAX_call('{getuheadsurl}&id=' + currprofile, 'get');
    AJAX_call('{getsignaturesurl}', 'get');
    document.getElementById('navcont').style.display = 'block';
    switchto('generic');
}

function emptyfields()
{
    form = document.forms.mainform;
    form.popname.value = '';
    form.address.value = '';
    form.real_name.value = '';
    form.popserver.value = '';
    form.popport.value = '110';
    form.popuser.value = '';
    form.poppass.value = '';
    form.imapserver.value = '';
    form.imapport.value = '143';
    form.imapuser.value = '';
    form.imappass.value = '';
    form.smtp_host.value = '';
    form.smtp_port.value = '25';
    form.smtp_user.value = '';
    form.smtp_pass.value = '';
    form.checkevery.value = '0';
    form.be_checkevery.value = '0';
    form.sendvcf.selectedIndex = 0;
    form.inbox.selectedIndex = 0;
    form.sent_objects.selectedIndex = 0;
    form.junk.selectedIndex = 0;
    form.waste.selectedIndex = 0;
    form.drafts.selectedIndex = 0;
    form.templates.selectedIndex = 0;
    // form.cachetype.selectedIndex = 0;
    form.popapop.selectedIndex = 0;
    form.imaptls.selectedIndex = 0;
    form.poptls.selectedIndex = 0;
    form.smtptls.selectedIndex = 0;
    form.checkspam.checked = false;
    form.leaveonserver.checked = true;
    form.localkillserver.checked = true;
    form.smtpafterpop.checked = false;
    form.onlysubscribed.checked = true;
    form.sig_on.checked = false;
    form.imapprefix.value = '';

    $('#pop3_inboxline').css('display', 'none');
    $('#pop3_leaveonserver').css('display', 'none');
    $('#pop3_smtpafterpop').css('display', 'none');
    // $('#imapcache').css('display', 'none');
    $('#addalias').css('display', 'none');
    $('#adduhead').css('display', 'none');
    // Throw away any already existant childs
    $('#aliascontainer').html('');
    $('#uheadcontainer').html('');
    $('#sigcontain').html('');
    $('#sigpreview').html('');
}

function addprofile(acc_type)
{
    emptyfields();
    currprofile = 0;
    sigid = false;
    AJAX_call('{getsignaturesurl}', 'get');
    if (acc_type == 'imap') {
        acctype = 'imap';/*
        try {
            document.getElementById('imapcache').style.display = 'table-row';
        } catch (e) {
            document.getElementById('imapcache').style.display = 'inline';
        }*/
        document.getElementById('reiter_pop3').style.display = 'none';
        document.getElementById('reiter_imap').style.display = 'inline';
    } else {
        acctype = 'pop3';
        document.getElementById('pop3_leaveonserver').style.display = 'block';
        try {
            document.getElementById('pop3_inboxline').style.display = 'table-row';
        } catch (e) {
            document.getElementById('pop3_inboxline').style.display = 'inline';
        }
        try {
            document.getElementById('pop3_smtpafterpop').style.display = 'table-row';
        } catch (e) {
            document.getElementById('pop3_smtpafterpop').style.display = 'inline';
        }
        document.getElementById('reiter_pop3').style.display = 'inline';
        document.getElementById('reiter_imap').style.display = 'none';
    }
    document.getElementById('delebutton').style.display = 'none';
    document.getElementById('navcont').style.display = 'block';
    switchto('generic');
}

function saveprofile()
{
    var error = false;
    form = document.forms.mainform;
    if (ssl_available == 0) {
        if (form.smtp_host.value.substr(0, 6) == 'ssl://') {
            error = true;
            alert('{msg_nossl_smtp}');
        }
        if (form.popserver.value.substr(0, 6) == 'ssl://') {
            if (error == false) alert('{msg_nossl_pop3}');
            error = true;
        }
    }

    if (error != false) return;
    data = 'acctype=' + encodeURIComponent(acctype)
            + '&popname=' + encodeURIComponent(form.popname.value)
            + '&address=' + encodeURIComponent(form.address.value)
            + '&real_name=' + encodeURIComponent(form.real_name.value)
            + '&smtp_host=' + encodeURIComponent(form.smtp_host.value)
            + '&smtp_port=' + encodeURIComponent(form.smtp_port.value)
            + '&smtp_user=' + encodeURIComponent(form.smtp_user.value)
            + '&smtp_pass=' + encodeURIComponent(form.smtp_pass.value)
            + '&smtpsec=' + ((form.smtptls.selectedIndex == 1) ? 1 : 0)
            + '&checkevery=' + encodeURIComponent(form.checkevery.value)
            + '&be_checkevery=' + encodeURIComponent(form.be_checkevery.value)
            + '&checkspam=' + ((form.checkspam.checked) ? 1 : 0)
            + '&sig_on=' + ((form.sig_on.checked) ? 1 : 0)
            + '&signature=' + sigid
            + '&sendvcf=' + encodeURIComponent(form.sendvcf.options[form.sendvcf.selectedIndex].value)
            + '&sent_objects=' + encodeURIComponent(form.sent_objects.options[form.sent_objects.selectedIndex].value)
            + '&junk=' + encodeURIComponent(form.junk.options[form.junk.selectedIndex].value)
            + '&waste=' + encodeURIComponent(form.waste.options[form.waste.selectedIndex].value)
            + '&drafts=' + encodeURIComponent(form.drafts.options[form.drafts.selectedIndex].value)
            + '&templates=' + encodeURIComponent(form.templates.options[form.templates.selectedIndex].value);
    if (acctype == 'imap') {
        data += '&popserver=' + encodeURIComponent(form.imapserver.value)
                + '&popport=' + encodeURIComponent(form.imapport.value)
                + '&popuser=' + encodeURIComponent(form.imapuser.value)
                + '&poppass=' + encodeURIComponent(form.imappass.value)
                + '&popapop=' + ((form.imaptls.selectedIndex == 1) ? 1 : 0)
                // + '&cachetype=' + encodeURIComponent(form.cachetype.options[form.cachetype.selectedIndex].value)
                + '&onlysubscribed=' + ((form.onlysubscribed.checked) ? 1 : 0)
                + '&imapprefix=' + encodeURIComponent(form.imapprefix.value);
    } else {
        data += '&popserver=' + encodeURIComponent(form.popserver.value)
                + '&popport=' + encodeURIComponent(form.popport.value)
                + '&popuser=' + encodeURIComponent(form.popuser.value)
                + '&poppass=' + encodeURIComponent(form.poppass.value)
                + '&popsec=' + ((form.poptls.selectedIndex == 1) ? 1 : 0)
                + '&popapop=' + ((form.popapop.selectedIndex == 1) ? 1 : 0)
                + '&leaveonserver=' + ((form.leaveonserver.checked) ? 1 : 0)
                + '&localkillserver=' + ((form.localkillserver.checked) ? 1 : 0)
                + '&smtpafterpop=' + ((form.smtpafterpop.checked) ? 1 : 0)
                + '&inbox=' + encodeURIComponent(form.inbox.options[form.inbox.selectedIndex].value);
    }
    AJAX_call('{savelink}' + ((currprofile != 0) ? 'saveold&account=' + currprofile : 'savenew'), 'post', data);
}

function deleprofile()
{
    if (!currprofile) return;
    if (confirm('{kill_request}')) {
        AJAX_call('{delelink}' + currprofile, 'get');
    }
}

function switchto(what)
{
    switch (open_mask) {
    case 'generic':
        open_mask = false;
        document.getElementById('reiter_generic').className = 'reiter_aus';
        document.getElementById('generic').style.display = 'none';
        break;
    case 'pop3':
        open_mask = false;
        document.getElementById('reiter_pop3').className = 'reiter_aus';
        document.getElementById('pop3fields').style.display = 'none';
        break;
    case 'imap':
        open_mask = false;
        document.getElementById('reiter_imap').className = 'reiter_aus';
        document.getElementById('imapfields').style.display = 'none';
        break;
    case 'smtp':
        open_mask = false;
        document.getElementById('reiter_smtp').className = 'reiter_aus';
        document.getElementById('smtpfields').style.display = 'none';
        break;
    case 'folders':
        open_mask = false;
        document.getElementById('reiter_folders').className = 'reiter_aus';
        document.getElementById('folderfields').style.display = 'none';
        break;
    case 'alias':
        open_mask = false;
        document.getElementById('reiter_alias').className = 'reiter_aus';
        document.getElementById('aliasfields').style.display = 'none';
        break;
    case 'more':
        open_mask = false;
        document.getElementById('reiter_more').className = 'reiter_aus';
        document.getElementById('advancedfields').style.display = 'none';
        break;
    case 'uhead':
        open_mask = false;
        document.getElementById('reiter_uhead').className = 'reiter_aus';
        document.getElementById('uheadfields').style.display = 'none';
        break;
    }

    switch (what) {
    case 'generic':
        open_mask = 'generic';
        document.getElementById('reiter_generic').className = 'reiter_an';
        document.getElementById('generic').style.display = 'block';
        break;
    case 'pop3':
        open_mask = 'pop3';
        document.getElementById('reiter_pop3').className = 'reiter_an';
        document.getElementById('pop3fields').style.display = 'block';
        break;
    case 'imap':
        open_mask = 'imap';
        document.getElementById('reiter_imap').className = 'reiter_an';
        document.getElementById('imapfields').style.display = 'block';
        break;
    case 'smtp':
        open_mask = 'smtp';
        document.getElementById('reiter_smtp').className = 'reiter_an';
        document.getElementById('smtpfields').style.display = 'block';
        break;
    case 'folders':
        open_mask = 'folders';
        document.getElementById('reiter_folders').className = 'reiter_an';
        document.getElementById('folderfields').style.display = 'block';
        break;
    case 'alias':
        open_mask = 'alias';
        document.getElementById('reiter_alias').className = 'reiter_an';
        document.getElementById('aliasfields').style.display = 'block';
        break;
    case 'more':
        open_mask = 'more';
        document.getElementById('reiter_more').className = 'reiter_an';
        document.getElementById('advancedfields').style.display = 'block';
        break;
    case 'uhead':
        open_mask = 'uhead';
        document.getElementById('reiter_uhead').className = 'reiter_an';
        document.getElementById('uheadfields').style.display = 'block';
        break;
    }
}
// ]]>
</script>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
 <tr>
  <td align="left" valign="top">
<div class="sendmenuborder" style="width:200px;height:246px;overflow:auto;background:white;">
 <table border="0" cellpadding="2" cellspacing="0"><!-- START menline -->
  <tr id="prof_{id}" class="inbxoline" style="cursor:pointer;" onclick="loadprofile({id})">
   <td align="left" valign="top"><!-- START acctype_pop3 --><img src="{confpath}/icons/proto_pop3.gif" alt="POP3" title="POP3" /><!-- END acctype_pop3 --><!-- START acctype_imap --><img src="{confpath}/icons/proto_imap.gif" alt="IMAP" title="IMAP" /><!-- END acctype_imap --></td>
   <td align="left" valign="top">{profilenm}</td>
  </tr><!-- END menline -->
 </table>
</div>
  </td>
  <td align="left" valign="top">
  <form name="mainform" onsubmit="saveprofile();" action="#" method="get">
  <div id="navcont" style="display:none; text-align:left;width:530px;">
  <div>
   <div id="reiter_generic" onclick="switchto('generic')" class="reiter_aus">{msg_generic}</div>
   <div id="reiter_pop3" onclick="switchto('pop3')" class="reiter_aus">POP3</div>
   <div id="reiter_imap" onclick="switchto('imap')" class="reiter_aus">IMAP</div>
   <div id="reiter_smtp" onclick="switchto('smtp')" class="reiter_aus">SMTP</div>
   <div id="reiter_folders" onclick="switchto('folders')" class="reiter_aus">{msg_folders}</div>
   <div id="reiter_alias" onclick="switchto('alias')" class="reiter_aus">{msg_aliases}</div>
   <div id="reiter_uhead" onclick="switchto('uhead')" class="reiter_aus">{msg_uhead}</div>
   <div id="reiter_more" onclick="switchto('more')" class="reiter_aus">{msg_various}</div>
  </div>

  <div class="sendmenubut" style="margin:auto; height:210px;">
   <div id="generic" style="display:none">
    <table border="0" cellpadding="2" cellspacing="0">
    <tbody>
     <tr>
      <td align="left"><strong>{msg_profile}:</strong></td>
      <td align="left"><input type="text" name="popname" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr>
      <td align="left">{msg_email}:</td>
      <td align="left"><input type="text" name="address" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr>
      <td align="left">{msg_realname}:</td>
      <td align="left"><input type="text" name="real_name" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr id="imapcache" style="display:none">
      <td align="left">{msg_cachetype}:</td>
      <td align="left"><select size="1" name="cachetype"><!-- START cacheline -->
        <option value="{id}">{name}</option><!-- END cacheline -->
       </select>
      </td>
     </tr>
     <tr>
      <td colspan="2" align="left">
       <input type="checkbox" id="lbl_chkspam" name="checkspam" value="1" />
       <label for="lbl_chkspam">{msg_checkspam}</label><br />
       <div id="pop3_leaveonserver">
       <input type="checkbox" id="lbl_leave" name="leaveonserver" value="1" />
       <label for="lbl_leave">{msg_leaveonserver}</label>
        <div id="pop3_localkillserver" style="padding-left:12px">
         <input type="checkbox" id="lbl_localkill" name="localkillserver" value="1" />
         <label for="lbl_localkill">{msg_localkillserver}</label>
        </div>
       </div>
      </td>
     </tr>
    </tbody>
    </table>
   </div>

   <div id="pop3fields" style="display:none">
    <table border="0" cellpadding="2" cellspacing="0">
    <tbody>
     <tr>
      <td align="left">{msg_popserver}:</td>
      <td align="left">
       <input type="text" name="popserver" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('popserver', 'smtp_host')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_popport}:</td>
      <td align="left"><input type="text" name="popport" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr>
      <td align="left">{msg_popuser}:</td>
      <td align="left">
       <input type="text" name="popuser" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('popuser', 'smtp_user')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_poppass}:</td>
      <td align="left">
       <input type="password" name="poppass" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('poppass', 'smtp_pass')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
       </td>
     </tr>
     <tr>
      <td class="l">TLS:</td>
      <td class="l">
       <select name="poptls" size="1">
        <option value="">{msg_auto}</option>
        <option value="1">{msg_no}</option>
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_popapop}:</td>
      <td align="left">
       <select name="popapop" size="1">
        <option value="">{msg_auto}</option>
        <option value="1">{msg_no}</option>
       </select>
      </td>
     </tr>
    </tbody>
    </table>
   </div>

   <div id="imapfields" style="display:none">
    <table border="0" cellpadding="2" cellspacing="0">
    <tbody>
     <tr>
      <td align="left">{msg_popserver}:</td>
      <td align="left">
       <input type="text" name="imapserver" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('imapserver', 'smtp_host')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_popport}:</td>
      <td align="left"><input type="text" name="imapport" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr>
      <td align="left">{msg_popuser}:</td>
      <td align="left">
       <input type="text" name="imapuser" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('imapuser', 'smtp_user')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_poppass}:</td>
      <td align="left">
       <input type="password" name="imappass" size="24" value="" maxlength="64" />
       <button type="button" onclick="copyf('imappass', 'smtp_pass')" title="{copy_smtp}">
        -&gt; SMTP
       </button>
       </td>
     </tr>
     <tr>
      <td align="left">TLS:</td>
      <td align="left">
       <select name="imaptls" size="1">
        <option value="">{msg_auto}</option>
        <option value="1">{msg_no}</option>
       </select>
      </td>
     </tr>
     <tr>
      <td align="left" colspan="2">
       <input type="checkbox" id="lbl_onlysubscribed" name="onlysubscribed" value="1" />
       <label for="lbl_onlysubscribed">{msg_onlysubscribed}</label><br />
       <div style="display:none">{msg_imapprefix}: <input type="text" name="imapprefix" value="" size="6" maxlength="250" /></div>
      </td>
     </tr>
    </tbody>
    </table>
   </div>

   <div id="smtpfields" style="display:none">
    <table border="0" cellpadding="2" cellspacing="0">
    <tbody>
     <tr>
      <td align="left">{msg_smtphost}:</td>
      <td align="left">
       <input type="text" name="smtp_host" size="24" value="" maxlength="64" />
      </td>
     </tr>
     <tr>
      <td align="left">{msg_smtpport}:</td>
      <td align="left"><input type="text" name="smtp_port" size="24" value="" maxlength="64" /></td>
     </tr>
     <tr>
      <td align="left">{msg_smtpuser}:</td>
      <td align="left">
       <input type="text" name="smtp_user" size="24" value="" maxlength="64" />
      </td>
     </tr>
     <tr>
      <td align="left">{msg_smtppass}:</td>
      <td align="left">
       <input type="password" name="smtp_pass" size="24" value="" maxlength="64" />
       </td>
     </tr>
     <tr id="pop3_smtpafterpop" style="display:none">
      <td align="left" colspan="2">
       <input type="checkbox" id="lbl_smtpafterpop" name="smtpafterpop" value="1" />
       <label for="lbl_smtpafterpop">SMTP after POP</label>
      </td>
     </tr>
    </tbody>
    </table>
   </div>

   <div id="folderfields" style="display:none">
    <table border="0" cellpadding="2" cellspacing="0">
    <tbody>
     <tr id="pop3_inboxline" style="display:none">
      <td align="left">{msg_inboxfolder}:</td>
      <td align="left">
       <select size="1" name="inbox">
        <option value="0">{msg_defaultfolder}</option><!-- START inboxline -->
        <option value="{id}">{name}</option><!-- END inboxline -->
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_sentfolder}:</td>
      <td align="left">
       <select size="1" name="sent_objects">
        <option value="0">{msg_defaultfolder}</option>{inboxline}
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_wastefolder}:</td>
      <td align="left">
       <select size="1" name="waste">
        <option value="0">{msg_defaultfolder}</option>{inboxline}
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_junkfolder}:</td>
      <td align="left">
       <select size="1" name="junk">
        <option value="0">{msg_defaultfolder}</option>{inboxline}
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_draftsfolder}:</td>
      <td align="left">
       <select size="1" name="drafts">
        <option value="0">{msg_defaultfolder}</option>{inboxline}
       </select>
      </td>
     </tr>
     <tr>
      <td align="left">{msg_templatesfolder}:</td>
      <td align="left">
       <select size="1" name="templates">
        <option value="0">{msg_defaultfolder}</option>{inboxline}
       </select>
      </td>
     </tr>
    </tbody>
    </table>
   </div>

   <div id="aliasfields" style="display:none" class="body">
    <br />
    <div class="sendmenuborder" id="aliascontainer" style="width:98%;height:160px;overflow:auto;clear:both;background:white;">
    </div>
    <button id="addalias" style="display:none" type="button" onclick="open_editalias()">{msg_addalias}</button>
   </div>

   <div id="uheadfields" style="display:none">
    {about_uheaders}<br />
    <br />
    <div class="sendmenuborder" id="uheadcontainer" style="width:98%;height:120px;overflow:auto;clear:both;background:white;">
    </div>
    <button id="adduhead" style="display:none" type="button" onclick="open_edituhead()">{msg_adduhead}</button>
   </div>

   <div id="advancedfields" style="display:none"><br />
    {msg_fetchevery}<br />
    <table border="0" cellpadding="2" cellspacing="0">
     <tr>
      <td style="text-align:left; vertical-align:top">&middot; {msg_fetchfrontend}:</td>
      <td style="text-align:left; vertical-align:top"><input type="text" name="checkevery" size="2" value="" maxlength="3" /></td>
     </tr>
     <tr>
      <td style="text-align:left; vertical-align:top">&middot; {msg_fetchbackend}:</td>
      <td style="text-align:left; vertical-align:top"><input type="text" name="be_checkevery" size="2" value="" maxlength="3" /></td>
     </tr>
    </table>
    <input type="checkbox" id="lbl_sigon" name="sig_on" value="1" />
    <label for="lbl_sigon"><strong>{msg_sigon}</strong></label><br />
    <div style="float:right;width:20px;padding:4px;text-align:left;vertical-align:top;height:95px;">
     <img onclick="open_editsig(1);" style="cursor:pointer;display:block;" src="{confpath}/icons/edit_menu.gif" alt="" title="{msg_editsig}" /><br />
     <img onclick="dele_signature();" style="cursor:pointer;display:block;" src="{confpath}/icons/dustbin_menu.gif" alt="" title="{msg_delesig}" /><br />
     <img onclick="open_editsig();" style="cursor:pointer;display:block;" src="{confpath}/icons/add_menu.gif" alt="" title="{msg_addsig}" /><br />
    </div>
    <div class="sendmenuborder" id="sigpreview" style="float:right;width:265px;height:95px;overflow:auto;background:darkgrey"></div>
    <div class="sendmenuborder" id="sigcontain" style="width:200px;height:95px;overflow:auto;background:white">
   </div>
   </div>
   </div>
   <div style="text-align:right">
    <button style="display:none;" id="delebutton" type="button" onclick="deleprofile()">{msg_dele}</button>
    <button type="button" onclick="saveprofile()">{msg_save}</button>
   </div>
   </div>
   </form>
  </td>
 </tr>
 <tr class="sendmenubut darker">
  <td colspan="2" align="left">{msg_addacct}:
   <a style="text-decoration:underline;" href="javascript:addprofile('pop3');">POP3</a><!-- START has_imap -->&nbsp;&middot;&nbsp;
   <a style="text-decoration:underline;" href="javascript:addprofile('imap');">IMAP</a><!-- END has_imap -->
  </td>
 </tr>
</table>

<div class="sendmenubut" style="display:none;width:285px;height:75px;z-index:100;position:absolute;left:50px;top:170px;" id="editalias">
<form action="#" method="get" onsubmit="return false;" accept-charset="UTF-8">
<table border="0" cellpadding="2" cellspacing="0">
 <tr>
  <td align="left" valign="top">{msg_realname}:</td>
  <td align="left" valign="top"><input type="text" name="alRN" id="aliasrealname" size="20" maxlength="32" /></td>
 </tr>
 <tr>
  <td align="left" valign="top">{msg_email}:</td>
  <td align="left" valign="top"><input type="text" name="alEM" id="aliasemail" size="20" maxlength="255" /></td>
 </tr>
 <tr>
  <td align="left"><button type="button" onclick="react_editalias();">{msg_save}</button></td>
  <td align="right"><button type="button" onclick="cancel_alias();">{msg_cancel}</button></td>
 </tr>
</table>
</form>
</div>

<div class="sendmenubut" style="display:none;width:285px;height:75px;z-index:100;position:absolute;left:50px;top:170px;" id="edituhead">
<form action="#" method="get" onsubmit="return false;" accept-charset="UTF-8">
<table border="0" cellpadding="2" cellspacing="0">
 <tr>
  <td align="left" valign="top">{msg_hkey}:</td>
  <td align="left" valign="top"><input type="text" name="uheadK" id="uheadhkey" size="20" maxlength="32" /></td>
 </tr>
 <tr>
  <td align="left" valign="top">{msg_hval}:</td>
  <td align="left" valign="top"><input type="text" name="uheadV" id="uheadhval" size="20" maxlength="255" /></td>
 </tr>
 <tr>
  <td align="left"><button type="button" onclick="react_edituhead();">{msg_save}</button></td>
  <td align="right"><button type="button" onclick="cancel_uhead();">{msg_cancel}</button></td>
 </tr>
</table>
</form>
</div>

<div class="sendmenubut" style="display:none;width:473px;height:170px;z-index:100;position:absolute;left:50px;top:120px;" id="editsig">
<form action="#" method="get" onsubmit="return false;" accept-charset="UTF-8">
<table border="0" cellpadding="2" cellspacing="0">
 <tr>
  <td align="left" valign="top" width="40%">{msg_sigtitle}:</td>
  <td align="left" valign="top"><input type="text" name="sigtitle" id="sigtitle" size="32" maxlength="32" /></td>
 </tr>
 <tr>
  <td colspan="2" align="left" valign="top"><textarea name="sigval" id="sigval" rows="5" cols="80" style="width:465px;height:100px;"></textarea></td>
 </tr>
 <tr>
  <td align="left"><button type="button" onclick="react_editsig();">{msg_save}</button></td>
  <td align="right"><button type="button" onclick="cancel_sig();">{msg_cancel}</button></td>
 </tr>
</table>
</form>
</div>

<br />
<div align="left">
<form action="{form_target}" method="post">
<fieldset>
 <legend>{msg_defacc}</legend>
 {about_defacc}<br />
 <br />
 <strong>{msg_defacc}:</strong>&nbsp;
 <select name="def_prof" size="1">
  <option value="0">{msg_notdef}</option><!-- START profline -->
  <option value="{id}"<!-- START sel --> selected="selected"<!-- END sel -->>{name}</option><!-- END profline -->
 </select>&nbsp;
 <input type="submit" value="{msg_save}" />
</fieldset>
</form>
</div>
Return current item: phlyMail Lite