Exemplo n.º 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _keywordId = Body.GetQueryInt("keywordID");

            if (!IsPostBack)
            {
                EMatchTypeUtils.AddListItems(DdlMatchType);

                CbIsEnabled.Checked = true;

                BtnContentSelect.Attributes.Add("onclick", ModalContentSelect.GetOpenWindowString(PublishmentSystemId, false, "contentSelect"));
                BtnChannelSelect.Attributes.Add("onclick", ModalChannelSelect.GetOpenWindowString(PublishmentSystemId, true));

                if (_keywordId > 0)
                {
                    var keywordInfo = DataProviderWx.KeywordDao.GetKeywordInfo(_keywordId);

                    TbKeywords.Text = keywordInfo.Keywords;
                    ControlUtils.SelectListItems(DdlMatchType, EMatchTypeUtils.GetValue(keywordInfo.MatchType));
                    CbIsEnabled.Checked = !keywordInfo.IsDisabled;
                    TbReply.Text        = keywordInfo.Reply;
                }
            }
        }
Exemplo n.º 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _menuId   = Body.GetQueryInt("menuID");
            _parentId = Body.GetQueryInt("parentID");

            if (!IsPostBack)
            {
                EMenuTypeUtils.AddListItems(DdlMenuType);

                var menuInfo = DataProviderWx.MenuDao.GetMenuInfo(_menuId);
                if (menuInfo == null)
                {
                    _menuId = 0;
                }

                if (_menuId == 0)
                {
                    LtlPageTitle.Text = $"添加{(_parentId == 0 ? "主" : "子")}菜单";
                }
                else
                {
                    LtlPageTitle.Text = $"修改{(_parentId == 0 ? "主" : "子")}菜单({menuInfo.MenuName})";

                    TbMenuName.Text = menuInfo.MenuName;
                    ControlUtils.SelectListItems(DdlMenuType, EMenuTypeUtils.GetValue(menuInfo.MenuType));
                    TbKeyword.Text = menuInfo.Keyword;
                    TbUrl.Text     = menuInfo.Url;
                    LtlScript.Text =
                        $"<script>{MPUtils.GetChannelOrContentSelectScript(PublishmentSystemInfo, menuInfo.ChannelId, menuInfo.ContentId)}</script>";
                }

                DdlMenuType_OnSelectedIndexChanged(null, EventArgs.Empty);

                BtnKeywordSelect.Attributes.Add("onclick", "parent." + ModalKeywordSelect.GetOpenWindowString(PublishmentSystemId, "selectKeyword"));

                BtnContentSelect.Attributes.Add("onclick", "parent." + ModalContentSelect.GetOpenWindowString(PublishmentSystemId, false, "contentSelect"));
                BtnChannelSelect.Attributes.Add("onclick", "parent." + ModalChannelSelect.GetOpenWindowString(PublishmentSystemId));
            }
        }
