Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //菜单栏目
            Johnny.CMS.BLL.SystemInfo.MenuCategory        category      = new Johnny.CMS.BLL.SystemInfo.MenuCategory();
            IList <Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList();

            //菜单
            Johnny.CMS.BLL.SystemInfo.Menu        menu      = new Johnny.CMS.BLL.SystemInfo.Menu();
            IList <Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true);

            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();

            arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"]));

            //顶部菜单与菜单类别
            int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]);

            if (iTopMenuId <= 0)
            {
                iTopMenuId = 1;
            }
            Johnny.CMS.BLL.SystemInfo.TopMenuBinding        topMainMenu      = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding();
            IList <Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId);

            //生成左侧菜单导航栏
            foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel)
            {
                if (CategoryContains(item.MenuCategoryId, topMainMenuModel))
                {
                    MainMenuItem mainmenu = new MainMenuItem();
                    mainmenu.Text = item.MenuCategoryName;

                    foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel)
                    {
                        //判断是否属于该主菜单,并且具有访问权限
                        if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId))
                        {
                            SubMenuItem submenu = new SubMenuItem();
                            submenu.Text    = subitem.MenuName;
                            submenu.Url     = subitem.PageLink;
                            submenu.ToolTip = subitem.ToolTip;
                            submenu.Image   = subitem.Image;
                            mainmenu.SubItems.Add(submenu);
                        }
                    }

                    if (mainmenu.SubItems.Count > 0)
                    {
                        LeftMenu1.items.Add(mainmenu);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private bool CheckPermission(string currentPage)
        {
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();

            arrPermission = accounts.GetUserPermission(Session["UserName"].ToString());

            //页面访问权限
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            int permission = menu.GetPermissionByPageLink(currentPage);

            return(arrPermission.Contains(permission));
        }
Exemplo n.º 3
0
        private bool CheckPermission(string currentPage)
        {
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();
            arrPermission = accounts.GetUserPermission(Session["UserName"].ToString());

            //页面访问权限
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            int permission = menu.GetPermissionByPageLink(currentPage);

            return arrPermission.Contains(permission);

        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //菜单栏目
            Johnny.CMS.BLL.SystemInfo.MenuCategory category = new Johnny.CMS.BLL.SystemInfo.MenuCategory();
            IList<Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList();

            //菜单
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            IList<Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true);
                        
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();
            arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"]));

            //顶部菜单与菜单类别
            int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]);
            if (iTopMenuId <= 0)
                iTopMenuId = 1;
            Johnny.CMS.BLL.SystemInfo.TopMenuBinding topMainMenu = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding();
            IList<Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId);

            //生成左侧菜单导航栏
            foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel)
            {
                if (CategoryContains(item.MenuCategoryId, topMainMenuModel))
                {
                    MainMenuItem mainmenu = new MainMenuItem();
                    mainmenu.Text = item.MenuCategoryName;

                    foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel)
                    {
                        //判断是否属于该主菜单,并且具有访问权限
                        if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId))
                        {
                            SubMenuItem submenu = new SubMenuItem();
                            submenu.Text = subitem.MenuName;
                            submenu.Url = subitem.PageLink;
                            submenu.ToolTip = subitem.ToolTip;
                            submenu.Image = subitem.Image;
                            mainmenu.SubItems.Add(submenu);
                        }
                    }

                    if (mainmenu.SubItems.Count > 0)
                        LeftMenu1.items.Add(mainmenu);
                }
            }
        }
Exemplo n.º 5
0
        private void CreateddlMenu()
        {
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            IList<Johnny.CMS.OM.SystemInfo.Menu> menuList;
            if (ddlCategory.SelectedIndex == -1)
                menuList = menu.GetList();
            else
                menuList = menu.GetListByCategory(DataConvert.GetInt32(ddlCategory.SelectedValue));
            ddlListMenu.DataSource = menuList;
            ddlListMenu.DataTextField = "MenuName";
            ddlListMenu.DataValueField = "MenuId";
            ddlListMenu.DataBind();

            ddlAddMenu.DataSource = menuList;
            ddlAddMenu.DataTextField = "MenuName";
            ddlAddMenu.DataValueField = "MenuId";
            ddlAddMenu.DataBind();
        }
Exemplo n.º 6
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();
                    bll.Delete(DataConvert.GetInt32(strId));
                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
Exemplo n.º 7
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();
                    bll.Delete(DataConvert.GetInt32(strId));

                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
