<!-- BEGIN DYNAMIC BLOCK: notice -->
<div class="yellowbox">
    <h2>[l]NOTICE[/l]:</h2>
    <!-- BEGIN DYNAMIC BLOCK: noticeOrder -->
    <p>[l]When an E-mail is received or a new request is entered through the public section, rules are checked as they are ordered below and only the first matching one will be processed.[/l]<br />
    [l]You can drag and drop lines in the table to reorder the rules. Order will be saved automatically.[/l]</p>
    <!-- END DYNAMIC BLOCK: noticeOrder -->
    <!-- BEGIN DYNAMIC BLOCK: noGuestsEmailRulesWarning -->
    <p>[l]if you choose not to handle E-mails from guest clients, it is recommended that you set up at least one routing rule that handles them with an autoresponder letting them know that their message was discarded.[/l]</p>
    <!-- END DYNAMIC BLOCK: noGuestsEmailRulesWarning -->
    <!-- BEGIN DYNAMIC BLOCK: noPublicSectionRulesWarning -->
    <p>[l]To enable the public section support, you must enable the setting "Allow Guests To Submit Tickets"[/l]</p>
    <!-- END DYNAMIC BLOCK: noPublicSectionRulesWarning -->
</div>
<!-- END DYNAMIC BLOCK: notice -->
<table border="0" width="100%" style="position:relative">
    <thead>
        <tr>
            <th>[l]Name[/l]</th>
            <th>[l]E-mails[/l]</th>
            <th>[l]User type[/l]</th>
            <th>[l]Autoresponder[/l]</th>
            <th>[l]Create Ticket[/l]</th>
            <th>[l]Source[/l]</th>
        </tr>
    </thead>
    <tbody id="routingRules">
        <!-- BEGIN DYNAMIC BLOCK: emailRoutingRow -->
        <tr id="rule_{routingId}" class="{trClass}">
            <td>
                <!-- BEGIN DYNAMIC BLOCK: canEditRoutings1 -->
                <a href="index.php?fuse=support&view=AddEditEmailRouting&routing={routingId}">
                <!-- END DYNAMIC BLOCK: canEditRoutings1 -->
                {routingName}
                <!-- BEGIN DYNAMIC BLOCK: canEditRoutings2 -->
                </a>
                <!-- END DYNAMIC BLOCK: canEditRoutings2 -->
            </td>
            <td>
                {routingEmails}
            </td>
            <td>
                {routingUserType}
            </td>
            <td align="center">
                {routingAutoresponder}
            </td>
            <td align="center">
                {routingCreateTicket}
            </td>
            <td>
                {routingType}
            </td>
        </tr>
        <!-- END DYNAMIC BLOCK: emailRoutingRow -->
        <!-- BEGIN DYNAMIC BLOCK: noEmailRoutings -->
        <tr>
            <td colspan="6" align="center">
                <span style="color: rgb(128, 128, 128);">[l]There are currently no E-mail routing rules defined[/l]</span>
            </td>
        </tr>
        <!-- END DYNAMIC BLOCK: noEmailRoutings -->
    </tbody>
</table>
<!-- BEGIN DYNAMIC BLOCK: sortableCode -->
<script type="text/javascript">
Sortable.create("routingRules", {tag: "tr", onUpdate: updateRulesOrder});

function updateRulesOrder()
{
    new Ajax.Request(
        'index.php?fuse=support&action=UpdateEmailRoutingRulesOrder',
        {
            method      : 'post',
            parameters  : Sortable.serialize("routingRules"),
            onLoading   : function(){resetStatus(lang('Updating'))},
            onSuccess   : updateRulesOrderComplete
        }
    );
}

function updateRulesOrderComplete(responseObj)
{
    unsetStatus(false);
    if (responseObj.responseText != 'OK') {
        alert(responseObj.responseText.stripTags());
        return;
    }
}
</script>
<!-- END DYNAMIC BLOCK: sortableCode -->
