using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TABS.MailCarrier.WebSDK.User;

public partial class Common_TopNavbarl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TitleLabel.Text = AppSetting.GetTitleInfo(Request).Title;
            StringBuilder listTag = new StringBuilder();
            listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu1").ToString(), "Mail"));
            if (AppSetting.UseApproval && !DomainUser.IncludedInAccessGroup(WebUser.CurrentUser.DomainUserID, "전자결재사용금지"))
            {
                listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu2").ToString(), "Approval"));
            }
            listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu3").ToString(), "Contact"));
            if (AppSetting.UseCalendar) listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu4").ToString(), "Calendar"));
            if (AppSetting.UseFilebox) listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu5").ToString(), "Filebox"));
            if (AppSetting.UseBoard) listTag.Append(GetMenuTag(GetLocalResourceObject("NavMenu6").ToString(), "Board"));
            if (AppSetting.SupportWebPush) listTag.Append(GetMailNotificationMenuTag(GetLocalResourceObject("NavMenu8").ToString()));
            listTag.Append(GetLogoutMenuTag(GetLocalResourceObject("NavMenu7").ToString()));
            MenuListTag.Text = listTag.ToString();
        }
    }

    private string GetMenuTag(string title, string serviceName)
    {
        return string.Format("<li><a href='#' onclick=\"GotoService('{0}');return false;\">{1}</a></li>", serviceName, title);
    }

    private string GetLogoutMenuTag(string title)
    {
        return string.Format("<li><a href='#' onclick=\"Logout();return false;\">{0}</a></li>", title);
    }

    private string GetMailNotificationMenuTag(string title)
    {
        return string.Format("<li><a href='#' onclick=\"GotoMailNotification();return false;\">{0}</a></li>", title);
    }
}