Exemplo n.º 8
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("Menu_Title");
                litMenuCategory.Text = GetLabelText("Menu_MenuCategoryId");
                ddlCategory.ToolTip = GetLabelText("Menu_MenuCategoryId");
                litMenuName.Text = GetLabelText("Menu_MenuName");
                txtMenuName.ToolTip = GetLabelText("Menu_MenuName");
                litPageLink.Text = GetLabelText("Menu_PageLink");
                txtPageLink.ToolTip = GetLabelText("Menu_PageLink");
                litToolTip.Text = GetLabelText("Menu_ToolTip");
                txtToolTip.ToolTip = GetLabelText("Menu_ToolTip");
                litImage.Text = GetLabelText("Menu_Image");
                txtImage.ToolTip = GetLabelText("Menu_Image");
                litPermission.Text = GetLabelText("Menu_PermissionId");
                ddlPermission.ToolTip = GetLabelText("Menu_PermissionId");
                litIsDisplay.Text = GetLabelText("Menu_IsDisplay");
                rdbDisplay0.Text = GetLabelText("Common_Yes");
                rdbDisplay1.Text = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Menu_IsDisplay");

                if (Request.QueryString["action"] == "modify")
                {
                    //get MenuId
                    int MenuId = Convert.ToInt32(Request.QueryString["id"]);

                    //Permission entity
                    Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();

                    //bind data
                    Johnny.CMS.OM.SystemInfo.Menu model = new Johnny.CMS.OM.SystemInfo.Menu();
                    model = bll.GetModel(MenuId);

                    CreateddlCategory();
                    foreach (ListItem item in ddlCategory.Items)
                    {
                        if (DataConvert.GetInt32(item.Value) == model.MenuCategoryId)
                        {
                            item.Selected = true;
                            break;
                        }
                    }

                    txtMenuName.Text = model.MenuName;
                    txtToolTip.Text = model.ToolTip;
                    txtPageLink.Text = model.PageLink;
                    txtImage.Text = model.Image;

                    CreateddlPermission();
                    foreach (ListItem item in ddlPermission.Items)
                    {
                        if (DataConvert.GetInt32(item.Value) == model.PermissionId)
                        {
                            item.Selected = true;
                            break;
                        }
                    }

                    if (model.IsDisplay)
                        rdbDisplay0.Checked = true;
                    else
                        rdbDisplay1.Checked = true;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    CreateddlCategory();
                    CreateddlPermission();
                    rdbDisplay0.Checked = true;
                }

                //RFVldtMenuName.Text = GetMessage("E00901", txtMenuName.MaxLength.ToString());
                //RFVldtPageLink.Text = GetMessage("E00903", txtPageLink.MaxLength.ToString());
            }

//                            <zr:ValidationRadioButton ID="rdbDisplay0" runat="server" GroupName="IsDisplay" Text="ÊÇ" IsRequired="True" />
//                <zr:ValidationRadioButton ID="rdbDisplay1" runat="server" GroupName="IsDisplay" Text="·ñ"  IsRequired="True" />
//<asp:Panel ID="IsDisplayTip" runat="server" class="msgNormal" tip="ÏÔʾÔÚ×ó²à²Ëµ¥À¸Àï">ÏÔʾÔÚ×ó²à²Ëµ¥À¸Àï</asp:Panel>
        }
Exemplo n.º 9
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtMenuName, "E00901", "E00902", false))
                return;
            //check page url
            if (!CheckInputEmptyAndLength(txtPageLink, "E00903", "E00904"))
                return;

            //tips
            if (!CheckInputLength(txtToolTip, "E00903", false))
                return;

            //image
            if (!CheckInputLength(txtImage, "E00903"))
                return;

            Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();
            Johnny.CMS.OM.SystemInfo.Menu model = new Johnny.CMS.OM.SystemInfo.Menu();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.MenuId = Convert.ToInt32(Request.QueryString["id"]);
                model.MenuCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue);
                model.MenuName = txtMenuName.Text;
                model.ToolTip = txtToolTip.Text;
                model.PageLink = txtPageLink.Text;
                model.Image = txtImage.Text;
                model.PermissionId = DataConvert.GetInt32(ddlPermission.SelectedValue);
                model.IsDisplay = rdbDisplay0.Checked;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert                
                model.MenuCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue);
                model.MenuName = txtMenuName.Text;
                model.ToolTip = txtToolTip.Text;
                model.PageLink = txtPageLink.Text;
                model.Image = txtImage.Text;
                model.PermissionId = DataConvert.GetInt32(ddlPermission.SelectedValue);
                model.IsDisplay = rdbDisplay0.Checked;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    ddlCategory.SelectedIndex = 0;
                    txtMenuName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }        
