Пример #1
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var specialInfo = (SpecialInfo)e.Item.DataItem;

            var ltlTitle   = (Literal)e.Item.FindControl("ltlTitle");
            var ltlUrl     = (Literal)e.Item.FindControl("ltlUrl");
            var ltlAddDate = (Literal)e.Item.FindControl("ltlAddDate");
            var ltlActions = (Literal)e.Item.FindControl("ltlActions");

            ltlTitle.Text   = $@"<a href=""{SpecialManager.GetSpecialUrl(SiteInfo, specialInfo.Url)}"" target=""_blank"">{specialInfo.Title}</a>";
            ltlUrl.Text     = specialInfo.Url;
            ltlAddDate.Text = specialInfo.AddDate.ToString("yyyy-MM-dd HH:mm");

            ltlActions.Text = $@"
<a class=""m-r-10"" href=""javascript:;"" onclick=""{ModalSpecialAdd.GetOpenWindowString(SiteId, specialInfo.Id)}"">编辑</a>
<a class=""m-r-10"" href=""javascript:;"" onclick=""{ModalSpecialUpload.GetOpenWindowString(SiteId, specialInfo.Id)}"">上传压缩包</a>
<a class=""m-r-10"" href=""{GetRedirectUrl(SiteId)}&specialId={specialInfo.Id}&download={true}"">下载压缩包</a>
<a class=""m-r-10"" onclick=""{AlertUtils.ConfirmDelete("删除专题", $"此操作将删除专题“{specialInfo.Title}”及相关文件,确认吗?", $"{GetRedirectUrl(SiteId)}&specialId={specialInfo.Id}&delete={true}")}"" href=""javascript:;"">删除</a>
";
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            var defaultChannelTemplateId = TemplateManager.GetDefaultTemplateId(SiteId, TemplateType.ChannelTemplate);

            _defaultChannelTemplateName = TemplateManager.GetTemplateName(SiteId, defaultChannelTemplateId);

            var defaultContentTemplateId = TemplateManager.GetDefaultTemplateId(SiteId, TemplateType.ContentTemplate);

            _defaultContentTemplateName = TemplateManager.GetTemplateName(SiteId, defaultContentTemplateId);

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.SitePermissions.TemplatesMatch);

            LbChannelTemplateId.Attributes.Add("onfocus", "$('#LbContentTemplateId option:selected').removeAttr('selected')");
            LbContentTemplateId.Attributes.Add("onfocus", "$('#LbChannelTemplateId option:selected').removeAttr('selected')");

            BindListBox();

            BtnCreateChannelTemplate.OnClientClick    = $"{AlertUtils.Confirm("创建栏目模板", "此操作将创建空的栏目模板并匹配选中栏目,确认吗?", "创 建", "$('#BtnCreateChannelTemplateReal').click()")}";
            BtnCreateSubChannelTemplate.OnClientClick = $"{AlertUtils.Confirm("创建下级栏目模版", "此操作将创建空的栏目模板并匹配选中栏目的下级栏目,确认吗?", "创 建", "$('#BtnCreateSubChannelTemplateReal').click()")}";
            BtnCreateContentTemplate.OnClientClick    = $"{AlertUtils.Confirm("创建内容模版", "此操作将创建空的内容模板并匹配选中栏目,确认吗?", "创 建", "$('#BtnCreateContentTemplateReal').click()")}";
            BtnCreateSubContentTemplate.OnClientClick = $"{AlertUtils.Confirm("创建下级内容模版", "此操作将创建空的内容模板并匹配选中栏目的下级栏目,确认吗?", "创 建", "$('#BtnCreateSubContentTemplateReal').click()")}";
        }
Пример #3
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var fileName = (string)e.Item.DataItem;

            var ltlFileName = (Literal)e.Item.FindControl("ltlFileName");
            var ltlCharset  = (Literal)e.Item.FindControl("ltlCharset");
            var ltlView     = (Literal)e.Item.FindControl("ltlView");
            var ltlEdit     = (Literal)e.Item.FindControl("ltlEdit");
            var ltlDelete   = (Literal)e.Item.FindControl("ltlDelete");

            ltlFileName.Text = fileName;

            var charset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, fileName));

            ltlCharset.Text = ECharsetUtils.GetText(charset);

            ltlView.Text = $@"<a href=""{PageUtility.GetSiteUrl(SiteInfo, $"{_assetsDir}/{fileName}", true)}"" target=""_blank"">查看</a>";
            ltlEdit.Text =
                $@"<a href=""{PageTemplateAssetsAdd.GetRedirectUrlToEdit(SiteId, _type, fileName)}"">编辑</a>";
            ltlDelete.Text =
                $@"<a href=""javascript:;"" onclick=""{AlertUtils.ConfirmDelete($"删除{_name}", $"此操作将删除{_name},确认吗", $"{GetRedirectUrl(SiteId, _type)}&delete={true}&fileName={fileName}")}"">删除</a>";
        }
Пример #4
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var fileName = (string)e.Item.DataItem;

            var ltlFileName = (Literal)e.Item.FindControl("ltlFileName");
            var ltlCharset  = (Literal)e.Item.FindControl("ltlCharset");
            var ltlView     = (Literal)e.Item.FindControl("ltlView");
            var ltlEdit     = (Literal)e.Item.FindControl("ltlEdit");
            var ltlDelete   = (Literal)e.Item.FindControl("ltlDelete");

            ltlFileName.Text = fileName;

            var charset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, fileName));

            ltlCharset.Text = ECharsetUtils.GetText(charset);

            ltlView.Text = $@"<a href=""{SiteInfo.Additional.WebUrl}/css/{fileName}"" target=""_blank"">查看</a>";
            ltlEdit.Text =
                $@"<a href=""{PageTemplateCssAdd.GetRedirectUrl(SiteId, fileName)}"">编辑</a>";
            ltlDelete.Text =
                $@"<a href=""javascript:;"" onclick=""{AlertUtils.ConfirmDelete("删除文件", "此操作将删除样式文件,确认吗", $"{GetRedirectUrl(SiteId)}&Delete={true}&FileName={fileName}")}"">删除</a>";
        }
