void LoadFromMap() { string tmpfolder = CDHelper.Config.DefaultTemplateGroupFileName; tmpfolder = tmpfolder.Remove(tmpfolder.IndexOf(".")); tmpfolder = Path.Combine(HttpContext.Current.Server.MapPath("~/" + CDHelper.Config.SiteSkinsBasePath), tmpfolder + ".map"); if (File.Exists(tmpfolder)) { TemplateMap tm = new TemplateMap(tmpfolder); Channel ch = ChannelHelper.GetChannel(ChannelID, null); ChannelTemplateGroup cg = tm.GetChannelTemplate(ch.FullUrl); if (cg != null) { TemplateIDTextBox.Text = cg.IndexTemplate; DetailTemplateIDTextBox.Text = cg.DetailTemplate; ListTemplateIDTextBox.Text = cg.ListTemplate; SearchTemplateIDTextBox.Text = cg.SearchTemplate; indexCheckbox.Checked = cg.IndexInherit; listCheckbox.Checked = cg.ListInherit; detailCheckbox.Checked = cg.DetailInherit; searchCheckbox.Checked = cg.SearchInherit; } } else { ShowInfomation(); } }
/// <summary> /// 构建当前位置导航 /// </summary> /// <returns></returns> string BuildPagePath() { string pos = "开始 > <a >本站设置</a> > <a >栏目管理</a> > {0} > {1}"; string channelFullPath = ""; string action = "创建子栏目"; if (ChannelID != null) { Channel ch = ChannelHelper.GetChannel(ChannelID, null); if (ch != null) { channelFullPath = ChannelHelper.FullPathFormat(ch.FullPath, " > "); action = "栏目修改"; } } else if (ParentID != null) { Channel pch = ChannelHelper.GetChannel(ParentID, null); if (pch != null) { channelFullPath = ChannelHelper.FullPathFormat(pch.FullPath, " > "); action = "栏目修改"; } } return(string.Format(pos, channelFullPath, action)); }
string DelChannel() { if (!CheckChannelPermission()) { return("无法删除此栏目,没有权限!"); } if (!We7Helper.IsEmptyID(ChannelID)) { List <Channel> listSon = ChannelHelper.GetChannels(ChannelID); if (listSon != null) { if (listSon.Count > 0) { return("栏目下有子栏目不能删除,请您先删除子栏目后再试。"); } } //删除节点 Channel ch = ChannelHelper.GetChannel(ChannelID, new string[] { "Name", "FullUrl" }); ChannelHelper.DeleteChannel(ChannelID); TemplateMap.DeleteChannelUrls(ch.FullUrl); TemplateMap.ResetInstance(); //记录日志 string content = string.Format("删除栏目:“{0}”", ch.Name); AddLog("栏目管理", content); } return("0"); }
protected void Page_Load(object sender, EventArgs e) { InitControls(); if (!IsPostBack) { if (ChannelID == null) { if (!We7Helper.IsEmptyID(ParentID)) { Channel ch = ChannelHelper.GetChannel(ParentID, new string[] { "FullPath", "Name" }); string pn = ch.FullPath; channelUrlLabel.InnerHtml = ch.FullUrl; } SaveButton2.Value = "创建栏目"; CreatedLabel.Text = "即将创建……"; ReturnUrlRowDisplay = "none"; } else { if (We7Helper.IsEmptyID(ChannelID)) { throw new CDException(TextCannotModifyColumn); } ShowInfomation(); if (Request["saved"] != null && Request["saved"].ToString() == "1") { Messages.ShowMessage("栏目已成功创建。"); Response.Write(string.Format("<script language=javascript>window.parent.freshNodeTree('{0}','{1}');</script>", We7Helper.RemoveBrarket(ChannelID), NameTextBox.Text)); } } CheckChannelPermission(); } }
/// <summary> /// 获取当前栏目对象 /// </summary> /// <returns>当前栏目</returns> protected Channel GetThisChannel() { string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); return(ch); }
string GetNodeContent(string ChannelID) { if (!We7Helper.IsEmptyID(ChannelID)) { string id = ChannelID; Channel ch = ChannelHelper.GetChannel(id, null); StringBuilder sb = new StringBuilder(); sb.Append("<div class=itemDetail style=line-height:220%><ul>"); sb.Append("<li>栏目名称:" + ch.Name + "</li>"); //sb.Append("<li>唯一名称:" + ch.ChannelName + "</li>"); sb.Append("<li>Url地址:<a href=\"" + ch.FullUrl + "\" target=\"_blank\"><u>" + ch.FullUrl + "</u></a></li>"); //sb.Append("<li>别名:" + ch.Alias + "</li>"); //sb.Append(string.Format("<li>文件存放目录:<a href=Folder.aspx?folder={0}&filter=*&create=auto target=ifRightDetail><u>{0}</u></a></li>", string.Format("\\{0}\\{1}", Constants.ChannelPath, ch.ChannelFolder))); //if(TemplateHelper.GetTemplateName(ch.TemplateName)==string.Empty) // sb.Append(string.Format("<li>索引模板:<u>{0}(模板文件不存在)</u></li>", ch.TemplateName)); //else // sb.Append(string.Format("<li>索引模板:<a href=Compose.aspx?file={0} target=_blank><u>{1}</u></a></li>", ch.TemplateName, TemplateHelper.GetTemplateName(ch.TemplateName))); //if (TemplateHelper.GetTemplateName(ch.DetailTemplate) == string.Empty) // sb.Append(string.Format("<li>详细页模板:<u>{0}(模板文件不存在)</u></li>", ch.DetailTemplate)); //else // sb.Append(string.Format("<li>详细页模板:<a href=Compose.aspx?file={0} target=_blank><u>{1}</u></a></li>", ch.DetailTemplate, TemplateHelper.GetTemplateName(ch.DetailTemplate))); sb.Append("<li>安全级别:" + ch.SecurityLevelText + "</li>"); sb.Append("<li>类型:" + ch.TypeText + "</li>"); sb.Append("<li>状态:" + ch.StateText + "</li>"); sb.Append("</ul><div>"); return(sb.ToString()); } else { return(string.Empty); } }
/// <summary> /// 判断访问该栏目的权限 /// </summary> /// <returns></returns> void HasReadPermission() { string BindColumnID = ArticleHelper.GetArticle(OwnerID, new string[] { "OwnerID" }).OwnerID; Channel ch = ChannelHelper.GetChannel(BindColumnID, new string[] { "SecurityLevel" }); if (ch.SecurityLevel == 1) { if (AccountID != null) { FileDownload(FormatUrl()); } else { Response.Write("<script language='javascript'>alert('您还没有登陆,请登陆后再下载该附件');window.location='Login.aspx';</script>"); } } else if (ch.SecurityLevel == 2) { if (AccountID != null) { // "您没有权限下载该附件"; } else { Response.Write("<script language='javascript'>alert('您还没有登陆,请登陆后再下载该附件');window.location='Login.aspx';</script>"); } } else { FileDownload(FormatUrl()); } }
/// <summary> /// 获得当前栏目下的第一篇文章 /// </summary> /// <returns></returns> protected Article GetThisArticle() { string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); Criteria c = new Criteria(CriteriaType.Equals, "ChannelFullUrl", ch.FullUrl); c.Add(CriteriaType.Equals, "State", 1); Order[] os = new Order[] { new Order("Updated", OrderMode.Desc) }; List <Article> aList = Assistant.List <Article>(c, os, 0, 1, new string[] { "ID", "Title", "ChannelFullUrl", "Created", "SN" }); if (aList != null && aList.Count > 0) { return(aList[0]); } else { return(new Article()); } }
void DoChannelType() { string msg = ""; Channel ch = ChannelHelper.GetChannel(OwnerID, null); if (ch != null) { switch ((TypeOfChannel)int.Parse(ch.Type)) { case TypeOfChannel.RssOriginal: msg = "本栏目为RSS源信息展示,不可以发布信息。"; break; case TypeOfChannel.BlankChannel: msg = "本栏目为空节点栏目,不可以在此栏目下发布信息。"; break; case TypeOfChannel.ReturnChannel: msg = "本栏目已经跳转到另外的地址: " + ch.ReturnUrl; break; default: break; } if (msg != "") { Response.Write(msg); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { DoChannelType(); DoModel(); if (Request["notiframe"] != null) { NameLabel.Text = "全部"; TitleH2.Visible = true; if (!We7Helper.IsEmptyID(OwnerID)) { string chTitle = ChannelHelper.GetChannel(OwnerID, new string[] { "Name" }).Name; NameLabel.Text = string.Format("栏目『{0}』下", chTitle); } if (!string.IsNullOrEmpty(Tag)) { NameLabel.Text += string.Format("标签为”{0}“", Tag); } NameLabel.Text += "信息"; ListTypeHyperLink.NavigateUrl = "articlelist.aspx" + Request.Url.Query; TreeTypeHyperLink.NavigateUrl = "articles.aspx" + Request.Url.Query; } else { if (!CheckChannelPermission()) { Response.Write("您没有权限管理此栏目下信息!"); } } }
protected override void Initialize() { if (!We7Helper.IsEmptyID(CommentID)) { Comments cm = CommentsHelper.GetComment(CommentID, null); AuthorLiteral.Text = cm.Author; IPLiteral.Text = cm.IP; ContentLiteral.Text = cm.Content; TimeLiteral.Text = cm.Created.ToString(); StateLiteral.Text = cm.AuditText; try { SummaryLabel.Text = String.Format("管理文章:“{0}”的评论", ArticleHelper.GetArticle(cm.ArticleID, new string[] { "Title" }).Title); } catch { string chID = ChannelHelper.GetChannelIDByOnlyName(cm.ArticleID); Channel ch = ChannelHelper.GetChannel(chID, new string[] { "FullPath" }); if (ch != null) { SummaryLabel.Text = String.Format("管理栏目:“{0}”的评论", ch.FullPath); } } RefreshHyperLink.NavigateUrl = String.Format("CommentDetail.aspx?id={0}", CommentID); } else { MessageLabel.Text = "没有任何评论"; } }
public object Do(PanelContext data) { string oid = data.Objects["oid"] as string; if (We7Helper.IsEmptyID(oid)) { UIHelper.Message.AppendInfo(MessageType.ERROR, "不能移动到根栏目"); } ChannelHelper chHelper = HelperFactory.Instance.GetHelper <ChannelHelper>(); Channel channel = chHelper.GetChannel(oid, null); if (channel == null) { throw new Exception("当前栏目不存在"); } if (channel.ModelName != data.ModelName) { throw new Exception("移动到的栏目类型与当前栏目类型不一致"); } List <DataKey> dataKeys = data.State as List <DataKey>; foreach (DataKey key in dataKeys) { string id = key["ID"] as string; if (DbHelper.CheckTableExits(data.Table.Name)) { DbHelper.ExecuteSql(String.Format("UPDATE [{0}] SET [OwnerID]='{2}' WHERE [ID]='{1}'", data.Table.Name, id, oid)); } } UIHelper.SendMessage("移动成功"); CacheRecord.Create(data.ModelName).Release(); return(null); }
protected override void Initialize() { string rawurl = Request.RawUrl; rawurl = We7Helper.RemoveParamFromUrl(rawurl, "keyword"); string qString = @"<label class=""hidden"" for=""user-search-input"">ËÑË÷{0}:</label> <input type=""text"" class=""search-input"" id=""KeyWord"" name=""KeyWord"" value="""" onKeyPress=""javascript:KeyPressSearch('{1}',event);"" /> <input type=""button"" value=""ËÑË÷"" class=""button"" id=""SearchButton"" onclick=""javascript:doSearch('{1}');"" />"; qString = string.Format(qString, "À¸Ä¿", rawurl); SearchSimpleLiteral.Text = qString; MyChannelList = new ArrayList(); List<Channel> allChannel = null; if (!string.IsNullOrEmpty(ChannelType) && ChannelType.ToString() == "link") { allChannel = ChannelHelper.GetAllLinkChannels(); } else if (!string.IsNullOrEmpty(ChannelType) && ChannelType.ToString() == "article") { allChannel = ChannelHelper.GetChannelByModelName(""); } else { Channel ch = ChannelHelper.GetChannel(ColumnID, null); string enumState = ""; if (ch != null) enumState = ch.EnumState; allChannel = ChannelHelper.GetChannelsByType(enumState); } if (allChannel != null) { GetSubChannels(We7Helper.EmptyGUID, "", allChannel); } MyChannelList = FilterByKeyword(); DetailGridView.DataSource = MyChannelList; DetailGridView.DataBind(); }
/// <summary> /// 取得文章标题 /// </summary> /// <param name="id">文章ID</param> /// <returns></returns> public string GetUrl(string id) { if (!ChannelMap.ContainsKey(BindColumnID)) { ChannelMap[BindColumnID] = ChannelHelper.GetChannel(BindColumnID, null).FullUrl; } return(String.Format("{0}{1}.html", ChannelMap[BindColumnID], id.Trim('{').Trim('}').Replace("-", "_"))); }
protected void Page_Load(object sender, EventArgs e) { Channel ch = ChannelHelper.GetChannel(Request["oid"], null); if (ch != null) { NameLabel.Text = ch.Name; } }
public void InitChannels(Channel currentChannel) { if (currentChannel != null) { lsChannels.Add(currentChannel); Channel tempChanel = ChannelHelper.GetChannel(currentChannel.ID, null); InitChannels(tempChanel); } }
void ShowInfomation() { Channel ch = ChannelHelper.GetChannel(ChannelID, null); ParentID = ch.ParentID; TemplateIDTextBox.Text = ch.TemplateName; DetailTemplateIDTextBox.Text = ch.DetailTemplate; }
/// <summary> /// 取得数据列表 /// </summary> /// <returns>文章列表</returns> List <Article> GetArticleListFromDB() { ArticleQuery query = new ArticleQuery(); List <Article> list = new List <Article>(); if (String.IsNullOrEmpty(Tag)) { query.ChannelID = BindColumnID; } else { query.Tag = Tag; } Channel ch = ChannelHelper.GetChannel(query.ChannelID, new string[] { "FullFolderPath", "FullUrl" }); query.ChannelFullUrl = ch != null ? ch.FullUrl : ""; query.IncludeAllSons = ShowSubArticle; query.EnumState = ""; query.ModelName = ModelName; query.UseModel = UseModel; query.State = ArticleStates.Started; query.IsShowHome = ShowAtHome ? "1" : ""; query.IsImage = IsImage ? "1" : ""; if (!String.IsNullOrEmpty(OrderFields)) { query.OrderKeys = OrderFields; } else { query.OrderKeys = "Updated|Desc"; } query.Overdue = false; if (!String.IsNullOrEmpty(KeyWord)) { query.KeyWord = KeyWord; } RecordCount = ArticleHelper.QueryArtilceModelCountByAll(query); if (PageSize > 0) { list = ArticleHelper.QueryArtilceModelByAll(query, StartItem, PageItemsCount, null); } else { list = ArticleHelper.QueryArtilceModelByAll(query, 0, RecordCount, null); } foreach (Article a in list) { FormatArticle(a); } return(list); }
/// <summary> /// 按ID取得详细页的Url /// </summary> /// <param name="id">条目ID</param> /// <returns></returns> public string GetUrl(object id) { if (!ChannelMap.ContainsKey(BindColumnID)) { ChannelMap.Add(BindColumnID, ChannelHelper.GetChannel(BindColumnID, null)); } GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; return(String.Format("{0}{1}.{2}", ChannelMap.ContainsKey(BindColumnID) && ChannelMap[BindColumnID] != null ? ChannelMap[BindColumnID].FullUrl : "", We7Helper.GUIDToFormatString(ToStr(id)), ext)); }
void Load2Level() { LoadData(ChannelID); First = ChannelHelper.GetChannel(ChannelID, null); SecondChannel = ChannelHelper.GetChannels(ChannelID); if (SecondChannel != null && SecondChannel.Count > 0) { ThirdChannel = ChannelHelper.GetChannels(SecondChannel[0].ID); Second = ChannelHelper.GetChannel(SecondChannel[0].ID, null); //TODO::加上数据访问 } }
/// <summary> /// 获取当前栏目对象 /// </summary> /// <returns>当前栏目</returns> protected Channel GetThisChannel() { if (DesignHelper.IsDesigning && DesignRecords.Count > 0) { return(DesignRecords[0]); } string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); return(ch); }
public string GetTotalAudit(string ownerID) { Channel ch = ChannelHelper.GetChannel(ownerID, null); if (ch != null) { return(ch.ProcessLayerNOText); } else { return(""); } }
private string GetAll() { string result = ""; string id = ChannelHelper.GetChannelIDFromURL(); Channel ch = ChannelHelper.GetChannel(id, null); InitChannels(ch); for (int i = lsChannels.Count - 1; i >= 0; i--) { result += getChannelTree(lsChannels[i].ID); } return(result); }
void ShowInfomation() { Channel ch = ChannelHelper.GetChannel(ChannelID, null); ParentID = ch.ParentID; IDLabel.Text = ch.ID; NameTextBox.Text = ch.Name; DescriptionTextBox.Text = ch.Description; CreatedLabel.Text = ch.Created.ToString(); SetDropdownList(ContentTypeDropDownList, ch.ModelName); SetDropdownList(StateDropDownList, ch.State.ToString()); SetDropdownList(TypeDropDownList, ch.Type); ChannelNameTextBox.Text = ch.ChannelName; channelUrlLabel.InnerHtml = string.Format( "<a href='{0}' target='_blank'>{0}</a> <a href='/go/rss.aspx?ChannelUrl={0}' title='RSS地址' target='_blank'><img src='/admin/images/icon_share.gif' /></a>", ch.FullUrl); //ChannelNameLabel.Text = ch.ChannelName; ChannelNameHidden.Text = ch.ChannelName; ChannelNameTextBox.Visible = false; //ChannelFolderLiteral.Text = string.Format("{0}\\", Constants.ChannelPath); //栏目唯一名称不得修改 if (ch.ChannelName != null && ch.ChannelName != "") { ChannelNameTextBox.Enabled = false; } if ((TypeOfChannel)int.Parse(ch.Type) == TypeOfChannel.NormalChannel) { ModelRowDisplay = ""; ReturnUrlRowDisplay = "none"; } else if ((TypeOfChannel)int.Parse(ch.Type) == TypeOfChannel.ReturnChannel || (TypeOfChannel)int.Parse(ch.Type) == TypeOfChannel.RssOriginal) { ReturnUrlRowDisplay = ""; ModelRowDisplay = "none"; ReturnUrlTextBox.Text = ch.ReturnUrl; UrlTitle = "跳转地址"; if ((TypeOfChannel)int.Parse(ch.Type) == TypeOfChannel.RssOriginal) { UrlTitle = "RSS源地址"; } } else { ModelRowDisplay = "none"; ReturnUrlRowDisplay = "none"; } }
string GetChannelProcessLayerNO(string id) { string channelID = ArticleHelper.GetArticle(id).OwnerID; Channel ch = ChannelHelper.GetChannel(channelID, null); if (ch.ProcessLayerNO != null) { return(ch.ProcessLayerNO); } else { return(""); } }
/// <summary> /// 根节点初始化 /// </summary> /// <returns></returns> string GetInitArticleTreeRoot() { string jasonText = @"[ {{ ""data"" : ""{0}"", ""children"" : {1}, ""state"" : ""open"" }} ]"; Channel ch = ChannelHelper.GetChannel(OwnerID, null); string root = ch == null ? "所有栏目" : ch.Name; List <Article> paths = GetParentArticlePath(); jasonText = string.Format(jasonText, root, GetArticleChildrenJasonString("", paths, 0)); return(jasonText.Replace("{{", "{").Replace("}}", "}")); }
protected void Initialize() { bool enableCache = (CDHelper.Config.EnableCache == "true"); string result = ""; string curUrl = Context.Request.Path.Replace('/', '_'); result = ChannelHelper.GetChannelIDFromURL(); ColumnID = result; //初始化ArticleID result = ArticleHelper.GetArticleIDFromURL(); ArticleID = result; //初始化ColumnMode result = GetColumnMode(); ColumnMode = result; //初始化ThisChannel Channel ch = null; if (ColumnID != null && ColumnID != "") { ch = ChannelHelper.GetChannel(ColumnID, null); } else if (ColumnAlias != null) { ch = ChannelHelper.GetChannelByAlias(ColumnAlias); } else { ch = null; } ThisChannel = ch; //初始化TemplatePath result = TemplateHelper.GetThisPageTemplate(ColumnMode, ColumnID, SearchWord, SeSearchWord); if (result != null) { if (!result.StartsWith("/")) { TemplatePath = "/" + result; } else { TemplatePath = result; } } }
void QuoteArticles(string id) { Article a = ArticleHelper.GetArticle(id, null); a.Content = ""; a.ContentType = (int)TypeOfArticle.LinkArticle; Channel ch = ChannelHelper.GetChannel(a.OwnerID, null); a.ContentUrl = ch.FullUrl + a.FullUrl; a.OwnerID = QuoteOwnerID; a.EnumState = ch.EnumState; a.ChannelName = ch.FullPath; ArticleHelper.AddArticle(a); }
/// <summary> /// 按ID取得详细页的Url /// </summary> /// <param name="id">条目ID</param> /// <returns></returns> public string GetUrl(object id, object ChannelID) { if (ChannelID == null) { return(""); } string strChannelID = ChannelID.ToString(); if (!ChannelMap.ContainsKey(strChannelID)) { ChannelMap.Add(strChannelID, ChannelHelper.GetChannel(strChannelID, null)); } GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; return(String.Format("{0}{1}.{2}", ChannelMap.ContainsKey(strChannelID) && ChannelMap[strChannelID] != null ? ChannelMap[strChannelID].FullUrl : "", We7Helper.GUIDToFormatString(ToStr(id)), ext)); }
/// <summary> /// 删除栏目标签 /// </summary> /// <returns></returns> string DeleteChannelTag() { Channel c = ChannelHelper.GetChannel(ObjectID, new string[] { "Tags", "ID" }); if (c != null && c.Tags != null) { c.Tags = c.Tags.Replace("'" + TagName + "'", ""); ChannelHelper.UpdateChannel(c, new string[] { "Tags" }); //记录日志 AddLog("编辑栏目", string.Format("删除了栏目【{0}】的标签【{1}】", c.Name, TagName)); return("{\"success\":true,\"msg\":\"操作成功!\"}"); } return("{\"success\":false,\"msg\":\"操作失败,请刷新后再试!\"}"); }