/// <summary> /// XML help? /// </summary> public string GetUrl(string Id) { string Url = null; ROYcms.Sys.BLL.ROYcms_class ___ROYcms_class = new ROYcms.Sys.BLL.ROYcms_class(); ROYcms.Sys.BLL.ROYcms_news ___ROYcms_news = new ROYcms.Sys.BLL.ROYcms_news(); ROYcms.Sys.BLL.ROYcms_Url ___ROYcms_Url = new ROYcms.Sys.BLL.ROYcms_Url(); int ClassId = Convert.ToInt32(___ROYcms_news.GetField(Convert.ToInt32(Id), "classname")); string ShowRules = ___ROYcms_class.GetClassField(ClassId, "ShowRules"); string jumpurl = ___ROYcms_news.GetField(Convert.ToInt32(Id), "jumpurl").Trim(); ShowRules = ShowRules.Replace("{id}", Id).Replace("{yyyy}/{MM}/{dd}/", "show_"); if (jumpurl.Length > 2) { Url = jumpurl; } else { if (___ROYcms_Url.Exists_bh(Convert.ToInt32(Id))) { Url = ___ROYcms_Url.GetUrl(Convert.ToInt32(Id)); } else { Url = (___ROYcms_class.GetClassField(ClassId, "FilePath").Replace("{cmspath}/", "/")) + ShowRules; } } return(Url); }
/// <summary> /// 获取地址 /// </summary> /// <param name="Id">新闻ID</param> /// <param name="Class">分类ID</param> /// <param name="Div">层级</param> /// <returns></returns> public string GetLink(int Id, int Class, int Div) { string Url = null; try { if (Class == 0) //返回文章URL地址 { int ClassId = Convert.ToInt32(ROYcms_newsBLL.GetField(Id, "classname")); string ShowRules = ROYcms_classBll.GetClassField(ClassId, "ShowRules"); string jumpurl = ROYcms_newsBLL.GetField(Id, "jumpurl").Trim(); ShowRules = ShowRules.Replace("{id}", Id.ToString()).Replace("{yyyy}/{MM}/{dd}/", "show_"); if (jumpurl.Length > 2) //如果启用跳转则输出跳转的URL { Url = jumpurl; } else { //if (ROYcms_UrlBLL.Exists_bh(Convert.ToInt32(Id))) { Url = ___ROYcms_Url.GetUrl(Convert.ToInt32(this.Rid)); } //else //{ Url = (ROYcms_classBll.GetClassField(ClassId, "FilePath").Replace("{cmspath}/", "/")) + ShowRules; //} } } else //返回列表的链接地址 默认是封面 1是频道 { if (Div == 1) { string ListRules = ROYcms_classBll.GetClassField(Class, "ListeRules"); Url = (ROYcms_classBll.GetClassField(Class, "FilePath").Replace("{cmspath}/", "/")) + ListRules.Replace("{class}", Class.ToString()); } else { string DefaultFile = ROYcms_classBll.GetClassField(Class, "DefaultFile"); if (DefaultFile == "index.aspx") { DefaultFile = ""; } Url = (ROYcms_classBll.GetClassField(Class, "FilePath").Replace("{cmspath}/", "/")) + DefaultFile; } } return(Url); } catch { return("<!--输出错误!-->"); } }
/// <summary> /// 返回文章URL /// </summary> /// <param name="Rid"></param> /// <returns></returns> public string GetArticle(int Rid) { try { string Url = null; if (IsStatic) { Url = this.GetStaticArticle(Rid); } else { Url = "/Article-" + Rid.ToString() + ".aspx"; string jumpurl = NewBll.GetField(Rid, "jumpurl") == null ? "" : NewBll.GetField(Rid, "jumpurl").Trim(); //跳转地址 if (jumpurl.Length > 2) //跳转地址 { Url = jumpurl; } } return(Url); } catch { return(null); } }
/// <summary> /// 输出 /// </summary> /// <param name="output">The output.</param> protected override void Render(HtmlTextWriter output) { ROYcms.Sys.BLL.ROYcms_news ___ROYcms_news = new ROYcms.Sys.BLL.ROYcms_news(); ROYcms.Sys.BLL.ROYcms_Custom ROYcms_CustomBLL = new ROYcms.Sys.BLL.ROYcms_Custom(); string MainField = null; try { if (Array.IndexOf(ROYcms.Common.Zn_En.MainField(), Name) != -1) //是默认字段 { MainField = ___ROYcms_news.GetField(Convert.ToInt32(Rid), ROYcms.Common.Zn_En.Fy(Name)); } else { int Class = Convert.ToInt32(___ROYcms_news.GetClassName(Convert.ToInt32(Rid))); //获取Class MainField = ROYcms_CustomBLL.GetVal(Convert.ToInt32(Rid), Class, Name); //获取自定义字段的名字 } output.Write(MainField); } catch { output.Write("<!--输出错误!-->"); } }
/// <summary> /// 输出智能表单 返回一个字段的HTML的描述 方法 /// </summary> /// <param name="Name">字段名称 字段名称</param> /// <param name="Lable">字段的Lable 字段的Lable</param> /// <param name="Len">字段的长度 字段的长度</param> /// <param name="FieldType">字段的类型 字段的类型</param> /// <param name="IsNull">是否为空 是否为空</param> /// <param name="DefaultVal">默认值 默认值</param> /// <param name="Display">显示可见状态 显示可见状态</param> /// <param name="InputType"> input输入框的类型</param> /// <param name="InputLen">Input的显示长度</param> /// <returns>返回一个字段的HTML的描述</returns> public static string FormPut(string Id, string Class, string Name, string Lable, string Len, string FieldType, string IsNull, string DefaultVal, string Display, string InputType, string InputLen) { ROYcms.Sys.BLL.ROYcms_Custom CustomBLL = new ROYcms.Sys.BLL.ROYcms_Custom(); ROYcms.Sys.BLL.ROYcms_news ROYcms_newsBLL = new ROYcms.Sys.BLL.ROYcms_news(); string FieldVal = null; if (Id != null && Class != null) //如果是编辑 { if (!Name.Contains("_R")) { FieldVal = CustomBLL.GetVal(Convert.ToInt32(Id), Convert.ToInt32(Class), Name); } else { if (Name == "_RTitle") { FieldVal = ROYcms_newsBLL.GetField(Convert.ToInt32(Id), "title"); } else if (Name == "_RContent") { FieldVal = ROYcms_newsBLL.GetField(Convert.ToInt32(Id), "contents"); } } } DefaultVal = FieldVal; string Html = null; string input = "<input id='ROYcms_[Name]' name='ROYcms_[Name]' type='[InputType]' value='[DefaultVal]' maxlength='[Len]' style='width:[InputLen]px;' class='txtInput' />"; string textarea = "<textarea id='ROYcms_[Name]' name='ROYcms_[Name]'>[DefaultVal]</textarea>"; string Editor = @"<script> var editor; KindEditor.ready(function(K) { editor = K.create('#ROYcms_[Name]',{ cssPath : '/Administrator/Editor/plugins/code/prettify.css', uploadJson : '/Administrator/Editor/C/upload_json.ashx?root=News,Content', fileManagerJson : '/Administrator/Editor/C/file_manager_json.ashx?root=News,Content', autoHeightMode : true, allowFileManager : true }); }); </script> <textarea class='REditor' id='ROYcms_[Name]' name='ROYcms_[Name]' style='width:100%;height:360px;'>[DefaultVal]</textarea>"; string EditorBasic = @"<script> var Editor[Name]; KindEditor.ready(function(K) { Editor[Name] = K.create('#ROYcms_[Name]', { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, items : [ 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'] }); }); </script> <textarea class='REditor' id='ROYcms_[Name]' name='ROYcms_[Name]' style='width:[InputLen]px;height:200px;'>[DefaultVal]</textarea>"; string UFile = @" <script> KindEditor.ready(function(K) { var editor = K.editor({ cssPath : '/Administrator/Editor/plugins/code/prettify.css', uploadJson : '/Administrator/Editor/C/upload_json.ashx?root=News,Content', fileManagerJson : '/Administrator/Editor/C/file_manager_json.ashx?root=News,Content', allowFileManager : true }); K('#fileDialog[Name]').click(function() { editor.loadPlugin('insertfile', function() { editor.plugin.fileDialog({ fileUrl : K('#ROYcms_[Name]').val(), clickFn : function(url, title) { K('#ROYcms_[Name]').val(url); editor.hideDialog(); } }); }); }); }); </script> <input type='text' id='ROYcms_[Name]' name='ROYcms_[Name]' value='[DefaultVal]' class='txtInput' /> <input type='button' id='fileDialog[Name]' value='选择文件' /> "; string UImg = @" <script> KindEditor.ready(function(K) { var editor = K.editor({ cssPath : '/Administrator/Editor/plugins/code/prettify.css', uploadJson : '/Administrator/Editor/C/upload_json.ashx?root=News,Content', fileManagerJson : '/Administrator/Editor/C/file_manager_json.ashx?root=News,Content', allowFileManager : true }); K('#imageDialog[Name]').click(function() { editor.loadPlugin('image', function() { editor.plugin.imageDialog({ imageUrl : K('#ROYcms_[Name]').val(), clickFn : function(url, title, width, height, border, align) { K('#ROYcms_[Name]').val(url); editor.hideDialog(); } }); }); }); }); </script> <input type='text' id='ROYcms_[Name]' name='ROYcms_[Name]' value='[DefaultVal]' class='txtInput' /> <input type='button' id='imageDialog[Name]' value='选择图片' /> "; if (InputType == "1") //文本框 { Html = input; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "2") //多行输入 { Html = textarea; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "3") //单选按钮 { Html = input; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "4") //复选框 { Html = input; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "5") //下拉列表 { Html = input; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "6" && Name.Contains("_RContent")) //编辑器 复杂 { Html = Editor; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "6" && !Name.Contains("_RContent")) //编辑器 简单 { Html = EditorBasic; Html = Html.Replace("[Name]", Name.Trim()); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "7") //上传图片 { Html = UImg; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } else if (InputType == "8") //上传文件 { Html = UFile; Html = Html.Replace("[Name]", Name); Html = Html.Replace("[InputType]", "text"); Html = Html.Replace("[InputLen]", InputLen); Html = Html.Replace("[DefaultVal]", DefaultVal); Html = Html.Replace("[Len]", (Convert.ToInt32(Len) / 2).ToString()); } return(Html); }