Пример #5
0
        private void RptError_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.AlternatingItem && e.Item.ItemType != ListItemType.Item)
            {
                return;
            }

            var pluginInfo = (PluginInfo)e.Item.DataItem;

            var ltlPluginId     = (Literal)e.Item.FindControl("ltlPluginId");
            var ltlErrorMessage = (Literal)e.Item.FindControl("ltlErrorMessage");
            var ltlCmd          = (Literal)e.Item.FindControl("ltlCmd");

            ltlPluginId.Text     = pluginInfo.Id;
            ltlErrorMessage.Text = pluginInfo.ErrorMessage;

            var deleteUrl = PageUtils.GetPluginsUrl(nameof(PageManagement), new NameValueCollection
            {
                { "delete", true.ToString() },
                { "pluginId", pluginInfo.Id }
            });

            ltlCmd.Text = $@"
<a href=""javascript:;"" onClick=""{AlertUtils.ConfirmDelete("删除插件", $"此操作将会删除“{pluginInfo.Id}”插件,确认吗?", deleteUrl)}"">删除插件</a>";
        }
Пример #6
0
        public void BtnReload_Click(object sender, EventArgs e)
        {
            CacheUtils.ClearAll();
            CacheDbUtils.Clear();

            AddScript(AlertUtils.Success("插件重新加载成功", "插件重新加载成功,系统需要重载页面", "重新载入", "window.top.location.reload(true);"));
        }
Пример #7
0
        public static string GetTextEditorCommands(SiteInfo siteInfo, int channelId, string attributeName)
        {
            var url         = $"editorLayerImage.cshtml?siteId={siteInfo.Id}&channelId={channelId}&attributeName={attributeName}";
            var insertImage = $@"utils.openLayer({{title: '插入图片', url: '{url}', width: 700, height: 500}});return false;";

            url = $"editorLayerText.cshtml?siteId={siteInfo.Id}&channelId={channelId}&attributeName={attributeName}";
            var insertText = $@"utils.openLayer({{title: '插入图文', url: '{url}', full: true}});return false;";

            return($@"
<script type=""text/javascript"">
function getWordSpliter(){{
    var pureText = {UEditorUtils.GetPureTextScript(attributeName)}
	$.post('{AjaxCmsService.GetWordSpliterUrl(siteInfo.Id)}&r=' + Math.random(), {{content:pureText}}, function(data) {{
		if(data !=''){{
            //$('.nav-pills').children('li').eq(1).find('a').click();
			//$('#TbTags').val(data).focus();
            $vue.tagNames = data.split(' ');
            location.hash = '#tagNames';
		}}else{{
            {AlertUtils.Error("提取关键字", "对不起,内容不足,无法提取关键字")}
        }}
	}});	
}}
function detection_{attributeName}(){{
    var pureText = {UEditorUtils.GetPureTextScript(attributeName)}
    var htmlContent = {UEditorUtils.GetContentScript(attributeName)}
    var keyword = '';
	$.post('{AjaxCmsService.GetDetectionUrl(siteInfo.Id)}&r=' + Math.random(), {{content:pureText}}, function(data) {{
		if(data){{
			var arr = data.split(',');
            var i=0;
			for(;i<arr.length;i++)
			{{
                var reg = new RegExp(arr[i], 'gi');
				htmlContent = htmlContent.replace(reg,'<span style=""background-color:#ffff00;"">' + arr[i] + '</span>');
			}}
            keyword=data;
			{UEditorUtils.GetSetContentScript(attributeName, "htmlContent")}
            {AlertUtils.Warning("敏感词检测", "共检测到' + i + '个敏感词,内容已用黄色背景标明", "取 消", string.Empty, string.Empty)}
		}} else {{
            {AlertUtils.Success("敏感词检测", "检测成功,没有检测到任何敏感词")}
        }}
	}});	
}}
</script>
<div class=""btn-group btn-group-sm"">
    <button class=""btn"" onclick=""{ModalTextEditorImportWord.GetOpenWindowString(siteInfo.Id, attributeName)}"">导入Word</button>
    <button class=""btn"" onclick=""{insertImage}"">插入图片</button>
    <button class=""btn"" onclick=""{ModalTextEditorInsertVideo.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入视频</button>
    <button class=""btn"" onclick=""{ModalTextEditorInsertAudio.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入音频</button>
    <button class=""btn"" onclick=""{insertText}"">插入图文</button>
    <button class=""btn"" onclick=""getWordSpliter();return false;"">提取关键字</button>
    <button class=""btn"" onclick=""detection_{attributeName}();return false;"">敏感词检测</button>
</div>
");
            //    <button class=""btn"" onclick=""{ModalTextEditorInsertImage.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入图片</button>
        }
Пример #8
0
        public static string GetTextEditorCommands(SiteInfo siteInfo, string attributeName)
        {
            return($@"
<script type=""text/javascript"">
function getWordSpliter(){{
    var pureText = {UEditorUtils.GetPureTextScript(attributeName)}
	$.post('{AjaxCmsService.GetWordSpliterUrl(siteInfo.Id)}&r=' + Math.random(), {{content:pureText}}, function(data) {{
		if(data !=''){{
            $('.nav-pills').children('li').eq(1).find('a').click();
			$('#TbTags').val(data).focus();
		}}else{{
            {AlertUtils.Error("提取关键字", "对不起,内容不足,无法提取关键字")}
        }}
	}});	
}}
function detection_{attributeName}(){{
    var pureText = {UEditorUtils.GetPureTextScript(attributeName)}
    var htmlContent = {UEditorUtils.GetContentScript(attributeName)}
    var keyword = '';
	$.post('{AjaxCmsService.GetDetectionUrl(siteInfo.Id)}&r=' + Math.random(), {{content:pureText}}, function(data) {{
		if(data){{
			var arr = data.split(',');
            var i=0;
			for(;i<arr.length;i++)
			{{
                var reg = new RegExp(arr[i], 'gi');
				htmlContent = htmlContent.replace(reg,'<span style=""background-color:#ffff00;"">' + arr[i] + '</span>');
			}}
            keyword=data;
			{UEditorUtils.GetSetContentScript(attributeName, "htmlContent")}
            {AlertUtils.Warning("敏感词检测", "共检测到' + i + '个敏感词,内容已用黄色背景标明", "取 消", string.Empty, string.Empty)}
		}} else {{
            {AlertUtils.Success("敏感词检测", "检测成功,没有检测到任何敏感词")}
        }}
	}});	
}}
</script>
<div class=""




"">
    <button class=""btn"" onclick=""{ModalTextEditorImportWord.GetOpenWindowString(siteInfo.Id, attributeName)}"">导入Word</button>
    <button class=""btn"" onclick=""{ModalTextEditorInsertImage.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入图片</button>
    <button style='display:none;'class=""btn"" onclick=""{ModalTextEditorInsertVideo.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入视频</button>
    <button style='display:none;' class=""btn"" onclick=""{ModalTextEditorInsertAudio.GetOpenWindowString(siteInfo.Id, attributeName)}"">插入音频</button>
    <button class=""btn"" onclick=""getWordSpliter();return false;"">提取关键字</button>
    <button class=""btn"" onclick=""detection_{attributeName}();return false;"">敏感词检测</button>
</div>
");
            ////modify on 2019/1/27
        }
Пример #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageType = AuthRequest.GetQueryInt("pageType");

            if (AuthRequest.IsQueryExists("delete"))
            {
                var pluginId = AuthRequest.GetQueryString("pluginId");

                PluginManager.Delete(pluginId);
                AuthRequest.AddAdminLog("删除插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件删除成功", "插件删除成功,系统需要重载页面", "重新载入", "window.top.location.reload(true);"));
            }
            if (AuthRequest.IsQueryExists("enable"))
            {
                var pluginId = AuthRequest.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, false);
                AuthRequest.AddAdminLog("启用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件启用成功", "插件启用成功,系统需要重载页面", "重新载入", "window.top.location.reload(true);"));
            }
            else if (AuthRequest.IsQueryExists("disable"))
            {
                var pluginId = AuthRequest.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, true);
                AuthRequest.AddAdminLog("禁用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件禁用成功", "插件禁用成功,系统需要重载页面", "重新载入", "window.top.location.reload(true);"));
            }

            if (Page.IsPostBack)
            {
                return;
            }

            VerifySystemPermissions(ConfigManager.PluginsPermissions.Management);
        }
