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> /// <param name="sender"></param> /// <param name="e"></param> protected void ToOtherButton_Click(object sender, EventArgs e) { UpdateAdviceTag(); if (OperationInfo(AdviceState.WaitHandle)) { AdviceType adviceType = AdviceTypeHelper.GetAdviceType(AdviceTypeID); if (adviceType != null) { if (adviceType.ParticipateMode == (int)AdviceParticipateMode.Mail || adviceType.ParticipateMode == (int)AdviceParticipateMode.All) { List <string> contents = AccountHelper.GetPermissionContents(AccountID, AdviceTypeID); if (contents.Contains("Advice.Admin") || We7Helper.IsEmptyID(AccountID)) { ToOtherReplyUser(); } } } Messages.ShowMessage(" :) 转办成功!"); //记录日志 string content = string.Format("转办了留言反馈:“{0}”的详细信息", AdviceID); AddLog("留言反馈详细信息", content); BindReplayList(); actionTable.Visible = false; } }
/// <summary> /// 创建文件路径 /// </summary> /// <param name="ext">文件扩展名</param> /// <returns>文件的绝地路径</returns> string GetFileFolder() { Article article = new Article(); article.ID = We7Helper.CreateNewID(); return(article.AttachmentUrlPath.TrimEnd("/".ToCharArray()) + "/Thumbnail"); }
protected void Initialize() { List <string> accounts = new List <string>(); ArticleUPager.PageIndex = PageNumber; ArticleUPager.ItemCount = AccountHelper.GetAccountCountOfRole(RoleID); ArticleUPager.UrlFormat = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}"); ArticleUPager.PrefixText = "共 " + ArticleUPager.MaxPages + " 页 · 第 " + ArticleUPager.PageIndex + " 页 · "; accounts = AccountHelper.GetAccountsOfRole(RoleID, ArticleUPager.Begin - 1, ArticleUPager.Count); List <InnerItem> items = new List <InnerItem>(); foreach (string aid in accounts) { InnerItem item = new InnerItem(); item.AccountID = aid; item.RoleID = RoleID; Account a = AccountHelper.GetAccount(aid, new string[] { "LoginName", "DepartmentID", "Department" }); if (a != null) { item.AccountName = a.LoginName; item.DepartmentName = a.Department; } items.Add(item); } personalForm.DataSource = items; personalForm.DataBind(); }
/// <summary> /// »ñµÃÀ¸Ä¿ÏµÄËùÓÐ×ÓÀ¸Ä¿ /// v1.1 2011-1-11 moye /// </summary> /// <param name="parentID"></param> /// <param name="prefix"></param> protected void GetSubChannels(string parentID, string prefix, List<Channel> allChannel) { List<string> chids = new List<string>(); if (!We7Helper.IsEmptyID(AccountID)) chids = AccountHelper.GetObjectsByPermission(AccountID, "Channel.Article"); foreach (Channel ch in allChannel) { if (parentID == We7Helper.EmptyGUID) { Channel parent = allChannel.FindLast(p => p.ID == ch.ParentID); if (parent != null) { DrawTreeMenu(parent, prefix, chids, ref allChannel); } else { DrawTreeMenu(ch, prefix, chids, ref allChannel); } } else if (parentID == ch.ParentID) { DrawTreeMenu(ch, prefix, chids, ref allChannel); } } }
public string GetAccountName(string id) { string name; string accountID = ""; if (StartState == "-1") { accountID = ProcessHistoryHelper.GetAdviceProcessHistory(ArticleID, id).ProcessAccountID; } else { accountID = ProcessHistoryHelper.GetArticleProcessHistory(ArticleID, id).ProcessAccountID; } if (We7Helper.IsEmptyID(accountID)) { name = "管理员"; } else { name = AccountHelper.GetAccount(accountID, new string[] { "LastName" }).LastName; } if (name == null || name == "") { name = "未知用户"; } return(name); }
/// <summary> /// 获取链接地址 /// </summary> /// <param name="dataitem"></param> /// <returns></returns> private string GetLinkUrl(object dataitem) { if (ModelInfo == null) { ModelInfo = ModelHelper.GetModelInfo(We7Helper.GetParamValueFromUrl(HttpContext.Current.Request.RawUrl, "model")); } string result = string.Empty; foreach (We7DataColumn d in ModelInfo.DataSet.Tables[0].Columns) { if (d.Name.Contains("_Count")) { string model = string.Format("{0}.{1}", ModelInfo.GroupName, d.Name.Remove(d.Name.Length - 6)); string url = We7Helper.AddParamToUrl(HttpContext.Current.Request.RawUrl, "model", model); url = We7Helper.RemoveParamFromUrl(url, "mode"); url = We7Helper.AddParamToUrl(url, d.Mapping.Split('|')[0], GetValue(dataitem, d.Mapping.Split('|')[1])); result = url; break; } } if (string.IsNullOrEmpty(result)) { result = string.Format("/admin/AddIns/ModelViewer.aspx?notiframe=1&model={0}&ID={1}", ModelInfo.ModelName, GetValue(dataitem, "ID")); } return(result); }
/// <summary> /// 添加一条投票及选项(进行统计) /// </summary> /// <param name="vote"></param> /// <param name="listEntrys"></param> #region bool AddVote(Vote vote, List<VoteEntry> listEntrys) public bool AddVote(Vote vote, List <VoteEntry> listEntrys) { if (vote == null || listEntrys == null) { return(false); } if (listEntrys.Count == 0) { return(false); } try { vote.ID = We7Helper.CreateNewID(); vote.VotePeoples = 0; vote.AddDate = DateTime.Now; Assistant.Insert(vote); for (int i = 0; i < listEntrys.Count; i++) { listEntrys[i].VoteID = vote.ID; Assistant.Insert(listEntrys[i]); } return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// 更新回答选项统计() /// </summary> /// <param name="voteID"></param> /// <param name="voteEntryID"></param> /// <param name="voteEntryText"></param> /// <param name="sum">加几票</param> #region bool UpdateVoteAnswerStat(string voteID,string voteEntryID,string voteEntryText,int sum) protected bool UpdateVoteAnswerStat(string voteID, string voteEntryID, string voteEntryText, int sum) { try { Criteria criteria = new Criteria(CriteriaType.Equals, "VoteID", voteID); criteria.Add(CriteriaType.Equals, "VoteEntryID", voteEntryID); List <VoteAnswerStat> listAnswerStats = Assistant.List <VoteAnswerStat>(criteria, null); VoteEntry entry = GetVoteEntryByEntryID(voteEntryID); if (listAnswerStats != null && listAnswerStats.Count > 0) { //进行更新 listAnswerStats[0].VoteEntrySum += sum; Assistant.Update(listAnswerStats[0]); } else { //新增一个 VoteAnswerStat voteAnswerStat = new VoteAnswerStat(); voteAnswerStat.ID = We7Helper.CreateNewID(); voteAnswerStat.VoteEntryID = voteEntryID; voteAnswerStat.VoteID = voteID; voteAnswerStat.VoteEntrySum = sum; voteAnswerStat.VoteEntryText = voteEntryText; voteAnswerStat.OrderID = entry.OrderID; Assistant.Insert(voteAnswerStat); } return(true); } catch (Exception ex) { return(false); } }
protected void DeleteBtn_Click(object sender, EventArgs e) { string xmlTitle = We7Helper.Base64Decode(MailFileText.Text); string title = TitleText.Text; string root = Server.MapPath("/_Data/SendEmail/"); if (xmlTitle.Trim() != "") { File.Delete(Path.Combine(root, xmlTitle)); Messages.ShowMessage("您已经成功删除【" + xmlTitle + "】邮件。"); } else { List <string> list = GetIDs(); if (list.Count < 1) { Messages.ShowMessage("您没有选择任何一条记录!"); return; } foreach (string titleTM in list) { File.Delete(Path.Combine(root, We7Helper.Base64Decode(titleTM))); } Messages.ShowMessage(string.Format("您已经成功删除了{0}封邮件", list.Count.ToString())); } LoadAdvices(); }
protected void DataBind() { AdviceUPager.PageIndex = PageNumber; AdviceUPager.UrlFormat = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}"); AdviceUPager.PrefixText = "共 " + AdviceUPager.MaxPages + " 页 · 第 " + AdviceUPager.PageIndex + " 页 · "; if (ShowType != 3) { Dictionary <string, object> queryInfo = new Dictionary <string, object>(); if (!string.IsNullOrEmpty(txtQuery.Text.Trim())) { queryInfo.Add("title", txtQuery.Text.Trim()); } if (!string.IsNullOrEmpty(Request["RelationID"])) { queryInfo.Add("RelationID", Request["RelationID"].Trim()); } AdviceUPager.ItemCount = adviceHelper.QueryAdviceCount(TypeID, ShowType, queryInfo); AdviceGridView.Visible = true; TransferGridView.Visible = false; AdviceGridView.DataSource = adviceHelper.QueryAdvice(TypeID, ShowType, queryInfo, AdviceUPager.Begin - 1, AdviceUPager.Count); AdviceGridView.DataBind(); } else { AdviceUPager.ItemCount = adviceHelper.QueryAdviceCount(TypeID, ShowType); AdviceGridView.Visible = false; TransferGridView.Visible = true; TransferGridView.DataSource = adviceHelper.QueryTransfers(TypeID, AdviceUPager.Begin - 1, AdviceUPager.Count); TransferGridView.DataBind(); } }
/// <summary> /// 从输入框的文本转换处理后存入BodyContent /// </summary> public void FromVisualBoxText() { String s = Input; int start = s.IndexOf("<?"); while (start >= 0) { int end = s.IndexOf("/??>", start); if (end > 0) { s = s.Remove(start, end - start + 4); } else { start = -1; } } s = ConvertTagsToControls(s); //检查是否有FORM节点。 //TODO: 需要确保Control一定在Form节点中。 Regex r = new Regex(@"\<form"); Match m = r.Match(s); if (!m.Success && !IsSubTemplate) { s = "<form id=\"mainForm\" runat=\"server\">\r\n" + s; s = s + "\r\n</form>\r\n"; } bodyContent = We7Helper.FilterXMLChars(s); }
void ShowDepartment(Department dpt) { NameTextBox.Text = dpt.Name; NumberTextBox.Text = dpt.Number; IndexTextBox.Text = dpt.Index.ToString(); DescriptionTextBox.Text = dpt.Description; IDLabel.Text = dpt.ID.ToString(); ParentTextBox.Text = dpt.ParentID.ToString(); CreatedLabel.Text = dpt.Created.ToString(); AddressTextBox.Text = dpt.Address; FaxTextBox.Text = dpt.Fax; EmailTextBox.Text = dpt.Email; PhoneTextBox.Text = dpt.Phone; MapScriptTextBox.Text = dpt.MapScript; SiteUrlTextBox.Text = dpt.SiteUrl; ContentTextBox.Value = dpt.Text; DepartmentNameLabel.Text = string.Format("编辑部门 {0} 信息", dpt.Name); ReturnHyperLink.NavigateUrl = String.Format("Departments.aspx?id={0}", dpt.ParentID); if (!We7Helper.IsEmptyID(dpt.ParentID)) { Department p = AccountHelper.GetDepartment(dpt.ParentID, new string[] { "FullName" }); FullPathLabel.Text = p.FullName; } else { FullPathLabel.Text = "/"; } }
/// <summary> /// 页面加载信息 /// </summary> void LoadErrorEmailInfo() { //TitleTextBox.Text = Title; string root = Server.MapPath("/_Data/ErrorEmail/" + FileName); if (File.Exists(root)) { XmlDocument doc = new XmlDocument(); doc.Load(root); XmlNode node = doc.SelectSingleNode("/root/infoBody"); if (node != null) { ReplayContent.InnerHtml = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoUser"); if (node != null) { UserLabel.Text = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoRawManage"); if (node != null) { InfoRawManage.InnerHtml = We7Helper.Base64Decode(node.InnerText); } node = doc.SelectSingleNode("/root/infoSubject"); if (node != null) { TitleTextBox.Text = EmailTitleLabel.Text = We7Helper.Base64Decode(node.InnerText); } } }
/// <summary> /// 构建标签项,完全可以通过控制每步骤的display属性 /// 进行功能项的控制,此属性完全可以进行如同模块式的管理 /// 设计页面、Tab名称、Tab显示属性、Tab所加载控件 /// 三者以控制其相应的显示 /// </summary> /// <returns></returns> string BuildNavString() { string strActive = @"<li class='TabIn' id='tab{0}' style='display:{2}'><a>{1}</a> </li>"; string strLink = @"<li class='TabOut' id='tab{0}' style='display:{2}'><a href='{3}'>{1}</a> </li>"; int tab = 1; string tabString = ""; string dispay = ""; string rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "tab"); rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "saved"); if (TabID != null && We7Helper.IsNumber(TabID)) { tab = int.Parse(TabID); } if (tab == 1) { tabString += string.Format(strActive, 1, "站点关联", dispay); Control ctl = this.LoadControl("Config_SiteSetting.ascx"); ContentHolder.Controls.Add(ctl); } else { tabString += string.Format(strLink, 1, "站点关联", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "1")); } return(tabString); }
protected void bttnNew_Click(object sender, EventArgs e) { string url = "~/admin/addins/ModelEditor.aspx?notiframe={2}&model={0}&ID={1}"; url = String.Format(url, PanelContext.Model.ModelName, We7Helper.CreateNewID(), Request["notiframe"]); Response.Redirect(url); }
/// <summary> /// 返回控件值 /// </summary> /// <returns></returns> public override object GetValue() { string field1 = Control.Params["field1"]; string field2 = Control.Params["field2"]; string field3 = Control.Params["field3"]; TypeCode field1Type = PanelContext.DataSet.Tables[0].Columns[field1].DataType; TypeCode field2Type = PanelContext.DataSet.Tables[0].Columns[field2].DataType; TypeCode field3Type = PanelContext.DataSet.Tables[0].Columns[field3].DataType; Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add(field1, TypeConverter.StrToObjectByTypeCode(We7Helper.FilterHtmlChars(Request.Form[Field1DropDownList.UniqueID]), field1Type)); if (Request.Form[Field2DropDownList.UniqueID] == null) { dic.Add(field2, ""); } else { dic.Add(field2, TypeConverter.StrToObjectByTypeCode(We7Helper.FilterHtmlChars(Request.Form[Field2DropDownList.UniqueID]), field2Type));//this.Field2DropDownList.SelectedValue } if (Request.Form[Field3DropDownList.UniqueID] == null) { dic.Add(field3, ""); } else { dic.Add(field3, TypeConverter.StrToObjectByTypeCode(We7Helper.FilterHtmlChars(Request.Form[Field3DropDownList.UniqueID]), field3Type));//this.Field2DropDownList.SelectedValue } return(dic); }
protected void Page_Load(object sender, EventArgs e) { string accoundID = Request[We7.Model.Core.UI.Constants.FEID]; if (!String.IsNullOrEmpty(accoundID)) { Account account = AccountHelper.GetAccount(accoundID, null); if (account == null) { Response.Write("验证帐号不存在,请重新申请帐号!"); } else { account.EmailValidate = 1; account.State = 1; AccountHelper.UpdateAccount(account, new string[] { "EmailValidate", "State" }); if (!string.IsNullOrEmpty(Request["returnUrl"])) { string url = Request["returnUrl"]; url = We7Helper.AddParamToUrl(url, We7.Model.Core.UI.Constants.FEID, account.ID); url = We7Helper.AddParamToUrl(url, "activeIndex", "2"); Response.Redirect(url); } } } }
/// <summary> /// 新用户申请通知 /// </summary> public static void SendMailOfHandle(Account account, string modelName) { try { MailHelper mailHelper = GetMailHelper(); MailMessageTemplate mt = new MailMessageTemplate("UserEmailConfig.xml", "新用户申请通知"); string subject = mt.Subject.Replace("${LoginName}", account.LoginName); subject = subject.Replace("${ContentModelName}", modelName); string message = mt.Body.Replace("${LoginName}", account.LoginName); HttpContext context = HttpContext.Current; string url = "http://" + context.Request.Url.Host; if (context.Request.Url.Port != 80) { url += ":" + context.Request.Url.Port.ToString(); } message = message.Replace("${HandleUrl}", String.Format("{0}", url + "/admin/Permissions/AccountEdit.aspx?id=" + account.ID)); message = We7Helper.ConvertTextToHtml(message); mailHelper.Send(GeneralConfigs.GetConfig().NotifyMail, mailHelper.AdminEmail, subject, message, "Low"); } catch (Exception ex) { We7.Framework.LogHelper.WriteLog(typeof(AccountMails), ex); throw ex; } }
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); }
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 DeleteMenuButton_Click(object sender, EventArgs e) { if (AppCtx.IsDemoSite) { ScriptManager.RegisterStartupScript(this, GetType(), "aler", "alert('演示站点,不能删除!');", true); return; } string id = IDTextBox.Text.Trim(); string name = MenuHelper.DeleteMenuItem(id); /* * Content:删除菜单后同时删除XML数据, 根据数据库删除规则,删除顶级菜单时 级联删除子菜单 * Author: 勾立国 2011-7-13 * Begin: */ if (EntityID == "System.User") { //MenuItemXmlHelper helper = new MenuItemXmlHelper(Server.MapPath("/user/Resource/menuItems.xml")); //helper.DeleteMenuItemWidthChilds(id); } /* * End */ string url = We7Helper.AddParamToUrl(Request.RawUrl, "reload", "menu"); url = We7Helper.AddParamToUrl(url, "del", name); HttpContext.Current.Session.Clear(); Response.Redirect(url); }
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("您没有权限管理此栏目下信息!"); } } }
/// <summary> /// 添加访问信息 /// </summary> /// <param name="AccountID"></param> /// <returns></returns> public PageVisitor AddPageVisitor(string AccountID) { HttpContext Context = HttpContext.Current; string ip = Context.Request.ServerVariables["REMOTE_ADDR"]; PageVisitor s = GetPageVisitorByIP(ip); if (s != null) { s.OnlineTime = DateTime.Now; Assistant.Update(s, new string[] { "OnlineTime" }); return(s); } else { s = new PageVisitor(); HttpBrowserCapabilities bc = Context.Request.Browser; s.TypeCode = StatisticsHelper.TypeCode_User; s.VisitorIP = ip; s.Url = Context.Request.RawUrl; s.HttpReferer = Context.Request.ServerVariables["HTTP_REFERER"]; SearchEngine se = new SearchEngine(); s.Keyword = se.SearchKey(s.HttpReferer); s.SearchEngine = se.EngineName; s.Platform = GetPlatformInfo(Context); s.Screen = bc.ScreenPixelsWidth.ToString() + "×" + bc.ScreenPixelsHeight.ToString(); s.Browser = bc.Browser + bc.Version; s.FromSite = We7Helper.GetDomainFromUrl(s.HttpReferer); s.Clicks = 1; AddPageVisitor(s); return(s); } }
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(); }
string BuildFloatMenu() { StringBuilder sb = new StringBuilder(); sb.Append(""); string TemplatePath = TemplateHelper.GetThisPageTemplate(ColumnMode, ColumnID, SearchWord, SeSearchWord); string tmpRedirect = "<p style='margin:3px;'><a href='/Compose.aspx?file={0}&folder={1}' target='_blank'>±à¼Ä£°å</a></p>"; string fileName = TemplatePath.Remove(TemplatePath.LastIndexOf("/")).Substring(TemplatePath.Remove(TemplatePath.LastIndexOf("/")).LastIndexOf("/")); sb.Append(string.Format(tmpRedirect, TemplatePath.Substring(TemplatePath.LastIndexOf('/') + 1), Path.GetFileNameWithoutExtension(fileName))); if (!We7Helper.IsEmptyID(ArticleID)) { string strArticle = "<p style='margin:3px;'><a href='/addins/articleEdit.aspx?id={0}' target='_blank'>±à¼±¾ÎÄÄÚÈÝ</a></p>"; sb.Append(string.Format(strArticle, ArticleID)); } else if (!We7Helper.IsEmptyID(ColumnID)) { string strChannnel = "<p style='margin:3px;'><a href='/Channels.aspx?id={0}' target='_blank'>±à¼±¾À¸Ä¿ÊôÐÔ</a></p>"; sb.Append(string.Format(strChannnel, ColumnID)); string strArticles = "<p style='margin:3px;'><a href='/addins/Articles.aspx?oid={0}' target='_blank'>±à¼±¾À¸Ä¿ÎÄÕÂ</a></p>"; sb.Append(string.Format(strArticles, ColumnID)); } return(sb.ToString()); }
/// <summary> /// 审核通过 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ReportButton_Click(object sender, EventArgs e) { if (OperationInfo(AdviceState.Checking)) { Advice a = ThisAdvice; AdviceReply reply = AdviceReplyHelper.GetAdviceReplyByAdviceID(AdviceID); if (reply == null) { reply = new AdviceReply(); reply.AdviceID = AdviceID; reply.Suggest = ToAdviceTextBox.Text; reply.UserID = AccountID; reply.CreateDate = DateTime.Now; reply.Updated = DateTime.Now; } reply.Content = We7Helper.ConvertPageBreakFromVisualToChar(ReplyContentTextBox.Value); AdviceReplyHelper.UpdateReplyByAdviceID(reply, null); if (a.State == (int)AdviceState.Finished) { if (chbSendEmail.Checked) { AdviceEmailConfigs adviceEmailConfigs = new AdviceEmailConfigs(); AdviceEmailConfigInfo info = adviceEmailConfigs["ReplyUser"]; AdviceHelper.SendResultMailToAdvicer(a, reply, null, info); } } Messages.ShowMessage(" :) 审核成功!"); //记录日志 string content = string.Format("审核通过了留言反馈:“{0}”的详细信息", AdviceID); AddLog("留言反馈详细信息", content); Response.Write("<script>alert('审核成功!');location.href='AdviceList.aspx?adviceTypeID=" + ThisAdvice.TypeID + "';</script>"); //Initialize(); } }
/// <summary> /// 按照变量生成文章URL /// </summary> /// <param name="sn"></param> /// <param name="create"></param> /// <param name="id"></param> /// <param name="modelName"></param> /// <returns></returns> public string GenerateArticleUrl(long sn, DateTime create, string id, string modelName) { GeneralConfigInfo si = GeneralConfigs.GetConfig(); string ext = si.UrlFormat; if (!String.IsNullOrEmpty(modelName)) { string snRex = si.ArticleUrlGenerator; if (snRex != null && snRex.Trim().Length > 0) { if (snRex == "0") { return(sn.ToString() + "." + ext); } else { return(create.ToString(snRex) + "-" + sn.ToString() + "." + ext); } } else { return(We7Helper.GUIDToFormatString(id) + "." + ext); } } else { return(We7Helper.GUIDToFormatString(id) + "." + ext); } }
protected override void Initialize() { string file = FileTextBox.Text = Request["file"]; We7Helper.Assert(file != null, " 非法的参数。"); Template tp = new Template(); if (EnableSiteSkins) { tp.FromFile(Server.MapPath(String.Format("\\{0}\\{1}", Constants.TemplateBasePath, FileFolder)), file + ".xml"); FileName = TemplateHelper.GetTemplatePath(String.Format("{0}/{1}", FileFolder, tp.FileName)); } else { tp.FromFile(Server.MapPath(Constants.TemplateBasePath), file + ".xml"); FileName = TemplateHelper.GetTemplatePath(tp.FileName); } NameLabel.Text = "编辑模板"; SummaryLabel.Text = String.Format("正在编辑" + InfoKey + "文件 {0}。", tp.FileName); string fn = Server.MapPath(FileName); if (File.Exists(fn)) { LoadTemplateFromFile(fn); } else { SummaryLabel.Text = String.Format("新建的" + InfoKey + "文件,将被保存到文件 {0}", FileName); } TemplatePathTextBox.Text = Constants.TemplateUrlPath; string path = string.Format("/{0}/{1}", Constants.TemplateBasePath, FileFolder); }
/// <summary> /// 设置RssItem /// </summary> /// <param name="list"></param> /// <param name="channel"></param> private void SetRssItems(List <Article> list, RssChannel channel) { List <RssItem> l = new List <RssItem>(); foreach (Article article in list) { FormatArticleUrl(article); RssItem item = new RssItem(); item.Author = article.Author; item.Link = article.LinkUrl; item.Title = article.Title; if (!string.IsNullOrEmpty(article.Description)) { item.Description = article.Description; } else { string content = We7Helper.RemoveHtml(article.Content); content = content.Replace(" ", ""); content = We7Helper.ConvertTextToHtml(content); if (content.Length > 200) { content = content.Substring(0, 200) + "..."; } item.Description = content; } item.PubDate = article.Created.ToString("yyyy-MM-dd"); l.Add(item); } channel.Rssitem = l; }