# --
# AdminMailAccount.dtl - provides HTML form for AdminMailAccount
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: AdminMailAccount.dtl,v 1.38 2011-12-23 13:55:31 mg Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
<!-- dtl:block:Overview -->
<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>$Text{"Mail Account Management"}</h1>

    <div class="SidebarColumn">

<!-- dtl:block:ActionList -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Actions"}</h2>
            </div>
            <div class="Content">
                <ul class="ActionList">
<!-- dtl:block:ActionOverview -->
                    <li>
                        <a href="$Env{"Baselink"}Action=$Env{"Action"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
                    </li>
<!-- dtl:block:ActionOverview -->
<!-- dtl:block:ActionAdd -->
                    <li>
                        <a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=AddNew" class="CallForAction Plus"><span>$Text{"Add mail account"}</span></a>
                    </li>
<!-- dtl:block:ActionAdd -->
                </ul>
            </div>
        </div>
<!-- dtl:block:ActionList -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p class="FieldExplanation">
                    $Text{"All incoming emails with one account will be dispatched in the selected queue!"}
                </p>
                <p class="FieldExplanation">
                    $Text{"If your account is trusted, the already existing X-OTRS header at arrival time (for priority, ...) will be used! PostMaster filter will be used anyway."}
                </p>
            </div>
        </div>
    </div>

    <div class="ContentColumn">
        <div class="WidgetSimple">
<!-- dtl:block:OverviewResult -->
            <div class="Header">
                <h2>$Text{"List"}</h2>
            </div>
            <div class="Content">
                <table class="DataTable">
                    <thead>
                        <tr>
                            <th>$Text{"Host"}/$Text{"Username"}</th>
                            <th>$Text{"Type"}</th>
                            <th>$Text{"Comment"}</th>
                            <th>$Text{"Validity"}</th>
                            <th>$Text{"Changed"}</th>
                            <th>$Text{"Created"}</th>
                            <th>$Text{"Delete"}</th>
                            <th>$Text{"Run Now!"}</th>
                        </tr>
                    </thead>
                    <tbody>
<!-- dtl:block:NoDataFoundMsg -->
                        <tr>
                            <td colspan="8">
                                $Text{"No data found."}
                            </td>
                        </tr>
<!-- dtl:block:NoDataFoundMsg -->
<!-- dtl:block:OverviewResultRow -->
                        <tr class="$QData{"Invalid"}">
                            <td>
                                <a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Update;ID=$LQData{"ID"}">$QData{"Host"} / $QData{"Login"}</a>
                            </td>
                            <td>$QData{"Type"}</td>
                            <td title="$QData{"Comment"}">$QData{"Comment","20"}</td>
                            <td>$Text{"$Data{"ShownValid"}"}</td>
                            <td>$TimeShort{"$QData{"ChangeTime"}"}</td>
                            <td>$TimeShort{"$QData{"CreateTime"}"}</td>
                            <td class="Center">
                                <a class="TrashCan" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Delete;ID=$LQData{"ID"};$QEnv{"ChallengeTokenParam"}" title="$Text{"Delete account"}">$Text{"Delete account"}</a>
                            </td>
                            <td>
                                <a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Run;ID=$LQData{"ID"};$QEnv{"ChallengeTokenParam"}">$Text{"Fetch mail"}</a>
                            </td>
                        </tr>
<!-- dtl:block:OverviewResultRow -->
                    </tbody>
                </table>
            </div>
<!-- dtl:block:OverviewResult -->