Пример #10
0
        private void RptLogs_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var logInfo = (LogInfo)e.Item.DataItem;

            var ltlValues    = (Literal)e.Item.FindControl("ltlValues");
            var ltlAddDate   = (Literal)e.Item.FindControl("ltlAddDate");
            var ltlOperation = (Literal)e.Item.FindControl("ltlOperation");

            foreach (var fieldInfo in _fieldInfoList)
            {
                var settings = new FieldSettings(fieldInfo.Settings);
                if (!settings.IsVisibleInList)
                {
                    continue;
                }

                var values = logInfo.GetString(fieldInfo.Title) ?? string.Empty;
                if (FieldManager.IsExtra(fieldInfo))
                {
                    var builder = new StringBuilder();
                    foreach (var item in fieldInfo.Items)
                    {
                        var extras = logInfo.GetString(FieldManager.GetExtrasId(fieldInfo.Id, item.Id));
                        if (!string.IsNullOrEmpty(extras))
                        {
                            builder.Append($@"<li class=""list-group-item""><label>{item.Value}:</label>{extras}</li>");
                        }
                    }
                    if (builder.Length > 0)
                    {
                        values += $@"<ul class=""list-group m-t-10"">{builder}</ul>";
                    }
                }
                ltlValues.Text += $@"<td style=""min-width: 120px;"">{values}</td>";
            }

            ltlAddDate.Text = logInfo.AddDate.ToString("yyyy-MM-dd HH:mm");

            ltlOperation.Text =
                $@"
<a href=""javascript:;"" onclick=""{ModalView.GetOpenScript(SiteId, FormInfo.Id, logInfo.Id)}"">查看</a>
<a class=""m-l-10"" href=""javascript:;"" onclick=""{AlertUtils.Warning("删除项目", "本操作将删除此项,确定吗?", "取 消", "删 除", $"location.href='{GetRedirectUrl(SiteId, FormInfo.Id, ReturnUrl)}&delete={true}&logId={logInfo.Id}'")};return false;"">删除</a>";
        }
Пример #11
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var collectionInfo = (TableInfo)e.Item.DataItem;
            var tableName      = collectionInfo.TableName;
            //var isHighlight = !collectionInfo.IsCreatedInDb || collectionInfo.IsChangedAfterCreatedInDb;
            var isTableUsed = DataProvider.SiteDao.IsTableUsed(tableName);

            //if (isHighlight) e.Item.Attributes.Add("style", "color: red");

            var ltlTableName                 = (Literal)e.Item.FindControl("ltlTableName");
            var ltlDisplayName               = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlIsUsed                    = (Literal)e.Item.FindControl("ltlIsUsed");
            var ltlIsCreatedInDb             = (Literal)e.Item.FindControl("ltlIsCreatedInDB");
            var ltlIsChangedAfterCreatedInDb = (Literal)e.Item.FindControl("ltlIsChangedAfterCreatedInDb");
            var ltlMetadataEdit              = (Literal)e.Item.FindControl("ltlMetadataEdit");
            var ltlStyleEdit                 = (Literal)e.Item.FindControl("ltlStyleEdit");
            var ltlEdit   = (Literal)e.Item.FindControl("ltlEdit");
            var ltlDelete = (Literal)e.Item.FindControl("ltlDelete");

            ltlTableName.Text                 = tableName;
            ltlDisplayName.Text               = collectionInfo.DisplayName;
            ltlIsUsed.Text                    = StringUtils.GetBoolText(isTableUsed);
            ltlIsCreatedInDb.Text             = StringUtils.GetBoolText(collectionInfo.IsCreatedInDb);
            ltlIsChangedAfterCreatedInDb.Text = collectionInfo.IsCreatedInDb == false
                ? "----"
                : StringUtils.GetBoolText(collectionInfo.IsChangedAfterCreatedInDb);

            ltlMetadataEdit.Text =
                $@"<a href=""{PageSiteTableMetadata.GetRedirectUrl(tableName)}"">管理真实字段</a>";

            ltlStyleEdit.Text = $@"<a href=""{PageSiteTableStyle.GetRedirectUrl(tableName)}"">管理虚拟字段</a>";

            ltlEdit.Text = $@"<a href=""javascript:;"" onclick=""{ModalAuxiliaryTableAdd.GetOpenWindowString(tableName)}"">编辑</a>";

            if (!isTableUsed)
            {
                var script = AlertUtils.Warning("删除内容表", $"此操作将删除内容表“{tableName}”,如果内容表已在数据库中建立,将同时删除建立的内容表,确认吗?", "取 消",
                                                "确认删除", $"location.href = '{GetRedirectUrl()}?Delete=True&ENName={tableName}';");
                ltlDelete.Text =
                    $@"<a href=""javascript:;"" onClick=""{script}"">删除</a>";
            }
        }
