<%@ Register TagPrefix="uc1" TagName="Trailer" Src="Trailer.ascx" %>
<%@ Import Namespace="edu.jhu.Cas.Util" %>
<%@ Import Namespace="System.IO" %>

<%@ Page Language="c#" Codebehind="GroupsContent.aspx.cs" AutoEventWireup="false"
    Inherits="edu.jhu.Cas.Web.GroupsContent" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
    <meta http-equiv="Pragma" content="no-cache" />
    <title>Groups Info</title>
    <link href="cjobs.css" rel="stylesheet">
</head>
<body>
    <form runat="server" target="_top" id="fizorm">
        <%if (groupName == null) {%>
        <h2>
            <%=user%>
            's Groups</h2>
        <p class="message">
            <%=lmessage%>
        </p>
        <p>
            <b>Pending invitations:</b><br>
            <% if (inviteDataSet.Tables[0].Rows.Count > 0) {%>
            <asp:DataGrid ID="inviteGrid" runat="server" DataSource="<% #inviteDataSet %>" BorderStyle="None"
                CellPadding="4" AutoGenerateColumns="False" OnItemCommand="InviteCommand" EnableViewState="false"
                AllowSorting="True">
                <HeaderStyle Font-Bold="True"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn DataField="Name" HeaderText="Name" />
                    <asp:BoundColumn DataField="gid" HeaderText="GroupID" />
                    <asp:BoundColumn DataField="owner" HeaderText="OwnerID" />
                    <asp:BoundColumn DataField="description" HeaderText="Description" />
                    <asp:ButtonColumn Text="Accept" CommandName="Accept" />
                    <asp:ButtonColumn Text="Decline" CommandName="Decline" />
                </Columns>
            </asp:DataGrid>
            <%}
              else {%>
            <i>No invitations</i>
            <%}%>
        </p>
        <p>
            <asp:Button Text="Create Group" OnClick="Create" ID="createButton" runat="server" />
            <!--<a target="help" href="faq.aspx#q21">?</a>-->
        </p>
        <p>
            Groups you subscribe to are represented as links on the left. From the individual
            group pages you can:
        </p>
        <p>
            <li>View various information about a particular group
                <li>Update group information (admin only)
                    <li>Unsubscribe from a group
                        <li>Manage group members (admin only)
                            <li>Destroy a group (admin only)
                                <p>
                                </p>
                                <%}
                                      else { %>
                                <h2>
                                    <%=groupName%>
                                </h2>
                                <%if (admin) {%>
                                <p>
                                    You are the <font>admin</font> for this group</p>
                                <p>
                                    <asp:Button Text="Manage Users" ID="manageButton" OnClick="Manage" runat="server" />
                                    <!--<a target="help" href="faq.aspx#q22">?</a>-->
                                </p>
                                <p>
                                    <b>Description:</b><br>
                                    <asp:TextBox runat="server" TextMode="MultiLine" Rows="5" Columns="50" ID="DescriptionBox" /><br>
                                    <asp:Button CausesValidation="True" runat="server" Text="Set" OnClick="SetGroupDescription"
                                        ID="groupDescriptionSetButton" />
                                    <!--<a target="help" href="faq.aspx#q23">?</a>-->
                                </p>
                                <%}
                                      else {%>
                                <p>
                                    <b>Admin:</b>&nbsp; <font>
                                        <%=adminID%>
                                    </font>
                                </p>
                                <p>
                                    <b>Description:</b><br>
                                    <i>
                                        <%=description%>
                                    </i>
                                </p>
                                <%}%>
                                <p>
                                    <b>Members:</b><br>
                                    <asp:DataGrid ID="membersGrid" runat="server" DataSource="<% #membersDataSet %>"
                                        BorderStyle="None" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="True"
                                        EnableViewState="false" AllowSorting="True">
                                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                                    </asp:DataGrid>
                                </p>
                                <%if (admin) {%>
                                <!--bottom items -->
                                <p>
                                    <asp:Button Text="Destroy Group" ID="destroyButton" OnClick="Destroy" runat="server" />
                                    <!--<a target="help" href="faq.aspx#q25">?</a>-->
                                </p>
                                <%}
                                      else { %>
                                <p>
                                    <asp:Button Text="UnSubscribe" OnClick="Remove" ID="Button2" runat="server" />
                                    <!--<a target="help" href="faq.aspx#q24">?</a>-->
                                </p>
                                <%}%>
                                <%}%>
    </form>
    <uc1:Trailer ID="Trailer1" runat="server" cvsTag="$Name: v3_5_18 $" cvsRev="$Revision: 1.11 $">
    </uc1:Trailer>
    </LI>
</body>
</html>
