Location: PHPKode > projects > phlyMail Lite > phlymail/frontend/templates/read.general.tpl
<script type="text/javascript">
/*<![CDATA[*/
// This should reflect setting the mail status to read in the inbox folder
try { if (opener.CurrentHandler == "email") { opener.email_refreshlist(); } } catch (e) {}
theme_path = '{theme_path}';
active_part = false;
inline_att = [];<!-- START showinline -->
inline_att[{id}] = {"type": '{type}', "name" : '{name}'};<!-- END showinline -->
is_inline = 0<!-- START is_inline -->+1<!-- END is_inline -->;
replysamewin = 0<!-- START replysamewin -->+1<!-- END replysamewin -->
link = [];
<!-- START normalheader -->
pm_menu_additem('view', false, '{but_header}', '{link_header}', 0, 0, 'href');<!-- END normalheader --><!-- START fullheader -->
pm_menu_additem('view', false, '{but_header}', '{link_header}', 0, 0, 'href');<!-- END fullheader --><!-- START teletype_pro -->
pm_menu_additem('view', false, '{but_teletype}', '{link_teletype}', 0, 0, 'href');<!-- END teletype_pro --><!-- START teletype_sys -->
pm_menu_additem('view', false, '{but_teletype}', '{link_teletype}', 0, 0 , 'href');<!-- END teletype_sys -->
pm_menu_addline('view');<!-- START but_txtvers -->
pm_menu_additem('view', false, '{msg_textversion}',"switch_part('text')", 0, 0, 'js');
link['text'] = '{link}';<!-- END but_txtvers --><!-- START but_htmlvers -->
pm_menu_additem('view', false, '{msg_securehtml}', "switch_part('sanitizedhtml')", 0, 0, 'js');
pm_menu_additem('view', false, '{msg_originalhtml}', "switch_part('originalhtml')", 0, 0, 'js');
link['sanitizedhtml'] = '{link}';
link['originalhtml']  = '{link}&sanitize=0';<!-- END but_htmlvers -->
pm_menu_addline('view');
pm_menu_additem('view', '{theme_path}/icons/raw_ctx.gif', '{msg_viewsrc}', "do_mailop('viewsrc')", 0, 0, 'js');
pm_menu_additem('mail', '{theme_path}/icons/save_ctx.gif', '{msg_save}', '{link_save}', 0, 0, 'href');
ctxmen = [ {'status' : 1, 'link' : 'dl_attach()', 'name' : '{msg_save}', 'icon' : '{theme_path}/icons/save_ctx.gif'} ];
ctxmen_id = false;
ctxadded = false;
hdl_ctx = [];
att_info = [];
ctxover = false;<!-- START availhdls -->
context_addhandler('{icon}', '{handler}', '{msg}');<!-- END availhdls -->

function context_addhandler(icon, handler, msg)
{
    if (!ctxadded) {
        ctxmen.push({'status' : 2});
        ctxadded = true;
    }
    ctxmen.push({'status':3,'link':'sendto("' + handler + '")','name':msg,'icon':'{theme_path}/icons/' + icon});
    hdl_ctx[handler] = ctxmen.length-1;
}

function menuattach(attnum)
{
    for (var i = 0; i < ctxmen.length; ++i) {
        if (i < 2) continue;
        ctxmen[i]['status'] = 3;
    }
    for (var i = 0; i < att_info[attnum]['hdls'].length; ++i) ctxmen[hdl_ctx[att_info[attnum]['hdls'][i]]]['status'] = 1;
    ctxover = attnum;
}

function dl_attach()
{
    if (ctxover == false) return;
    var ahref = document.getElementById('ahref_' + ctxover);
    if (ahref) {
        if (typeof ahref.target != 'undefiend' && ahref.target == '_blank')  {
            window.open(ahref.href);
        } else {
            self.location.href = ahref.href;
        }
    }
}

function sendto(hndlr)
{
    var resid = att_info[ctxover]['resid'];
    date = new Date();
    ctime = date.getTime();
    window.open
            ('{link_sendto}&handler=' + hndlr + '&resid=' + encodeURIComponent(resid)
            ,'_sendto_' + ctime
            ,'width=250,height=250,scrollbars=no,resizable=yes,location=no,menubar=no,status=no,toolbar=no,personalbar=no'
            );
}

function switch_part(part)
{
    if (active_part != part) document.getElementById('mbody_iframe').src = link[part];
    mpart = part_to_menu(active_part);
    if (!pm_menu['view'][mpart]) return;
    pm_menu['view'][mpart]['selected'] = 0;
    mpart = part_to_menu(part);
    if (!pm_menu['view'][mpart]) return;
    pm_menu['view'][mpart]['selected'] = 1;
    active_part = part;
}