Пример #12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _pluginId  = Body.GetQueryString("pluginId");
            _returnUrl = Body.GetQueryString("returnUrl");

            if (Body.IsQueryExists("install"))
            {
                var version = Body.GetQueryString("version");

                string errorMessage;

                PackageUtils.DownloadPackage(_pluginId, version);

                var idWithVersion = $"{_pluginId}.{version}";
                if (!PackageUtils.UpdatePackage(idWithVersion, false, out errorMessage))
                {
                    FailMessage(errorMessage);
                    return;
                }

                PluginManager.ClearCache();
                Body.AddAdminLog("安装插件", $"插件:{_pluginId}");

                AddScript(AlertUtils.Success("插件安装成功", "插件安装成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            else if (Body.IsQueryExists("update"))
            {
                PageUtils.Redirect(PageUpdate.GetRedirectUrl());
            }

            if (Page.IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Plugins.Add, ConfigManager.Permissions.Plugins.Management);
        }
Пример #13
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var tokenInfo = (AccessTokenInfo)e.Item.DataItem;

            var ltlTitle   = (Literal)e.Item.FindControl("ltlTitle");
            var ltlScopes  = (Literal)e.Item.FindControl("ltlScopes");
            var ltlActions = (Literal)e.Item.FindControl("ltlActions");

            ltlTitle.Text  = $@"<a href=""javascript:;"" onclick=""{ModalUtilityAccessToken.GetOpenWindowString(tokenInfo.Id)}"">{tokenInfo.Title}</a>";
            ltlScopes.Text = tokenInfo.Scopes;

            ltlActions.Text = $@"
<a href=""{PageUtilityAccessTokensAdd.GetRedirectUrlToEdit(tokenInfo.Id)}"" class=""btn btn-success m-r-5"">编 辑</a>
<a href=""javascript:;"" class=""btn btn-danger m-r-5"" onclick=""{AlertUtils.ConfirmDelete("删除API密钥", $"此操作将删除API密钥 {tokenInfo.Title},确定吗?", GetRedirectUrl() + "?delete=true&id=" + tokenInfo.Id)}"">删 除</a>";
        }
Пример #14
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var ltlItemTitle     = (Literal)e.Item.FindControl("ltlItemTitle");
            var ltlItemChannel   = (Literal)e.Item.FindControl("ltlItemChannel");
            var ltlItemAddDate   = (Literal)e.Item.FindControl("ltlItemAddDate");
            var ltlItemStatus    = (Literal)e.Item.FindControl("ltlItemStatus");
            var ltlItemEditUrl   = (Literal)e.Item.FindControl("ltlItemEditUrl");
            var ltlItemDeleteUrl = (Literal)e.Item.FindControl("ltlItemDeleteUrl");

            var contentInfo = new ContentInfo(e.Item.DataItem);

            ltlItemTitle.Text   = WebUtils.GetContentTitle(SiteInfo, contentInfo, PageUrl);
            ltlItemChannel.Text = ChannelManager.GetChannelNameNavigation(SiteId, contentInfo.ChannelId);
            ltlItemAddDate.Text = DateUtils.GetDateAndTimeString(contentInfo.AddDate);
            ltlItemStatus.Text  = CheckManager.GetCheckState(SiteInfo, contentInfo.IsChecked,
                                                             contentInfo.CheckedLevel);

            if (!HasChannelPermissions(contentInfo.ChannelId, ConfigManager.ChannelPermissions.ContentEdit) &&
                AuthRequest.AdminName != contentInfo.AddUserName)
            {
                return;
            }

            ltlItemEditUrl.Text =
                $@"<a href=""{WebUtils.GetContentAddEditUrl(SiteId, _nodeInfo, contentInfo.Id, PageUrl)}"">编辑</a>";

            var removeUrl = PageUtils.GetCmsUrl(SiteId, nameof(PageContentsGroup), new NameValueCollection
            {
                { "contentGroupName", _contentGroupName },
                { "contentId", contentInfo.Id.ToString() },
                { "remove", true.ToString() }
            });

            ltlItemDeleteUrl.Text =
                $@"<a href=""javascript:;"" onClick=""{AlertUtils.Warning("从此内容组移除", $"此操作将从内容组“{_contentGroupName}”移除该内容,确认吗?", "取 消", "移 除", $"location.href = '{removeUrl}';return false;")}"">从此内容组移除</a>";
        }
Пример #15
0
        private static void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var roleName = (string)e.Item.DataItem;

            e.Item.Visible = !EPredefinedRoleUtils.IsPredefinedRole(roleName);

            var ltlRoleName    = (Literal)e.Item.FindControl("ltlRoleName");
            var ltlDescription = (Literal)e.Item.FindControl("ltlDescription");
            var ltlEdit        = (Literal)e.Item.FindControl("ltlEdit");
            var ltlDelete      = (Literal)e.Item.FindControl("ltlDelete");

            ltlRoleName.Text    = roleName;
            ltlDescription.Text = DataProvider.RoleDao.GetRoleDescription(roleName);
            ltlEdit.Text        = $@"<a href=""{PageAdminRoleAdd.GetRedirectUrl(roleName)}"">修改</a>";
            ltlDelete.Text      = $@"<a href=""javascript:;"" onClick=""{AlertUtils.ConfirmDelete("删除角色", $"此操作将会删除角色“{roleName}”,确认吗?", $"{GetRedirectUrl()}?Delete={true}&RoleName={roleName}")}"">删除</a>";
        }
