Exemplo n.º 1
0
        public string GetFunctionOrChannelOrContentSelectScript(WebMenuInfo menuInfo)
        {
            if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function))
            {
                if (menuInfo.FunctionId > 0)
                {
                    var functionName = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(menuInfo.KeywordType), menuInfo.FunctionId);
                    return($@"selectKeyword(""{menuInfo.KeywordType},{menuInfo.FunctionId},{functionName}"")");
                }
            }
            else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Site))
            {
                if (menuInfo.ContentId > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, menuInfo.ChannelId);
                    var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, menuInfo.ChannelId);

                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, menuInfo.ContentId);

                    var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);

                    return
                        ($@"contentSelect(""{contentInfo.Title}"", ""{menuInfo.ChannelId}"", ""{menuInfo.ContentId}"", ""{pageUrl}"")");
                }
                else if (menuInfo.ChannelId > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, menuInfo.ChannelId);
                    var pageUrl   = PageUtilityWX.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemId, menuInfo.ChannelId));
                    return($"selectChannel('{nodeNames}', '{menuInfo.ChannelId}', '{pageUrl}');");
                }
            }

            return(string.Empty);
        }
Exemplo n.º 2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                try
                {
                    var menuInfo = new WebMenuInfo();
                    if (_menuId > 0)
                    {
                        menuInfo = DataProviderWx.WebMenuDao.GetMenuInfo(_menuId);
                    }

                    menuInfo.MenuName            = TbMenuName.Text;
                    menuInfo.ParentId            = _parentId;
                    menuInfo.PublishmentSystemId = PublishmentSystemId;
                    menuInfo.NavigationType      = DdlNavigationType.SelectedValue;

                    if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Url))
                    {
                        menuInfo.Url = TbUrl.Text;
                    }
                    else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function))
                    {
                        var keywordType = Request.Form["keywordType"];
                        var functionId  = TranslateUtils.ToInt(Request.Form["functionID"]);
                        if (!string.IsNullOrEmpty(keywordType) && functionId > 0)
                        {
                            menuInfo.KeywordType = keywordType;
                            menuInfo.FunctionId  = functionId;
                        }
                        else
                        {
                            FailMessage("菜单保存失败,必须选择微功能页面,请点击下方按钮进行选择");
                            return;
                        }
                    }
                    else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Site))
                    {
                        var idsCollection = Request.Form["idsCollection"];
                        if (!string.IsNullOrEmpty(idsCollection))
                        {
                            menuInfo.ChannelId = TranslateUtils.ToInt(idsCollection.Split('_')[0]);
                            menuInfo.ContentId = TranslateUtils.ToInt(idsCollection.Split('_')[1]);
                        }

                        if (menuInfo.ChannelId == 0 && menuInfo.ContentId == 0)
                        {
                            FailMessage("菜单保存失败,必须选择微网站页面,请点击下方按钮进行选择");
                            return;
                        }
                    }

                    if (_menuId > 0)
                    {
                        DataProviderWx.WebMenuDao.Update(menuInfo);
                        SuccessMessage("底部导航菜单修改成功!");
                    }
                    else
                    {
                        _menuId = DataProviderWx.WebMenuDao.Insert(menuInfo);
                        SuccessMessage("底部导航菜单新增成功!");
                    }

                    var redirectUrl = PageWebMenu.GetRedirectUrl(PublishmentSystemId, _parentId, _menuId);
                    LtlPageTitle.Text += $@"<script>parent.redirect('{redirectUrl}');</script>";
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "底部导航菜单配置失败!");
                }
            }
        }