function part_to_menu(part)
{
    switch (part) {
    case 'text': return 3; break;
    case 'sanitizedhtml': return ((link['text']) ? 4 : 3); break;
    case 'originalhtml':  return ((link['text']) ? 5 : 4); break;
    default: return 3; break;
    }
}

function AJAX_process(next)
{
    if (next['done']) {
        try { if (opener.CurrentHandler == 'email') { opener.email_refreshlist(); } } catch (e) {}
        window.close();
    }
}

/**
 * Handling answering, answering all, forwarding, bouncing,
 * printing, view source
 */
function do_mailop(which)
{
    var sanitize = '';
    var link;
    if (active_part && active_part == 'originalhtml') sanitize = '&sanitize=0';
    switch (which) {
    case 'answer':
        if (is_inline) return false;
        link = '{link_answer}';
        break;
    case 'answerAll':
        if (is_inline) return false;
        link = '{link_answerAll}';
        break;
    case 'forward':
        if (is_inline) return false;
        link = '{link_forward}';
        break;
    case 'bounce':
        if (is_inline) return false;
        link = '{link_bounce}';
        break;
    case 'print':
        link = '{link_print}';
        break;
    case 'viewsrc':
        if (is_inline) return false;
        link = '{link_viewsrc}';
        break;
    default:
        return false;
        break;
    }
    if ('viewsrc' != which && 'print' != which && replysamewin == 1) {
        self.location.href = link + sanitize;
    } else {
        window.open
                (link + sanitize
                ,'send_' + new Date().getTime()
                ,'width=600,height=500,scrollbars=yes,resizable=yes,location=no,menubar=no,status=no,toolbar=no'
                );
    }
}

function delete_mail()
{
    if (confirm('{msg_dele}')) $.ajax({"url": '{link_dele}', "success": AJAX_process});
}

function adjust_height()
{
    var avail_screen = 500;
    // Eeeeeextrawurst, Extrawurst .... für den IE natürlich
    if (document.getElementById('kopfzeilen').offsetHeight > 150) {
        document.getElementById('kopfzeilen').style.height = '150px';
    }
    // Get the available Window height
    if (window.innerHeight) {
        avail_screen = window.innerHeight;
    } else if (document.documentElement.offsetHeight) {
        avail_screen = document.documentElement.offsetHeight;
    } else if (document.body.offsetHeight) {
        avail_screen = document.body.offsetHeight;
    }

    var mbody = document.getElementById('mailbody');
    var mbody_height = mbody.offsetHeight;
    var iframe_height = document.getElementById('mbody_iframe').offsetHeight;
    var availbody = avail_screen - (mbody.offsetTop);
    if (document.getElementById('attachments')) {
        availbody = availbody - (document.getElementById('attachments').offsetHeight + 6);
    }
    if (availbody > 0)  {
        mbody.style.height = availbody + 'px';
        var new_iframe = availbody - 8;
        document.getElementById('mbody_iframe').style.height = new_iframe + 'px';
    }
}

function view_inline()
{
    // On inline mails, disable all not supported items
    if (1 == is_inline) {
        document.getElementById('but_answer').className = 'disabledbut';
        document.getElementById('but_answerall').className = 'disabledbut';
        document.getElementById('but_forward').className = 'disabledbut';
        document.getElementById('but_dele').className = 'disabledbut';
        document.getElementById('pm_menu_container').style.visibility = 'hidden';
    }
    var hr, im, div;
    if (inline_att.length == 0) return;
    AppDoc = frames.mbody_iframe.document;
    if (typeof AppDoc == 'undefined') return;

    AppNode = AppDoc.getElementById('mailtext');
    for (var ID in inline_att) {
        if (inline_att[ID]['type'] != 'image' && inline_att[ID]['type'] != 'text') continue;

        // We don't have a generic style sheet for HTML mails
        hr = AppDoc.createElement('div');
        hr.style.borderBottom = '1px solid darkgray';
        hr.style.padding = '4px';
        hr.style.margin = '2px';
        hr.style.fontSize = '9pt';
        hr.style.backgroundColor = 'white';
        hr.style.fontFamily = 'Verdana, Arial, Helvetica, "Sans Serif"';
        hr.style.color = 'darkgray';
        hr.appendChild(AppDoc.createTextNode(inline_att[ID]['name']));
        AppNode.appendChild(hr);

        if (inline_att[ID]['type'] == 'image') {
            img = AppDoc.createElement('img');
            img.style.display = 'block';
            img.style.margin = 'auto';
            img.src = '{showinlineurl}' + ID;
            AppNode.appendChild(img);
        } else if (inline_att[ID]['type'] == 'text') {
            div = AppDoc.createElement('div');
            div.id = 'inline_div_' + ID;
            AppNode.appendChild(div);
            $.ajax(
                {url : '{showinlineurl}' + ID
                ,dataType: 'text'
                ,success: function (data) {
                    AppDoc.getElementById('inline_div_' + ID).innerHTML = '<pre>' + data + '</pre>';
                }});
        }
    }
}