Exemplo n.º 3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged    = false;
            var keywordIdNew = 0;

            try
            {
                if (_keywordId == 0)
                {
                    var conflictKeywords = string.Empty;
                    if (KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, TbKeywords.Text, out conflictKeywords))
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                    }
                    else
                    {
                        var keywordInfo = new KeywordInfo();

                        keywordInfo.KeywordId           = 0;
                        keywordInfo.PublishmentSystemId = PublishmentSystemId;
                        keywordInfo.Keywords            = TbKeywords.Text;
                        keywordInfo.IsDisabled          = !CbIsEnabled.Checked;
                        keywordInfo.KeywordType         = EKeywordType.News;
                        keywordInfo.MatchType           = EMatchTypeUtils.GetEnumType(DdlMatchType.SelectedValue);
                        keywordInfo.Reply   = string.Empty;
                        keywordInfo.AddDate = DateTime.Now;
                        keywordInfo.Taxis   = 0;

                        keywordIdNew = DataProviderWx.KeywordDao.Insert(keywordInfo);

                        Body.AddSiteLog(PublishmentSystemId, "添加图文回复关键词", $"关键词:{TbKeywords.Text}");

                        isChanged = true;
                    }
                }
                else
                {
                    var conflictKeywords = string.Empty;
                    if (KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, _keywordId, TbKeywords.Text, out conflictKeywords))
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                    }
                    else
                    {
                        var keywordInfo = DataProviderWx.KeywordDao.GetKeywordInfo(_keywordId);
                        keywordInfo.Keywords   = TbKeywords.Text;
                        keywordInfo.IsDisabled = !CbIsEnabled.Checked;
                        keywordInfo.MatchType  = EMatchTypeUtils.GetEnumType(DdlMatchType.SelectedValue);

                        DataProviderWx.KeywordDao.Update(keywordInfo);

                        Body.AddSiteLog(PublishmentSystemId, "编辑图文回复关键词", $"关键词:{TbKeywords.Text}");

                        isChanged = true;
                    }
                }
            }
            catch (Exception ex)
            {
                FailMessage(ex, "失败:" + ex.Message);
            }

            if (isChanged)
            {
                if (_keywordId == 0)
                {
                    if (CbIsSelect.Checked)
                    {
                        PageUtils.Redirect(ModalContentSelect.GetRedirectUrlByKeywordAddList(PublishmentSystemId, !_isSingle, keywordIdNew));
                    }
                    else
                    {
                        PageUtils.CloseModalPageAndRedirect(Page, PageKeywordNewsAdd.GetRedirectUrl(PublishmentSystemId, keywordIdNew, 0, _isSingle));
                    }
                }
                else
                {
                    PageUtils.CloseModalPage(Page);
                }
            }
        }
Exemplo n.º 4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");

            _keywordId  = Body.GetQueryInt("keywordID");
            _resourceId = Body.GetQueryInt("resourceID");
            _floor      = Body.GetQueryInt("floor");
            _isSingle   = TranslateUtils.ToBool(Body.GetQueryString("isSingle"));

            if (!IsPostBack)
            {
                LtlPreview.Text = @"
<p class=""js_cover upload_preview"" style=""display:none"">
    <input type=""hidden"" id=""imageUrl"" name=""imageUrl"" value="""" />
    <img src="""" width=""64"">
    <a class=""js_removeCover"" href=""javascript:;"" onclick=""deleteImageUrl();return false;"">删除</a>
</p>";
                LtlNav.Text     = GetNavHtml(EResourceType.Site);

                LtlSite.Text = @"
<div id=""titles"" class=""well well-small"" style=""display:none""></div>
<input id=""channelID"" name=""channelID"" type=""hidden"" value="""" />
<input id=""contentID"" name=""contentID"" type=""hidden"" value="""" />";

                if (_resourceId > 0)
                {
                    var resourceInfo = DataProviderWx.KeywordResourceDao.GetResourceInfo(_resourceId);

                    if (resourceInfo.ResourceType == EResourceType.Site)
                    {
                        var siteHtml = MPUtils.GetSitePreivewHtml(PublishmentSystemInfo, resourceInfo.ChannelId, resourceInfo.ContentId);
                        if (!string.IsNullOrEmpty(siteHtml))
                        {
                            LtlSite.Text = $@"
<div id=""titles"" class=""well well-small"">{siteHtml}</div>
<input id=""channelID"" name=""channelID"" type=""hidden"" value=""{resourceInfo.ChannelId}"" />
<input id=""contentID"" name=""contentID"" type=""hidden"" value=""{resourceInfo.ContentId}"" />";
                        }
                    }

                    TbTitle.Text = resourceInfo.Title;
                    TbTaxis.Text = resourceInfo.Taxis.ToString();
                    if (!string.IsNullOrEmpty(resourceInfo.ImageUrl))
                    {
                        LtlPreview.Text = $@"
<p class=""js_cover upload_preview"">
    <input type=""hidden"" id=""imageUrl"" name=""imageUrl"" value=""{resourceInfo.ImageUrl}"" />
    <img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, resourceInfo.ImageUrl)}"" width=""64"">
    <a class=""js_removeCover"" href=""javascript:;"" onclick=""deleteImageUrl();return false;"">删除</a>
</p>";
                    }
                    TbSummary.Text = resourceInfo.Summary;
                    if (resourceInfo.IsShowCoverPic == false)
                    {
                        LtlScript.Text += "<script>$('.js_show_cover_pic').click();</script>";
                    }
                    BreContent.Text      = resourceInfo.Content;
                    TbNavigationUrl.Text = resourceInfo.NavigationUrl;

                    LtlScript.Text +=
                        $@"<script>$('.nav a.{EResourceTypeUtils.GetValue(resourceInfo.ResourceType)}').click();</script>";
                }

                BtnContentSelect.Attributes.Add("onclick", "parent." + ModalContentSelect.GetOpenWindowString(PublishmentSystemId, false, "contentSelect"));
                BtnChannelSelect.Attributes.Add("onclick", "parent." + ModalChannelSelect.GetOpenWindowString(PublishmentSystemId));

                var top = 0;
                if (_floor > 1)
                {
                    top = 67 + (_floor - 1) * 103;
                }
                LtlArrow.Text =
                    $@"<i class=""arrow arrow_out"" style=""margin-top: {top}px;""></i><i class=""arrow arrow_in"" style=""margin-top: {top}px;""></i>";
            }
        }
