<style>

    .eventinfoshort-textbox {
        max-width: 30em;
        padding: 0.3em;
    }

</style>
<TABLE class="lmsbox-inner" id="table">
{*
    commented out as it causes strange table grow
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 1%;">
        <COL style="width: 98%;">
    </COLGROUP>
*}
    <THEAD>
    <TR>
        <TD>
            {icon name="timetable"}
        </TD>
        <TD class="bold">
            {trans("Title")}
        </TD>
        <TD class="bold">
            {$event.title|escape}
        </TD>
    </TR>
    </THEAD>
    <TBODY>
    <TR>
        <TD>
            {icon name="uptime"}
        </TD>
        <TD class="bold nobr">
            {trans("Begin time")}
        </TD>
        <TD>
            {$event.date|date_format:"Y-m-d (l)"}
            {($event.date + $event.begintime)|date_format:"H:i"}
        </TD>
    </TR>
    {if $event.begintime != $event.endtime || $event.enddate > $event.date}
        <TR>
            <TD>
                {icon name="uptime"}
            </TD>
            <TD class="bold nobr">
                {trans("End time")}
            </TD>
            <TD>
                {if $event.enddate}
                    {$event.enddate|date_format:"Y-m-d (l)"}
                    {($event.enddate + $event.endtime)|date_format:"H:i"}
                {else}
                    {$event.date|date_format:"Y-m-d (l)"}
                    {($event.date + $event.endtime)|date_format:"H:i"}
                {/if}
            </TD>
        </TR>
    {/if}
    {if $event.description}
        <TR>
            <TD>
                {icon name="description"}
            </TD>
            <TD class="bold nobr">
                {trans("Description")}
            </TD>
            <TD>
                <div class="fall superlight eventinfoshort-textbox">
                    {$event.description|replace:"\n":"<BR>"}
                </div>
            </TD>
        </TR>
    {/if}
    <TR>
        <TD>
            {icon name="type"}
        </TD>
        <TD class="bold">
            {trans("Type")}
        </TD>
        <TD class="nobr">
            {trans($_EVENTTYPES[$event.type].label)}
        </TD>
    </TR>
    <TR>
        <TD>
            {icon name="status"}
        </TD>
        <TD class="bold">
            {trans("Availability")}
        </TD>
        <TD class="nobr">
            {if $event.private}{trans("private")}{else}{trans("public")}{/if}
        </TD>
    </TR>
    <TR>
        <TD>
            {icon name="user"}
        </TD>
        <TD class="bold">
            {trans("Created by")}
        </TD>
        <TD class="nobr">
            <A href="?m=userinfo&id={$event.userid}">{$event.username|escape}</A>
        </TD>
    </TR>
    {if $event.creationdate != 0}
        <TR>
            <TD>
                {icon name="uptime"}
            </TD>
            <TD class="bold">
                {trans("Creation time")}
            </TD>
            <TD>
                {$event.creationdate|date_format:"Y-m-d (H:i:s)"}
            </TD>
        </TR>
    {/if}
    {if $event.moduserid != 0}
        <TR>
            <TD>
                {icon name="user"}
            </TD>
            <TD class="bold">
                {trans("Last modified by")}
            </TD>
            <TD class="nobr">
                <A href="?m=userinfo&id={$event.moduserid}">{$event.modusername|escape}</A>
            </TD>
        </TR>
    {/if}
    {if $event.moddate != 0}
        <TR>
            <TD>
                {icon name="uptime"}
            </TD>
            <TD class="bold">
                {trans("Last modification time")}
            </TD>
            <TD>
                {$event.moddate|date_format:"Y-m-d (H:i:s)"}
            </TD>
        </TR>
    {/if}
    {if $event.closeduserid != 0}
        <TR>
            <TD>
                {icon name="user"}
            </TD>
            <TD class="bold nobr">
                {trans("Closed by")}:
            </TD>
            <TD class="nobr">
                <A href="?m=userinfo&id={$event.closeduserid}">{$event.closedusername|escape}</A>
            </TD>
        </TR>
    {/if}
    {if $event.closeddate != 0}
        <TR>
            <TD>
                {icon name="timetable"}
            </TD>
            <TD class="bold nobr">
                {trans("Closed time")}:
            </TD>
            <TD>
                {$event.closeddate|date_format:"Y-m-d (H:i:s)"}
            </TD>
        </TR>
    {/if}
    {if $event.customername}
    <TR>
        <TD class="valign-top">
	        {icon name="customer"}
        </TD>
        <TD class="valign-top bold">
            {trans("Customer")}
        </TD>
        <TD class="nobr">
            <A href="?m=customerinfo&id={$event.customerid}">
                {$event.customername|escape} (#{$event.customerid})
            </A>
            {if !empty($event.phones)}
                <br>
                {foreach $event.phones as $phone}
                    {icon name="phone"}
                    <a href="tel:{$phone.contact}">{$phone.fullname}</a>
                    {if !$phone@last}
                        <br>
                    {/if}
                {/foreach}
            {/if}
        </TD>
    </TR>
    {/if}
    {if $event.netnode_name || $event.customerlocation}
    <TR>
        <TD>
            {icon name="location"}
        </TD>
        <TD class="bold">
            {trans("Location")}
        </TD>
        <TD class="nobr">
        {if $event.netnode_name}
            {button type='link' icon='netnode' href="?m=netnodeinfo&id={$event.netnodeid}" label=$event.netnode_name}
            {if !empty($event.netnode_location)}<br>{$event.netnode_location|escape}{/if}
        {else}
            {if $event.customername}
                {if !empty($event.address_id)}
                    {$event.location|escape}
                {elseif !empty($event.nodeid)}
                    <a href="?m=nodeinfo&id={$event.nodeid}">{$event.nodelocation|escape}</a>
                {else}
		            {$event.customerlocation|escape}
                {/if}
            {/if}
        {/if}
        </TD>
    </TR>
    {/if}
    {if !empty($event.nodeid)}
        <TR>
            <TD>
                {icon name="node"}
            </TD>
            <TD class="bold">
                {trans("Node")}
            </TD>
            <TD class="nobr">
                <a href="?m=nodeinfo&id={$event.nodeid}">{$event.node_name}: {$event.node_location|escape}</a>
            </TD>
        </TR>
    {/if}
    {if $event.note}
        <TR>
            <TD>
                {icon name="note"}
            </TD>
            <TD class="bold nobr">
                {trans("Note")}
            </TD>
            <TD>
                <div class="fall superlight eventinfoshort-textbox">
                    {$event.note|escape|replace:"\n":"<BR>"}
                </div>
            </TD>
        </TR>
    {/if}
    {if $event.userlist}
        <TR>
            <TD>
                {icon name="user"}
            </TD>
            <TD class="bold">
                {trans("Users")}
            </TD>
            <TD class="nobr">
                {foreach $event.userlist as $userid => $user}
                    <a href="?m=userinfo&id={$userid}">{$user.rname|escape}</a><br>
                {/foreach}
            </TD>
        </TR>
    {/if}
    {if isset($event.ticketid)}
        <TR>
            <TD>
                {icon name="helpdesk"}
            </TD>
            <TD class="bold">
                {trans("Helpdesk assignment")}
            </TD>
            <TD>
		    <a href="?m=rtticketview&id={$event.ticketid}">#{$event.ticketid}</a> ({$_RT_STATES[$event.ticket.state].label})
            </TD>
        </TR>
	{if $event.ticket.state != $smarty.const.RT_RESOLVED}
	<TR>
		<TD colspan="3">
                    {if ($ticket.state != $smarty.const.RT_RESOLVED || ($ticket.state == $smarty.const.RT_RESOLVED && $aet && ($smarty.now - $ticket.resolvetime) < $aet)) || (ConfigHelper::checkPrivilege('superuser'))}
                        {button type="link-button" icon="message" label="New Message" href="?m=rtmessageadd&ticketid={$event.ticketid}"}
                    {/if}
                    {button type="link-button" icon="note" label="New Note" href="?m=rtnoteadd&ticketid={$event.ticketid}"}
		</TD>
	</TR>
        {/if}
    {/if}
    <TR>
        <TD class="text-right" colspan="3">
            {button type='link-button' id='delete-event' href="?m=eventdel&id={$event.id}" label='Delete' icon='delete'}
            {button type='link-button' href="?m=eventedit&id={$event.id}" label='Edit' icon='edit'}
            {if !$event.closed}
                {button type='link-button' href="?m=eventedit&id={$event.id}&action=close" label='Close' icon='close'}
            {else}
                {button type='link-button' href="?m=eventedit&id={$event.id}&action=open" label='Open' icon='open'}
            {/if}
        </TD>
    </TR>
    </TBODY>
</TABLE>