Exemplo n.º 10
0
 public override void getData()
 {
     Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();
     myManageGridView.DataSource = bll.GetListForLink();
     myManageGridView.DataBind();
 }
Exemplo n.º 11
0
 public override void getData()
 {
     Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();
     myManageGridView.DataSource = bll.GetListForLink();
     myManageGridView.DataBind();
 }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /*
                 * string strXmlFile = System.Web.HttpRuntime.AppDomainAppPath + "admin/xmlconfig/pagepart.xml";
                 * //set properties
                 * XmlDocument doc = new XmlDocument();
                 * doc.Load(strXmlFile);
                 * XmlNodeList nodes = doc.SelectSingleNode("JohnnyCMS").SelectNodes("Page");
                 *
                 * string currentPage = GetCurrentPageName();
                 * for (int ix = 0; ix < nodes.Count; ix++)
                 * {
                 *  if (currentPage == nodes[ix].Attributes["AddName"].Value || currentPage == nodes[ix].Attributes["ListName"].Value)
                 *  {
                 *      lblStatus.Text = "&nbsp;";
                 *      //lblCategory.Text = nodes[ix].ChildNodes[0].InnerText;
                 *      lblTitle.Text = nodes[ix].ChildNodes[1].InnerText;
                 *      hyperlinkAllList.Text = nodes[ix].ChildNodes[2].InnerText;
                 *      hyperlinkAllList.NavigateUrl = nodes[ix].ChildNodes[3].InnerText;
                 *      hyperlinkAdd.Text = nodes[ix].ChildNodes[4].InnerText;
                 *      hyperlinkAdd.NavigateUrl = nodes[ix].ChildNodes[5].InnerText;
                 *      if (nodes[ix].Attributes["Single"].Value == "True")
                 *      {
                 *          lblSeparator.Visible = false;
                 *          hyperlinkAdd.Visible = false;
                 *      }
                 *      break;
                 *  }
                 * }*/

                //Get current page
                string currentPage = GetCurrentPageName();
                //Get Page Binding
                Johnny.CMS.BLL.SystemInfo.PageBinding        pagebinding = new Johnny.CMS.BLL.SystemInfo.PageBinding();
                IList <Johnny.CMS.OM.SystemInfo.PageBinding> bindinglist = pagebinding.GetList();
                Johnny.CMS.BLL.SystemInfo.Menu        menu     = new Johnny.CMS.BLL.SystemInfo.Menu();
                IList <Johnny.CMS.OM.SystemInfo.Menu> menulist = menu.GetList();
                foreach (var menuitem in menulist)
                {
                    if (menuitem.PageLink.Equals(currentPage) || menuitem.PageLink.Contains("/" + currentPage))
                    {
                        foreach (var bindingitem in bindinglist)
                        {
                            if (menuitem.MenuId == bindingitem.ListMenuId || menuitem.MenuId == bindingitem.AddMenuId)
                            {
                                lblStatus.Text        = "&nbsp;";
                                lblTitle.Text         = bindingitem.Title;
                                hyperlinkAllList.Text = GlobalizationUtility.GetLabelText("AdminMaster_List");
                                //hyperlinkAllList.Text = DataConvert.GetString(GetGlobalResourceObject("globaladmin", "AdminMasterLinkButtonList"));
                                Johnny.CMS.OM.SystemInfo.Menu listmenu = menulist.FirstOrDefault(p => p.MenuId == bindingitem.ListMenuId);
                                hyperlinkAllList.NavigateUrl = listmenu.PageLink;
                                //hyperlinkAdd.Text = "Add";
                                hyperlinkAdd.Text = GlobalizationUtility.GetLabelText("AdminMaster_Add");
                                Johnny.CMS.OM.SystemInfo.Menu addmenu = menulist.FirstOrDefault(p => p.MenuId == bindingitem.AddMenuId);
                                hyperlinkAdd.NavigateUrl = addmenu.PageLink;
                                if (bindingitem.ListMenuId == bindingitem.AddMenuId)
                                {
                                    hyperlinkAllList.Text = bindingitem.Title;
                                    lblSeparator.Visible  = false;
                                    hyperlinkAdd.Visible  = false;
                                }
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 13
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text     = GetLabelText("Menu_Title");
                litMenuCategory.Text  = GetLabelText("Menu_MenuCategoryId");
                ddlCategory.ToolTip   = GetLabelText("Menu_MenuCategoryId");
                litMenuName.Text      = GetLabelText("Menu_MenuName");
                txtMenuName.ToolTip   = GetLabelText("Menu_MenuName");
                litPageLink.Text      = GetLabelText("Menu_PageLink");
                txtPageLink.ToolTip   = GetLabelText("Menu_PageLink");
                litToolTip.Text       = GetLabelText("Menu_ToolTip");
                txtToolTip.ToolTip    = GetLabelText("Menu_ToolTip");
                litImage.Text         = GetLabelText("Menu_Image");
                txtImage.ToolTip      = GetLabelText("Menu_Image");
                litPermission.Text    = GetLabelText("Menu_PermissionId");
                ddlPermission.ToolTip = GetLabelText("Menu_PermissionId");
                litIsDisplay.Text     = GetLabelText("Menu_IsDisplay");
                rdbDisplay0.Text      = GetLabelText("Common_Yes");
                rdbDisplay1.Text      = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Menu_IsDisplay");

                if (Request.QueryString["action"] == "modify")
                {
                    //get MenuId
                    int MenuId = Convert.ToInt32(Request.QueryString["id"]);

                    //Permission entity
                    Johnny.CMS.BLL.SystemInfo.Menu bll = new Johnny.CMS.BLL.SystemInfo.Menu();

                    //bind data
                    Johnny.CMS.OM.SystemInfo.Menu model = new Johnny.CMS.OM.SystemInfo.Menu();
                    model = bll.GetModel(MenuId);

                    CreateddlCategory();
                    foreach (ListItem item in ddlCategory.Items)
                    {
                        if (DataConvert.GetInt32(item.Value) == model.MenuCategoryId)
                        {
                            item.Selected = true;
                            break;
                        }
                    }

                    txtMenuName.Text = model.MenuName;
                    txtToolTip.Text  = model.ToolTip;
                    txtPageLink.Text = model.PageLink;
                    txtImage.Text    = model.Image;

                    CreateddlPermission();
                    foreach (ListItem item in ddlPermission.Items)
                    {
                        if (DataConvert.GetInt32(item.Value) == model.PermissionId)
                        {
                            item.Selected = true;
                            break;
                        }
                    }

                    if (model.IsDisplay)
                    {
                        rdbDisplay0.Checked = true;
                    }
                    else
                    {
                        rdbDisplay1.Checked = true;
                    }

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    CreateddlCategory();
                    CreateddlPermission();
                    rdbDisplay0.Checked = true;
                }

                //RFVldtMenuName.Text = GetMessage("E00901", txtMenuName.MaxLength.ToString());
                //RFVldtPageLink.Text = GetMessage("E00903", txtPageLink.MaxLength.ToString());
            }

//                            <zr:ValidationRadioButton ID="rdbDisplay0" runat="server" GroupName="IsDisplay" Text="ÊÇ" IsRequired="True" />
//                <zr:ValidationRadioButton ID="rdbDisplay1" runat="server" GroupName="IsDisplay" Text="·ñ"  IsRequired="True" />
//<asp:Panel ID="IsDisplayTip" runat="server" class="msgNormal" tip="ÏÔʾÔÚ×ó²à²Ëµ¥À¸Àï">ÏÔʾÔÚ×ó²à²Ëµ¥À¸Àï</asp:Panel>
        }
Exemplo n.º 14
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtMenuName, "E00901", "E00902", false))
            {
                return;
            }
            //check page url
            if (!CheckInputEmptyAndLength(txtPageLink, "E00903", "E00904"))
            {
                return;
            }

            //tips
            if (!CheckInputLength(txtToolTip, "E00903", false))
            {
                return;
            }

            //image
            if (!CheckInputLength(txtImage, "E00903"))
            {
                return;
            }

            Johnny.CMS.BLL.SystemInfo.Menu bll   = new Johnny.CMS.BLL.SystemInfo.Menu();
            Johnny.CMS.OM.SystemInfo.Menu  model = new Johnny.CMS.OM.SystemInfo.Menu();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.MenuId         = Convert.ToInt32(Request.QueryString["id"]);
                model.MenuCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue);
                model.MenuName       = txtMenuName.Text;
                model.ToolTip        = txtToolTip.Text;
                model.PageLink       = txtPageLink.Text;
                model.Image          = txtImage.Text;
                model.PermissionId   = DataConvert.GetInt32(ddlPermission.SelectedValue);
                model.IsDisplay      = rdbDisplay0.Checked;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.MenuCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue);
                model.MenuName       = txtMenuName.Text;
                model.ToolTip        = txtToolTip.Text;
                model.PageLink       = txtPageLink.Text;
                model.Image          = txtImage.Text;
                model.PermissionId   = DataConvert.GetInt32(ddlPermission.SelectedValue);
                model.IsDisplay      = rdbDisplay0.Checked;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    ddlCategory.SelectedIndex = 0;
                    txtMenuName.Text          = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /*
                string strXmlFile = System.Web.HttpRuntime.AppDomainAppPath + "admin/xmlconfig/pagepart.xml";
                //set properties
                XmlDocument doc = new XmlDocument();
                doc.Load(strXmlFile);
                XmlNodeList nodes = doc.SelectSingleNode("JohnnyCMS").SelectNodes("Page");

                string currentPage = GetCurrentPageName();
                for (int ix = 0; ix < nodes.Count; ix++)
                {
                    if (currentPage == nodes[ix].Attributes["AddName"].Value || currentPage == nodes[ix].Attributes["ListName"].Value)
                    {
                        lblStatus.Text = "&nbsp;";
                        //lblCategory.Text = nodes[ix].ChildNodes[0].InnerText;
                        lblTitle.Text = nodes[ix].ChildNodes[1].InnerText;
                        hyperlinkAllList.Text = nodes[ix].ChildNodes[2].InnerText;
                        hyperlinkAllList.NavigateUrl = nodes[ix].ChildNodes[3].InnerText;
                        hyperlinkAdd.Text = nodes[ix].ChildNodes[4].InnerText;
                        hyperlinkAdd.NavigateUrl = nodes[ix].ChildNodes[5].InnerText;
                        if (nodes[ix].Attributes["Single"].Value == "True")
                        {
                            lblSeparator.Visible = false;
                            hyperlinkAdd.Visible = false;
                        }
                        break;
                    }
                }*/

                //Get current page
                string currentPage = GetCurrentPageName();
                //Get Page Binding
                Johnny.CMS.BLL.SystemInfo.PageBinding pagebinding = new Johnny.CMS.BLL.SystemInfo.PageBinding();
                IList<Johnny.CMS.OM.SystemInfo.PageBinding> bindinglist = pagebinding.GetList();
                Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
                IList<Johnny.CMS.OM.SystemInfo.Menu> menulist = menu.GetList();
                foreach (var menuitem in menulist)
                {
                    if (menuitem.PageLink.Equals(currentPage) || menuitem.PageLink.Contains("/"+currentPage))
                    {
                        foreach (var bindingitem in bindinglist)
                        {
                            if (menuitem.MenuId == bindingitem.ListMenuId || menuitem.MenuId == bindingitem.AddMenuId)
                            {
                                lblStatus.Text = "&nbsp;";
                                lblTitle.Text = bindingitem.Title;
                                hyperlinkAllList.Text = GlobalizationUtility.GetLabelText("AdminMaster_List");
                                //hyperlinkAllList.Text = DataConvert.GetString(GetGlobalResourceObject("globaladmin", "AdminMasterLinkButtonList"));
                                Johnny.CMS.OM.SystemInfo.Menu listmenu = menulist.FirstOrDefault(p => p.MenuId == bindingitem.ListMenuId);
                                hyperlinkAllList.NavigateUrl = listmenu.PageLink;
                                //hyperlinkAdd.Text = "Add";
                                hyperlinkAdd.Text = GlobalizationUtility.GetLabelText("AdminMaster_Add");
                                Johnny.CMS.OM.SystemInfo.Menu addmenu = menulist.FirstOrDefault(p => p.MenuId == bindingitem.AddMenuId);
                                hyperlinkAdd.NavigateUrl = addmenu.PageLink;
                                if (bindingitem.ListMenuId == bindingitem.AddMenuId)
                                {
                                    hyperlinkAllList.Text = bindingitem.Title;
                                    lblSeparator.Visible = false;
                                    hyperlinkAdd.Visible = false;
                                }
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }