# --
# AdminGroup.dtl - provides HTML form for AdminGroup
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: AdminGroup.dtl,v 1.30 2011/05/16 09:24:01 mb 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:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
Core.Agent = Core.Agent || {};
Core.Agent.Admin = Core.Agent.Admin || {};

/**
 * @namespace
 * @exports TargetNS as Core.Agent.Admin.Group
 * @description
 *      This namespace contains the special module functions for AdminGroup.
 */
Core.Agent.Admin.Group = (function (TargetNS) {
    /**
     * @function
     * @return nothing
     *      This function initializes the special module functions
     */
    TargetNS.AdminGroupCheck = function () {
        var NameValue = $('#GroupName').val(),
            NameOldValue = $('#GroupOldName').val();

        if (!NameOldValue || NameOldValue !== 'admin' || NameValue === 'admin') {
            return true;
        }

        if (confirm('$JSText{"WARNING: When you change the name of the group 'admin', before making the appropriate changes in the SysConfig, you will be locked out of the administrations panel! If this happens, please rename the group back to admin per SQL statement."}')) {
            return true;
        }
        else {
            $('#GroupName').focus();
            return false;
        }
    };

    return TargetNS;
}(Core.Agent.Admin.Group || {}));

    $('#Submit').bind('click', Core.Agent.Admin.Group.AdminGroupCheck);
//]]></script>
<!--dtl:js_on_document_complete-->

<!-- dtl:block:Overview -->
<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>$Text{"Group 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:ActionAdd-->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="$Env{"Action"}"/>
                            <input type="hidden" name="Subaction" value="Add"/>
                            <button class="CallForAction Plus" type="submit" value="$Text{"Add"}">
                                <span>$Text{"Add group"}</span>
                            </button>
                        </form>
                    </li>
<!--dtl:block:ActionAdd-->

<!--dtl:block:ActionOverview-->
                    <li>
                        <a href="$Env{"Baselink"}Action=$Env{"Action"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
                    </li>
<!--dtl:block:ActionOverview-->
                </ul>
            </div>
        </div>
<!-- dtl:block:ActionList -->


        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p class="FieldExplanation">
                    $Text{"The admin group is to get in the admin area and the stats group to get stats area."}
                </p>
                <p class="FieldExplanation">
                    $Text{"Create new groups to handle access permissions for different groups of agent (e. g. purchasing department, support department, sales department, ...). "}
                </p>
                <p class="FieldExplanation">
                    $Text{"It's useful for ASP solutions. "}
                </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{"Name"}</th>
                            <th>$Text{"Comment"}</th>
                            <th>$Text{"Validity"}</th>
                            <th>$Text{"Changed"}</th>
                            <th>$Text{"Created"}</th>
                        </tr>
                    </thead>
                    <tbody>
<!-- dtl:block:OverviewResultRow -->
                        <tr>
                            <td><a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Change;ID=$LQData{"ID"}">$QData{"Name"}</a></td>
                            <td title="$QData{"Comment"}">$QData{"Comment","26"}</td>
                            <td>$Text{"$Data{"Valid"}"}</td>
                            <td>$TimeShort{"$QData{"ChangeTime"}"}</td>
                            <td>$TimeShort{"$QData{"CreateTime"}"}</td>
                        </tr>
<!-- dtl:block:OverviewResultRow -->
                    </tbody>
                </table>
            </div>
<!-- dtl:block:OverviewResult -->

<!-- dtl:block:OverviewUpdate -->
            <div class="Header">
<!-- dtl:block:HeaderAdd -->
                <h2>$Text{"Add Group"}</h2>
<!-- dtl:block:HeaderAdd -->
<!-- dtl:block:HeaderEdit -->
                <h2>$Text{"Edit Group"}</h2>
<!-- dtl:block:HeaderEdit -->
            </div>
            <div class="Content">
                <form action="$Env{"CGIHandle"}" method="post" name="GroupUpdate" class="Validate PreventMultipleSubmits">
                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="$QData{"Action"}Action"/>
                    <input type="hidden" name="ID" value="$QData{"ID"}"/>
                    <input type="hidden" name="NameOld" id="GroupOldName" value="$QData{"Name"}"/>
                    <fieldset class="TableLike">

                        <label class="Mandatory" for="GroupName"><span class="Marker">*</span> $Text{"Name"}:</label>
                        <div class="Field">
                            <input type="text" name="Name" id="GroupName" value="$QData{"Name"}" class="W50pc Validate_Required $QData{"GroupNameInvalid"}" maxlength="200"/>
                            <div id="GroupNameError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                            <div id="GroupNameServerError" class="TooltipErrorMessage">
                                <p>$Text{"This field is required."}</p>
                            </div>
                        </div>
                        <div class="Clear"></div>


                        <label for="ValidID">$Text{"Validity"}:</label>
                        <div class="Field">
                            $Data{"ValidOption"}
                        </div>
                        <div class="Clear"></div>

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


                        <div class="Field SpacingTop">
                            <button class="Primary" type="submit" id="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 -->
        </div>
    </div>
    <div class="Clear"></div>
</div>
<!-- dtl:block:Overview -->