Пример #16
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ChannelId = Utils.ToInt(Request.QueryString["channelId"]);

            _isPermissionReply = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Reply);
            _isPermissionEdit  = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Edit);

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (list.Count > 0)
                {
                    foreach (var contentId in list)
                    {
                        Main.ContentApi.Delete(SiteId, ChannelId, contentId);
                    }
                    LtlScript.Text = AlertUtils.Success("删除成功!", "");
                }
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["accept"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.New || state == EState.Denied)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Accepted));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("受理申请成功!", "");
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["deny"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.New || state == EState.Accepted)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Denied));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("拒绝受理申请成功!", "");
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["check"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.Replied)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Checked));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("审核申请成功!", "");
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = 25;
            SpContents.SelectCommand     = GetSelectString();
            SpContents.SortField         = nameof(IContentInfo.Taxis);
            SpContents.SortMode          = "DESC";
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (!IsPostBack)
            {
                SpContents.DataBind();
                LtlTotalCount.Text = SpContents.TotalCount.ToString();

                if (PhAccept != null)
                {
                    PhAccept.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Accept);
                    HlAccept?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Accept=True", "IDCollection", "IDCollection", "请选择需要受理的申请!", "此操作将受理所选申请,确定吗?"));
                    HlDeny?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Deny=True", "IDCollection", "IDCollection", "请选择需要拒绝的申请!", "此操作将拒绝受理所选申请,确定吗?"));
                }
                if (PhCheck != null)
                {
                    PhCheck.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Check);
                    HlCheck?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Check=True", "IDCollection", "IDCollection", "请选择需要审核的申请!", "此操作将审核所选申请,确定吗?"));
                    HlRedo?.Attributes.Add("onclick", ModalApplyRedo.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhSwitchToTranslate != null)
                {
                    PhSwitchToTranslate.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.SwitchToTranslate);
                    HlSwitchTo?.Attributes.Add("onclick", ModalApplySwitchTo.GetOpenWindowString(SiteId, ChannelId));
                    HlTranslate?.Attributes.Add("onclick", ModalApplyTranslate.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhComment != null)
                {
                    PhComment.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Comment);
                    HlComment.Attributes.Add("onclick", ModalApplyComment.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhDelete != null)
                {
                    PhDelete.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Delete) && ConfigInfo.ApplyIsDeleteAllowed;
                    HlDelete.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Delete=True", "IDCollection", "IDCollection", "请选择需要删除的申请!", "此操作将删除所选申请,确定吗?"));
                }
                //hlExport?.Attributes.Add("onclick", ModalContentExport.GetOpenWindowString(SiteId, _channelId));
            }
        }
Пример #17
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var templateId          = SqlUtils.EvalInt(e.Item.DataItem, nameof(TemplateInfo.Id));
            var templateType        = TemplateTypeUtils.GetEnumType(SqlUtils.EvalString(e.Item.DataItem, nameof(TemplateInfo.TemplateType)));
            var templateName        = SqlUtils.EvalString(e.Item.DataItem, nameof(TemplateInfo.TemplateName));
            var relatedFileName     = SqlUtils.EvalString(e.Item.DataItem, nameof(TemplateInfo.RelatedFileName));
            var createdFileFullName = SqlUtils.EvalString(e.Item.DataItem, nameof(TemplateInfo.CreatedFileFullName));
            var isDefault           = TranslateUtils.ToBool(SqlUtils.EvalString(e.Item.DataItem, nameof(TemplateInfo.IsDefault)));

            var ltlTemplateName    = (Literal)e.Item.FindControl("ltlTemplateName");
            var ltlRelatedFileName = (Literal)e.Item.FindControl("ltlRelatedFileName");
            var ltlFileName        = (Literal)e.Item.FindControl("ltlFileName");
            var ltlUseCount        = (Literal)e.Item.FindControl("ltlUseCount");
            var ltlTemplateType    = (Literal)e.Item.FindControl("ltlTemplateType");
            var ltlDefaultUrl      = (Literal)e.Item.FindControl("ltlDefaultUrl");
            var ltlCopyUrl         = (Literal)e.Item.FindControl("ltlCopyUrl");
            var ltlLogUrl          = (Literal)e.Item.FindControl("ltlLogUrl");
            var ltlCreateUrl       = (Literal)e.Item.FindControl("ltlCreateUrl");
            var ltlDeleteUrl       = (Literal)e.Item.FindControl("ltlDeleteUrl");

            var templateAddUrl = PageTemplateAdd.GetRedirectUrl(SiteId, templateId, templateType);

            ltlTemplateName.Text    = $@"<a href=""{templateAddUrl}"">{templateName}</a>";
            ltlRelatedFileName.Text = relatedFileName;

            if (templateType == TemplateType.IndexPageTemplate || templateType == TemplateType.FileTemplate)
            {
                var url = PageUtility.ParseNavigationUrl(SiteInfo, createdFileFullName, false);
                ltlFileName.Text = $"<a href='{url}' target='_blank'>{createdFileFullName}</a>";
            }

            ltlUseCount.Text = DataProvider.ChannelDao.GetTemplateUseCount(SiteId, templateId, templateType, isDefault).ToString();

            ltlTemplateType.Text = TemplateTypeUtils.GetText(templateType);

            if (templateType != TemplateType.FileTemplate)
            {
                if (isDefault)
                {
                    ltlDefaultUrl.Text = @"<span class=""badge badge-primary"">默认模板</span>";
                }
                else
                {
                    var defaultUrl = PageUtils.GetCmsUrl(SiteId, nameof(PageTemplate), new NameValueCollection
                    {
                        { "TemplateID", templateId.ToString() },
                        { "SetDefault", true.ToString() },
                        { "TemplateType", templateType.Value }
                    });
                    ltlDefaultUrl.Text =
                        $@"<a href=""{defaultUrl}"" onClick=""javascript:return confirm('此操作将把此模板设为默认,确认吗?');"">设为默认</a>";
                }
            }

            var copyUrl = PageTemplateAdd.GetRedirectUrlToCopy(SiteId, templateId);

            ltlCopyUrl.Text = $@"<a href=""{copyUrl}"">快速复制</a>";

            var logUrl = PageTemplateLog.GetRedirectUrl(SiteId, templateId);

            ltlLogUrl.Text = $@"<a href=""{logUrl}"">修订历史</a>";

            ltlCreateUrl.Text =
                $@"<a href=""javascript:;"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateByTemplate(
                    SiteId, templateId)}"">生成页面</a>";

            if (!isDefault)
            {
                var deleteUrl = PageUtils.GetCmsUrl(SiteId, nameof(PageTemplate), new NameValueCollection
                {
                    { "TemplateID", templateId.ToString() },
                    { "Delete", true.ToString() },
                    { "TemplateType", templateType.Value }
                });

                ltlDeleteUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{AlertUtils.ConfirmDelete("删除文件", $"此操作将删除模板“{templateName}”,确认吗?", deleteUrl)}"">删除</a>";
            }
        }