Exemplo n.º 5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _searchId = Body.GetQueryInt("searchID");

            if (!IsPostBack)
            {
                var pageTitle = _searchId > 0 ? "编辑微搜索" : "添加微搜索";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdSearch, pageTitle, AppManager.WeiXin.Permission.WebSite.Search);
                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{SearchManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{SearchManager.GetContentImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";

                LtlSearchNavs.Text = $@"
itemController.openFunctionSelect = function(itemIndex){{
    var openString = ""{ModalFunctionSelect.GetOpenWindowStringByItemIndex(PublishmentSystemId, "selectFunction",
                    "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openChannelSelect = function(itemIndex){{
    var openString = ""{ModalChannelSelect.GetOpenWindowStringByItemIndex(
                    PublishmentSystemId, "selectChannel", "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openContentSelect = function(itemIndex){{
    var openString = ""{ModalContentSelect.GetOpenWindowStringByItemIndex(PublishmentSystemId, "selectContent",
                    "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openImageCssClassSelect = function(itemIndex){{
    var openString = ""{ModalImageCssClassSelect.GetOpenWindowStringByItemIndex(PublishmentSystemId,
                    "selectImageCssClass", "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
";

                if (_searchId == 0)
                {
                    LtlSearchNavs.Text += "itemController.itemCount = 2;itemController.items = [{navigationType : 'Url', imageCssClass : 'fa fa-angle-double-down'}, {navigationType : 'Url', imageCssClass : 'fa fa-angle-double-down'}];";
                }
                else
                {
                    var searchInfo = DataProviderWx.SearchDao.GetSearchInfo(_searchId);

                    TbKeywords.Text     = DataProviderWx.KeywordDao.GetKeywords(searchInfo.KeywordId);
                    CbIsEnabled.Checked = !searchInfo.IsDisabled;
                    TbTitle.Text        = searchInfo.Title;
                    if (!string.IsNullOrEmpty(searchInfo.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, searchInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbSummary.Text = searchInfo.Summary;

                    CbIsOutsiteSearch.Checked = searchInfo.IsOutsiteSearch;
                    CbIsNavigation.Checked    = searchInfo.IsNavigation;
                    TbNavTitleColor.Text      = searchInfo.NavTitleColor;
                    TbNavImageColor.Text      = searchInfo.NavImageColor;
                    if (!string.IsNullOrEmpty(searchInfo.ContentImageUrl))
                    {
                        LtlContentImageUrl.Text =
                            $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, searchInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    var searchNavigationInfoList = DataProviderWx.SearchNavigationDao.GetSearchNavigationInfoList(PublishmentSystemId, _searchId);
                    var itemBuilder = new StringBuilder();
                    foreach (var searchNavigationInfo in searchNavigationInfoList)
                    {
                        var searchPageTitle = string.Empty;

                        if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Url))
                        {
                            searchPageTitle = string.Empty;
                        }
                        else if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Function))
                        {
                            searchPageTitle = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(searchNavigationInfo.KeywordType), searchNavigationInfo.FunctionId);
                        }
                        else if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Site))
                        {
                            if (searchNavigationInfo.ContentId > 0)
                            {
                                var tableStyle  = NodeManager.GetTableStyle(PublishmentSystemInfo, searchNavigationInfo.ChannelId);
                                var tableName   = NodeManager.GetTableName(PublishmentSystemInfo, searchNavigationInfo.ChannelId);
                                var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, searchNavigationInfo.ContentId);

                                var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);
                                searchPageTitle = $@"内容页:{contentInfo.Title}";
                            }
                            else
                            {
                                var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, searchNavigationInfo.ChannelId);
                                var pageUrl   = PageUtility.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemId, searchNavigationInfo.ChannelId));
                                searchPageTitle = $@"栏目页:{nodeNames}";
                            }
                        }

                        itemBuilder.AppendFormat("{{id: '{0}', title: '{1}',pageTitle: '{2}', url: '{3}', imageCssClass: '{4}',navigationType:'{5}',keywordType:'{6}',functionID:'{7}',channelID:'{8}',contentID:'{9}'}},", searchNavigationInfo.Id, searchNavigationInfo.Title, searchPageTitle, searchNavigationInfo.Url, searchNavigationInfo.ImageCssClass, searchNavigationInfo.NavigationType, searchNavigationInfo.KeywordType, searchNavigationInfo.FunctionId, searchNavigationInfo.ChannelId, searchNavigationInfo.ContentId);
                    }

                    if (itemBuilder.Length > 0)
                    {
                        itemBuilder.Length--;
                    }

                    LtlSearchNavs.Text += $@"
itemController.itemCount = {searchNavigationInfoList.Count};itemController.items = [{itemBuilder}];";

                    ImageUrl.Value        = searchInfo.ImageUrl;
                    ContentImageUrl.Value = searchInfo.ContentImageUrl;

                    TbImageAreaTitle.Text = searchInfo.ImageAreaTitle;
                    TbTextAreaTitle.Text  = searchInfo.TextAreaTitle;

                    if (searchInfo.ImageAreaChannelId > 0)
                    {
                        var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, searchInfo.ImageAreaChannelId);
                        LtlSearchNavs.Text += $@"
$(document).ready(function() {{
    selectChannel(1, '{nodeNames}', {searchInfo.ImageAreaChannelId});
}});
";
                    }
                    if (searchInfo.TextAreaChannelId > 0)
                    {
                        var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, searchInfo.TextAreaChannelId);
                        LtlSearchNavs.Text += $@"
$(document).ready(function() {{
    selectChannel(2, '{nodeNames}', {searchInfo.TextAreaChannelId});
}});
";
                    }
                }

                BtnImageChannelSelect.Attributes.Add("onclick", ModalChannelSelect.GetOpenWindowStringByItemIndex(PublishmentSystemId, "selectChannel", "1"));
                BtnTextChannelSelect.Attributes.Add("onclick", ModalChannelSelect.GetOpenWindowStringByItemIndex(PublishmentSystemId, "selectChannel", "2"));

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageSearch.GetRedirectUrl(PublishmentSystemId)}"";return false");
            }
        }