Exemplo n.º 1
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>
        }
Exemplo n.º 2
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
        }
Exemplo n.º 3
0
        public static string GetTextEditorCommands(PublishmentSystemInfo publishmentSystemInfo, string attributeName)
        {
            var builder = new StringBuilder();

            builder.Append(
                $@"<div class=""btn_word"" onclick=""{ModalTextEditorImportWord.GetOpenWindowString(
                    publishmentSystemInfo.PublishmentSystemId, attributeName)}"">导入Word</div>");

            builder.Append(
                $@"<div class=""btn_video"" onclick=""{ModalTextEditorInsertVideo.GetOpenWindowString(
                    publishmentSystemInfo.PublishmentSystemId, attributeName)}"">插入视频</div>");

            builder.Append(
                $@"<div class=""btn_audio"" onclick=""{ModalTextEditorInsertAudio.GetOpenWindowString(
                    publishmentSystemInfo.PublishmentSystemId, attributeName)}"">插入音频</div>");

            var command = @"<div class=""btn_keywords"" onclick=""getWordSpliter();"">提取关键字</div>
<script type=""text/javascript"">
function getWordSpliter(){
    var pureText = [getPureText]
	$.post('[url]&r=' + Math.random(), {content:pureText}, function(data) {
		if(data !=''){
			$('#Tags').val(data).focus();
		}else{
            [tips]
        }
	});	
}
</script>
";

            command = command.Replace("[url]", AjaxCmsService.GetWordSpliterUrl(publishmentSystemInfo.PublishmentSystemId));
            command = command.Replace("[getPureText]", ETextEditorTypeUtils.GetPureTextScript(attributeName));
            command = command.Replace("[tips]", PageUtils.GetOpenTipsString("对不起,内容不足,无法提取关键字", PageUtils.TipsError));

            builder.Append(command);

            command = @"<div class=""btn_detection"" onclick=""detection_[attributeName]();"">敏感词检测</div>
<script type=""text/javascript"">
function detection_[attributeName](){
    var pureText = [getPureText]
    var htmlContent = [getContent]
    var keyword = '';
	$.post('[url]&r=' + Math.random(), {content:pureText}, function(data) {
        debugger;
		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;
			[setContent]
            [tips_warn]
		}else{
            [tips_success]
        }
	});	
}
</script>
";
            command = command.Replace("[attributeName]", attributeName);
            command = command.Replace("[url]", AjaxCmsService.GetDetectionUrl(publishmentSystemInfo.PublishmentSystemId));
            command = command.Replace("[getPureText]", ETextEditorTypeUtils.GetPureTextScript(attributeName));
            command = command.Replace("[getContent]", ETextEditorTypeUtils.GetContentScript(attributeName));
            command = command.Replace("[setContent]", ETextEditorTypeUtils.GetSetContentScript(attributeName, "htmlContent"));
            command = command.Replace("[tips_warn]", PageUtils.GetOpenTipsString("共检测到' + i + '个敏感词,内容已用黄色背景标明", PageUtils.TipsWarn));
            command = command.Replace("[tips_success]", PageUtils.GetOpenTipsString("检测成功,没有检测到任何敏感词", PageUtils.TipsSuccess));
            builder.Append(command);

            return(builder.ToString());
        }