Пример #18
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = Constants.PageSize;

            SpContents.SelectCommand = !AuthRequest.IsQueryExists("Keyword") ? DataProvider.LogDao.GetSelectCommend() : DataProvider.LogDao.GetSelectCommend(AuthRequest.GetQueryString("UserName"), AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"), AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(LogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            VerifySystemPermissions(ConfigManager.SettingsPermissions.Log);

            if (AuthRequest.IsQueryExists("Keyword"))
            {
                TbUserName.Text = AuthRequest.GetQueryString("UserName");
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.LogDao.Delete(arraylist);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                DataProvider.LogDao.DeleteAll();
                SuccessDeleteMessage();
            }
            else if (AuthRequest.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogAdmin = !ConfigManager.SystemConfigInfo.IsLogAdmin;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogAdmin ? "启用" : "禁用")}日志记录");
            }

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogAdmin), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogAdmin), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogAdmin)
            {
                BtnSetting.Text = "禁用管理员日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用管理员日志", "此操作将禁用管理员日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogAdmin), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">管理员日志当前处于禁用状态,系统将不会记录管理员操作日志!</div>";
                BtnSetting.Text = "启用管理员日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用管理员日志", "此操作将启用管理员日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogAdmin), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
Пример #19
0
        private void RptRunnable_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.AlternatingItem && e.Item.ItemType != ListItemType.Item)
            {
                return;
            }

            var pluginInfo = (PluginInfo)e.Item.DataItem;

            var ltlLogo        = (Literal)e.Item.FindControl("ltlLogo");
            var ltlPluginId    = (Literal)e.Item.FindControl("ltlPluginId");
            var ltlPluginName  = (Literal)e.Item.FindControl("ltlPluginName");
            var ltlVersion     = (Literal)e.Item.FindControl("ltlVersion");
            var ltlOwners      = (Literal)e.Item.FindControl("ltlOwners");
            var ltlDescription = (Literal)e.Item.FindControl("ltlDescription");
            var ltlInitTime    = (Literal)e.Item.FindControl("ltlInitTime");
            var ltlCmd         = (Literal)e.Item.FindControl("ltlCmd");

            ltlLogo.Text       = $@"<img src=""{PluginManager.GetPluginIconUrl(pluginInfo.Service)}"" width=""48"" height=""48"" />";
            ltlPluginId.Text   = $@"<a href=""{PageView.GetRedirectUrl(pluginInfo.Id, GetRedirectUrl())}"">{pluginInfo.Id}</a>";
            ltlPluginName.Text = pluginInfo.Plugin.Title;
            ltlVersion.Text    = pluginInfo.Plugin.Version;
            if (pluginInfo.Plugin.Owners != null)
            {
                ltlOwners.Text = string.Join("&nbsp;", pluginInfo.Plugin.Owners);
            }

            ltlDescription.Text = pluginInfo.Plugin.Description;

            if (pluginInfo.InitTime > 1000)
            {
                ltlInitTime.Text = Math.Round((double)pluginInfo.InitTime / 1000) + "秒";
            }
            else
            {
                ltlInitTime.Text = pluginInfo.InitTime + "毫秒";
            }

            var ableUrl = PageUtils.GetPluginsUrl(nameof(PageManagement), new NameValueCollection
            {
                { pluginInfo.IsDisabled ? "enable" : "disable", true.ToString() },
                { "pluginId", pluginInfo.Id }
            });

            var deleteUrl = PageUtils.GetPluginsUrl(nameof(PageManagement), new NameValueCollection
            {
                { "delete", true.ToString() },
                { "pluginId", pluginInfo.Id }
            });

            var ableText = pluginInfo.IsDisabled ? "启用" : "禁用";

            ltlCmd.Text = $@"
<a href=""javascript:;"" onClick=""{ModalTaxis.GetOpenWindowString()}"">排序</a>
&nbsp;&nbsp;
<a href=""javascript:;"" onClick=""{AlertUtils.ConfirmRedirect($"{ableText}插件", $"此操作将会{ableText}“{pluginInfo.Id}”插件,确认吗?", ableText, ableUrl)}"">
{ableText}
</a>
&nbsp;&nbsp;
<a href=""javascript:;"" onClick=""{AlertUtils.ConfirmDelete("删除插件", $"此操作将会删除“{pluginInfo.Id}”插件,确认吗?", deleteUrl)}"">删除插件</a>";
        }