function sendtoadb(address, realname)
{
    if (address == realname) realname = '';
    window.open
            ('{link_sendtoadb}&email1=' + address + '&firstname=' + realname
            ,'contact_' + new Date().getTime()
            ,'width=870,height=620,scrollbars=no,resizable=yes,location=no,menubar=no,status=yes,toolbar=no'
            )
}
<!-- START mdn -->
send_dsn = ('{dispomode}' == 'manual') ? confirm('{msg_confirm_mdn}') : true;
if (send_dsn) $.ajax({url:'{send_url}'});
$.ajax({url:'{status_url}'});<!-- END mdn -->
active_part = '{active_part}';
switch_part('{active_part}');
$(document).ready(function () {
	adjust_height();
});
$(window).resize(function () {
    adjust_height();
});
/*]]>*/
</script>
<div class="solid_line" style="text-align:left;" id="topmenucontainer">
    <table border="0" cellpadding="0" cellspacing="0">
        <tr class="solid_nodrop" id="pm_menu_container">
            <td><a href="javascript:void(0);" class="active" id="topmendrop_mail" onmouseover="pm_menu_create('mail');" onclick="pm_menu_switch(this);">{msg_mail}</a></td>
            <td class="men_separator"></td>
            <td><a href="javascript:void(0);" class="active" id="topmendrop_view" onmouseover="pm_menu_create('view');" onclick="pm_menu_switch(this);">{msg_view}</a></td>
            <td class="men_separator"></td>
        </tr>
    </table>
</div>
<div class="outset">
    <div class="topbarcontainer">
        <ul class="l">
            <li class="activebut" id="but_answer" onclick="do_mailop('answer')" title="{but_answer}">
                <img src="{theme_path}/icons/answer.gif" alt="" /><span>{but_answer}</span>
            </li>
            <li class="activebut" id="but_answerall" onclick="do_mailop('answerAll')" title="{but_answerAll}">
                <img src="{theme_path}/icons/answerall.gif" alt="" /><span>{but_answerAll}</span>
            </li>
            <li class="activebut" id="but_forward" onclick="do_mailop('forward')" title="{but_forward}">
                <img src="{theme_path}/icons/forward.gif" alt="" /><span>{but_forward}</span>
            </li>
            <li class="activebut" id="but_bounce" onclick="do_mailop('bounce')" title="{but_bounce}">
                <img src="{theme_path}/icons/bounce.gif" alt="" /><span>{but_bounce}</span>
            </li>
            <li class="activebut" onclick="do_mailop('print')" title="{but_print}">
                <img src="{theme_path}/icons/print_men.gif" alt="" /><span>{but_print}</span>
            </li>
            <li class="activebut" id="but_dele" onclick="delete_mail();" title="{but_dele}">
                <img src="{theme_path}/icons/delete.gif" alt="" /><span>{but_dele}</span>
            </li>
        </ul>
    </div>
</div>
<div class="sendmenubut tdl" style="max-height:150px;overflow:auto;" id="kopfzeilen">
    <table border="0" cellpadding="2" cellspacing="0"><!-- START headerlines -->
        <tr>
            <td class="t l" style="white-space:nowrap;"><strong>{hl_key}:</strong>&nbsp;</td>
            <td class="t l"><span {hl_add}>{hl_val}</span>&nbsp;{hl_eval}</td>
        </tr><!-- END headerlines -->
    </table>
</div>
<div id="mailbody">
    <iframe src="{body_link}" width="100%" height="100%" id="mbody_iframe" name="mbody_iframe" frameborder="0" class="mailtext"></iframe>
</div><!-- START attachblock -->
<div id="attachments">
    <div class="sendmenubut" id="attachmentdivider"></div>
    <div id="attachmentcontainer"><!-- START attachline -->
        <script type="text/javascript">/*<![CDATA[*/att_info[{att_num}] = {'resid' : '{resid}', 'hdls' : [{hdllist}]};/*]]>*/</script>
        <span onmouseover="ctxmen_activate_sensor(ctxmen)" onmouseout="ctxmen_disable_sensor();if(ctxmen_id==false){ctxover=false;}" oncontextmenu="menuattach('{att_num}')" style="white-space:nowrap;"><img src="{frontend_path}/filetypes/32/{att_icon}" alt="" title="{att_icon_alt}" />&nbsp;<a id="ahref_{att_num}" title="{att_size} {msg_att_type}: {att_type}" href="{link_target}"<!-- START inline --> target="_blank"<!-- END inline -->>{att_name}</a></span><!-- END attachline -->
    </div>
</div><!-- END attachblock --><!-- START preview_blocked --><!-- END preview_blocked -->
Return current item: phlyMail Lite