<%@ Page Language="C#" %>
<%@ Import Namespace="TABS.MailCarrier.WebSDK.Board" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Guid boardId = WebParam.GetGuidParamValue("boardId");
        if (boardId == Guid.Empty)
        {
            string userEmail = WebUser.CurrentUser.MailAddress;
            // MainTitle.xml에 <defaultboardid>가 정의되어 있을 경우 해당 게시판으로 이동한다.
            AppSetting.TitleInfo TI = AppSetting.GetTitleInfo(Request);
            if (TI["defaultboardid"] != "")
            {
                boardId = new Guid(TI["defaultboardid"]);
                Board.RsAccessFlag accessFlag = Board.GetAccessFlag(WebUser.CurrentUser.DomainUserID, boardId);
                if (accessFlag != Board.RsAccessFlag.None && AppSetting.PassDisplayBoardFilter(boardId, userEmail))
                {
                    Response.Redirect("List.aspx?board=" + boardId.ToString());
                    return;
                }
            }

            UserBoard userBoard = new UserBoard(WebUser.CurrentUser.DomainUserID);
            foreach (Board board in userBoard.ShareBoards)
            {
                if (board.Type == Board.BoardType.General && board.AccessFlag != Board.RsAccessFlag.None && AppSetting.PassDisplayBoardFilter(board.ID, userEmail))
                {
                    boardId = board.ID;
                    break;
                }
            }
        }
        Response.Redirect("List.aspx?board=" + boardId.ToString());
    }
</script>

<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