Пример #20
0
        public void BtnReload_Click(object sender, EventArgs e)
        {
            PluginManager.ClearCache();

            AddScript(AlertUtils.Success("插件重新加载成功", "插件重新加载成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
        }
Пример #21
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = !Body.IsQueryExists("LogType")
                ? DataProvider.SiteLogDao.GetSelectCommend()
                : DataProvider.SiteLogDao.GetSelectCommend(SiteId, Body.GetQueryString("LogType"),
                                                           Body.GetQueryString("UserName"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"),
                                                           Body.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(SiteLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (Body.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.SiteLogDao.Delete(arraylist);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("DeleteAll"))
            {
                try
                {
                    DataProvider.SiteLogDao.DeleteAll();
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Log);

            if (SiteId == 0)
            {
                LtlSite.Text = @"<th align=""text-center text-nowrap"">站点名称</th>";
            }

            DdlSiteId.Items.Add(new ListItem("<<全部站点>>", "0"));

            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            foreach (var psId in siteIdList)
            {
                DdlSiteId.Items.Add(new ListItem(SiteManager.GetSiteInfo(psId).SiteName, psId.ToString()));
            }

            DdlLogType.Items.Add(new ListItem("全部记录", "All"));
            DdlLogType.Items.Add(new ListItem("栏目相关记录", "Channel"));
            DdlLogType.Items.Add(new ListItem("内容相关记录", "Content"));

            if (Body.IsQueryExists("LogType"))
            {
                ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString());
                ControlUtils.SelectSingleItem(DdlLogType, Body.GetQueryString("LogType"));
                TbUserName.Text = Body.GetQueryString("UserName");
                TbKeyword.Text  = Body.GetQueryString("Keyword");
                TbDateFrom.Text = Body.GetQueryString("DateFrom");
                TbDateTo.Text   = Body.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick",
                                     PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            SpContents.DataBind();
        }
Пример #22
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            bool isChanged;
            var  parentChannelId = Utils.ToInt(Request.Form["channelId"]);

            if (parentChannelId == 0)
            {
                parentChannelId = SiteId;
            }

            try
            {
                if (string.IsNullOrEmpty(TbChannelNames.Text))
                {
                    LtlScript.Text = $"<script>{AlertUtils.Error("操作错误", "请填写需要添加的栏目名称")}</script>";
                    return;
                }

                var insertedChannelIdHashtable = new Hashtable {
                    [1] = parentChannelId
                };                                                                        //key为栏目的级别,1为第一级栏目

                var           channelNameArray = TbChannelNames.Text.Split('\n');
                List <string> indexNameList    = null;
                foreach (var item in channelNameArray)
                {
                    if (string.IsNullOrEmpty(item))
                    {
                        continue;
                    }

                    //count为栏目的级别
                    var count        = (Utils.GetStartCount('-', item) == 0) ? Utils.GetStartCount('-', item) : Utils.GetStartCount('-', item);
                    var channelName  = item.Substring(count, item.Length - count);
                    var channelIndex = string.Empty;
                    count++;

                    if (!string.IsNullOrEmpty(channelName) && insertedChannelIdHashtable.Contains(count))
                    {
                        if (CbIsNameToIndex.Checked)
                        {
                            channelIndex = channelName.Trim();
                        }

                        if (Utils.Contains(channelName, "(") && Utils.Contains(channelName, ")"))
                        {
                            var length = channelName.IndexOf(')') - channelName.IndexOf('(');
                            if (length > 0)
                            {
                                channelIndex = channelName.Substring(channelName.IndexOf('(') + 1, length);
                                channelName  = channelName.Substring(0, channelName.IndexOf('('));
                            }
                        }
                        channelName  = channelName.Trim();
                        channelIndex = channelIndex.Trim(' ', '(', ')');
                        if (!string.IsNullOrEmpty(channelIndex))
                        {
                            if (indexNameList == null)
                            {
                                indexNameList = GetChannelIndexList();
                            }
                            if (indexNameList.IndexOf(channelIndex) != -1)
                            {
                                channelIndex = string.Empty;
                            }
                            else
                            {
                                indexNameList.Add(channelIndex);
                            }
                        }

                        var parentId       = (int)insertedChannelIdHashtable[count];
                        var parentNodeInfo = Main.ChannelApi.GetChannelInfo(SiteId, parentId);

                        var channelInfo = Main.ChannelApi.NewInstance(SiteId);

                        channelInfo.ParentId             = parentId;
                        channelInfo.ChannelName          = channelName;
                        channelInfo.IndexName            = channelIndex;
                        channelInfo.ContentModelPluginId = Main.PluginId;
                        channelInfo.ChannelTemplateId    = parentNodeInfo.ChannelTemplateId;
                        channelInfo.ContentTemplateId    = parentNodeInfo.ContentTemplateId;

                        var insertedChannelId = Main.ChannelApi.Insert(SiteId, channelInfo);
                        insertedChannelIdHashtable[count + 1] = insertedChannelId;
                    }
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                isChanged      = false;
                LtlScript.Text = $"<script>{AlertUtils.Error("操作错误", ex.Message)}</script>";
            }

            if (isChanged)
            {
                LtlScript.Text = $"<script>{AlertUtils.Success("操作成功", "您已成功添加栏目,点击确认返回", "确 认", $"location.href = '{_redirectUrl}'")}</script>";
            }
        }
Пример #23
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = !AuthRequest.IsQueryExists("LogType")
                ? DataProvider.SiteLogDao.GetSelectCommend()
                : DataProvider.SiteLogDao.GetSelectCommend(SiteId, AuthRequest.GetQueryString("LogType"),
                                                           AuthRequest.GetQueryString("UserName"), AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"),
                                                           AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(SiteLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                DataProvider.SiteLogDao.Delete(arraylist);
                SuccessDeleteMessage();
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                DataProvider.SiteLogDao.DeleteAll();
                SuccessDeleteMessage();
            }
            else if (AuthRequest.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogSite = !ConfigManager.SystemConfigInfo.IsLogSite;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogSite ? "启用" : "禁用")}日志记录");
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Log);

            if (SiteId == 0)
            {
                LtlSite.Text = @"<th align=""text-center text-nowrap"">站点名称</th>";
            }

            DdlSiteId.Items.Add(new ListItem("<<全部站点>>", "0"));

            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            foreach (var psId in siteIdList)
            {
                DdlSiteId.Items.Add(new ListItem(SiteManager.GetSiteInfo(psId).SiteName, psId.ToString()));
            }

            DdlLogType.Items.Add(new ListItem("全部记录", "All"));
            DdlLogType.Items.Add(new ListItem("栏目相关记录", "Channel"));
            DdlLogType.Items.Add(new ListItem("内容相关记录", "Content"));

            if (AuthRequest.IsQueryExists("LogType"))
            {
                ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString());
                ControlUtils.SelectSingleItem(DdlLogType, AuthRequest.GetQueryString("LogType"));
                TbUserName.Text = AuthRequest.GetQueryString("UserName");
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick",
                                     PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogSite)
            {
                BtnSetting.Text = "禁用站点日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用站点日志", "此操作将禁用站点日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">站点日志当前处于禁用状态,系统将不会记录站点操作日志!</div>";
                BtnSetting.Text = "启用站点日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用站点日志", "此操作将启用站点日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
Пример #24
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var list = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.ErrorLogDao.Delete(list);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("DeleteAll"))
            {
                try
                {
                    DataProvider.ErrorLogDao.DeleteAll();
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = DataProvider.ErrorLogDao.GetSelectCommend(Body.GetQueryString("PluginId"), Body.GetQueryString("Keyword"),
                                                                                 Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(ErrorLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            DdlPluginId.Items.Add(new ListItem("全部错误", string.Empty));
            foreach (var pluginInfo in PluginManager.AllPluginInfoList)
            {
                DdlPluginId.Items.Add(new ListItem(pluginInfo.Id, pluginInfo.Id));
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Log);

            if (Body.IsQueryExists("Keyword"))
            {
                ControlUtils.SelectSingleItem(DdlPluginId, Body.GetQueryString("PluginId"));
                TbKeyword.Text  = Body.GetQueryString("Keyword");
                TbDateFrom.Text = Body.GetQueryString("DateFrom");
                TbDateTo.Text   = Body.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            SpContents.DataBind();
        }
Пример #25
0
        public static string GetAutoCheckKeywordsScript(SiteInfo siteInfo)
        {
            var isAutoCheckKeywords = siteInfo.Additional.IsAutoCheckKeywords.ToString().ToLower();
            var url         = AjaxCmsService.GetDetectionReplaceUrl(siteInfo.Id);
            var getPureText = ETextEditorTypeUtils.GetPureTextScript(BackgroundContentAttribute.Content);
            var getContent  = ETextEditorTypeUtils.GetContentScript(BackgroundContentAttribute.Content);
            var setContent  = ETextEditorTypeUtils.GetSetContentScript(BackgroundContentAttribute.Content, "htmlContent");
            var tipsWarn    = AlertUtils.Warning("敏感词检测", "内容中共检测到' + i + '个敏感词,已用黄色背景标明", "取 消", "自动替换并保存",
                                                 "autoReplaceKeywords");

            var command = $@"
<script type=""text/javascript"">
var bairongKeywordArray;
function autoCheckKeywords() {{
    if({isAutoCheckKeywords}) {{
        var pureText = {getPureText}
        var htmlContent = {getContent}
	    $.post('{url}&r=' + Math.random(), {{content:pureText}}, function(data) {{
		    if(data) {{
                bairongKeywordArray = data;
			    var arr = data.split(',');
                var i=0;
			    for(;i<arr.length;i++)
			    {{
                    var tmpArr = arr[i].split('|');
                    var keyword = tmpArr[0];
                    var replace = tmpArr.length==2?tmpArr[1]:'';
                    var reg = new RegExp(keyword, 'gi');
				    htmlContent = htmlContent.replace(reg,'<span style=""background-color:#ffff00;"">' + keyword + '</span>');
			    }}
			    {setContent}
                {tipsWarn}
		    }} else {{
                $('#BtnSubmit').attr('onclick', '').click();
            }}
	    }});
        return false;	
    }}
}}
function autoReplaceKeywords() {{
    var arr = bairongKeywordArray.split(',');
    var i=0;
    var htmlContent = {getContent}
	for(;i<arr.length;i++)
	{{
        var tmpArr = arr[i].split('|');
        var keyword = tmpArr[0];
        var replace = tmpArr.length==2?tmpArr[1]:'';
        var reg = new RegExp('<span style=""background-color:#ffff00;"">' + keyword + '</span>', 'gi');
		htmlContent = htmlContent.replace(reg, replace);
        //IE8
        reg = new RegExp('<span style=""background-color:#ffff00"">' + keyword + '</span>', 'gi');
		htmlContent = htmlContent.replace(reg, replace);
	}}
    {setContent}
    $('#BtnSubmit').attr('onclick', '').click();
}}
</script>
";



            return(command);
        }
Пример #26
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var list = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.ErrorLogDao.Delete(list);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                try
                {
                    DataProvider.ErrorLogDao.DeleteAll();
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogError = !ConfigManager.SystemConfigInfo.IsLogError;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogError ? "启用" : "禁用")}日志记录");
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = DataProvider.ErrorLogDao.GetSelectCommend(AuthRequest.GetQueryString("PluginId"), AuthRequest.GetQueryString("Keyword"),
                                                                                 AuthRequest.GetQueryString("DateFrom"), AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(ErrorLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            DdlPluginId.Items.Add(new ListItem("全部错误", string.Empty));
            foreach (var pluginInfo in PluginManager.AllPluginInfoList)
            {
                DdlPluginId.Items.Add(new ListItem(pluginInfo.Id, pluginInfo.Id));
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Log);

            if (AuthRequest.IsQueryExists("Keyword"))
            {
                ControlUtils.SelectSingleItem(DdlPluginId, AuthRequest.GetQueryString("PluginId"));
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogError)
            {
                BtnSetting.Text = "禁用系统错误日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用系统错误日志", "此操作将禁用系统错误日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">系统错误日志当前处于禁用状态,系统将不会记录系统错误日志!</div>";
                BtnSetting.Text = "启用记录日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用系统错误日志", "此操作将启用系统错误日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
Пример #27
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("delete"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.Delete(pluginId);
                Body.AddAdminLog("删除插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件删除成功", "插件删除成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            if (Body.IsQueryExists("enable"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, false);
                Body.AddAdminLog("启用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件启用成功", "插件启用成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }
            else if (Body.IsQueryExists("disable"))
            {
                var pluginId = Body.GetQueryString("pluginId");

                PluginManager.UpdateDisabled(pluginId, true);
                Body.AddAdminLog("禁用插件", $"插件:{pluginId}");

                CacheUtils.ClearAll();
                CacheDbUtils.Clear();

                AddScript(AlertUtils.Success("插件禁用成功", "插件禁用成功,系统需要重载页面", "重新载入", "window.top.location.reload();"));
            }

            if (Page.IsPostBack)
            {
                return;
            }

            PageType = Body.GetQueryInt("type", 1);

            VerifyAdministratorPermissions(ConfigManager.Permissions.Plugins.Management);

            var listEnabled  = new List <PluginInfo>();
            var listDisabled = new List <PluginInfo>();
            var listError    = new List <PluginInfo>();

            foreach (var pluginInfo in PluginManager.AllPluginInfoList)
            {
                if (pluginInfo.Plugin == null)
                {
                    CountError++;
                    listError.Add(pluginInfo);
                }
                else
                {
                    if (pluginInfo.IsDisabled)
                    {
                        CountDisabled++;
                        listDisabled.Add(pluginInfo);
                    }
                    else
                    {
                        CountEnabled++;
                        listEnabled.Add(pluginInfo);
                    }
                }
            }

            RptEnabled.DataSource     = listEnabled;
            RptEnabled.ItemDataBound += RptRunnable_ItemDataBound;
            RptEnabled.DataBind();

            RptDisabled.DataSource     = listDisabled;
            RptDisabled.ItemDataBound += RptRunnable_ItemDataBound;
            RptDisabled.DataBind();

            RptError.DataSource     = listError;
            RptError.ItemDataBound += RptError_ItemDataBound;
            RptError.DataBind();
        }