<!-- dtl:block:OverviewAdd -->
            <div class="Header">
                <h2>$Text{"Add Mail Account"}</h2>
            </div>
            <div class="Content">
                <form action="$Env{"CGIHandle"}" method="post" class="Validate PreventMultipleSubmits">
                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="AddAction"/>
                    <fieldset class="TableLike">
                        <label class="Mandatory" for="TypeAdd"><span class="Marker">*</span> $Text{"Type"}:</label>
                        <div class="Field">
                            $Data{"TypeOptionAdd"}
                            <div id="TypeAddError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="TypeAddServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="LoginAdd"><span class="Marker">*</span> $Text{"Username"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc Validate_Required $QData{"LoginAddInvalid"}" name="Login" id="LoginAdd" value="" maxlength="200"/>
                            <div id="LoginAddError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="LoginAddServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="PasswordAdd"><span class="Marker">*</span> $Text{"Password"}:</label>
                        <div class="Field">
                            <input type="password" class="W50pc Validate_Required $QData{"PasswordAddInvalid"}" name="Password" id="PasswordAdd" value="" maxlength="200"/>
                            <div id="PasswordAddError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="PasswordAddServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="HostAdd"><span class="Marker">*</span> $Text{"Host"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc Validate_Required $QData{"HostAddInvalid"}" name="Host" id="HostAdd" value="" maxlength="200"/>
                            <div id="HostAddError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="HostAddServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <p class="FieldExplanation">$Text{"Example: mail.example.com"}</p>
                        </div>
                        <div class="Clear"></div>

                        <div class="Row Row_IMAPFolder Hidden">
                            <label for="IMAPFolder">$Text{"IMAP Folder"}:</label>
                            <div class="Field">
                                <input type="text" class="W50pc" name="IMAPFolder" id="IMAPFolder" value="INBOX" maxlength="250"/>
                                <p class="FieldExplanation">$Text{"Only modify this if you need to fetch mail from a different folder than INBOX."}</p>
                            </div>
                            <div class="Clear"></div>
                        </div>

                        <label class="Mandatory" for="Trusted"><span class="Marker">*</span> $Text{"Trusted"}:</label>
                        <div class="Field">
                            $Data{"TrustedOption"}
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="DispatchingBy"><span class="Marker">*</span> $Text{"Dispatching"}:</label>
                        <div class="Field">
                            $Data{"DispatchingOption"}
                        </div>
                        <div class="Clear"></div>

                        <div class="Row Row_Queue Hidden">
                            <label class="Mandatory" for="QueueID"><span class="Marker">*</span> $Text{"Queue"}:</label>
                            <div class="Field">
                                $Data{"QueueOption"}
                            </div>
                            <div class="Clear"></div>
                        </div>

                        <label class="Mandatory" for="ValidID"><span class="Marker">*</span> $Text{"Validity"}:</label>
                        <div class="Field">
                            $Data{"ValidOption"}
                            <div id="ValidIDError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="ValidIDServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label for="Comment">$Text{"Comment"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc" name="Comment" id="Comment" value="$QData{"Comment"}" maxlength="250"/>
                        </div>
                        <div class="Clear"></div>

                        <div class="Field SpacingTop">
                            <button class="Primary" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
                            $Text{"or"}
                            <a href="$Env{"Baselink"}Action=$Env{"Action"}">$Text{"Cancel"}</a>
                        </div>
                        <div class="Clear"></div>
                    </fieldset>
                </form>
            </div>
<!-- dtl:block:OverviewAdd -->

<!-- dtl:block:OverviewUpdate -->
            <div class="Header">
                <h2>$Text{"Edit Mail Account"}</h2>
            </div>
            <div class="Content">
                <form action="$Env{"CGIHandle"}" method="post" class="Validate PreventMultipleSubmits">
                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="UpdateAction"/>
                    <input type="hidden" name="ID" value="$QData{"ID"}"/>
                    <fieldset class="TableLike">
                        <label class="Mandatory" for="Type"><span class="Marker">*</span> $Text{"Type"}:</label>
                        <div class="Field">
                            $Data{"TypeOption"}
                            <div id="TypeError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="TypeServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="LoginEdit"><span class="Marker">*</span> $Text{"Username"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc Validate_Required $QData{"LoginEditInvalid"}" name="Login" id="LoginEdit" value="$QData{"Login"}" maxlength="200"/>
                            <div id="LoginEditError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="LoginEditServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="PasswordEdit"><span class="Marker">*</span> $Text{"Password"}:</label>
                        <div class="Field">
                            <input type="password" class="W50pc Validate_Required $QData{"PasswordEditInvalid"}" name="Password" id="PasswordEdit" value="$QData{"Password"}" maxlength="200"/>
                            <div id="PasswordEditError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="PasswordEditServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="HostEdit"><span class="Marker">*</span> $Text{"Host"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc Validate_Required $QData{"HostEditInvalid"}" name="Host" id="HostEdit" value="$QData{"Host"}" maxlength="200"/>
                            <div id="HostEditError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="HostEditServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <p class="FieldExplanation">$Text{"Example: mail.example.com"}</p>
                        </div>
                        <div class="Clear"></div>

                        <div class="Row Row_IMAPFolder Hidden">
                            <label for="IMAPFolder">$Text{"IMAP Folder"}:</label>
                            <div class="Field">
                                <input type="text" class="W50pc" name="IMAPFolder" id="IMAPFolder" value="$QData{"IMAPFolder"}" maxlength="250"/>
                                <p class="FieldExplanation">$Text{"Only modify this if you need to fetch mail from a different folder than INBOX."}</p>
                            </div>
                            <div class="Clear"></div>
                        </div>

                        <label class="Mandatory" for="Trusted"><span class="Marker">*</span> $Text{"Trusted"}:</label>
                        <div class="Field">
                            $Data{"TrustedOption"}
                            <div id="TrustedError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="TrustedServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label class="Mandatory" for="DispatchingBy"><span class="Marker">*</span> $Text{"Dispatching"}:</label>
                        <div class="Field">
                            $Data{"DispatchingOption"}
                            <div id="DispatchingByError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="DispatchingByServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <div class="Row Row_Queue Hidden">
                            <label class="Mandatory" for="QueueID"><span class="Marker">*</span> $Text{"Queue"}:</label>
                            <div class="Field">
                                $Data{"QueueOption"}
                                <div id="QueueIDError" class="TooltipErrorMessage">
                                    <p>$Text{"This field is required."}</p>
                                </div>
                                <div id="QueueIDServerError" class="TooltipErrorMessage">
                                    <p>$Text{"This field is required."}</p>
                                </div>
                            </div>
                            <div class="Clear"></div>
                        </div>

                        <label class="Mandatory" for="ValidID"><span class="Marker">*</span> $Text{"Validity"}:</label>
                        <div class="Field">
                            $Data{"ValidOption"}
                            <div id="ValidIDError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="ValidIDServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>

                        <label for="Comment">$Text{"Comment"}:</label>
                        <div class="Field">
                            <input type="text" class="W50pc" name="Comment" id="Comment" value="$QData{"Comment"}" maxlength="250"/>
                        </div>
                        <div class="Clear"></div>

                        <div class="Field SpacingTop">
                            <button class="Primary" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
                            $Text{"or"}
                            <a href="$Env{"Baselink"}Action=$Env{"Action"}">$Text{"Cancel"}</a>
                        </div>
                        <div class="Clear"></div>
                    </fieldset>
                </form>
            </div>
<!-- dtl:block:OverviewUpdate -->
<!-- end form -->
        </div>
    </div>
    <div class="Clear"></div>
</div>
<!-- dtl:block:Overview -->

<!-- dtl:js_on_document_complete -->
<script type="text/javascript">//<![CDATA[
// Show IMAPFolder selection only for IMAP backends
$('select#TypeAdd, select#Type').bind('change', function(){
    if (/IMAP/.test($(this).val())) {
        $('.Row_IMAPFolder').show();
    }
    else {
        $('.Row_IMAPFolder').hide();
    }
}).trigger('change');
// Show only Queue field if Dispatch By Queue is selected
$('select#DispatchingBy').bind('change', function(){
    if (/Queue/.test($(this).val())) {
        $('.Row_Queue').show();
    }
    else {
        $('.Row_Queue').hide();
    }
}).trigger('change');
//]]></script>

<!-- dtl:js_on_document_complete -->
