<table class="col2btn">
    <tr>
        <td>{$i.inoutbox_security}</td>
        <td>{security value=$outbox->security}</td>
    </tr>    
    <tr>
        <td>{$i.inoutbox_project}</td>
        <td>{$outbox->project}</td>
    </tr>
    {if $outbox->no neq ''}
        <tr>
            <td>{$i.inoutbox_no}</td>
            <td>{$outbox->no}</td>
        </tr>
    {/if}
    <tr>
        <td colspan="2" title="{$i.inoutbox_content}">
            <div style="max-height: 300px; max-height: 35vh; overflow: scroll; outline: 1px dotted #BBBBBB;">
                {$outbox->content|nl2br|truncate:2000:"..."}
            </div>
        </td>
    </tr>    
    <tr>
        <td>{$i.inoutbox_date}</td>
        <td>{$outbox->date->us_date_time()}</td>
    </tr>    
    {if $outbox->outbox_index neq ''}
        <tr>
            <td>{$i.inoutbox_index}</td>
            <td>{$outbox->outbox_index}</td>
        </tr>   
    {/if}
    <tr>
        <td>{$i.inoutbox_dispatch_mode}</td>
        <td>{$outbox->dispatch_mode_name} {if $outbox->is_mail || $outbox->email_cache_id}({$i.inoutbox_is_mail}){/if}</td>
    </tr>     
    <tr>
        <td>{$i.inoutbox_staff}</td>
        <td>{$outbox->staff_name}</td>
    </tr>    
    <tr>
        <td>{$i.inoutbox_recipient}</td>
        <td>
            <a href="{site_url url="start/open/addressesandcontacts/index/`$xjxcookie`/view/`$outbox->address_id`"}" onclick="usComm.windowOpen(this.href); return false;">
                {$outbox->address_name}
            </a>            
        </td>
    </tr>
    {if count($outbox->bcc)>0}
        <tr>
            <td>{$outbox->copies} {$i.inoutbox_bcc}</td> 
            <td>
                <div class="many">
                    {foreach from=$outbox->bcc item=bcc}
                        {if (!isset($outbox->object_is_editable) || $outbox->object_is_editable)}
                            <p style="cursor: pointer;" onclick="usComm.windowOpen('{site_url url="start/open/addressesandcontacts/index/`$xjxcookie`/view/`$bcc->address_id`"}')">
                        {else}
                            <p>
                        {/if}
                            {$bcc->address_name}
                        </p>
                    {/foreach}
                </div>
            </td>
        </tr>
    {/if}
    {if $outbox->has_document}
        <tr>
            <td>{$i.inoutbox_has_document}</td>
            <td>
                {if empty($outbox->correspondence)}
                    {boolview value=true}
                {else}
                    <a href="{site_url url="start/open/correspondence/index/$xjxcookie/view/{$outbox->correspondence->id}/"}"
                       onclick="usComm.windowOpen(this.href); return false;"
                       class="dialog_make_btn16 correspondence smallbtns ui-corner-all frstbtn frstbtnflt" title="{$i.basic_correspondence}"></a>

                    {additional_button type="correspondence_edit_document" value=$outbox->correspondence}
                    {$outbox->correspondence->subject|truncate:50:"..."}
                {/if}
            </td>
        </tr>    
    {/if}
    {if $outbox->has_transmittal_form}
        <tr>
            <td>{$i.inoutbox_has_transmittal_form}</td>
            <td>
                {if empty($outbox->transmittal_form)}
                    {boolview value=true}
                {else}
                      <a href="{site_url url="start/open/drawingandproductdirectory/index/$xjxcookie/viewdn/{$outbox->transmittal_form->id}/"}"
                       onclick="usComm.windowOpen(this.href); return false;"
                       class="dialog_make_btn16 drawings_inout smallbtns ui-corner-all frstbtn frstbtnflt" title="{$i.basic_transmittal_forms}"></a>
                      {$outbox->transmittal_form->transmittal_form_name}
                {/if}
            </td>
        </tr>        
    {/if}
    {if count($outbox->attachment_files)>0}
        <tr>
            <td>{$outbox->attachments} {$i.inoutbox_attachments}</td>
            <td>
                <div class="many frstbtn">
                    {foreach from=$outbox->attachment_files item=attachment_files}
                        {if (!isset($outbox->object_is_editable) || $outbox->object_is_editable)}
                            {filelink_html($attachment_files->path)}
                        {/if}
                        {$attachment_files->description}<br />
                    {/foreach}
                </div>
            </td>
        <tr>
    {/if}
    {if $outbox->is_mail || $outbox->email_cache_id}
        <tr>
            <td>{$i.inoutbox_mail_out_file}</td>
            {if $outbox->email_cache_id !== null}
                <td style="color: red" class="eml_not_downloaded_yet">
                    {$i.inoutbox_eml_not_downloaded_yet} ({$i.inoutbox_eml_download_attempts}: {$outbox->email_import_attempts})
                    <br />
                    <a href="#" onclick="mailoutbox.eml_import({$outbox->id}, this); return false;" style="color: red; font-weight: bold">
                        {$i.inoutbox_eml_download_now}
                    </a>                  
                </td>
            {else}
                <td>
                    {if (!isset($outbox->object_is_editable) || $outbox->object_is_editable)}
                        {filelink value=$outbox->mail_out_file_path type='msgfrstbtn'}
                        {if $ok_mof !== true} 
                            <div class="warningsmall ui-corner-all" style="cursor: auto;" title='{$ok_mof}''>{$i.portlet_install_modify_office_files_eml2}</div>
                        {else}
                            <span title="BETA - {$i.basic_print_preview} - ID:{$outbox->id}" class="dialog_make_btn16 open_printpreview smallbtns ui-corner-all"
                                onclick="fullPopup.viewurl('{site_url url="reportportlet/$xjxcookie/com_untermstrich_modify_office_files/process_eml/html/{$outbox->id}/2"}');"></span>
                            <span title="BETA - {$i.basic_print} - ID:{$outbox->id}" class="dialog_make_btn16 print smallbtns ui-corner-all"
                                onclick="fullPopup.viewurl('{site_url url="reportportlet/$xjxcookie/com_untermstrich_modify_office_files/process_eml/pdf/{$outbox->id}/2"}');"></span>
                        {/if}
                        <!-- Right finder/explorer buttons -->
                        <span style="float:right; padding-right:5px; transform: scale(0.85);">
                            {filelink type='folder' value=$outbox->mail_out_file_path}
                            {filelink value=dirname($outbox->mail_out_file_path)}
                        </span>
                    {/if}
                </td>
            {/if}        
        </tr>
    {/if}
    {if isset($outbox->attached_file_path) && $outbox->attached_file_path neq ''}
        <tr>
            <td>{$i.inoutbox_attached_file}</td>
            <td>{filelink type="filefrstbtn" value=$outbox->attached_file_path}</td>
        </tr>
    {/if}
    {if $outbox->mail_attachments>0}
        <tr>
            <td>{$i.inoutbox_mail_attachments}</td>
            <td>{$outbox->mail_attachments}</td>
        </tr>      
    {/if}
    {if $outbox->mail_size>0}
        <tr>
            <td>{$i.inoutbox_mail_size}</td>
            <td>{byte_format($outbox->mail_size * 1024, 0)}</td>
        </tr>
    {/if}
    
    <tr>
        <td>{$i.basic_created_by}</td>
        <td>{$outbox->created_by_name}</td>
    </tr>     
    <tr>
        <td>{$i.basic_created_date}</td>
        <td>{$outbox->created_date->us_date()}</td>
    </tr>    
    <tr>
        <td>{$i.basic_changed_by}</td>
        <td>{$outbox->changed_by_name}</td>
    </tr>      
    <tr>
        <td>{$i.basic_change_date}</td>
        <td>{$outbox->change_date->us_date()}</td>
    </tr>   
    {if !empty($outbox->gobd_hash)}
    <tr>
        <td>{$i.basic_gobd}</td>
        <td>
            {$outbox->gobd_date->us_date_time()}
            <a class="dialog_make_text_btn ui-corner-all" style="margin-left: 10px;"
                href="javascript:usComm.check_gobd('outbox', {$outbox->id});">{$i.basic_gobd_check}
            </a>
        </td>
    </tr>   
    {/if}  
    <tr>
        <td>{$i.inoutbox_auto_projectmail_import}</td>
        <td>{boolview value=$outbox->projectmail_account_id}</td>
    </tr>      
    {foreach from=$outbox->addi_fields item=field}
        <tr>
            {if $field->type eq US_exmodel::T_BLOCK}
                <th colspan="2" style="text-align:center; {if isset($field->color)}background:{$field->color}{/if}">{$field->name}</th>
            {else}
                <td style="{if isset($field->color)}background:{$field->color}{/if}">{$field->name}</td>
                <td>
                    {assign var='field_id' value=$field->field}
                    {addiview field=$field value=$outbox->$field_id item=$outbox}
                </td>
            {/if}
        </tr>
    {/foreach}    
</table>